diff --git a/components/cascader/demo/size.md b/components/cascader/demo/size.md new file mode 100644 index 0000000000..8e8c2123a3 --- /dev/null +++ b/components/cascader/demo/size.md @@ -0,0 +1,47 @@ +# 大小 + +- order: 7 + +不同大小的级联选择器。 + +--- + +````jsx +import { Cascader } from 'antd'; + +const options = [{ + value: 'zhejiang', + label: '浙江', + children: [{ + value: 'hangzhou', + label: '杭州', + children: [{ + value: 'xihu', + label: '西湖', + }], + }], +}, { + value: 'jiangsu', + label: '江苏', + children: [{ + value: 'nanjing', + label: '南京', + children: [{ + value: 'zhonghuamen', + label: '中华门', + }], + }], +}]; + +function onChange(value) { + console.log(value); +} + +ReactDOM.render( +
+

+

+

+
+, mountNode); +```` diff --git a/components/cascader/index.jsx b/components/cascader/index.jsx index e79c1ed6bd..32a732eb8d 100644 --- a/components/cascader/index.jsx +++ b/components/cascader/index.jsx @@ -104,7 +104,6 @@ AntCascader.defaultProps = { return label.join(' / '); }, disabled: false, - size: 'default', onPopupVisibleChange() {}, }; diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index 0f5c73d464..5ff24a0929 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -118,12 +118,29 @@ class FormItem extends React.Component { renderChildren() { const context = this.context; const props = this.props; - let children = props.children; + let children = null; if (context.form && props.id && props.fieldOption) { + const child = React.Children.only(props.children); + const size = {}; + if (typeof child.type === 'function' && !child.props.size) { + size.size = 'large'; + } children = React.cloneElement( - React.Children.only(children), - { ...context.form.getFieldProps(props.id, props.fieldOption), id: props.id } + child, + { + ...context.form.getFieldProps(props.id, props.fieldOption), + ...size, + id: props.id + } ); + } else { + children = React.Children.map(props.children, (child) => { + if (typeof child.type === 'function' && !child.props.size) { + return React.cloneElement(child, { size: 'large' }); + } + + return child; + }); } return [ this.renderLabel(), diff --git a/components/form/demo/mix.md b/components/form/demo/mix.md index a30ec60105..421e2205d5 100644 --- a/components/form/demo/mix.md +++ b/components/form/demo/mix.md @@ -7,7 +7,7 @@ --- ````jsx -import { Form, Select, InputNumber, DatePicker, Switch, Radio, +import { Form, Select, InputNumber, DatePicker, TimePicker, Switch, Radio, Slider, Button, message, Row, Col, Upload, Icon } from 'antd'; const FormItem = Form.Item; const Option = Select.Option; @@ -56,7 +56,7 @@ const Demo = React.createClass({ labelCol={{span: 8}} wrapperCol={{span: 10}} required> - + 台机器 @@ -92,7 +92,7 @@ const Demo = React.createClass({ labelCol={{span: 8}} wrapperCol={{span: 16}} required> - @@ -115,10 +115,18 @@ const Demo = React.createClass({ + + + + - + 选项一 选项二 选项三 diff --git a/components/form/demo/validate-other.md b/components/form/demo/validate-other.md index 3f98df7f4f..480cfc9357 100644 --- a/components/form/demo/validate-other.md +++ b/components/form/demo/validate-other.md @@ -70,7 +70,7 @@ let Demo = React.createClass({ { required: true, message: '请选择您的国籍' } ], }}> - @@ -89,7 +89,7 @@ let Demo = React.createClass({ { required: true, message: '请选择您喜欢的颜色', type: 'array' }, ] }}> - @@ -141,7 +141,7 @@ let Demo = React.createClass({ fieldOption={{ rules: [{ validator: this.checkPrime }], }}> - + ; } diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx index 299922674c..c277766ddc 100644 --- a/components/tabs/index.jsx +++ b/components/tabs/index.jsx @@ -78,7 +78,6 @@ class AntTabs extends React.Component { AntTabs.defaultProps = { prefixCls: 'ant-tabs', - size: 'default', animation: 'slide-horizontal', type: 'line', // or 'card' 'editable-card' onChange() {}, diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 567321e385..83a8a525db 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -22,7 +22,6 @@ const AntTimePicker = React.createClass({ disabledMinutes: undefined, disabledSeconds: undefined, hideDisabledOptions: false, - size: 'default', placement: 'bottomLeft', transitionName: 'slide-up', }; diff --git a/components/tree-select/demo/basic.md b/components/tree-select/demo/basic.md index 3eaab261c6..5b160444ef 100644 --- a/components/tree-select/demo/basic.md +++ b/components/tree-select/demo/basic.md @@ -42,5 +42,5 @@ const Demo = React.createClass({ ReactDOM.render( -, document.getElementById('components-tree-select-demo-basic')); +, mountNode); ```` diff --git a/components/tree-select/demo/checkable.md b/components/tree-select/demo/checkable.md index 23582cafef..8d17fdd5ad 100644 --- a/components/tree-select/demo/checkable.md +++ b/components/tree-select/demo/checkable.md @@ -71,5 +71,5 @@ const Demo = React.createClass({ }, }); -ReactDOM.render(, document.getElementById('components-tree-select-demo-checkable')); +ReactDOM.render(, mountNode); ```` diff --git a/components/tree-select/demo/size.md b/components/tree-select/demo/size.md new file mode 100644 index 0000000000..1a76825946 --- /dev/null +++ b/components/tree-select/demo/size.md @@ -0,0 +1,80 @@ +# 大小 + +- order: 2 + +不同大小的 TreeSelect。 + +--- + +````jsx +import { TreeSelect } from 'antd'; +const TreeNode = TreeSelect.TreeNode; + +const Demo = React.createClass({ + getInitialState() { + return { + value: 'leaf1', + }; + }, + onChange(value) { + this.setState({ value }); + }, + render() { + return ( +
+ + + + + + + + + + + +

+ + + + + + + + + + + +

+ + + + + + + + + + + +
+ ); + }, +}); + +ReactDOM.render( + +, mountNode); +```` diff --git a/components/tree-select/index.jsx b/components/tree-select/index.jsx index ea609c7c43..650a12bf26 100644 --- a/components/tree-select/index.jsx +++ b/components/tree-select/index.jsx @@ -11,7 +11,6 @@ const AntTreeSelect = React.createClass({ optionLabelProp: 'value', choiceTransitionName: 'zoom', showSearch: false, - size: 'default', // openAnimation: animation, }; }, diff --git a/style/components/spin.less b/style/components/spin.less index dff68ace0f..b0b68eb85c 100644 --- a/style/components/spin.less +++ b/style/components/spin.less @@ -10,7 +10,7 @@ .@{spin-prefix-cls} { color: @primary-color; display: inline-block; - font-size: 1em; + font-size: @spin-dot-size; text-align: center; opacity: 0; position: absolute; @@ -68,17 +68,13 @@ // Sizes // ------------------------------ - &-default { - font-size: @spin-dot-size; - } - // small - &-small { + &-sm { font-size: @spin-dot-size-sm; } // large - &-large { + &-lg { font-size: @spin-dot-size-lg; } }