From 8ab6159bb89d027740cec16a718b6e558d94121c Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 19 Feb 2016 19:59:07 +0800 Subject: [PATCH 01/26] Fix Input disabled style, ref #1038 --- style/mixins/input.less | 1 + style/themes/default/custom.less | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/style/mixins/input.less b/style/mixins/input.less index e1de58153c..6c7dd97dda 100644 --- a/style/mixins/input.less +++ b/style/mixins/input.less @@ -27,6 +27,7 @@ background-color: @input-disabled-bg; opacity: 1; cursor: @cursor-disabled; + color: #ccc; &:hover { .hover(@input-border-color); } diff --git a/style/themes/default/custom.less b/style/themes/default/custom.less index 28fc4c7099..cbb3d47f98 100644 --- a/style/themes/default/custom.less +++ b/style/themes/default/custom.less @@ -67,7 +67,7 @@ @btn-ghost-border : @border-color-base; @btn-disable-color : #ccc; -@btn-disable-bg : #f3f5f7; +@btn-disable-bg : #f4f4f4; @btn-disable-border : @border-color-base; @btn-padding-base : 4px 11px; @@ -136,6 +136,6 @@ @input-hover-border-color : @primary-color; @input-focus-border-color : @primary-color; -@input-disabled-bg : #f3f5f7; +@input-disabled-bg : #f4f4f4; @form-item-margin-bottom : 24px; From 21b3368d4e9d1172e597b5d467bc188bdac08bc6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 20 Feb 2016 16:33:01 +0800 Subject: [PATCH 02/26] remove row width 100% --- style/mixins/grid.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/style/mixins/grid.less b/style/mixins/grid.less index 9bd1e1c33d..939a8383a1 100644 --- a/style/mixins/grid.less +++ b/style/mixins/grid.less @@ -10,7 +10,6 @@ .make-row(@gutter: @grid-gutter-width) { position: relative; - width: 100%; margin-left: (@gutter / -2); margin-right: (@gutter / -2); height: auto; @@ -69,4 +68,4 @@ .make-grid() { .loop-grid-columns(@grid-columns); -} \ No newline at end of file +} From efd768bf076f0e138d0efaa2b2fd18fc53ea5218 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Sat, 20 Feb 2016 16:39:49 +0800 Subject: [PATCH 03/26] allow more value type for radiogroup --- components/radio/demo/radiogroup.md | 13 ++++---- components/radio/group.jsx | 46 ++++++++++++++++++++++------- package.json | 4 +-- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/components/radio/demo/radiogroup.md b/components/radio/demo/radiogroup.md index 820bab872c..7bd3991de0 100644 --- a/components/radio/demo/radiogroup.md +++ b/components/radio/demo/radiogroup.md @@ -13,11 +13,11 @@ const RadioGroup = Radio.Group; const App = React.createClass({ getInitialState() { return { - value: 'a' + value: 1 }; }, onChange(e) { - console.log(`radio checked:${e.target.value}`); + console.log(`radio checked`, e.target.value); this.setState({ value: e.target.value }); @@ -26,12 +26,11 @@ const App = React.createClass({ return (
- A - B - C - D + A + B + C + D -
你选中的: {this.state.value}
); } diff --git a/components/radio/group.jsx b/components/radio/group.jsx index 293288e687..f6c486b63e 100644 --- a/components/radio/group.jsx +++ b/components/radio/group.jsx @@ -1,13 +1,17 @@ import React from 'react'; function getCheckedValue(children) { - let checkedValue = null; + let value = null; + let matched = 0; React.Children.forEach(children, (radio) => { if (radio.props && radio.props.checked) { - checkedValue = radio.props.value; + value = radio.props.value; + matched = 1; } }); - return checkedValue; + return matched ? { + value, + } : undefined; } export default React.createClass({ @@ -21,29 +25,51 @@ export default React.createClass({ }, getInitialState() { let props = this.props; + let value; + if ('value' in props) { + value = props.value; + } else if ('defaultValue' in props) { + value = props.defaultValue; + } else { + const checkedValue = getCheckedValue(props.children); + value = checkedValue && checkedValue.value; + } return { - value: props.value || props.defaultValue || getCheckedValue(props.children) + value, }; }, componentWillReceiveProps(nextProps) { - if ('value' in nextProps || getCheckedValue(nextProps.children)) { + if ('value' in nextProps) { this.setState({ - value: nextProps.value || getCheckedValue(nextProps.children) + value: nextProps.value }); + } else { + const checkedValue = getCheckedValue(nextProps.children); + if (checkedValue) { + this.setState({ + value: checkedValue.value + }); + } } }, onRadioChange(ev) { - this.setState({ - value: ev.target.value - }); + if (!('value' in this.props)) { + this.setState({ + value: ev.target.value + }); + } this.props.onChange(ev); }, render() { const props = this.props; const children = React.Children.map(props.children, (radio) => { if (radio.props) { + const keyProps = {}; + if (!('key' in radio) && typeof radio.props.value === 'string') { + keyProps.key = radio.props.value; + } return React.cloneElement(radio, { - key: radio.props.value, + ...keyProps, ...radio.props, onChange: this.onRadioChange, checked: this.state.value === radio.props.value, diff --git a/package.json b/package.json index bf2b5111ed..a41ce18464 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "0.12.3", + "version": "0.12.2", "title": "Ant Design", "description": "一个 UI 设计语言", "homepage": "http://ant.design/", @@ -41,7 +41,7 @@ "rc-animate": "~2.0.2", "rc-calendar": "~5.4.0", "rc-cascader": "~0.9.0", - "rc-checkbox": "~1.2.0", + "rc-checkbox": "~1.3.0", "rc-collapse": "~1.4.4", "rc-dialog": "~5.3.1", "rc-dropdown": "~1.4.3", From 89d990c2e25cef33c0a8731f5f6b2c45af623637 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 20 Feb 2016 16:58:29 +0800 Subject: [PATCH 04/26] Fix spin style size bug in Chrome --- style/components/spin.less | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/style/components/spin.less b/style/components/spin.less index bd631491ad..195ec293fe 100644 --- a/style/components/spin.less +++ b/style/components/spin.less @@ -10,7 +10,6 @@ .@{spin-prefix-cls} { color: @primary-color; display: inline-block; - font-size: @spin-dot-size; text-align: center; opacity: 0; position: absolute; @@ -52,30 +51,38 @@ &-dot { .animation(antSpinPulse 1.2s infinite @ease-in-out-circ); - .square(1em); + .square(@spin-dot-size); border-radius: 50%; display: inline-block; background-color: @primary-color; } &-dot-second { .animation-delay(200ms); - margin-left: 1em; } &-dot-third { .animation-delay(400ms); - margin-left: 1em; + } + + &-dot + &-dot { + margin-left: @spin-dot-size; } // Sizes // ------------------------------ // small - &-sm { - font-size: @spin-dot-size-sm; + &-sm &-dot { + .square(@spin-dot-size-sm); + + & { + margin-left: @spin-dot-size-sm; + } } // large - &-lg { - font-size: @spin-dot-size-lg; + &-lg &-dot { + .square(@spin-dot-size-lg); + + & { + margin-left: @spin-dot-size-lg; + } } } From 8736b0a17e5fc990577cf6e69f75b9f698f7fb9f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 20 Feb 2016 17:41:40 +0800 Subject: [PATCH 05/26] Fix inline form style with help, close #1040 --- style/components/form.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/style/components/form.less b/style/components/form.less index 72951220ca..099c3ff6aa 100644 --- a/style/components/form.less +++ b/style/components/form.less @@ -268,6 +268,11 @@ form { .has-feedback { display: inline-block; } + + // Fix https://github.com/ant-design/ant-design/issues/1040 + .@{css-prefix}form-explain { + position: absolute; + } } .@{css-prefix}form-horizontal, From 5a032af8e92190478ee2622a1e18405abb647f18 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 21 Feb 2016 14:04:08 +0800 Subject: [PATCH 06/26] update some code style --- components/radio/group.jsx | 16 +++++++--------- package.json | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/components/radio/group.jsx b/components/radio/group.jsx index f6c486b63e..113b470690 100644 --- a/components/radio/group.jsx +++ b/components/radio/group.jsx @@ -2,16 +2,14 @@ import React from 'react'; function getCheckedValue(children) { let value = null; - let matched = 0; + let matched = false; React.Children.forEach(children, (radio) => { if (radio.props && radio.props.checked) { value = radio.props.value; - matched = 1; + matched = true; } }); - return matched ? { - value, - } : undefined; + return matched ? { value } : undefined; } export default React.createClass({ @@ -20,7 +18,7 @@ export default React.createClass({ prefixCls: 'ant-radio-group', disabled: false, onChange() { - } + }, }; }, getInitialState() { @@ -41,13 +39,13 @@ export default React.createClass({ componentWillReceiveProps(nextProps) { if ('value' in nextProps) { this.setState({ - value: nextProps.value + value: nextProps.value, }); } else { const checkedValue = getCheckedValue(nextProps.children); if (checkedValue) { this.setState({ - value: checkedValue.value + value: checkedValue.value, }); } } @@ -55,7 +53,7 @@ export default React.createClass({ onRadioChange(ev) { if (!('value' in this.props)) { this.setState({ - value: ev.target.value + value: ev.target.value, }); } this.props.onChange(ev); diff --git a/package.json b/package.json index a41ce18464..3d2ab70cbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "0.12.2", + "version": "0.12.3", "title": "Ant Design", "description": "一个 UI 设计语言", "homepage": "http://ant.design/", From e539e08f4ea6c4cb2d6ae0b84108c60189331f8c Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 21 Feb 2016 14:13:33 +0800 Subject: [PATCH 07/26] Fix CheckboxGroup initial state --- components/checkbox/Group.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/checkbox/Group.jsx b/components/checkbox/Group.jsx index 7071094228..e90d13e63b 100644 --- a/components/checkbox/Group.jsx +++ b/components/checkbox/Group.jsx @@ -16,10 +16,14 @@ export default React.createClass({ onChange: React.PropTypes.func, }, getInitialState() { - const { value, defaultValue } = this.props; - return { - value: value || defaultValue, - }; + const props = this.props; + let value; + if ('value' in props) { + value = props.value; + } else if ('defaultValue' in props) { + value = props.defaultValue; + } + return { value }; }, componentWillReceiveProps(nextProps) { if ('value' in nextProps) { From c63f0b806032a83e8be0df5d641f7d2089693558 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 21 Feb 2016 14:14:59 +0800 Subject: [PATCH 08/26] update demo text --- components/checkbox/demo/group.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/checkbox/demo/group.md b/components/checkbox/demo/group.md index 89b03f9949..b7dacc4f69 100644 --- a/components/checkbox/demo/group.md +++ b/components/checkbox/demo/group.md @@ -2,7 +2,7 @@ - order: 3 -方便的生成一个 Checkbox 组。 +方便的从数组生成 Checkbox 组。若需要 label 和 value 分离请直接使用 Checkbox。 --- From bcb9c2d13303849428cf3c1e4dc685bd02050d9a Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 21 Feb 2016 14:40:19 +0800 Subject: [PATCH 09/26] Fix spin style --- style/components/spin.less | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/style/components/spin.less b/style/components/spin.less index 195ec293fe..0c415980fc 100644 --- a/style/components/spin.less +++ b/style/components/spin.less @@ -10,11 +10,13 @@ .@{spin-prefix-cls} { color: @primary-color; display: inline-block; + vertical-align: middle; text-align: center; opacity: 0; position: absolute; visibility: hidden; transition: opacity 0.3s @ease-in-out-circ; + font-size: @font-size-base; &-spining { opacity: 1; @@ -30,8 +32,10 @@ position: absolute; top: 50%; left: 50%; - margin-top: -0.75em; - margin-left: -2.5em; + height: 20px; + line-height: 20px; + margin-top: -10px; + margin-left: -2.5 * @spin-dot-size; z-index: 4; } @@ -41,6 +45,7 @@ &-nested-loading > &-container { opacity: 0.7; + -webkit-filter: blur(1px); filter: blur(1px); filter: ~"progid\:DXImageTransform\.Microsoft\.Blur(PixelRadius\=1, MakeShadow\=false)"; /* IE6~IE9 */ pointer-events: none; @@ -77,6 +82,10 @@ } } + &-nested-loading &-sm { + margin-left: -2.5 * @spin-dot-size-sm; + } + // large &-lg &-dot { .square(@spin-dot-size-lg); @@ -84,6 +93,10 @@ margin-left: @spin-dot-size-lg; } } + + &-nested-loading &-sm { + margin-left: -2.5 * @spin-dot-size-lg; + } } // pulse From 4a50b31d2302e855f55ae88ea78ff1d1e5b6ba67 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 21 Feb 2016 15:02:11 +0800 Subject: [PATCH 10/26] improve center style code of spin --- style/components/spin.less | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/style/components/spin.less b/style/components/spin.less index 0c415980fc..1fe2acb381 100644 --- a/style/components/spin.less +++ b/style/components/spin.less @@ -31,12 +31,12 @@ &-nested-loading & { position: absolute; top: 50%; - left: 50%; height: 20px; line-height: 20px; margin-top: -10px; - margin-left: -2.5 * @spin-dot-size; z-index: 4; + text-align: center; + width: 100%; } &-container { @@ -82,10 +82,6 @@ } } - &-nested-loading &-sm { - margin-left: -2.5 * @spin-dot-size-sm; - } - // large &-lg &-dot { .square(@spin-dot-size-lg); @@ -93,10 +89,6 @@ margin-left: @spin-dot-size-lg; } } - - &-nested-loading &-sm { - margin-left: -2.5 * @spin-dot-size-lg; - } } // pulse From 77ba9a609e12de97bc90075facac985f98270882 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Mon, 22 Feb 2016 10:04:54 +0800 Subject: [PATCH 11/26] deps: upgrade eslint to 2.0.0+ --- .eslintrc.json | 9 ++++++--- package.json | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index caf7efe8d6..3108b198a4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,9 +7,12 @@ "jest": true, "es6": true }, - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true + "parserOptions": { + "ecmaVersion": 6, + "ecmaFeatures": { + "jsx": true, + "experimentalObjectRestSpread": true + } }, "plugins": [ "markdown", diff --git a/package.json b/package.json index 3d2ab70cbc..e14a4f4e41 100644 --- a/package.json +++ b/package.json @@ -86,11 +86,11 @@ "css-loader": "^0.23.0", "cz-conventional-changelog": "^1.1.5", "es3ify-loader": "^0.1.0", - "eslint": "^1.1.0", - "eslint-config-airbnb": "latest", + "eslint": "^2.2.0", + "eslint-config-airbnb": "^6.0.1", "eslint-plugin-babel": "^3.0.0", "eslint-plugin-markdown": "*", - "eslint-plugin-react": "^3.3.1", + "eslint-plugin-react": "^4.0.0", "eslint-tinker": "~0.2.0", "extract-text-webpack-plugin": "^1.0.1", "gh-pages": "^0.9.0", From c1659c2ce3201ba680e1929263686199180dcceb Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Mon, 22 Feb 2016 10:52:30 +0800 Subject: [PATCH 12/26] style: update code style to please lint --- .eslintrc.json | 4 +++- components/badge/index.jsx | 4 ---- components/calendar/demo/locale.md | 2 +- components/calendar/index.jsx | 2 +- components/collapse/demo/accordion.md | 6 +++--- components/collapse/demo/mix.md | 8 ++++---- components/date-picker/RangePicker.jsx | 8 ++++---- components/date-picker/index.jsx | 6 +++--- components/dropdown/demo/item.md | 2 +- components/dropdown/demo/trigger.md | 2 +- components/form/FormItem.jsx | 2 ++ components/form/ValueMixin.jsx | 16 ++++------------ components/form/demo/input-group.md | 4 ++-- components/form/demo/mix.md | 6 +++--- components/form/demo/validate-basic.md | 8 ++++---- components/input/index.jsx | 2 +- components/modal/demo/async.md | 2 +- components/modal/demo/footer.md | 2 +- components/queue-anim/demo/form.md | 2 +- components/queue-anim/demo/router.md | 2 +- components/radio/demo/radiogroup.md | 2 +- components/table/filterDropdown.jsx | 4 +--- components/table/index.jsx | 21 +++++++++------------ components/tabs/index.jsx | 2 +- components/transfer/index.jsx | 7 ++++--- components/transfer/list.jsx | 24 +++++++++++------------- components/transfer/search.jsx | 6 +----- components/tree/demo/basic-controlled.md | 2 +- components/upload/demo/picture-card.md | 2 +- components/upload/index.jsx | 4 ++-- package.json | 4 ++-- 31 files changed, 75 insertions(+), 93 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 3108b198a4..8f6cb778f5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,6 +31,8 @@ "react/jsx-closing-bracket-location": 0, "react/jsx-no-bind": 0, "no-param-reassign": 0, - "max-len": 0 + "no-return-assign": 0, + "max-len": 0, + "consistent-return": 0 } } diff --git a/components/badge/index.jsx b/components/badge/index.jsx index cd51874288..7076faaad3 100644 --- a/components/badge/index.jsx +++ b/components/badge/index.jsx @@ -4,10 +4,6 @@ import ScrollNumber from './ScrollNumber'; import classNames from 'classnames'; class AntBadge extends React.Component { - constructor(props) { - super(props); - } - render() { let { count, prefixCls, overflowCount, className, style, children } = this.props; const dot = this.props.dot; diff --git a/components/calendar/demo/locale.md b/components/calendar/demo/locale.md index 94b22c1ad4..f292bbc540 100644 --- a/components/calendar/demo/locale.md +++ b/components/calendar/demo/locale.md @@ -15,6 +15,6 @@ function onPanelChange(value, mode) { } ReactDOM.render( - + , mountNode); ```` diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index cd6266b06f..6be2b5e8e0 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -92,7 +92,7 @@ class Calendar extends Component { locale={locale.lang} prefixCls={prefixCls} onTypeChange={this.setType.bind(this)} - onValueChange={this.setValue.bind(this)}/> + onValueChange={this.setValue.bind(this)} /> - +

{text}

- +

{text}

- +

{text}

diff --git a/components/collapse/demo/mix.md b/components/collapse/demo/mix.md index d28d3f57b8..ba376017f0 100644 --- a/components/collapse/demo/mix.md +++ b/components/collapse/demo/mix.md @@ -22,17 +22,17 @@ const text = ` ReactDOM.render( - + - +

{text}

- +

{text}

- +

{text}

diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index 0b24c77c3d..57d1525a6d 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -74,7 +74,7 @@ export default React.createClass({ timePicker = (); + transitionName="slide-up" />); } const calendarClassName = classNames({ @@ -151,15 +151,15 @@ export default React.createClass({ onChange={this.handleInputChange} value={start && this.getFormatter().format(start)} placeholder={startPlaceholder} - className="ant-calendar-range-picker-input"/> + className="ant-calendar-range-picker-input" /> ~ - + className="ant-calendar-range-picker-input" /> + ); } diff --git a/components/date-picker/index.jsx b/components/date-picker/index.jsx index 97bd1a2da1..85670591ec 100644 --- a/components/date-picker/index.jsx +++ b/components/date-picker/index.jsx @@ -61,7 +61,7 @@ function createPicker(TheCalendar, defaultFormat) { const timePicker = this.props.showTime ? () + transitionName="slide-up" />) : null; const disabledTime = this.props.showTime ? this.props.disabledTime : null; @@ -139,8 +139,8 @@ function createPicker(TheCalendar, defaultFormat) { value={value && this.getFormatter().format(value)} placeholder={placeholder} style={this.props.style} - className={`ant-calendar-picker-input ant-input${sizeClass}`}/> - + className={`ant-calendar-picker-input ant-input${sizeClass}`} /> + ); } diff --git a/components/dropdown/demo/item.md b/components/dropdown/demo/item.md index 4f58b2397c..5e6d379239 100644 --- a/components/dropdown/demo/item.md +++ b/components/dropdown/demo/item.md @@ -17,7 +17,7 @@ const menu = ( 第二个菜单项 - + 第三个菜单项(不可用) ); diff --git a/components/dropdown/demo/trigger.md b/components/dropdown/demo/trigger.md index a701fcda9a..2a7e8cf04f 100644 --- a/components/dropdown/demo/trigger.md +++ b/components/dropdown/demo/trigger.md @@ -17,7 +17,7 @@ const menu = ( 第二个菜单项 - + 第三个菜单项 ); diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index d96de2627f..b48b029f8b 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -58,6 +58,8 @@ class FormItem extends React.Component { } else if (getFieldValue(field) !== undefined) { return 'success'; } + + return ''; } renderValidateWrapper(c1, c2, c3) { diff --git a/components/form/ValueMixin.jsx b/components/form/ValueMixin.jsx index 57637057ce..7450ddd687 100644 --- a/components/form/ValueMixin.jsx +++ b/components/form/ValueMixin.jsx @@ -1,14 +1,3 @@ -function merge() { - const ret = {}; - const args = [].slice.call(arguments, 0); - args.forEach((a) => { - Object.keys(a).forEach((k) => { - ret[k] = a[k]; - }); - }); - return ret; -} - const ValueMixin = { setValue(field, e) { let v = e; @@ -24,7 +13,10 @@ const ValueMixin = { const newFormData = {}; newFormData[field] = v; this.setState({ - formData: merge(this.state.formData, newFormData), + formData: { + ...this.state.formData, + ...newFormData, + }, }); }, }; diff --git a/components/form/demo/input-group.md b/components/form/demo/input-group.md index c3fa8a28db..c2c1c22344 100644 --- a/components/form/demo/input-group.md +++ b/components/form/demo/input-group.md @@ -18,14 +18,14 @@ ReactDOM.render( label="标签输入框:" labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}> - + - + - + - +

-

@@ -100,7 +100,7 @@ let Demo = React.createClass({ labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} required> - +
+ })} /> + onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} /> + })} /> + })} /> diff --git a/components/input/index.jsx b/components/input/index.jsx index e502a70804..1665ca680d 100644 --- a/components/input/index.jsx +++ b/components/input/index.jsx @@ -99,7 +99,7 @@ class Input extends React.Component { ); default: inputClassName = props.className ? props.className : inputClassName; - return ; + return ; } } diff --git a/components/modal/demo/async.md b/components/modal/demo/async.md index eebd848421..ed81f81806 100644 --- a/components/modal/demo/async.md +++ b/components/modal/demo/async.md @@ -55,5 +55,5 @@ const Test = React.createClass({ } }); -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ```` diff --git a/components/modal/demo/footer.md b/components/modal/demo/footer.md index b650d3b1ca..24bf9f45aa 100644 --- a/components/modal/demo/footer.md +++ b/components/modal/demo/footer.md @@ -56,5 +56,5 @@ const Test = React.createClass({ } }); -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ```` diff --git a/components/queue-anim/demo/form.md b/components/queue-anim/demo/form.md index 319386170a..2b82e8210a 100644 --- a/components/queue-anim/demo/form.md +++ b/components/queue-anim/demo/form.md @@ -38,7 +38,7 @@ const Test = React.createClass({
- +
,
diff --git a/components/queue-anim/demo/router.md b/components/queue-anim/demo/router.md index b8908be062..292f736f75 100644 --- a/components/queue-anim/demo/router.md +++ b/components/queue-anim/demo/router.md @@ -29,7 +29,7 @@ const App = React.createClass({ - {React.cloneElement(this.props.children || , { key })} + {React.cloneElement(this.props.children || , { key })}
); diff --git a/components/radio/demo/radiogroup.md b/components/radio/demo/radiogroup.md index 7bd3991de0..eadfb117f8 100644 --- a/components/radio/demo/radiogroup.md +++ b/components/radio/demo/radiogroup.md @@ -17,7 +17,7 @@ const App = React.createClass({ }; }, onChange(e) { - console.log(`radio checked`, e.target.value); + console.log('radio checked', e.target.value); this.setState({ value: e.target.value }); diff --git a/components/table/filterDropdown.jsx b/components/table/filterDropdown.jsx index 1526d6ae46..97e2921dd7 100644 --- a/components/table/filterDropdown.jsx +++ b/components/table/filterDropdown.jsx @@ -59,9 +59,7 @@ let FilterMenu = React.createClass({ const keyPathOfSelectedItem = this.state.keyPathOfSelectedItem; const containSelected = Object.keys(keyPathOfSelectedItem).some(key => { const keyPath = keyPathOfSelectedItem[key]; - if (keyPath.indexOf(item.value) >= 0) { - return true; - } + return keyPath.indexOf(item.value) >= 0; }); const subMenuCls = containSelected ? 'ant-dropdown-submenu-contain-selected' : ''; return ( diff --git a/components/table/index.jsx b/components/table/index.jsx index e97d8d4d14..599cc2af4c 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -134,8 +134,8 @@ let AntTable = React.createClass({ } } if (typeof column.sorter === 'function') { - sorter = function () { - let result = column.sorter.apply(this, arguments); + sorter = function (...args) { + let result = column.sorter.apply(this, args); if (sortOrder === 'ascend') { return result; } else if (sortOrder === 'descend') { @@ -296,7 +296,7 @@ let AntTable = React.createClass({ return ( + value={rowIndex} checked={checked} /> ); }, @@ -315,7 +315,7 @@ let AntTable = React.createClass({ } return ( + onChange={this.handleSelect.bind(this, record, rowIndex)} /> ); }, @@ -408,7 +408,7 @@ let AntTable = React.createClass({ filterDropdown = ( + confirmFilter={this.handleFilter} /> ); } if (column.sorter) { @@ -427,12 +427,12 @@ let AntTable = React.createClass({ - + - + ); @@ -517,10 +517,7 @@ let AntTable = React.createClass({ // 否则进行读取分页数据 if (data.length > pageSize || pageSize === Number.MAX_VALUE) { data = data.filter((item, i) => { - if (i >= (current - 1) * pageSize && - i < current * pageSize) { - return item; - } + return i >= (current - 1) * pageSize && i < current * pageSize; }); } return data; @@ -575,7 +572,7 @@ let AntTable = React.createClass({ if (!data || data.length === 0) { emptyText = (
- {locale.emptyText} + {locale.emptyText}
); emptyClass = ' ant-table-empty'; diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx index 611c7159e0..e84e8c5fa8 100644 --- a/components/tabs/index.jsx +++ b/components/tabs/index.jsx @@ -29,7 +29,7 @@ class AntTabs extends React.Component { let { prefixCls, size, tabPosition, animation, type, children, tabBarExtraContent } = this.props; let className = classNames({ - [this.props.className]: !!this. props.className, + [this.props.className]: !!this.props.className, [`${prefixCls}-mini`]: size === 'small' || size === 'mini', [`${prefixCls}-vertical`]: tabPosition === 'left' || tabPosition === 'right', [`${prefixCls}-card`]: type.indexOf('card') >= 0, diff --git a/components/transfer/index.jsx b/components/transfer/index.jsx index 6bb6fd2679..a2f8517ac8 100644 --- a/components/transfer/index.jsx +++ b/components/transfer/index.jsx @@ -33,6 +33,7 @@ class Transfer extends Component { leftDataSource.splice(index, 1); return true; } + return false; })[0]); }); } @@ -181,14 +182,14 @@ class Transfer extends Component { searchPlaceholder={searchPlaceholder} body={body} footer={footer} - prefixCls={`${prefixCls}-list`}/> + prefixCls={`${prefixCls}-list`} /> + className={`${prefixCls}-operation`} /> + prefixCls={`${prefixCls}-list`} /> ); } diff --git a/components/transfer/list.jsx b/components/transfer/list.jsx index bd8e9fde77..e7e9625162 100644 --- a/components/transfer/list.jsx +++ b/components/transfer/list.jsx @@ -81,21 +81,19 @@ class TransferList extends Component { [`${prefixCls}-with-footer`]: !!footerDom, }); - const showItems = dataSource.map((item) => { - // apply filter + const showItems = dataSource.filter((item) => { const itemText = this.props.render(item); const filterResult = this.matchFilter(itemText, filter); + return !!filterResult; + }).map((item) => { const renderedText = this.props.render(item); - - if (filterResult) { - return ( -
  • - key === item.key)} /> - {renderedText} -
  • - ); - } - }).filter(item => !!item); + return ( +
  • + key === item.key)} /> + {renderedText} +
  • + ); + }); return (
    @@ -104,7 +102,7 @@ class TransferList extends Component { prefixCls: 'ant-transfer', checked: checkStatus === 'all', checkPart: checkStatus === 'part', - checkable: + checkable: })}{(checkedKeys.length > 0 ? `${checkedKeys.length}/` : '') + dataSource.length} 条 {titleText}
    diff --git a/components/transfer/search.jsx b/components/transfer/search.jsx index 203e36ab88..b951f1613a 100644 --- a/components/transfer/search.jsx +++ b/components/transfer/search.jsx @@ -4,10 +4,6 @@ function noop() { } class Search extends Component { - constructor(props) { - super(props); - } - handleChange(e) { this.props.onChange(e); } @@ -22,7 +18,7 @@ class Search extends Component { return ( - + 示例 diff --git a/components/upload/index.jsx b/components/upload/index.jsx index 7104d8c274..e3079bf154 100644 --- a/components/upload/index.jsx +++ b/components/upload/index.jsx @@ -235,7 +235,7 @@ const AntUpload = React.createClass({ uploadList = ( + onRemove={this.handleManualRemove} /> ); } if (type === 'drag') { @@ -292,7 +292,7 @@ const AntUpload = React.createClass({ AntUpload.Dragger = React.createClass({ render() { - return ; + return ; } }); diff --git a/package.json b/package.json index e14a4f4e41..64f03ae539 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "eslint-plugin-babel": "^3.0.0", "eslint-plugin-markdown": "*", "eslint-plugin-react": "^4.0.0", - "eslint-tinker": "~0.2.0", + "eslint-tinker": "^0.3.1", "extract-text-webpack-plugin": "^1.0.1", "gh-pages": "^0.9.0", "history": "^1.17.0", @@ -130,7 +130,7 @@ "just-deploy": "npm run site && node scripts/deploy.js", "lint": "npm run srclint && npm run mdlint && npm run lesshint", "srclint": "eslint components test index.js --ext '.js,.jsx'", - "mdlint": "eslint components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0,eol-last: 0'", + "mdlint": "eslint components/*/demo/*.md --ext '.md' --global 'React,ReactDOM,mountNode' --rule 'no-console: 0, eol-last: 0, prefer-rest-params: 0'", "lesshint": "lesshint style/ -e 'style/+(core|mixins)/+(base|iconfont|normalize|layouts|compatibility|grid).less'", "eslint-fix": "eslint --fix components test index.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md", "test": "npm run lint && webpack && npm run jest", From 09589a8eb5102ce8d3e3181054b2c75ad20becfa Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 22 Feb 2016 11:56:27 +0800 Subject: [PATCH 13/26] Fix site style --- site/static/style.less | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/static/style.less b/site/static/style.less index 11fc7644c0..e27355f998 100644 --- a/site/static/style.less +++ b/site/static/style.less @@ -361,7 +361,6 @@ footer ul li > h2 { } footer ul li > div { - text-align: left; margin: auto; margin: 10px 0; } @@ -1541,6 +1540,10 @@ a.entry-link:hover .anticon-smile { padding-right: 30px; } + .prev-next-nav { + padding-left: 0; + } + footer { text-align: center; } From be3a90fbc658c64096914c40354efef0807c14d9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 18 Feb 2016 16:08:48 +0800 Subject: [PATCH 14/26] Add click effect for primary button, close #942 --- components/button/button.jsx | 12 ++++++++++-- style/components/button.less | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/components/button/button.jsx b/components/button/button.jsx index b9e7ec6110..3692ce9cad 100644 --- a/components/button/button.jsx +++ b/components/button/button.jsx @@ -30,9 +30,17 @@ export default class Button extends React.Component { window.PIE.attach(findDOMNode(this)); } } + handleClick() { + const buttonNode = findDOMNode(this); + buttonNode.className = buttonNode.className.replace(`${prefix}clicked`, ''); + setTimeout(() => { + buttonNode.className += ` ${prefix}clicked`; + }, 10); + this.props.onClick(); + } render() { const props = this.props; - const { type, shape, size, onClick, className, htmlType, children, ...others } = props; + const { type, shape, size, className, htmlType, children, ...others } = props; // large => lg // small => sm @@ -53,7 +61,7 @@ export default class Button extends React.Component { const kids = React.Children.map(children, insertSpace); return ( - ); diff --git a/style/components/button.less b/style/components/button.less index b40cf9e366..00a96720a1 100644 --- a/style/components/button.less +++ b/style/components/button.less @@ -97,4 +97,26 @@ > span + .@{iconfont-css-prefix} { margin-left: 0.5em; } + + &-clicked:before { + content: ''; + position: absolute; + top: -6px; + left: -6px; + bottom: -6px; + right: -6px; + border-radius: inherit; + z-index: -1; + background: inherit; + opacity: 1; + transform: scale3d(0.5, 0.5, 1); + animation: buttonEffect 0.48s ease forwards; + } +} + +@keyframes buttonEffect { + to { + opacity: 0; + transform: scale3d(1, 1, 1); + } } From 203cdd9c35b9afcd654b030e2678c80f2fa55d73 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 22 Feb 2016 14:53:57 +0800 Subject: [PATCH 15/26] Fix site code style --- docs/react/getting-started.md | 2 +- site/static/tomorrow.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/react/getting-started.md b/docs/react/getting-started.md index ea7bd213f1..c386264d0e 100644 --- a/docs/react/getting-started.md +++ b/docs/react/getting-started.md @@ -102,7 +102,7 @@ Ant Design React 支持所有的现代浏览器和 IE8+。