提交 428c41ef 编写于 作者: 展新

Merge branch 'master' of github.com:ant-design/ant-design

# 基本
# 基本使用
- order: 0
你说什么我还是听不清。
基本使用
---
````html
<select>
<option>选项一</option>
<option>选项二</option>
<option>选项三</option>
</select>
````
````jsx
var Select = antd.Select;
var Option = Select.Option;
function handleChange(value) {
console.log('selected ' + value);
}
var c1 = (
<div>
<h1>Single Select</h1>
<div style={{width: 300}}>
<Select value="lucy" style={{width:250}} onChange={handleChange}>
<Option value="jack">
<b style={{
color: 'red'
}}>jack</b>
</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>disabled</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
</div>
</div>
);
React.render(
c1
, document.getElementById('components-select-demo-basic'));
````
# combobox
- order: 2
combobox
---
````jsx
var Select = antd.Select;
var Option = Select.Option;
var style = {
color: 'red'
};
var c3 = (
<div>
<h1>combobox</h1>
<div style={{width: 300}}>
<Select combobox>
<Option value="jack">
<b style={style}>jack</b>
</Option>
<Option value="lucy" >lucy</Option>
<Option value="disabled" disabled>disabled</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
</div>
</div>
);
React.render(
c3
, document.getElementById('components-select-demo-combobox'));
````
# 多选
- order: 1
多选
---
````jsx
var Select = antd.Select;
var Option = Select.Option;
var children = [];
for (var i = 10; i < 36; i++) {
children.push(<Option value={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
function handleChange(value) {
console.log('selected ' + value);
}
var style = '.rc-select-menu {max-height:200px;overflow:auto;}';
var c2 = (
<div>
<h1>multiple select(scroll the menu)</h1>
<div style={{width: 300}}>
<style>
{style}
</style>
<Select multiple value={['name2', 'name3']} onChange={handleChange}>
{children}
</Select>
</div>
</div>
);
React.render(
c2
, document.getElementById('components-select-demo-multiple'));
````
# tags
- order: 3
tags
---
````jsx
var Select = antd.Select;
var Option = Select.Option;
var children = [];
for (var i = 10; i < 36; i++) {
children.push(<Option value={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
function handleChange(value) {
console.log('selected ' + value);
}
var style = '.rc-select-menu {max-height:200px;overflow:auto;}';
var c2 = (
<div>
<h1>tags select(scroll the menu)</h1>
<div style={{width: 300}}>
<style>
{style}
</style>
<Select tags value={['name2', 'name3']} onChange={handleChange}>
{children}
</Select>
</div>
</div>
);
React.render(
c2
, document.getElementById('components-select-demo-tags'));
````
'use strict';
var React = require('react');
var Select = require('rc-select');
module.exports = Select;
\ No newline at end of file
......@@ -5,30 +5,25 @@
---
这是一个单/多项选择器。
类似 select2 的选择器
```html
<Select>
<Option value="lucy">lucy</Option>
</Select>
```
## API
| 参数 | 说明 | 类型 | 默认值 |
|----------|----------------|----------|--------------|
| value | specify the default selected item(s) | string/Array<String> | 无 |
| multiple | can select more than one option | | false |
| filterOption | whether filter options by input value | | true |
| tags | when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far. | |false |
| allowClear | show clear button | | true |
| combobox | enable combobox mode(can not set multiple at the same time) | | false |
| onSelect | called when a option is selected. param is option's value | function | 无 |
| onDeselect | called when a option is deselected. param is option's value. only called for multiple or tags | function | 无 |
| onChange | called when select an option or input value change(combobox) | function | 无 |
## 何时使用
当你再次和我说起 青春时的故事
我正在下着雨的无锡 乞讨着生活的权利
前一天早晨 我睁开眼已是江南
他们说柔软的地方 总会发生柔软的事
那年的舞台上 说谎的人一直歌唱
大不列颠的广场上 有没有鸽子飞翔
青春和瞎子一起 变成了哑巴
今天扯平了我们的当年 分食了理想
## 为什么使用
你可知道你的名字解释了我的一生
碎了满天的往事如烟 与世无争
当你装满行李 回到故乡
我的余生 却再也没有北方
有一天我又梦见 那个装满乐器的教室
你还站在门口 一脸羞涩的表情
你说这么多年你还没找到 让你心动的男人
我说去他妈的爱情 都是过眼云烟的东西
我的余生 都用来寻找北方
# 基本
- order: 0
最简单的用法
---
````jsx
var Tabs = antd.Tab;
var TabPane = Tabs.TabPane;
function callback() {}
React.render(
<Tabs defaultActiveKey="2" onChange={callback}>
<TabPane tab='tab 1' key="1"></TabPane>
<TabPane tab='tab 2' key="2"></TabPane>
<TabPane tab='tab 3' key="3"></TabPane>
</Tabs>
, document.getElementById('components-tab-demo-basic'));
````
......@@ -5,29 +5,24 @@
---
## 何时使用
选项卡切换组件。
当你再次和我说起 青春时的故事
我正在下着雨的无锡 乞讨着生活的权利
前一天早晨 我睁开眼已是江南
他们说柔软的地方 总会发生柔软的事
那年的舞台上 说谎的人一直歌唱
大不列颠的广场上 有没有鸽子飞翔
青春和瞎子一起 变成了哑巴
今天扯平了我们的当年 分食了理想
## API
### Tabs
## 为什么使用
| 参数 | 说明 | 类型 | 默认值 |
|------------------|----------------------------------------------|----------|------------|
| activeKey | 当前激活 tab 面板的 key | String | 无 |
| effect | 是否启用面板切换动画 | Boolean | true |
| defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | String | 第一个面板 |
| onChange | 切换面板的回调 | Function | 无 |
| onTabClick | tab 被点击的回调 | Function | 无 |
你可知道你的名字解释了我的一生
碎了满天的往事如烟 与世无争
当你装满行李 回到故乡
我的余生 却再也没有北方
有一天我又梦见 那个装满乐器的教室
你还站在门口 一脸羞涩的表情
你说这么多年你还没找到 让你心动的男人
我说去他妈的爱情 都是过眼云烟的东西
我的余生 都用来寻找北方
### TabPane
| 参数 | 说明 | 类型 | 默认值 |
|------|---------------------|--------|--------|
| key | 对应 activeKey | Object | 无 |
| tab | 当前 tab 对应的面板 | String | 无 |
......@@ -7,7 +7,8 @@ var antd = {
modal: require('./components/modal'),
Menu: require('rc-menu'),
Dropdown: require('./components/dropdown'),
Progress: require('./components/progress')
Progress: require('./components/progress'),
Select: require('./components/select')
};
module.exports = window.antd = antd;
......@@ -25,9 +25,9 @@
{%- endif %}
</h1>
{{ post.html }}
{%- if post.meta.template === 'component' && !post.meta.nodemos %}
{%- include "demos.html" %}
{%- endif %}
</article>
{%- if post.meta.template === 'component' && !post.meta.nodemos %}
{%- include "demos.html" %}
{%- endif %}
</section>
{% endblock %}
......@@ -526,6 +526,7 @@ footer ul li > a {
.markdown {
color: #777;
font-size: 14px;
line-height: 1.8;
}
.markdown h1 {
......@@ -549,7 +550,12 @@ footer ul li > a {
.markdown > ul > li {
list-style: circle;
margin-left: 18px;
margin-left: 20px;
padding-left: 8px;
}
.markdown code {
margin: 0 3px;
}
.markdown pre code {
......@@ -557,6 +563,7 @@ footer ul li > a {
border: none;
border-radius: 6px;
padding: 12px 20px;
margin: 0;
}
.markdown > table {
......@@ -1633,6 +1640,10 @@ footer ul li > a {
margin-right: 5px;
}
.component-demos {
margin: 2em 0 1em;
}
.component-demos .icon-all {
cursor: pointer;
font-size: 16px;
......
@selectPrefixCls: rc-select;
.@{selectPrefixCls} {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle;
color: #666;
&-selection {
outline: none;
}
ul, li {
margin: 0;
padding: 0;
list-style: none;
}
> ul > li > a {
padding: 0;
background-color: #fff;
}
// arrow
&-arrow {
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0;
}
}
&-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 28px;
user-select: none;
-webkit-user-select: none;
background-color: #fff;
border: 1px solid #d9d9d9;
border-radius: 4px;
.@{selectPrefixCls}-selection__rendered {
display: block;
overflow: hidden;
padding-left: 8px;
padding-right: 20px;
text-overflow: ellipsis;
line-height: 28px;
}
.@{selectPrefixCls}-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
}
}
&-selection--multiple {
box-sizing: border-box;
display: block;
min-height: 32px;
user-select: none;
-webkit-user-select: none;
background-color: #fff;
border: 1px solid #d9d9d9;
border-radius: 4px;
cursor: text;
.@{selectPrefixCls}-selection__rendered {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
padding-left: 8px;
}
.@{selectPrefixCls}-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px;
}
.@{selectPrefixCls}-selection__choice {
background-color: #f3f3f3;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 4px;
margin-top: 4px;
padding: 4px 8px;
}
.@{selectPrefixCls}-selection__choice__remove {
color: #919191;
cursor: pointer;
display: inline-block;
font-weight: bold;
padding: 0 0 0 8px;
&:hover {
color: #333;
}
}
}
&-search--inline {
float: left;
.@{selectPrefixCls}-search__field {
border: none;
font-size: 100%;
margin-top: 5px;
background: transparent;
outline: 0;
}
}
&-dropdown {
display: none;
background-color: white;
border: 1px solid #d9d9d9;
box-shadow: 0 0px 4px #d9d9d9;
border-radius: 4px;
box-sizing: border-box;
width: 100%;
z-index: 100;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
position: absolute;
top: 100%;
marin-top: -1px;
outline: none;
.@{selectPrefixCls}-menu-item[aria-selected=true] {
background-color: #ddd;
}
}
&-search--dropdown {
display: block;
padding: 4px;
.@{selectPrefixCls}-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box;
border: 1px solid #d9d9d9;
border-radius: 4px;
outline: none;
}
&.@{selectPrefixCls}-search--hide {
display: none;
}
}
&-open {
.@{selectPrefixCls}-arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px;
}
.@{selectPrefixCls}-dropdown {
display: block;
}
.@{selectPrefixCls}-selection {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
}
&-menu {
outline: none;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
z-index: 99999;
.@{selectPrefixCls}-menu-item-active, .@{selectPrefixCls}-menu-submenu-active {
//background-color: #8EC8F9 !important;
background-color: rgba(142, 200, 249, 0.1) !important;
}
> li {
position: relative;
display: block;
padding: 15px 20px;
white-space: nowrap;
// Disabled state sets text to gray and nukes hover/tab effects
&.@{selectPrefixCls}-menu-item-disabled, &.@{selectPrefixCls}-menu-submenu-disabled {
color: #777;
}
}
.@{selectPrefixCls}-menu-item-divider {
padding: 0;
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
}
}
\ No newline at end of file
// index.less
@prefixClass: rc-tabs;
@easing-in-out: cubic-bezier(0.35, 0, 0.25, 1);
@effect-duration: .5s;
.@{prefixClass} {
outline: none;
box-sizing: border-box;
position: relative;
&-ink-bar {
z-index: 1;
position: absolute;
left: 0;
bottom: -2px;
box-sizing: border-box;
height: 3px;
background-color: #3fc7fa;
transform: scaleX(1);
transform-origin: 0 0;
&-transition-right {
transition: right 0.3s @easing-in-out,
left 0.3s @easing-in-out 0.3s * 0.3;
}
&-transition-left {
transition: right 0.3s @easing-in-out 0.3s * 0.3,
left 0.3s @easing-in-out;
}
}
&-nav-container {
font-size: 14px;
line-height: 1.5;
box-sizing: border-box;
width: 100%;
overflow: hidden;
position: relative;
white-space: nowrap;
padding-left: 32px;
padding-right: 32px;
}
&-tab-prev, &-tab-next {
user-select: none;
-webkit-user-select: none;
z-index: 1;
margin-right: -2px;
width: 32px;
height: 100%;
line-height: 36px;
cursor: pointer;
border: none;
background-color: transparent;
position: absolute;
&-icon {
position: relative;
display: inline-block;
font-style: normal;
font-weight: normal;
font-variant: normal;
line-height: inherit;
vertical-align: baseline;
text-align: center;
text-transform: none;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0px;
-moz-osx-font-smoothing: grayscale;
font-family: sans-serif;
&:before {
display: block;
font-family: "iconfont" !important;
}
}
}
&-tab-next {
right: 2px;
&-icon:before {
content: "\e651";
}
}
&-tab-prev {
left: 0;
transform: rotate(180deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
&-icon:before {
content: "\e651";
}
}
&-nav-wrap {
width: 100%;
overflow: hidden;
}
&-nav-scroll {
width:99999px;
}
&-nav {
height: 36px;
box-sizing: border-box;
padding-left: 0;
transition: left 0.5s @easing-in-out;
position: relative;
margin: 0;
list-style: none;
display: inline-block;
border-bottom: 2px solid #e9e9e9;
&:before, &:after {
display: table;
content: " ";
}
&:after {
clear: both;
}
div.@{prefixClass}-tab-active {
> a, > a:hover, > a:focus {
color: #3fc7fa;
cursor: default;
text-decoration: none;
}
}
div.@{prefixClass}-tab-disabled {
pointer-events: none;
cursor: default;
color: #ccc;
}
.@{prefixClass}-tab {
float: left;
height: 100%;
padding: 10px 20px;
margin-right: 30px;
box-sizing: border-box;
position: relative;
display: block;
> a {
transition: color 0.3s @easing-in-out;
font-weight: 500;
display: inline-block;
color: #999;
}
> a:hover {
color: #23c0fa;
cursor: pointer;
}
> a:hover, > a:focus {
text-decoration: none;
}
}
}
&-tabpane-hidden {
display: none;
}
&-content {
position: relative;
width: 100%;
overflow: hidden;
}
&-effect-left-enter {
transform: translateX(-100%);
}
&-effect-left-enter&-effect-left-enter-active {
transform: translateX(0);
transition: transform @effect-duration @easing-in-out;
}
&-effect-left-leave {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: translateX(0);
}
&-effect-left-leave&-effect-left-leave-active {
transform: translateX(100%);
transition: transform @effect-duration @easing-in-out;
}
&-effect-right-enter {
transform: translateX(100%);
}
&-effect-right-enter&-effect-right-enter-active {
transform: translateX(0);
transition: transform @effect-duration @easing-in-out;
}
&-effect-right-leave {
position: absolute;
transform: translateX(0);
top: 0;
right: 0;
left: 0;
bottom: 0;
}
&-effect-right-leave&-effect-right-leave-active {
transform: translateX(-100%);
transition: transform @effect-duration @easing-in-out;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册