Browse Source

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

pull/1954/head
偏右 9 years ago
parent
commit
23b8c44d39
  1. 2
      components/button/button.jsx
  2. 2
      components/cascader/index.md
  3. 4
      components/dropdown/demo/dropdown-button.md
  4. 4
      components/dropdown/dropdown-button.jsx
  5. 3
      components/input-number/demo/basic.md
  6. 19
      components/input-number/demo/digit.md
  7. 2
      components/input-number/index.md
  8. 6
      components/table/index.jsx
  9. 12
      components/tabs/index.jsx
  10. 2
      components/tag/index.jsx
  11. 3
      components/tree-select/index.md
  12. 127
      style/components/tabs.less

2
components/button/button.jsx

@ -25,7 +25,7 @@ function insertSpace(child) {
} }
function clearButton(button) { function clearButton(button) {
button.className = button.className.replace(`${prefix}clicked`, ''); button.className = button.className.replace(` ${prefix}clicked`, '');
} }
export default class Button extends React.Component { export default class Button extends React.Component {

2
components/cascader/index.md

@ -27,7 +27,7 @@
| defaultValue | 默认的选中项 | array |[] | | defaultValue | 默认的选中项 | array |[] |
| value | 指定选中项 | array | - | | value | 指定选中项 | array | - |
| onChange | 选择完成后的回调 | `function(value, selectedOptions)` | - | | onChange | 选择完成后的回调 | `function(value, selectedOptions)` | - |
| displayRender | 选择后展示的渲染函数 | `function(label)`` | `function(label) { return label.join(' / ') }` | | displayRender | 选择后展示的渲染函数 | `function(label)` | `label => label.join(' / ')` |
| style | 自定义样式 | string | - | | style | 自定义样式 | string | - |
| className | 自定义类名 | string | - | | className | 自定义类名 | string | - |
| popupClassName | 自定义浮层类名 | string | - | | popupClassName | 自定义浮层类名 | string | - |

4
components/dropdown/demo/dropdown-button.md

@ -10,8 +10,8 @@
import { Menu, Dropdown } from 'antd'; import { Menu, Dropdown } from 'antd';
const DropdownButton = Dropdown.Button; const DropdownButton = Dropdown.Button;
function handleButtonClick() { function handleButtonClick(e) {
console.log('click button'); console.log('click left button', e);
} }
function handleMenuClick(e) { function handleMenuClick(e) {

4
components/dropdown/dropdown-button.jsx

@ -21,14 +21,14 @@ export default React.createClass({
}; };
}, },
render() { render() {
const { type, overlay, trigger, align, children, className, ...restProps } = this.props; const { type, overlay, trigger, align, children, className, onClick, ...restProps } = this.props;
const cls = classNames({ const cls = classNames({
'ant-dropdown-button': true, 'ant-dropdown-button': true,
className: !!className, className: !!className,
}); });
return ( return (
<ButtonGroup {...restProps} className={cls}> <ButtonGroup {...restProps} className={cls}>
<Button type={type}>{children}</Button> <Button type={type} onClick={onClick}>{children}</Button>
<Dropdown align={align} overlay={overlay} trigger={trigger}> <Dropdown align={align} overlay={overlay} trigger={trigger}>
<Button type={type}> <Button type={type}>
<Icon type="down" /> <Icon type="down" />

3
components/input-number/demo/basic.md

@ -2,7 +2,7 @@
- order: 0 - order: 0
数字输入框 数字输入框
--- ---
@ -17,4 +17,3 @@ ReactDOM.render(
<InputNumber min={1} max={10} defaultValue={3} onChange={onChange} /> <InputNumber min={1} max={10} defaultValue={3} onChange={onChange} />
, mountNode); , mountNode);
```` ````

19
components/input-number/demo/digit.md

@ -0,0 +1,19 @@
# 小数
- order: 3
和原生的数字输入框一样,value 的精度由 step 的小数位数决定。
---
````jsx
import { InputNumber } from 'antd';
function onChange(value) {
console.log('changed', value);
}
ReactDOM.render(
<InputNumber min={1} max={10} step={0.1} onChange={onChange} />
, mountNode);
````

2
components/input-number/index.md

@ -21,7 +21,7 @@
| min | 最小值 | Number | -Infinity | | min | 最小值 | Number | -Infinity |
| max | 最大值 | Number | Infinity | | max | 最大值 | Number | Infinity |
| value | 当前值 | Number | | | value | 当前值 | Number | |
| step | 每次改变步数 | Number or String | 1 | | step | 每次改变步数,可以为小数 | Number or String | 1 |
| defaultValue | 初始值 | Number | | | defaultValue | 初始值 | Number | |
| onChange | 变化回调 | Function | | | onChange | 变化回调 | Function | |
| disabled | 禁用 | Boolean | false | | disabled | 禁用 | Boolean | false |

6
components/table/index.jsx

@ -85,9 +85,9 @@ let AntTable = React.createClass({
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (('pagination' in nextProps) && nextProps.pagination !== false) { if (('pagination' in nextProps) && nextProps.pagination !== false) {
this.setState({ this.setState(previousState => ({
pagination: objectAssign({}, defaultPagination, this.state.pagination, nextProps.pagination) pagination: objectAssign({}, defaultPagination, previousState.pagination, nextProps.pagination),
}); }));
} }
// dataSource // dataSource
if ('dataSource' in nextProps && if ('dataSource' in nextProps &&

12
components/tabs/index.jsx

@ -58,14 +58,16 @@ class AntTabs extends React.Component {
); );
} }
tabBarExtraContent = tabBarExtraContent ? (
<div className={`${prefixCls}-extra-content`}>
{tabBarExtraContent}
</div>
) : null;
return ( return (
<Tabs {...this.props} <Tabs {...this.props}
className={className} className={className}
tabBarExtraContent={ tabBarExtraContent={tabBarExtraContent}
<div className={`${prefixCls}-extra-content`}>
{tabBarExtraContent}
</div>
}
onChange={this.handleChange} onChange={this.handleChange}
animation={animation}> animation={animation}>
{children} {children}

2
components/tag/index.jsx

@ -26,7 +26,7 @@ class AntTag extends React.Component {
} }
animationEnd(key, existed) { animationEnd(key, existed) {
if (!existed) { if (!existed && !this.state.closed) {
this.setState({ this.setState({
closed: true, closed: true,
closing: false, closing: false,

3
components/tree-select/index.md

@ -22,14 +22,13 @@
| defaultValue | 指定默认选中的条目 | string/Array<String> | 无 | | defaultValue | 指定默认选中的条目 | string/Array<String> | 无 |
| multiple | 支持多选 | boolean | false | | multiple | 支持多选 | boolean | false |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value) | 无 | | onSelect | 被选中时调用,参数为选中项的 value 值 | function(value) | 无 |
| onChange | 选中option,或input的value变化(combobox 模式下)时,调用此函数 | function(value, label) | 无 | | onChange | 选中项变化时调用此函数 | function(value, label) | 无 |
| allowClear | 显示清除按钮 | boolean | false | | allowClear | 显示清除按钮 | boolean | false |
| onSearch | 文本框值变化时回调 | function(value: String) | | | onSearch | 文本框值变化时回调 | function(value: String) | |
| placeholder | 选择框默认文字 | string | 无 | | placeholder | 选择框默认文字 | string | 无 |
| searchPlaceholder | 搜索框默认文字 | string | 无 | | searchPlaceholder | 搜索框默认文字 | string | 无 |
| dropdownStyle | 下拉菜单的样式 | object | 无 | | dropdownStyle | 下拉菜单的样式 | object | 无 |
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | | dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true |
| combobox | 输入框自动提示模式 | boolean | false |
| size | 选择框大小,可选 `large` `small` | String | default | | size | 选择框大小,可选 `large` `small` | String | default |
| showSearch | 在下拉中显示搜索框 | boolean | false | | showSearch | 在下拉中显示搜索框 | boolean | false |
| disabled | 是否禁用 | boolean | false | | disabled | 是否禁用 | boolean | false |

127
style/components/tabs.less

@ -281,113 +281,108 @@
} }
&-vertical { &-vertical {
.@{tab-prefix-cls}-tab { > .@{tab-prefix-cls}-bar {
float: none;
margin-right: 0;
margin-bottom: 16px;
&:last-child {
margin-bottom: 0;
}
.@{tab-prefix-cls}-tab-inner {
padding: 8px 24px;
}
}
.@{tab-prefix-cls}-nav-scroll {
width: auto;
}
.@{tab-prefix-cls}-bar {
border-bottom: 0; border-bottom: 0;
}
.@{tab-prefix-cls}-nav-container { .@{tab-prefix-cls}-tab {
margin-bottom: 0; float: none;
} margin-right: 0;
margin-bottom: 16px;
&:last-child {
margin-bottom: 0;
}
.@{tab-prefix-cls}-tab-inner {
padding: 8px 24px;
}
}
.@{tab-prefix-cls}-nav-wrap { .@{tab-prefix-cls}-nav-scroll {
margin-bottom: 0; width: auto;
} }
.@{tab-prefix-cls}-ink-bar { .@{tab-prefix-cls}-nav-container {
width: 2px; margin-bottom: 0;
left: auto;
height: auto;
&-transition-forward {
transition: bottom 0.3s @ease-in-out,
top 0.3s @ease-in-out 0.3s * 0.3;
} }
&-transition-backward {
transition: bottom 0.3s @ease-in-out 0.3s * 0.3, .@{tab-prefix-cls}-nav-wrap {
top 0.3s @ease-in-out; margin-bottom: 0;
} }
}
.@{tab-prefix-cls}-container { .@{tab-prefix-cls}-ink-bar {
margin-bottom: 0; width: 2px;
left: auto;
height: auto;
&-transition-forward {
transition: bottom 0.3s @ease-in-out,
top 0.3s @ease-in-out 0.3s * 0.3;
}
&-transition-backward {
transition: bottom 0.3s @ease-in-out 0.3s * 0.3,
top 0.3s @ease-in-out;
}
}
} }
.@{tab-prefix-cls}-content { > .@{tab-prefix-cls}-content {
overflow: hidden; overflow: hidden;
width: auto; width: auto;
} }
} }
&-vertical&-left { &-vertical&-left {
.@{tab-prefix-cls}-bar { > .@{tab-prefix-cls}-bar {
float: left; float: left;
border-right: 1px solid @border-color-split; border-right: 1px solid @border-color-split;
margin-right: -1px; margin-right: -1px;
margin-bottom: 0; margin-bottom: 0;
} .@{tab-prefix-cls}-tab {
.@{tab-prefix-cls}-tab { .@{tab-prefix-cls}-tab-inner {
.@{tab-prefix-cls}-tab-inner { text-align: right;
text-align: right; }
}
.@{tab-prefix-cls}-nav-container {
margin-right: -1px;
}
.@{tab-prefix-cls}-nav-wrap {
margin-right: -1px;
}
.@{tab-prefix-cls}-ink-bar {
right: 1px;
} }
} }
.@{tab-prefix-cls}-nav-container { > .@{tab-prefix-cls}-content {
margin-right: -1px;
}
.@{tab-prefix-cls}-nav-wrap {
margin-right: -1px;
}
.@{tab-prefix-cls}-ink-bar {
right: 1px;
}
.@{tab-prefix-cls}-content {
padding-left: 24px; padding-left: 24px;
border-left: 1px solid @border-color-split; border-left: 1px solid @border-color-split;
} }
} }
&-vertical&-right { &-vertical&-right {
.@{tab-prefix-cls}-bar { > .@{tab-prefix-cls}-bar {
float: right; float: right;
border-left: 1px solid @border-color-split; border-left: 1px solid @border-color-split;
margin-left: -1px; margin-left: -1px;
margin-bottom: 0; margin-bottom: 0;
.@{tab-prefix-cls}-nav-container {
margin-left: -1px;
}
.@{tab-prefix-cls}-nav-wrap {
margin-left: -1px;
}
.@{tab-prefix-cls}-ink-bar {
left: 1px;
}
} }
.@{tab-prefix-cls}-nav-container { > .@{tab-prefix-cls}-content {
margin-left: -1px;
}
.@{tab-prefix-cls}-nav-wrap {
margin-left: -1px;
}
.@{tab-prefix-cls}-ink-bar {
left: 1px;
}
.@{tab-prefix-cls}-content {
padding-right: 24px; padding-right: 24px;
border-right: 1px solid @border-color-split; border-right: 1px solid @border-color-split;
} }
} }
&-bottom &-bar { &-bottom > &-bar {
margin-bottom: 0; margin-bottom: 0;
margin-top: 16px; margin-top: 16px;
} }
// card style // card style
&&-card &-nav-container { &&-card &-nav-container {
height: 36px; height: 36px;

Loading…
Cancel
Save