From c962705f03169ba5784c6751f80aba0427d92b36 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Thu, 18 May 2017 14:28:48 +0800 Subject: [PATCH 01/55] Increase click area of Tree icons Close #6120 --- components/tree-select/style/index.less | 15 +++++++++------ components/tree/style/index.less | 11 ++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/components/tree-select/style/index.less b/components/tree-select/style/index.less index 5ffa4af45c..7f54d381fd 100644 --- a/components/tree-select/style/index.less +++ b/components/tree-select/style/index.less @@ -27,9 +27,9 @@ margin: 0; padding: 0 0 0 18px; } - > span { + .@{select-tree-prefix-cls}-node-content-wrapper { display: inline-block; - padding: 1px 5px; + padding: 3px 5px; border-radius: 2px; margin: 0; cursor: pointer; @@ -41,22 +41,25 @@ background-color: @item-hover-bg; } &.@{select-tree-prefix-cls}-node-selected { - background-color: @item-active-bg; + background-color: @primary-2; } + } + > span { &.@{select-tree-prefix-cls}-checkbox { margin: 2px 4px 0 0; } &.@{select-tree-prefix-cls}-switcher, &.@{select-tree-prefix-cls}-iconEle { margin: 0; - width: 16px; - height: 16px; - line-height: 16px; + width: 24px; + height: 24px; + line-height: 24px; display: inline-block; vertical-align: middle; border: 0 none; cursor: pointer; outline: none; + text-align: center; } &.@{select-tree-prefix-cls}-icon_loading { &:after { diff --git a/components/tree/style/index.less b/components/tree/style/index.less index 65b78fa054..d11ccd9dc0 100644 --- a/components/tree/style/index.less +++ b/components/tree/style/index.less @@ -55,7 +55,7 @@ } .@{tree-prefix-cls}-node-content-wrapper { display: inline-block; - padding: 1px 5px; + padding: 3px 5px; border-radius: 2px; margin: 0; cursor: pointer; @@ -78,14 +78,15 @@ &.@{tree-prefix-cls}-switcher, &.@{tree-prefix-cls}-iconEle { margin: 0; - width: 16px; - height: 16px; - line-height: 16px; + width: 24px; + height: 24px; + line-height: 24px; display: inline-block; vertical-align: middle; border: 0 none; cursor: pointer; outline: none; + text-align: center; } &.@{tree-prefix-cls}-icon_loading { &:after { @@ -187,7 +188,7 @@ border-left: 1px solid @border-color-base; height: 100%; position: absolute; - left: 6px; + left: 12px; margin: 18px 0; } } From fa44de3faadb6d901aeede9b886b3c74aa1c0df8 Mon Sep 17 00:00:00 2001 From: Mitchell Demler Date: Fri, 19 May 2017 15:29:16 +1200 Subject: [PATCH 02/55] refactor: rearrange AbstractSelectProps so that AutoCompleteProps has access to some needed SelectProps (#6205) --- components/auto-complete/index.tsx | 1 - components/select/index.tsx | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 559f456aee..31a1bc00b5 100755 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -23,7 +23,6 @@ export interface AutoCompleteProps extends AbstractSelectProps { defaultValue?: SelectValue; dataSource: DataSourceItemType[]; optionLabelProp?: string; - filterOption?: boolean | ((inputValue: string, option: Object) => any); onChange?: (value: SelectValue) => void; onSelect?: (value: SelectValue, option: Object) => any; children?: ValidInputElement | diff --git a/components/select/index.tsx b/components/select/index.tsx index 4ade7cb16c..b9b214d0af 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -16,6 +16,11 @@ export interface AbstractSelectProps { disabled?: boolean; style?: React.CSSProperties; placeholder?: string; + dropdownClassName?: string; + dropdownStyle?: React.CSSProperties; + dropdownMenuStyle?: React.CSSProperties; + onSearch?: (value: string) => any; + filterOption?: boolean | ((inputValue: string, option: Object) => any); } export interface LabeledValue { @@ -33,18 +38,14 @@ export interface SelectProps extends AbstractSelectProps { tags?: boolean; combobox?: boolean; optionLabelProp?: string; - filterOption?: boolean | ((inputValue: string, option: Object) => any); onChange?: (value: SelectValue) => void; onSelect?: (value: SelectValue, option: Object) => any; onDeselect?: (value: SelectValue) => any; - onSearch?: (value: string) => any; dropdownMatchSelectWidth?: boolean; optionFilterProp?: string; defaultActiveFirstOption?: boolean; labelInValue?: boolean; getPopupContainer?: (triggerNode: Element) => HTMLElement; - dropdownStyle?: React.CSSProperties; - dropdownMenuStyle?: React.CSSProperties; tokenSeparators?: string[]; getInputElement?: () => React.ReactElement; } From 42c36655175ca7facdedbde7daff033c58dab2ea Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 19 May 2017 16:02:21 +0800 Subject: [PATCH 03/55] filter dropdown should be render inside td --- components/table/filterDropdown.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index 67ffca526a..d5b012227a 100755 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -228,6 +228,7 @@ export default class FilterMenu extends React.Component { overlay={menus} visible={this.neverShown ? false : this.state.visible} onVisibleChange={this.onVisibleChange} + getPopupContainer={triggerNode => triggerNode.parentNode as HTMLElement} > {this.renderFilterIcon()} From be238c788775990d4f15c9f83c16ca4db7226271 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 19 May 2017 18:28:19 +0800 Subject: [PATCH 04/55] upgrade create-react-app doc for newest version --- docs/react/use-with-create-react-app.en-US.md | 37 ++++++++++++++++--- docs/react/use-with-create-react-app.zh-CN.md | 37 ++++++++++++++++--- 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/docs/react/use-with-create-react-app.en-US.md b/docs/react/use-with-create-react-app.en-US.md index 3c8dd5b708..6d41c519bc 100644 --- a/docs/react/use-with-create-react-app.en-US.md +++ b/docs/react/use-with-create-react-app.en-US.md @@ -124,7 +124,7 @@ $ yarn add babel-plugin-import --save-dev loader: 'babel', query: { + plugins: [ -+ ['import', [{ libraryName: "antd", style: 'css' }]], ++ ['import', { libraryName: 'antd', style: 'css' }], + ], // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ @@ -171,8 +171,8 @@ loaders: [ loader: 'babel', query: { plugins: [ -- ['import', [{ libraryName: "antd", style: 'css' }]], -+ ['import', [{ libraryName: "antd", style: true }]], // import less +- ['import', [{ libraryName: 'antd', style: 'css' }]], ++ ['import', [{ libraryName: 'antd', style: true }]], // import less ], }, @@ -181,9 +181,36 @@ loaders: [ + // Parse less files and modify variables + { + test: /\.less$/, -+ loader: 'style!css!postcss!less?{modifyVars:{"@primary-color":"#1DA57A"}}' ++ use: [ ++ require.resolve('style-loader'), ++ require.resolve('css-loader'), ++ { ++ loader: require.resolve('postcss-loader'), ++ options: { ++ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options ++ plugins: () => [ ++ require('postcss-flexbugs-fixes'), ++ autoprefixer({ ++ browsers: [ ++ '>1%', ++ 'last 4 versions', ++ 'Firefox ESR', ++ 'not ie < 9', // React doesn't support IE8 anyway ++ ], ++ flexbox: 'no-2009', ++ }), ++ ], ++ }, ++ }, ++ { ++ loader: require.resolve('less-loader'), ++ options: { ++ modifyVars: { "@primary-color": "#1DA57A" }, ++ }, ++ }, ++ ], + }, -] +], ``` We use `modifyVars` option of [less-loader](https://github.com/webpack/less-loader#less-options) here, you can see a green button rendered on the page after reboot start server. diff --git a/docs/react/use-with-create-react-app.zh-CN.md b/docs/react/use-with-create-react-app.zh-CN.md index 398d448808..a0f5c1929c 100644 --- a/docs/react/use-with-create-react-app.zh-CN.md +++ b/docs/react/use-with-create-react-app.zh-CN.md @@ -121,7 +121,7 @@ $ yarn add babel-plugin-import --save-dev loader: 'babel', query: { + plugins: [ -+ ['import', [{ libraryName: "antd", style: 'css' }]], ++ ['import', { libraryName: 'antd', style: 'css' }], + ], // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ @@ -168,8 +168,8 @@ loaders: [ loader: 'babel', query: { plugins: [ -- ['import', [{ libraryName: "antd", style: 'css' }]], -+ ['import', [{ libraryName: "antd", style: true }]], // 加载 less 文件 +- ['import', [{ libraryName: 'antd', style: 'css' }]], ++ ['import', [{ libraryName: 'antd', style: true }]], // 加载 less 文件 ], }, @@ -178,9 +178,36 @@ loaders: [ + // 解析 less 文件,并加入变量覆盖配置 + { + test: /\.less$/, -+ loader: 'style!css!postcss!less?{modifyVars:{"@primary-color":"#1DA57A"}}' ++ use: [ ++ require.resolve('style-loader'), ++ require.resolve('css-loader'), ++ { ++ loader: require.resolve('postcss-loader'), ++ options: { ++ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options ++ plugins: () => [ ++ require('postcss-flexbugs-fixes'), ++ autoprefixer({ ++ browsers: [ ++ '>1%', ++ 'last 4 versions', ++ 'Firefox ESR', ++ 'not ie < 9', // React doesn't support IE8 anyway ++ ], ++ flexbox: 'no-2009', ++ }), ++ ], ++ }, ++ }, ++ { ++ loader: require.resolve('less-loader'), ++ options: { ++ modifyVars: { "@primary-color": "#1DA57A" }, ++ }, ++ }, ++ ], + }, -] +], ``` 这里利用了 [less-loader](https://github.com/webpack/less-loader#less-options) 的 `modifyVars` 来进行主题配置, From adfca8ae78537d0c37e825fdb3c6f139a155c3ef Mon Sep 17 00:00:00 2001 From: Graeme Yeates Date: Wed, 3 May 2017 10:33:28 -0400 Subject: [PATCH 05/55] Use @tag-default-bg for multiselect tags --- components/select/style/index.less | 3 ++- components/style/themes/default.less | 5 +++++ components/tag/style/index.less | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/select/style/index.less b/components/select/style/index.less index 77c60d2925..1d0befab09 100644 --- a/components/select/style/index.less +++ b/components/select/style/index.less @@ -298,7 +298,8 @@ } .@{select-prefix-cls}-selection__choice { - background-color: #f3f3f3; + color: @tag-default-color; + background-color: @tag-default-bg; border-radius: 4px; cursor: default; float: left; diff --git a/components/style/themes/default.less b/components/style/themes/default.less index 6e9eaeab36..fb317a8523 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -299,6 +299,11 @@ @table-padding-vertical: 16px; @table-padding-horizontal: 8px; +// Tag +// -- +@tag-default-bg: #f3f3f3; +@tag-default-color: @text-color; + // TimePicker // --- @time-picker-panel-column-width: 56px; diff --git a/components/tag/style/index.less b/components/tag/style/index.less index f9b17fd749..3b977610e4 100644 --- a/components/tag/style/index.less +++ b/components/tag/style/index.less @@ -3,9 +3,6 @@ @tag-prefix-cls: ~"@{ant-prefix}-tag"; -@tag-default-bg: @background-color-base; -@tag-default-color: @text-color; - .@{tag-prefix-cls} { display: inline-block; line-height: 20px; From 1dae0b65f2bc7095d79e219c058120a49f33ee35 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Mon, 22 May 2017 09:42:04 +0800 Subject: [PATCH 06/55] chore: improve UX of RangePicker (#6200) * chore: improve UX of RangePicker * test: fix CI --- components/date-picker/RangePicker.tsx | 29 +++++++++++++++---- .../date-picker/__tests__/RangePicker.test.js | 19 ++++++++++++ .../date-picker/__tests__/showTime.test.js | 8 +++-- package.json | 2 +- 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index 703522308e..e2f257e29b 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -33,7 +33,7 @@ function pickerValueAdapter(value?: moment.Moment | moment.Moment[]): moment.Mom export default class RangePicker extends React.Component { static contextTypes = { - antLocale: PropTypes.object, + antLocale: PropTypes.object, }; static defaultProps = { prefixCls: 'ant-calendar', @@ -56,6 +56,7 @@ export default class RangePicker extends React.Component { this.state = { value, open: props.open, + hoverValue: [], }; } @@ -78,6 +79,8 @@ export default class RangePicker extends React.Component { this.handleChange([]); } + clearHoverValue = () => this.setState({ hoverValue: [] }); + handleChange = (value: moment.Moment[]) => { const props = this.props; if (!('value' in props)) { @@ -100,6 +103,8 @@ export default class RangePicker extends React.Component { handleShowDateChange = showDate => this.setState({ showDate }); + handleHoverChange = hoverValue => this.setState({ hoverValue }); + setValue(value) { this.handleChange(value); if (!this.props.showTime) { @@ -115,7 +120,16 @@ export default class RangePicker extends React.Component { const operations = Object.keys(ranges).map((range) => { const value = ranges[range]; - return this.setValue(value)}>{range}; + return ( + this.setValue(value)} + onMouseEnter={() => this.setState({ hoverValue: value })} + onMouseLeave={this.clearHoverValue} + > + {range} + + ); }); return (
@@ -126,7 +140,7 @@ export default class RangePicker extends React.Component { render() { const { state, props, context } = this; - const { value, showDate, open } = state; + const { value, showDate, hoverValue, open } = state; const localeCode = getLocaleCode(context); if (value && localeCode) { if (value[0]) { @@ -138,9 +152,10 @@ export default class RangePicker extends React.Component { } const { - disabledDate, disabledTime, showTime, showToday, - ranges, prefixCls, popupStyle, - style, onOk, locale, format, + prefixCls, popupStyle, style, + disabledDate, disabledTime, + showTime, showToday, + ranges, onOk, locale, format, } = props; warning(!('onOK' in props), 'It should be `RangePicker[onOk]`, instead of `onOK`!'); @@ -182,6 +197,8 @@ export default class RangePicker extends React.Component { onOk={onOk} value={showDate || pickerValueAdapter(props.defaultPickerValue) || pickerValueAdapter(moment())} onValueChange={this.handleShowDateChange} + hoverValue={hoverValue} + onHoverChange={this.handleHoverChange} showToday={showToday} /> ); diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index e6a518f4ae..7411bc2c0e 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -41,6 +41,25 @@ describe('RangePicker', () => { .toMatchSnapshot(); }); + it('highlight range when hover presetted range', () => { + const wrapper = mount( + trigger} + format="YYYY/MM/DD" + open + /> + ); + + let rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + rangeCalendarWrapper.find('.ant-calendar-range-quick-selector a') + .simulate('mouseEnter'); + rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + expect(rangeCalendarWrapper.find('.ant-calendar-selected-day').length).toBe(2); + }); + // issue: https://github.com/ant-design/ant-design/issues/5872 it('should not throw error when value is reset to `[]`', () => { const birthday = moment('2000-01-01', 'YYYY-MM-DD'); diff --git a/components/date-picker/__tests__/showTime.test.js b/components/date-picker/__tests__/showTime.test.js index f8a2752c41..dc60a4608c 100644 --- a/components/date-picker/__tests__/showTime.test.js +++ b/components/date-picker/__tests__/showTime.test.js @@ -65,11 +65,13 @@ describe('RangePicker with showTime', () => { ); - const calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + let calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); expect(calendarWrapper.find('.ant-calendar-time-picker-btn').hasClass('ant-calendar-time-picker-btn-disabled')).toBe(true); expect(calendarWrapper.find('.ant-calendar-ok-btn').hasClass('ant-calendar-ok-btn-disabled')).toBe(true); calendarWrapper.find('.ant-calendar-date').at(10).simulate('click'); + calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! TODO: calendarWrapper cannot get the latest state from wrapper calendarWrapper.find('.ant-calendar-date').at(11).simulate('click'); + calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! expect(calendarWrapper.find('.ant-calendar-time-picker-btn').hasClass('ant-calendar-time-picker-btn-disabled')).toBe(false); expect(calendarWrapper.find('.ant-calendar-ok-btn').hasClass('ant-calendar-ok-btn-disabled')).toBe(false); expect(onChangeFn).toHaveBeenCalled(); @@ -84,9 +86,11 @@ describe('RangePicker with showTime', () => { ); - const calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + let calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); calendarWrapper.find('.ant-calendar-date').at(10).simulate('click'); + calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! calendarWrapper.find('.ant-calendar-date').at(11).simulate('click'); + calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! onChangeFn.mockClear(); calendarWrapper.find('.ant-calendar-ok-btn').simulate('click'); expect(onOkFn).toHaveBeenCalled(); diff --git a/package.json b/package.json index 6749d990d4..26547543e4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "omit.js": "^0.1.0", "prop-types": "^15.5.7", "rc-animate": "~2.3.0", - "rc-calendar": "~8.2.0", + "rc-calendar": "~8.3.0", "rc-cascader": "~0.11.0", "rc-checkbox": "~2.0.0", "rc-collapse": "~1.7.0", From 262cad100972f1cc0cd3fd3366bc4dec0faa8379 Mon Sep 17 00:00:00 2001 From: Arthur Denner Oliveira Santos Date: Sun, 21 May 2017 22:47:30 -0300 Subject: [PATCH 07/55] fix: adding missing translations to Upload and Table components (#6218) --- components/locale-provider/pt_BR.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/locale-provider/pt_BR.tsx b/components/locale-provider/pt_BR.tsx index 8ba326faa8..d06d61e96d 100644 --- a/components/locale-provider/pt_BR.tsx +++ b/components/locale-provider/pt_BR.tsx @@ -18,6 +18,8 @@ export default { filterConfirm: 'OK', filterReset: 'Resetar', emptyText: 'Não há dados', + selectAll: 'Selecionar página atual', + selectInvert: 'Inverter seleção', }, Modal: { okText: 'OK', @@ -37,4 +39,10 @@ export default { Select: { notFoundContent: 'Não encontrado', }, + Upload: { + uploading: 'Enviando...', + removeFile: 'Remover arquivo', + uploadError: 'Erro no envio', + previewFile: 'Visualizar arquivo', + }, }; From 4b8a291684ec475ec4971c20e9be5b2df9025701 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Mon, 22 May 2017 10:09:17 +0800 Subject: [PATCH 08/55] fix: broken style of Cascader in Input.Group (#6208) * fix: broken hover style of Cascader, close: #6202 * test: update snapshot --- .../__tests__/__snapshots__/demo.test.js.snap | 78 +++++++++---------- components/cascader/index.tsx | 6 +- components/cascader/style/index.less | 1 - .../__tests__/__snapshots__/demo.test.js.snap | 10 +-- .../__tests__/__snapshots__/demo.test.js.snap | 6 +- 5 files changed, 50 insertions(+), 51 deletions(-) diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index ed55e3080e..2946a2c3eb 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -5,6 +5,9 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -27,6 +27,9 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] = class="ant-cascader-picker" tabindex="0" > + - @@ -50,13 +50,6 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = ` style="width:270px;" tabindex="0" > - @@ -74,6 +67,13 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = ` ) + @@ -100,6 +100,11 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + + Zhejiang / Hangzhou / West Lake + - - Zhejiang / Hangzhou / West Lake - @@ -126,6 +126,9 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -148,6 +148,9 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -170,6 +170,9 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -192,6 +192,9 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -214,6 +214,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -235,6 +235,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - @@ -256,6 +256,9 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + - diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index ca037fa13f..3b3c163cac 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -330,6 +330,9 @@ export default class Cascader extends React.Component { style={style} className={pickerCls} > + + {this.getLabel()} + { onKeyDown={this.handleKeyDown} onChange={showSearch ? this.handleInputChange : undefined} /> - - {this.getLabel()} - {clearIcon} diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index f7caba073e..0e7b0cc582 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -13,7 +13,6 @@ background-color: transparent!important; cursor: pointer; width: 100%; - z-index: 1; display: block; } diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index bc3e792ce6..b04068689c 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -1232,6 +1232,11 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = ` class="ant-cascader-picker" tabindex="0" > + + Zhejiang / Hangzhou / West Lake + - - Zhejiang / Hangzhou / West Lake - diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 14a1e91ecf..9a5bd824d6 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -615,6 +615,9 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = ` style="width:70%;" tabindex="0" > + - From 64befeda32ab4c2edda822424f5aa0e2a857124b Mon Sep 17 00:00:00 2001 From: "mitchell.demler" Date: Mon, 22 May 2017 15:57:09 +1200 Subject: [PATCH 09/55] Add ValidationRule type for getFieldDecorator validation rules Copied types from english documentation. (these might need checking?) --- components/form/Form.tsx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 24e4d3c3a2..8bf5f26751 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -30,6 +30,31 @@ export interface FormProps { hideRequiredMark?: boolean; } +export type ValidationRule = { + /** validation error message */ + message?: string; + /** built-in validation type, available options: https://github.com/yiminghe/async-validator#type */ + type?: string; + /** indicates whether field is required */ + required?: boolean; + /** treat required fields that only contain whitespace as errors */ + whitespace?: boolean; + /** validate the exact length of a field */ + len?: number; + /** validate the min length of a field */ + min?: number; + /** validate the max length of a field */ + max?: number; + /** validate the value from a list of possible values */ + enum?: string | string[]; + /** validate from a regular expression */ + pattern?: RegExp; + /** transform a value before validation */ + transform?: (value: any) => any; + /** custom validate function (Note: callback must be called) */ + validator?: (rule: any, value: any, callback: any) => any; +}; + export type ValidateCallback = (erros: any, values: any) => void; // function create @@ -74,7 +99,7 @@ export type WrappedFormUtils = { /** 校验子节点值的时机 */ validateTrigger?: string | string[]; /** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */ - rules?: Array; + rules?: ValidationRule[]; /** 是否和其他控件互斥,特别用于 Radio 单选控件 */ exclusive?: boolean; }): (node: React.ReactNode) => React.ReactNode; From f61b69cbb1b2f7e63fdcd5edbd49809eadab445a Mon Sep 17 00:00:00 2001 From: Anas Tawfeek Date: Tue, 23 May 2017 03:56:59 +0200 Subject: [PATCH 10/55] docs: adding the prop 'loading' to the properties table. (#6225) --- components/card/index.en-US.md | 1 + 1 file changed, 1 insertion(+) diff --git a/components/card/index.en-US.md b/components/card/index.en-US.md index 30e8a30724..95e2909840 100644 --- a/components/card/index.en-US.md +++ b/components/card/index.en-US.md @@ -23,3 +23,4 @@ A card can be used to display content related to a single subject. The content c | extra | Content to render in the top-right corner of the card | string\|ReactNode | - | | bordered | Toggles rendering of the border around the card | boolean | true | | bodyStyle | Inline style to apply to the card content | object | - | +| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | From e0db2f424e56ce593bc446c2cbcca21f66af45fe Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Tue, 23 May 2017 10:03:34 +0800 Subject: [PATCH 11/55] docs: update docs for Card, ref: #6225 --- components/card/index.zh-CN.md | 1 + 1 file changed, 1 insertion(+) diff --git a/components/card/index.zh-CN.md b/components/card/index.zh-CN.md index e6877ce270..656a276eae 100644 --- a/components/card/index.zh-CN.md +++ b/components/card/index.zh-CN.md @@ -24,3 +24,4 @@ cols: 1 | extra | 卡片右上角的操作区域 | string\|ReactNode | - | | bordered | 是否有边框 | boolean | true | | bodyStyle | 内容区域自定义样式 | object | - | +| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | From 8395470ea8e6856776f4de8798aac9daee01a043 Mon Sep 17 00:00:00 2001 From: RaoHai Date: Tue, 23 May 2017 10:35:11 +0800 Subject: [PATCH 12/55] 2.10.2 --- CHANGELOG.en-US.md | 11 +++++++++++ CHANGELOG.zh-CN.md | 11 +++++++++++ package.json | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 1778cd8daf..77f93e5c64 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -17,6 +17,17 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi --- +## 2.10.2 + +`2017-05-23` + +- Fix style issue of TreeSelect. [#6137](https://github.com/ant-design/ant-design/issues/6137) +- Fix style issue of Input with prefix and addon. [#6144](https://github.com/ant-design/ant-design/issues/6144) +- Fix some bugs of `notification.destroy`. [#6161](https://github.com/ant-design/ant-design/issues/6161) +- Fix missing translations of Upload and Table. [#6218](https://github.com/ant-design/ant-design/issues/6218) +- Fix style issue of Cascader inside Input.Group. [#6208](https://github.com/ant-design/ant-design/issues/6208) +- Increase click area of Tree icons. [#6120](https://github.com/ant-design/ant-design/issues/6120) + ## 2.10.1 `2017-05-14` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index f400246a21..2b3a723426 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -17,6 +17,17 @@ timeline: true --- +## 2.10.2 + +`2017-05-23` + +- 修复 TreeSelect 的样式问题。[#6137](https://github.com/ant-design/ant-design/issues/6137) +- 修复 包含 prefix 和 addon 的 Input 的样式问题。[#6144](https://github.com/ant-design/ant-design/issues/6144) +- 修复 `notification.destroy` 的 Bug。[#6161](https://github.com/ant-design/ant-design/issues/6161) +- 修复了 Upload 和 Table 组件中缺失的翻译。 +- 修复了在 Input.Group 中的 Cascader 的样式问题。[#6208](https://github.com/ant-design/ant-design/issues/6208) +- 增大了 Tree 图标的可点击区域面积。 + ## 2.10.1 `2017-05-14` diff --git a/package.json b/package.json index 26547543e4..6f2f4c48ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "2.10.1", + "version": "2.10.2", "title": "Ant Design", "description": "An enterprise-class UI design language and React-based implementation", "homepage": "http://ant.design/", From 03fc4f57bec8e73fa8647bbd3d409dfa4bdd06ed Mon Sep 17 00:00:00 2001 From: RaoHai Date: Tue, 23 May 2017 11:01:38 +0800 Subject: [PATCH 13/55] supplement changeLog --- CHANGELOG.en-US.md | 1 + CHANGELOG.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 77f93e5c64..8624eac3c3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -21,6 +21,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi `2017-05-23` +- Fix `prop-types` warnings which due to upgrading React. [#5678](https://github.com/ant-design/ant-design/issues/5678) - Fix style issue of TreeSelect. [#6137](https://github.com/ant-design/ant-design/issues/6137) - Fix style issue of Input with prefix and addon. [#6144](https://github.com/ant-design/ant-design/issues/6144) - Fix some bugs of `notification.destroy`. [#6161](https://github.com/ant-design/ant-design/issues/6161) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 2b3a723426..b6c6686057 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -21,6 +21,7 @@ timeline: true `2017-05-23` +- 修复了 React 升级引起的 `prop-types` 相关的 warning 问题。[#5678](https://github.com/ant-design/ant-design/issues/5678) - 修复 TreeSelect 的样式问题。[#6137](https://github.com/ant-design/ant-design/issues/6137) - 修复 包含 prefix 和 addon 的 Input 的样式问题。[#6144](https://github.com/ant-design/ant-design/issues/6144) - 修复 `notification.destroy` 的 Bug。[#6161](https://github.com/ant-design/ant-design/issues/6161) From b83529daf2f43b732479960e907eefa151d16301 Mon Sep 17 00:00:00 2001 From: RaoHai Date: Tue, 23 May 2017 15:13:16 +0800 Subject: [PATCH 14/55] append changelog --- CHANGELOG.en-US.md | 1 + CHANGELOG.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 8624eac3c3..65bbb78a3e 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -22,6 +22,7 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi `2017-05-23` - Fix `prop-types` warnings which due to upgrading React. [#5678](https://github.com/ant-design/ant-design/issues/5678) +- Fix `defaultValue` issue of DatePicker and RangePicker in showTime mode. [#6160](https://github.com/ant-design/ant-design/pull/6160) - Fix style issue of TreeSelect. [#6137](https://github.com/ant-design/ant-design/issues/6137) - Fix style issue of Input with prefix and addon. [#6144](https://github.com/ant-design/ant-design/issues/6144) - Fix some bugs of `notification.destroy`. [#6161](https://github.com/ant-design/ant-design/issues/6161) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index b6c6686057..d7d0444c09 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -22,6 +22,7 @@ timeline: true `2017-05-23` - 修复了 React 升级引起的 `prop-types` 相关的 warning 问题。[#5678](https://github.com/ant-design/ant-design/issues/5678) +- 修复 DatePicker 和 RangePicker showTime 模式下 defaultValue 的问题。[#6160](https://github.com/ant-design/ant-design/pull/6160) - 修复 TreeSelect 的样式问题。[#6137](https://github.com/ant-design/ant-design/issues/6137) - 修复 包含 prefix 和 addon 的 Input 的样式问题。[#6144](https://github.com/ant-design/ant-design/issues/6144) - 修复 `notification.destroy` 的 Bug。[#6161](https://github.com/ant-design/ant-design/issues/6161) From f414398fae93aca60902cd601ae84b1db6630b4d Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 23 May 2017 17:07:17 +0800 Subject: [PATCH 15/55] Fix disabledDate of Calendar, close #6074 --- components/calendar/index.en-US.md | 1 + components/calendar/index.tsx | 1 + components/calendar/index.zh-CN.md | 1 + components/calendar/style/index.less | 33 +++++++++++++++++---------- components/date-picker/index.en-US.md | 2 +- components/date-picker/index.zh-CN.md | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/components/calendar/index.en-US.md b/components/calendar/index.en-US.md index dc9fb8e7a3..2288847020 100644 --- a/components/calendar/index.en-US.md +++ b/components/calendar/index.en-US.md @@ -43,3 +43,4 @@ moment.locale('zh-cn'); | locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | onPanelChange| callback when panel change | function(date: moment, mode: string) | - | | onSelect | callback when select date | function(date: moment) | - | +| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | 无 | diff --git a/components/calendar/index.tsx b/components/calendar/index.tsx index 66909be9e5..b3a0d3c409 100644 --- a/components/calendar/index.tsx +++ b/components/calendar/index.tsx @@ -39,6 +39,7 @@ export interface CalendarProps { style?: React.CSSProperties; onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void; onSelect?: (date?: moment.Moment) => void; + disabledDate?: (current: moment.Moment) => boolean; } export interface CalendarState { diff --git a/components/calendar/index.zh-CN.md b/components/calendar/index.zh-CN.md index 546a1cd000..7fbc659c79 100644 --- a/components/calendar/index.zh-CN.md +++ b/components/calendar/index.zh-CN.md @@ -45,3 +45,4 @@ moment.locale('zh-cn'); | locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 | | onSelect | 点击选择日期回调 | function(date: moment) | 无 | +| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 | diff --git a/components/calendar/style/index.less b/components/calendar/style/index.less index 7b458e26bd..649354be03 100644 --- a/components/calendar/style/index.less +++ b/components/calendar/style/index.less @@ -125,18 +125,6 @@ color: #fff; } - &-disabled-cell &-value { - cursor: not-allowed; - color: @disabled-color; - background: @disabled-bg; - border-radius: 0; - width: auto; - - &:hover { - background: @disabled-bg; - } - } - &-disabled-cell-first-of-row &-value { border-top-left-radius: @border-radius-base; border-bottom-left-radius: @border-radius-base; @@ -254,4 +242,25 @@ left: auto; bottom: auto; } + + &-disabled-cell &-date { + &, + &:hover { + cursor: not-allowed; + } + } + + &-disabled-cell:not(&-today) &-date { + &, + &:hover { + background: transparent; + } + } + + &-disabled-cell &-value { + color: @disabled-color; + border-radius: 0; + width: auto; + cursor: not-allowed; + } } diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index ffa9e247d2..f2c9d7a4b2 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -42,7 +42,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker. | popupStyle | to customize the style of the popup calendar | object | {} | | size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - | | locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | -| disabledDate | to specify the date that cannot be selected | function | - | +| disabledDate | specify the date that cannot be selected | (currentDate: moment) => boolean | - | | getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - | | open | open state of picker | boolean | - | | onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - | diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index 6c2698fcb3..75f2a5847a 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -43,7 +43,7 @@ moment.locale('zh-cn'); | popupStyle | 格外的弹出日历样式 | object | {} | | size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 | | locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | -| disabledDate | 不可选择的日期 | function | 无 | +| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 | | getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 | | open | 控制弹层是否展开 | boolean | - | | onOpenChange | 弹出日历和关闭日历的回调 | function(status) | 无 | From 5b4adeb3399f070a51872066df5163563d8ed3f6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 23 May 2017 17:48:13 +0800 Subject: [PATCH 16/55] tweak spin style --- components/spin/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/spin/style/index.less b/components/spin/style/index.less index 9c44f3a6a5..846df54050 100644 --- a/components/spin/style/index.less +++ b/components/spin/style/index.less @@ -115,7 +115,7 @@ &-dot { position: relative; - display: block; + display: inline-block; .square(@spin-dot-size); transform: rotate(45deg); animation: antRotate 1.2s infinite linear; From 5ef48289747409b6d962f75627ddb11e2765f965 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 23 May 2017 17:51:10 +0800 Subject: [PATCH 17/55] Remove default margin-bottom of Alert --- components/alert/demo/basic.md | 6 ++++++ components/alert/index.zh-CN.md | 1 - components/alert/style/index.less | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/alert/demo/basic.md b/components/alert/demo/basic.md index 02b0e57b58..cf4d174a25 100644 --- a/components/alert/demo/basic.md +++ b/components/alert/demo/basic.md @@ -20,3 +20,9 @@ ReactDOM.render( , mountNode); ```` + + diff --git a/components/alert/index.zh-CN.md b/components/alert/index.zh-CN.md index d47c93b967..de782408d3 100644 --- a/components/alert/index.zh-CN.md +++ b/components/alert/index.zh-CN.md @@ -24,4 +24,3 @@ title: Alert | onClose | 关闭时触发的回调函数 | Function | 无 | | showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true | | banner | 是否用作顶部公告 | boolean | false | - diff --git a/components/alert/style/index.less b/components/alert/style/index.less index eafd205b41..f37fa71d7c 100644 --- a/components/alert/style/index.less +++ b/components/alert/style/index.less @@ -12,7 +12,6 @@ color: @alert-text-color; font-size: @font-size-base; line-height: 16px; - margin-bottom: 10px; &&-no-icon { padding: 8px 48px 8px 16px; @@ -91,7 +90,6 @@ padding: 16px 16px 16px 60px; position: relative; border-radius: @border-radius-base; - margin-bottom: 10px; color: @text-color; line-height: 1.5; } From d6da30573bddc8695370671c95717e9bf9bba40c Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 23 May 2017 17:59:27 +0800 Subject: [PATCH 18/55] Fix inactive tab panel behavious, close #6237 --- components/tabs/style/index.less | 1 + 1 file changed, 1 insertion(+) diff --git a/components/tabs/style/index.less b/components/tabs/style/index.less index e4a8a012a8..9dde90f3a4 100644 --- a/components/tabs/style/index.less +++ b/components/tabs/style/index.less @@ -200,6 +200,7 @@ opacity: 0; height: 0; padding: 0!important; + pointer-events: none; } } > .@{tab-prefix-cls}-content-animated { From 977a5a1cc7b86565eb72e29213891ddd1ad52a53 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 24 May 2017 10:00:59 +0800 Subject: [PATCH 19/55] docs: add missing API docs for Modal, close: #6239 --- components/modal/Modal.tsx | 1 + components/modal/index.en-US.md | 1 + components/modal/index.zh-CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index c178f97465..ed8e5cb2c9 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -36,6 +36,7 @@ export interface ModalProps { maskTransitionName?: string; transitionName?: string; className?: string; + getContainer?: (instance: React.ReactInstance) => HTMLElement; } export interface ModalContext { diff --git a/components/modal/index.en-US.md b/components/modal/index.en-US.md index 47a765fd18..8090e1c7d0 100644 --- a/components/modal/index.en-US.md +++ b/components/modal/index.en-US.md @@ -32,6 +32,7 @@ and so on. | style | Style of floating layer, typically used at least for adjusting the position. | object | - | | wrapClassName | The class name of the container of the modal dialog | string | - | | afterClose | Specify a function that will be called when modal is closed completely. | function | - | +| getContainer | Return the mount node for Modal | (instance): HTMLElement | () => document.body | #### Destroy on close diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md index d8f4ff0753..88ec7f1f56 100644 --- a/components/modal/index.zh-CN.md +++ b/components/modal/index.zh-CN.md @@ -31,6 +31,7 @@ title: Modal | style | 可用于设置浮层的样式,调整浮层位置等 | object | - | | wrapClassName | 对话框外层容器的类名 | string | - | | afterClose | Modal 完全关闭后的回调 | function | 无 | +| getContainer | 指定 Modal 挂载的 HTML 节点 | (instance): HTMLElement | () => document.body | #### 清空旧数据 From 67c38fa3b49d6631ead07e7c73cb34c268be6c93 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 24 May 2017 10:25:43 +0800 Subject: [PATCH 20/55] fix: should hide collapsed children, close: #6131 --- components/layout/Sider.tsx | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 964 +++++++++--------- 2 files changed, 501 insertions(+), 465 deletions(-) diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index 71c4fd09eb..b08f5188fb 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -168,7 +168,7 @@ export default class Sider extends React.Component { }); return (
- {this.props.children} +
{this.props.children}
{collapsible || (this.state.below && zeroWidthTrigger) ? triggerDom : null}
); diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index c36569d067..4cfb266790 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -36,7 +36,11 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = ` class="ant-layout-sider" style="flex:0 0 200px;width:200px;" > - Sider +
+ Sider +
- Sider +
+ Sider +
- Sider +
+ Sider +
+ +
  • + +
  • + - + + +
    @@ -999,6 +1027,179 @@ exports[`renders ./components/layout/demo/top-side.md correctly 1`] = `
    +
    + +
    +
    +
    + Content +
    +
    + + + +`; + +exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = ` +
    +
    + +
    +
    +
    -
    - Content -
    -
    -
    - -
    -`; - -exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = ` -
    -
    - -
    -
    -
    Date: Wed, 24 May 2017 12:17:40 +0800 Subject: [PATCH 21/55] Fix table filter menu overflow issue, close #6245 --- components/table/SelectionCheckboxAll.tsx | 5 +++-- components/table/Table.tsx | 13 ++++++++++++- components/table/filterDropdown.tsx | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/table/SelectionCheckboxAll.tsx b/components/table/SelectionCheckboxAll.tsx index da7c802472..aeb6bee01d 100644 --- a/components/table/SelectionCheckboxAll.tsx +++ b/components/table/SelectionCheckboxAll.tsx @@ -22,6 +22,7 @@ export interface SelectionCheckboxAllProps { prefixCls: string | undefined; onSelect: (key: string, index: number, selectFunc: any) => void; selections?: SelectionDecorator[] | boolean; + getPopupContainer: (triggerNode?: Element) => HTMLElement; } export default class SelectionCheckboxAll extends React.Component { @@ -152,7 +153,7 @@ export default class SelectionCheckboxAll extends React.Component trigger.parentNode as HTMLElement} + getPopupContainer={getPopupContainer} >
    diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 2941c5307b..215d2a48c3 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -143,6 +143,7 @@ export default class Table extends React.Component, any> { CheckboxPropsCache: Object; store: Store; columns: ColumnProps[]; + tableWrapperNode: HTMLElement; constructor(props) { super(props); @@ -615,6 +616,10 @@ export default class Table extends React.Component, any> { return recordKey === undefined ? index : recordKey; } + getPopupContainer = () => { + return this.tableWrapperNode as HTMLElement; + } + renderRowSelection() { const { prefixCls, rowSelection } = this.props; const columns = this.columns.concat(); @@ -646,6 +651,7 @@ export default class Table extends React.Component, any> { prefixCls={prefixCls} onSelect={this.handleSelectRow} selections={rowSelection.selections} + getPopupContainer={this.getPopupContainer} /> ); } @@ -700,6 +706,7 @@ export default class Table extends React.Component, any> { confirmFilter={this.handleFilter} prefixCls={`${prefixCls}-filter`} dropdownPrefixCls={dropdownPrefixCls || 'ant-dropdown'} + getPopupContainer={this.getPopupContainer} /> ); } @@ -939,7 +946,11 @@ export default class Table extends React.Component, any> { } return ( -
    +
    { this.tableWrapperNode = node; }} + > any; prefixCls: string; dropdownPrefixCls: string; + getPopupContainer: (triggerNode?: Element) => HTMLElement; } export default class FilterMenu extends React.Component { @@ -182,7 +183,7 @@ export default class FilterMenu extends React.Component { }) : ; } render() { - const { column, locale, prefixCls, dropdownPrefixCls } = this.props; + const { column, locale, prefixCls, dropdownPrefixCls, getPopupContainer } = this.props; // default multiple selection in filter dropdown const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; const dropdownMenuClass = classNames({ @@ -228,7 +229,7 @@ export default class FilterMenu extends React.Component { overlay={menus} visible={this.neverShown ? false : this.state.visible} onVisibleChange={this.onVisibleChange} - getPopupContainer={triggerNode => triggerNode.parentNode as HTMLElement} + getPopupContainer={getPopupContainer} > {this.renderFilterIcon()} From 55fc44aba4d572fc6dccee73107e695c8e009ad3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 24 May 2017 16:16:42 +0800 Subject: [PATCH 22/55] fix table wrapper node null, #6245 --- components/table/Table.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 215d2a48c3..ba1a4854d8 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { findDOMNode } from 'react-dom'; import RcTable from 'rc-table'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -143,7 +144,6 @@ export default class Table extends React.Component, any> { CheckboxPropsCache: Object; store: Store; columns: ColumnProps[]; - tableWrapperNode: HTMLElement; constructor(props) { super(props); @@ -617,7 +617,7 @@ export default class Table extends React.Component, any> { } getPopupContainer = () => { - return this.tableWrapperNode as HTMLElement; + return findDOMNode(this) as HTMLElement; } renderRowSelection() { @@ -949,7 +949,6 @@ export default class Table extends React.Component, any> {
    { this.tableWrapperNode = node; }} > Date: Wed, 24 May 2017 16:19:10 +0800 Subject: [PATCH 23/55] update code style --- components/table/demo/custom-filter-panel.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/table/demo/custom-filter-panel.md b/components/table/demo/custom-filter-panel.md index 9a7117279c..52b0d29e6e 100644 --- a/components/table/demo/custom-filter-panel.md +++ b/components/table/demo/custom-filter-panel.md @@ -91,7 +91,11 @@ class App extends React.Component { ), filterIcon: , filterDropdownVisible: this.state.filterDropdownVisible, - onFilterDropdownVisibleChange: visible => this.setState({ filterDropdownVisible: visible }, () => this.searchInput.focus()), + onFilterDropdownVisibleChange: (visible) => { + this.setState({ + filterDropdownVisible: visible, + }, () => this.searchInput.focus()); + }, }, { title: 'Age', dataIndex: 'age', From 4d645a256f7a84253ebef8326e298aeee2c97631 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 24 May 2017 16:48:45 +0800 Subject: [PATCH 24/55] tweak select placeholder text align --- components/select/style/index.less | 1 + 1 file changed, 1 insertion(+) diff --git a/components/select/style/index.less b/components/select/style/index.less index 6de2fdfd93..6b18ec51d7 100644 --- a/components/select/style/index.less +++ b/components/select/style/index.less @@ -227,6 +227,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + text-align: left; } &-search__field__placeholder { From acdc563a547c49960521b2b48cd5c707ac1e4cf2 Mon Sep 17 00:00:00 2001 From: Jordan Hornblow Date: Wed, 24 May 2017 19:38:39 +1000 Subject: [PATCH 25/55] Add filterDropdownVisible and onFilterDropdownVisibleChange to ColumnProps interface --- components/table/Column.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/table/Column.tsx b/components/table/Column.tsx index 6767c2f733..38fa2a2d44 100644 --- a/components/table/Column.tsx +++ b/components/table/Column.tsx @@ -10,6 +10,8 @@ export interface ColumnProps { onFilter?: (value: any, record: T) => boolean; filterMultiple?: boolean; filterDropdown?: React.ReactNode; + filterDropdownVisible?: boolean; + onFilterDropdownVisibleChange?: (visible: boolean) => void; sorter?: boolean | ((a: any, b: any) => number); colSpan?: number; width?: string | number; From 551b17203cbca5018d477cf430548df500a12e2b Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 25 May 2017 11:57:45 +0800 Subject: [PATCH 26/55] Fix showSearch doc, close #6253 --- components/select/index.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/select/index.zh-CN.md b/components/select/index.zh-CN.md index 4a958864de..5e6944b9c7 100644 --- a/components/select/index.zh-CN.md +++ b/components/select/index.zh-CN.md @@ -44,7 +44,7 @@ title: Select | optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索 | string | value | | optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | | size | 选择框大小,可选 `large` `small` | string | default | -| showSearch | 在选择框中显示搜索框 | boolean | false | +| showSearch | 使单选模式可搜索 | boolean | false | | disabled | 是否禁用 | boolean | false | | defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | dropdownStyle | 下拉菜单的 style 属性 | object | - | From 0e5431d21becadd746cc228793535ff285e5d38b Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 25 May 2017 16:54:15 +0800 Subject: [PATCH 27/55] deps: upgrade antd-tools and code style --- components/affix/index.tsx | 2 +- components/auto-complete/index.tsx | 2 +- components/badge/index.tsx | 2 +- components/breadcrumb/Breadcrumb.tsx | 2 +- components/date-picker/RangePicker.tsx | 4 ++-- components/date-picker/createPicker.tsx | 2 +- components/input/Input.tsx | 2 +- components/layout/layout.tsx | 2 +- components/mention/index.tsx | 3 ++- components/modal/confirm.tsx | 6 +++--- components/modal/index.tsx | 2 +- components/pagination/Pagination.tsx | 2 +- components/popconfirm/index.tsx | 2 +- components/tabs/index.tsx | 2 +- components/tag/index.tsx | 2 +- components/time-picker/index.tsx | 2 +- components/transfer/index.tsx | 6 +++--- components/tree-select/index.tsx | 2 +- package.json | 2 +- 19 files changed, 25 insertions(+), 24 deletions(-) diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 9543e99915..3877ef1331 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -40,7 +40,7 @@ function noop() {} function getDefaultTarget() { return typeof window !== 'undefined' ? window : null; -}; +} // Affix export interface AffixProps { diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 31a1bc00b5..8c27e70b75 100755 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -5,7 +5,7 @@ import Select, { AbstractSelectProps, SelectValue, OptionProps, OptGroupProps } import Input from '../input'; import InputElement from './InputElement'; -export interface DataSourceItemObject { value: string; text: string; }; +export interface DataSourceItemObject { value: string; text: string; } export type DataSourceItemType = string | DataSourceItemObject; export interface InputProps { diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 8859537459..0ca96f8b38 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -110,7 +110,7 @@ export default class Badge extends React.Component { component="" showProp="data-show" transitionName={children ? `${prefixCls}-zoom` : ''} - transitionAppear + transitionAppear={true} > {scrollNumber} diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 03a4577636..1b561371b1 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -13,7 +13,7 @@ export interface BreadcrumbProps { itemRender?: (route: any, params: any, routes: Array, paths: Array) => React.ReactNode; style?: React.CSSProperties; className?: string; -}; +} function getBreadcrumbName(route, params) { if (!route.breadcrumbName) { diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index e2f257e29b..f1e91ed0fe 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -224,7 +224,7 @@ export default class RangePicker extends React.Component { { ~ { + return (Basic): any => { return class Adapter extends React.Component { static Header: any; static Footer: any; diff --git a/components/mention/index.tsx b/components/mention/index.tsx index b975d8f7d4..d6adbab34f 100644 --- a/components/mention/index.tsx +++ b/components/mention/index.tsx @@ -54,7 +54,8 @@ export default class Mention extends React.Component }; } - componentWillReceiveProps({ suggestions }) { + componentWillReceiveProps(nextProps: MentionProps) { + const { suggestions } = nextProps; if (!shallowequal(suggestions, this.props.suggestions)) { this.setState({ suggestions, diff --git a/components/modal/confirm.tsx b/components/modal/confirm.tsx index c5fb422c5c..c94623396f 100644 --- a/components/modal/confirm.tsx +++ b/components/modal/confirm.tsx @@ -57,7 +57,7 @@ export default function confirm(config) { {props.cancelText} - + {props.okText}
    @@ -65,7 +65,7 @@ export default function confirm(config) { } else { footer = (
    - + {props.okText}
    @@ -80,7 +80,7 @@ export default function confirm(config) { { selectPrefixCls: 'ant-select', }; - abstract getLocale() + abstract getLocale(); render() { const { className, size, ...restProps } = this.props; diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 786e3bf09a..23b3861580 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -28,7 +28,7 @@ abstract class Popconfirm extends React.Component { }; } - abstract getLocale() + abstract getLocale(); componentWillReceiveProps(nextProps: PopconfirmProps) { if ('visible' in nextProps) { diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index c404e8ced4..bfb15296dd 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -179,7 +179,7 @@ export default class Tabs extends React.Component { className={cls} tabBarPosition={tabPosition} renderTabBar={renderTabBar} - renderTabContent={() => } + renderTabContent={() => } onChange={this.handleChange} > {childrenWithClose || children} diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 7351e9261e..a1ca504c6a 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -104,7 +104,7 @@ export default class Tag extends React.Component { component="" showProp="data-show" transitionName={`${prefixCls}-zoom`} - transitionAppear + transitionAppear={true} onEnd={this.animationEnd} > {tag} diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index f46a8f6718..84e3329ae7 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -58,7 +58,7 @@ abstract class TimePicker extends React.Component { }; } - abstract getLocale() + abstract getLocale(); componentWillReceiveProps(nextProps: TimePickerProps) { if ('value' in nextProps) { diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index ee015648d1..df3270ff6b 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -91,7 +91,7 @@ abstract class Transfer extends React.Component { }; } - abstract getLocale() + abstract getLocale(); componentWillReceiveProps(nextProps: TransferProps) { const { sourceSelectedKeys, targetSelectedKeys } = this.state; @@ -227,10 +227,10 @@ abstract class Transfer extends React.Component { handleLeftSelectAll = (filteredDataSource, checkAll) => ( this.handleSelectAll('left', filteredDataSource, checkAll) - ); + ) handleRightSelectAll = (filteredDataSource, checkAll) => ( this.handleSelectAll('right', filteredDataSource, checkAll) - ); + ) handleFilter = (direction, e) => { this.setState({ diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index d1b7177af7..ddd2dd0ba6 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -20,7 +20,7 @@ abstract class TreeSelect extends React.Component { dropdownClassName: 'ant-select-tree-dropdown', }; - abstract getLocale() + abstract getLocale(); render() { const locale = this.getLocale(); diff --git a/package.json b/package.json index 6f2f4c48ab..9c9a068a5a 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@types/react": "^15.0.8", "@types/react-dom": "~0.14.18", "antd-demo-jest": "^1.0.5", - "antd-tools": "~0.19.1", + "antd-tools": "^1.2.0", "babel-cli": "^6.18.0", "babel-eslint": "^7.1.0", "babel-jest": "^19.0.0", From 99048fa9bfe13ae5333c1ec103ca93324e88bba4 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 25 May 2017 17:09:19 +0800 Subject: [PATCH 28/55] chore: antd-tools will handle this --- webpack.config.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index c5fcd0f32e..efca3970fd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,14 +10,6 @@ function ignoreMomentLocale(webpackConfig) { webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)); } -// Fix ie8 compatibility -function es3ify(webpackConfig) { - webpackConfig.module.loaders.unshift({ - test: /\.(tsx|jsx?)$/, - loader: 'es3ify-loader', - }); -} - function addLocales(webpackConfig) { let packageName = 'antd-with-locales'; if (webpackConfig.entry['antd.min']) { @@ -31,7 +23,6 @@ module.exports = function (webpackConfig) { webpackConfig = getWebpackConfig(webpackConfig); if (process.env.RUN_ENV === 'PRODUCTION') { webpackConfig.forEach((config) => { - es3ify(config); ignoreMomentLocale(config); addLocales(config); }); From 03504446b55bf1a94b3ffe91a55d5c8e929c2872 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 25 May 2017 17:39:53 +0800 Subject: [PATCH 29/55] chore: antd doesn't support IE8 anymore --- tests/index.test.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/index.test.js b/tests/index.test.js index 67bf37ff3b..e920ee205d 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -1,5 +1,3 @@ -import fs from 'fs'; -import path from 'path'; import pkg from '../package.json'; describe('antd dist files', () => { @@ -13,14 +11,6 @@ describe('antd dist files', () => { // https://github.com/ant-design/ant-design/issues/1970 // https://github.com/ant-design/ant-design/issues/1804 if (process.env.CI) { - it('should be compatible in IE8', () => { - const antdJsContent = fs.readFileSync(path.join(process.cwd(), 'dist', 'antd.js')); - expect( - antdJsContent.toString() - .indexOf('function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }') - ).toBe(-1); - }); - it('should have antd.version', () => { const antd = require('../dist/antd'); // eslint-disable-line global-require expect(antd.version).toBe(pkg.version); From 720a3d30b4359c908469dc3362052770f8b3ae81 Mon Sep 17 00:00:00 2001 From: Jordan Hornblow Date: Fri, 26 May 2017 11:16:53 +1000 Subject: [PATCH 30/55] fix: Form and Mention TypeScript definition (#6268) * Add source and options params to Form.ValidationRule.validator function As per rules section of async-validation readme: https://github.com/yiminghe/async-validator#rules * Make prefixCls optional in MentionProps interface --- components/form/Form.tsx | 2 +- components/mention/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 8bf5f26751..1419a226b6 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -52,7 +52,7 @@ export type ValidationRule = { /** transform a value before validation */ transform?: (value: any) => any; /** custom validate function (Note: callback must be called) */ - validator?: (rule: any, value: any, callback: any) => any; + validator?: (rule: any, value: any, callback: any, source?: any, options?: any) => any; }; export type ValidateCallback = (erros: any, values: any) => void; diff --git a/components/mention/index.tsx b/components/mention/index.tsx index d6adbab34f..ce56231edd 100644 --- a/components/mention/index.tsx +++ b/components/mention/index.tsx @@ -5,7 +5,7 @@ import shallowequal from 'shallowequal'; import Icon from '../icon'; export interface MentionProps { - prefixCls: string; + prefixCls?: string; suggestionStyle?: React.CSSProperties; suggestions?: Array; onSearchChange?: Function; From 1abbc1c31be1b3f254bc083885e72b61520ed77c Mon Sep 17 00:00:00 2001 From: Panjie Setiawan Wicaksono Date: Sat, 27 May 2017 08:31:06 +0700 Subject: [PATCH 31/55] chore: add name props to input-related interfaces (#6276) --- components/checkbox/Checkbox.tsx | 1 + components/input-number/index.tsx | 1 + components/input/Search.tsx | 1 + 3 files changed, 3 insertions(+) diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index 0d7e58c591..363aa5cb25 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -16,6 +16,7 @@ export interface AbstractCheckboxProps { onMouseEnter?: React.MouseEventHandler; onMouseLeave?: React.MouseEventHandler; value?: any; + name?: string; } export interface CheckboxProps extends AbstractCheckboxProps { diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index 3246c0d32c..d2880f49b1 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -17,6 +17,7 @@ export interface InputNumberProps { placeholder?: string; style?: React.CSSProperties; className?: string; + name?: string; } export default class InputNumber extends React.Component { diff --git a/components/input/Search.tsx b/components/input/Search.tsx index 527dd045fe..b0501846dd 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -15,6 +15,7 @@ export interface SearchProps { size?: 'large' | 'default' | 'small'; disabled?: boolean; readOnly?: boolean; + name?: string; } export default class Search extends React.Component { From addc0ca5210209fd6dc21fd1b4d34f35ec0f6bbc Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 10:05:07 +0800 Subject: [PATCH 32/55] build: update build config --- .babelrc | 6 ------ webpack.config.js | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .babelrc diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 36a371c9f7..0000000000 --- a/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": ["es2015", "react", "stage-0"], - "plugins": [ - "add-module-exports" - ] -} diff --git a/webpack.config.js b/webpack.config.js index efca3970fd..ed5ec6f0a3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,7 +20,7 @@ function addLocales(webpackConfig) { } module.exports = function (webpackConfig) { - webpackConfig = getWebpackConfig(webpackConfig); + webpackConfig = getWebpackConfig(webpackConfig, true); if (process.env.RUN_ENV === 'PRODUCTION') { webpackConfig.forEach((config) => { ignoreMomentLocale(config); From 81d609c41ac832c308746106c3e89da517c38d94 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 11:02:06 +0800 Subject: [PATCH 33/55] test: fix ci --- .babelrc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000000..991aecd776 --- /dev/null +++ b/.babelrc @@ -0,0 +1,10 @@ +{ + "env": { + "test": { + "presets": ["es2015", "react", "stage-0"], + "plugins": [ + "add-module-exports" + ] + } + } +} From b8118bb09c063b74dc521a2262c6fec2c6013f15 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 11:13:52 +0800 Subject: [PATCH 34/55] test: update test config --- .gitignore | 1 + package.json | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2b33a93a27..babd76691f 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ _site _data dist /lib +/es elasticsearch-* config/base.yaml /.vscode/ diff --git a/package.json b/package.json index 9c9a068a5a..73a639dd31 100644 --- a/package.json +++ b/package.json @@ -198,8 +198,8 @@ "/_site/" ], "testPathIgnorePatterns": [ - "dekko", "/node_modules/", + "dekko", "node" ], "transform": { @@ -210,11 +210,13 @@ "testRegex": ".*\\.test\\.js$", "collectCoverageFrom": [ "components/**/*.{ts,tsx}", - "!components/*/style/index.tsx" + "!components/*/style/index.tsx", + "!components/style/index.tsx", + "!components/*/locale/index.tsx" ], "transformIgnorePatterns": [ "/node_modules/", - "/dist/antd.js" + "/dist/" ], "snapshotSerializers": [ "enzyme-to-json/serializer" From eb25e96565ff90b0dee54bd452716076a7c047db Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 11:35:19 +0800 Subject: [PATCH 35/55] test: remove useless config --- .babelrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.babelrc b/.babelrc index 991aecd776..2f4eb5d7f5 100644 --- a/.babelrc +++ b/.babelrc @@ -1,10 +1,7 @@ { "env": { "test": { - "presets": ["es2015", "react", "stage-0"], - "plugins": [ - "add-module-exports" - ] + "presets": ["es2015", "react", "stage-0"] } } } From d7ac759a22aad928c270e700a4fb5f96fb54f900 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 11:55:54 +0800 Subject: [PATCH 36/55] Revert "test: remove useless config" This reverts commit eb25e96565ff90b0dee54bd452716076a7c047db. --- .babelrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.babelrc b/.babelrc index 2f4eb5d7f5..991aecd776 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,10 @@ { "env": { "test": { - "presets": ["es2015", "react", "stage-0"] + "presets": ["es2015", "react", "stage-0"], + "plugins": [ + "add-module-exports" + ] } } } From 1b607baddc8996ed6f04253e28307395bf7d3d09 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Sat, 27 May 2017 14:09:07 +0800 Subject: [PATCH 37/55] feat: expose components in ES2015 module --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 73a639dd31..e342a3d274 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,11 @@ "url": "https://github.com/ant-design/ant-design/issues" }, "main": "lib/index.js", + "module": "es/index.js", "files": [ "dist", - "lib" + "lib", + "es" ], "typings": "lib/index.d.ts", "license": "MIT", From f5247aba615fa87a4710b735abc437da5af19064 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Sat, 27 May 2017 14:18:14 +0800 Subject: [PATCH 38/55] docs: Add polyfill note close #6190 --- README.md | 2 +- docs/react/introduce.en-US.md | 2 +- docs/react/introduce.zh-CN.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f2f8db8857..8b4ffe7d22 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ An enterprise-class UI design language and React-based implementation. ## Environment Support -* Browser: Modern browsers and Internet Explorer 9+ +* Modern browsers and Internet Explorer 9+ (with [polyfills](https://ant.design/docs/react/getting-started#Compatibility)) * Server-side Rendering * [Electron](http://electron.atom.io/) diff --git a/docs/react/introduce.en-US.md b/docs/react/introduce.en-US.md index b86ba94a8f..65cb62ee0d 100644 --- a/docs/react/introduce.en-US.md +++ b/docs/react/introduce.en-US.md @@ -34,7 +34,7 @@ Following the Ant Design specification, we developed a React UI library `antd` t ## Environment Support -* Modern browsers and Internet Explorer 9+ +* Modern browsers and Internet Explorer 9+ (with [polyfills](https://ant.design/docs/react/getting-started#Compatibility)) * Server-side Rendering * [Electron](http://electron.atom.io/) diff --git a/docs/react/introduce.zh-CN.md b/docs/react/introduce.zh-CN.md index 0b330d9ab6..040b001272 100644 --- a/docs/react/introduce.zh-CN.md +++ b/docs/react/introduce.zh-CN.md @@ -34,7 +34,7 @@ title: Ant Design of React ## 支持环境 -* 现代浏览器和 IE9 及以上。 +* 现代浏览器和 IE9 及以上(需要 [polyfills](https://ant.design/docs/react/getting-started-cn#兼容性))。 * 支持服务端渲染。 * [Electron](http://electron.atom.io/) From 2202648d6e1c53409ade2141955232922b0040d6 Mon Sep 17 00:00:00 2001 From: clinyong Date: Sat, 27 May 2017 16:37:15 +0800 Subject: [PATCH 39/55] Input add autoFocus prop (for ts checking) --- components/input/Input.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/input/Input.tsx b/components/input/Input.tsx index e383f5396c..304b8a095f 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -59,6 +59,7 @@ export interface InputProps { prefix?: React.ReactNode; suffix?: React.ReactNode; spellCheck?: boolean; + autoFocus?: boolean; } export default class Input extends Component { From cc71ab957e5ca37d3a1ac1b8aa1b74d67df192c3 Mon Sep 17 00:00:00 2001 From: Panjie Setiawan Wicaksono Date: Sun, 28 May 2017 02:20:05 +0700 Subject: [PATCH 40/55] better typings for layout components --- components/layout/layout.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/layout/layout.tsx b/components/layout/layout.tsx index 5f586ed27a..c345376fc6 100644 --- a/components/layout/layout.tsx +++ b/components/layout/layout.tsx @@ -1,5 +1,6 @@ import React from 'react'; import classNames from 'classnames'; +import { SiderProps } from './Sider'; export interface BasicProps { style?: React.CSSProperties; @@ -40,7 +41,12 @@ class Basic extends React.Component { } } -const Layout = generator({ +const Layout: React.ComponentClass & { + Header: React.ComponentClass; + Footer: React.ComponentClass; + Content: React.ComponentClass; + Sider: React.ComponentClass; +} = generator({ prefixCls: 'ant-layout', })(Basic); From 14844eb0e08de398dea16881201672c1ec8b84b5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 May 2017 15:27:55 +0800 Subject: [PATCH 41/55] Fix AutoComplete and Input Group vertical align issue --- components/auto-complete/style/index.less | 10 +++++----- components/input/Input.tsx | 11 ++++++++--- components/input/style/index.less | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/components/auto-complete/style/index.less b/components/auto-complete/style/index.less index c4652aa54b..3b383a08ce 100644 --- a/components/auto-complete/style/index.less +++ b/components/auto-complete/style/index.less @@ -16,11 +16,11 @@ margin-left: 0; margin-right: 0; height: 100%; + line-height: @input-height-base; } &__placeholder { margin-left: 8px; margin-right: 8px; - top: @input-height-base / 2; } } } @@ -36,8 +36,8 @@ } &-lg { - .@{select-prefix-cls}-selection__placeholder { - top: @input-height-lg / 2; + .@{select-prefix-cls}-selection__rendered { + line-height: @input-height-lg; } .@{input-prefix-cls} { .input-lg(); @@ -45,8 +45,8 @@ } &-sm { - .@{select-prefix-cls}-selection__placeholder { - top: @input-height-sm / 2; + .@{select-prefix-cls}-selection__rendered { + line-height: @input-height-sm; } .@{input-prefix-cls} { .input-sm(); diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 304b8a095f..cba15b1cf7 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -176,18 +176,23 @@ export default class Input extends Component { ) : null; - const className = classNames({ - [`${props.prefixCls}-wrapper`]: true, + const className = classNames(`${props.prefixCls}-wrapper`, { [wrapperClassName]: (addonBefore || addonAfter), }); - return ( + const node = ( {addonBefore} {children} {addonAfter} ); + + // Need another wrapper for changing display:table to display:inline-block + if (addonBefore || addonAfter) { + return {node}; + } + return node; } renderLabeledIcon(children) { diff --git a/components/input/style/index.less b/components/input/style/index.less index a1178012d9..be6083d2b1 100644 --- a/components/input/style/index.less +++ b/components/input/style/index.less @@ -11,6 +11,10 @@ //== Style for input-group: input with label, with button or dropdown... .@{ant-prefix}-input-group { .input-group(~"@{ant-prefix}-input"); + &-wrapper { + display: inline-block; + vertical-align: middle; + } } // Input with affix: prefix or suffix From 2cde334cd532233b70d242c164333692983ff67d Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 May 2017 15:30:43 +0800 Subject: [PATCH 42/55] update snapshot --- .../__tests__/__snapshots__/demo.test.js.snap | 66 ++--- .../__tests__/__snapshots__/demo.test.js.snap | 248 +++++++++--------- 2 files changed, 165 insertions(+), 149 deletions(-) diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index b04068689c..a7c1b06a18 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -1277,51 +1277,55 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = ` class="ant-form-item-control " > -
    -
    +
    +
    -
    diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 9a5bd824d6..18a6a19439 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -6,129 +6,141 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = ` style="margin-bottom:16px;" > - Http:// - - - - .com - - -
    -
    - - -
    - -
    -
    - - -
    - -
    -
    -
    -
    -
    - - - - + + + .com + + + +
    +
    + + + +
    + +
    +
    + + +
    + +
    +
    +
    +
    +
    +
    + + + + + +
    From deebe4d973cfca411929bdca0ce60eea395717a3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 May 2017 15:35:49 +0800 Subject: [PATCH 43/55] site: tweak style --- site/theme/static/demo.less | 1 + site/theme/static/home.less | 1 + site/theme/static/markdown.less | 1 + site/theme/static/page-nav.less | 1 + 4 files changed, 4 insertions(+) diff --git a/site/theme/static/demo.less b/site/theme/static/demo.less index b8a9e9dd9f..1363643a3a 100644 --- a/site/theme/static/demo.less +++ b/site/theme/static/demo.less @@ -62,6 +62,7 @@ transform: scale(0.9); background: #fff; padding-right: 6px; + text-decoration: none; } &-demo { diff --git a/site/theme/static/home.less b/site/theme/static/home.less index 7cdfc51ce4..af9879022a 100644 --- a/site/theme/static/home.less +++ b/site/theme/static/home.less @@ -50,6 +50,7 @@ font-weight: 500; border-radius: @border-radius-base; border: 1px solid @start-button-color; + text-decoration: none; color: #0ae; font-size: 15px; background: transparent; diff --git a/site/theme/static/markdown.less b/site/theme/static/markdown.less index 9fbd4c35b5..4c2f155bbb 100644 --- a/site/theme/static/markdown.less +++ b/site/theme/static/markdown.less @@ -164,6 +164,7 @@ display: inline-block; margin-left: 10px; height: 12px; + text-decoration: none; i { color: #999; diff --git a/site/theme/static/page-nav.less b/site/theme/static/page-nav.less index 7111223a3a..fdbeae444b 100644 --- a/site/theme/static/page-nav.less +++ b/site/theme/static/page-nav.less @@ -14,6 +14,7 @@ float: left; line-height: 72px; height: 72px; + text-decoration: none; } > a.prev-page { From 85d813750682bda986bfa8e614001472b9cc2a97 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 May 2017 17:03:34 +0800 Subject: [PATCH 44/55] fix create-react-app doc --- docs/react/use-with-create-react-app.en-US.md | 91 +++++++++--------- docs/react/use-with-create-react-app.zh-CN.md | 93 ++++++++++--------- 2 files changed, 97 insertions(+), 87 deletions(-) diff --git a/docs/react/use-with-create-react-app.en-US.md b/docs/react/use-with-create-react-app.en-US.md index 6d41c519bc..a9c39f4cee 100644 --- a/docs/react/use-with-create-react-app.en-US.md +++ b/docs/react/use-with-create-react-app.en-US.md @@ -56,7 +56,7 @@ It is the default directory structure below. Now we install `antd` from yarn or npm. ```bash -$ yarn add antd --save +$ yarn add antd ``` Modify `src/App.js`, import Button component from `antd`. @@ -113,7 +113,7 @@ $ yarn run eject [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is a babel plugin for importing components on demand ([principle](/docs/react/getting-started#Import-on-Demand)). After eject all config files to antd-demo, we allowed to install it and modify `config/webpack.config.dev.js` now. ```bash -$ yarn add babel-plugin-import --save-dev +$ yarn add babel-plugin-import --dev ``` ```diff @@ -121,8 +121,8 @@ $ yarn add babel-plugin-import --save-dev { test: /\.(js|jsx)$/, include: paths.appSrc, - loader: 'babel', - query: { + loader: require.resolve('babel-loader'), + options: { + plugins: [ + ['import', { libraryName: 'antd', style: 'css' }], + ], @@ -145,22 +145,27 @@ Then reboot `yarn start` and visit demo page, you should find that the above war According to [Customize Theme documentation](/docs/react/customize-theme), we need `less` variables modify ability of [less-loader](https://github.com/webpack/less-loader), so we add it. ```bash -$ yarn add less less-loader --save-dev +$ yarn add less less-loader --dev ``` ```diff -loaders: [ { exclude: [ /\.html$/, /\.(js|jsx)$/, -+ /\.less$/, /\.css$/, ++ /\.less$/, /\.json$/, - /\.svg$/ + /\.bmp$/, + /\.gif$/, + /\.jpe?g$/, + /\.png$/, ], - loader: 'url', - }, + loader: require.resolve('file-loader'), + options: { + name: 'static/media/[name].[hash:8].[ext]', + }, + } ... @@ -169,7 +174,7 @@ loaders: [ test: /\.(js|jsx)$/, include: paths.appSrc, loader: 'babel', - query: { + options: { plugins: [ - ['import', [{ libraryName: 'antd', style: 'css' }]], + ['import', [{ libraryName: 'antd', style: true }]], // import less @@ -178,38 +183,38 @@ loaders: [ ... -+ // Parse less files and modify variables -+ { -+ test: /\.less$/, -+ use: [ -+ require.resolve('style-loader'), -+ require.resolve('css-loader'), -+ { -+ loader: require.resolve('postcss-loader'), -+ options: { -+ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options -+ plugins: () => [ -+ require('postcss-flexbugs-fixes'), -+ autoprefixer({ -+ browsers: [ -+ '>1%', -+ 'last 4 versions', -+ 'Firefox ESR', -+ 'not ie < 9', // React doesn't support IE8 anyway -+ ], -+ flexbox: 'no-2009', -+ }), -+ ], -+ }, -+ }, -+ { -+ loader: require.resolve('less-loader'), -+ options: { -+ modifyVars: { "@primary-color": "#1DA57A" }, -+ }, -+ }, -+ ], -+ }, ++ // Parse less files and modify variables ++ { ++ test: /\.less$/, ++ use: [ ++ require.resolve('style-loader'), ++ require.resolve('css-loader'), ++ { ++ loader: require.resolve('postcss-loader'), ++ options: { ++ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options ++ plugins: () => [ ++ require('postcss-flexbugs-fixes'), ++ autoprefixer({ ++ browsers: [ ++ '>1%', ++ 'last 4 versions', ++ 'Firefox ESR', ++ 'not ie < 9', // React doesn't support IE8 anyway ++ ], ++ flexbox: 'no-2009', ++ }), ++ ], ++ }, ++ }, ++ { ++ loader: require.resolve('less-loader'), ++ options: { ++ modifyVars: { "@primary-color": "#1DA57A" }, ++ }, ++ }, ++ ], ++ }, ], ``` diff --git a/docs/react/use-with-create-react-app.zh-CN.md b/docs/react/use-with-create-react-app.zh-CN.md index a0f5c1929c..e74233dbfa 100644 --- a/docs/react/use-with-create-react-app.zh-CN.md +++ b/docs/react/use-with-create-react-app.zh-CN.md @@ -55,7 +55,7 @@ $ yarn start 现在从 yarn 或 npm 安装并引入 antd。 ```bash -$ yarn add antd --save +$ yarn add antd ``` 修改 `src/App.js`,引入 antd 的按钮组件。 @@ -110,7 +110,7 @@ $ yarn run eject [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一个用于按需加载组件代码和样式的 babel 插件([原理](/docs/react/getting-started#按需加载)),现在我们尝试安装它并修改 `config/webpack.config.dev.js` 文件。 ```bash -$ yarn add babel-plugin-import --save-dev +$ yarn add babel-plugin-import --dev ``` ```diff @@ -118,8 +118,8 @@ $ yarn add babel-plugin-import --save-dev { test: /\.(js|jsx)$/, include: paths.appSrc, - loader: 'babel', - query: { + loader: require.resolve('babel-loader'), + options: { + plugins: [ + ['import', { libraryName: 'antd', style: 'css' }], + ], @@ -142,22 +142,27 @@ $ yarn add babel-plugin-import --save-dev 按照 [配置主题](/docs/react/customize-theme) 的要求,自定义主题需要用到 less 变量覆盖功能,因此首先我们需要引入 [less-loader](https://github.com/webpack/less-loader) 来加载 less 样式,同时修改 `config/webpack.config.dev.js` 文件。 ```bash -$ yarn add less less-loader --save-dev +$ yarn add less less-loader --dev ``` ```diff -loaders: [ { exclude: [ /\.html$/, /\.(js|jsx)$/, -+ /\.less$/, /\.css$/, ++ /\.less$/, /\.json$/, - /\.svg$/ + /\.bmp$/, + /\.gif$/, + /\.jpe?g$/, + /\.png$/, ], - loader: 'url', - }, + loader: require.resolve('file-loader'), + options: { + name: 'static/media/[name].[hash:8].[ext]', + }, + } ... @@ -166,47 +171,47 @@ loaders: [ test: /\.(js|jsx)$/, include: paths.appSrc, loader: 'babel', - query: { + options: { plugins: [ - ['import', [{ libraryName: 'antd', style: 'css' }]], -+ ['import', [{ libraryName: 'antd', style: true }]], // 加载 less 文件 ++ ['import', [{ libraryName: 'antd', style: true }]], // import less ], }, ... -+ // 解析 less 文件,并加入变量覆盖配置 -+ { -+ test: /\.less$/, -+ use: [ -+ require.resolve('style-loader'), -+ require.resolve('css-loader'), -+ { -+ loader: require.resolve('postcss-loader'), -+ options: { -+ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options -+ plugins: () => [ -+ require('postcss-flexbugs-fixes'), -+ autoprefixer({ -+ browsers: [ -+ '>1%', -+ 'last 4 versions', -+ 'Firefox ESR', -+ 'not ie < 9', // React doesn't support IE8 anyway -+ ], -+ flexbox: 'no-2009', -+ }), -+ ], -+ }, -+ }, -+ { -+ loader: require.resolve('less-loader'), -+ options: { -+ modifyVars: { "@primary-color": "#1DA57A" }, -+ }, -+ }, -+ ], -+ }, ++ // Parse less files and modify variables ++ { ++ test: /\.less$/, ++ use: [ ++ require.resolve('style-loader'), ++ require.resolve('css-loader'), ++ { ++ loader: require.resolve('postcss-loader'), ++ options: { ++ ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options ++ plugins: () => [ ++ require('postcss-flexbugs-fixes'), ++ autoprefixer({ ++ browsers: [ ++ '>1%', ++ 'last 4 versions', ++ 'Firefox ESR', ++ 'not ie < 9', // React doesn't support IE8 anyway ++ ], ++ flexbox: 'no-2009', ++ }), ++ ], ++ }, ++ }, ++ { ++ loader: require.resolve('less-loader'), ++ options: { ++ modifyVars: { "@primary-color": "#1DA57A" }, ++ }, ++ }, ++ ], ++ }, ], ``` From 709c750c2bed0ad7fe545b25e2e09869eaa04b6b Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 May 2017 01:51:13 +0800 Subject: [PATCH 45/55] Fix InputNumber feedback z-index issue, close #6289 --- components/input-number/style/index.less | 1 + 1 file changed, 1 insertion(+) diff --git a/components/input-number/style/index.less b/components/input-number/style/index.less index db26fe3cff..d772865178 100644 --- a/components/input-number/style/index.less +++ b/components/input-number/style/index.less @@ -113,6 +113,7 @@ opacity: 0; border-radius: 0 @border-radius-base @border-radius-base 0; transition: opacity 0.24s linear 0.1s; + z-index: 2; // https://github.com/ant-design/ant-design/issues/6289 } &-handler-wrap:hover &-handler { From fa235b78763d289a6c3f73e943691d5750d159ec Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 May 2017 16:19:59 +0800 Subject: [PATCH 46/55] Fix RangePicker test case --- components/date-picker/__tests__/RangePicker.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index 7411bc2c0e..fb2a233238 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -72,7 +72,7 @@ describe('RangePicker', () => { ); wrapper.setProps({ value: [] }); const rangeCalendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); - expect(() => rangeCalendarWrapper.find('.ant-calendar-today').simulate('click').simulate('click')) + expect(() => rangeCalendarWrapper.find('.ant-calendar-today').at(0).simulate('click').simulate('click')) .not.toThrow(); }); }); From 03adcefafdc6fff66a2c96310d1bfe3ec9d01740 Mon Sep 17 00:00:00 2001 From: Jordan Hornblow Date: Mon, 29 May 2017 20:14:16 +1000 Subject: [PATCH 47/55] Make count prop optional in BadgeProps interface E.g. https://ant.design/components/badge/#components-badge-demo-dot --- components/badge/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 0ca96f8b38..124bb0dee0 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -7,7 +7,7 @@ import warning from '../_util/warning'; export interface BadgeProps { /** Number to show in badge */ - count: number | string; + count?: number | string; showZero?: boolean; /** Max count to show */ overflowCount?: number; From ba65f9429e2b0aebd40b7c0e35a7ade7230aae9a Mon Sep 17 00:00:00 2001 From: Jordan Hornblow Date: Mon, 29 May 2017 20:17:01 +1000 Subject: [PATCH 48/55] Add onCellClick prop to ColumnProps interface --- components/table/Column.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/table/Column.tsx b/components/table/Column.tsx index 38fa2a2d44..177a1d3642 100644 --- a/components/table/Column.tsx +++ b/components/table/Column.tsx @@ -21,6 +21,7 @@ export interface ColumnProps { filteredValue?: any[]; sortOrder?: boolean | ('ascend' | 'descend'); children?: ColumnProps[]; + onCellClick?: (record: T, event: any) => void; } export default class Column extends (RcTable.Column as React.ComponentClass>) {} From 4417dcf300c03ce03b5ca747ba464c82790c5a02 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 May 2017 19:06:26 +0800 Subject: [PATCH 49/55] fix tsc --- components/badge/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 124bb0dee0..35a23bf333 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -54,7 +54,7 @@ export default class Badge extends React.Component { ...restProps, } = this.props; const isDot = dot || status; - let displayCount = count > (overflowCount as number) ? `${overflowCount}+` : count; + let displayCount = (count as number) > (overflowCount as number) ? `${overflowCount}+` : count; // dot mode don't need count if (isDot) { displayCount = ''; From b57047c919de081f3801814a04626ee58e57afbd Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 May 2017 17:48:07 +0800 Subject: [PATCH 50/55] upgrade typescript to 2.3, close #6263 --- components/tooltip/index.tsx | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 4405af762b..80312cf934 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -27,7 +27,7 @@ export interface AbstractTooltipProps { // getTooltipContainer had been rename to getPopupContainer getTooltipContainer?: (triggerNode: Element) => HTMLElement; getPopupContainer?: (triggerNode: Element) => HTMLElement; - children?: React.ReactElement; + children?: React.ReactNode; } export interface TooltipProps extends AbstractTooltipProps { diff --git a/package.json b/package.json index e342a3d274..390b80fd0a 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "rimraf": "^2.5.4", "stylelint": "^7.8.0", "stylelint-config-standard": "^16.0.0", - "typescript": "~2.2.1", + "typescript": "~2.3.0", "typescript-babel-jest": "^1.0.2", "values.js": "^1.0.3", "xhr2": "^0.1.3" From a4a6db76de57ac2559a2be80208121ab5e168fbf Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 31 May 2017 10:45:45 +0800 Subject: [PATCH 51/55] deps: upgrade rc-calendar --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 390b80fd0a..9115fbd73b 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "omit.js": "^0.1.0", "prop-types": "^15.5.7", "rc-animate": "~2.3.0", - "rc-calendar": "~8.3.0", + "rc-calendar": "~8.4.0", "rc-cascader": "~0.11.0", "rc-checkbox": "~2.0.0", "rc-collapse": "~1.7.0", From 35095fc776737bfc483b29708c34fcc39fdcadc0 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 31 May 2017 10:59:27 +0800 Subject: [PATCH 52/55] test: fix CI --- components/date-picker/__tests__/RangePicker.test.js | 2 +- components/date-picker/__tests__/showTime.test.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index fb2a233238..7d782e2ae3 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -45,7 +45,7 @@ describe('RangePicker', () => { const wrapper = mount( trigger} format="YYYY/MM/DD" diff --git a/components/date-picker/__tests__/showTime.test.js b/components/date-picker/__tests__/showTime.test.js index dc60a4608c..f8a2752c41 100644 --- a/components/date-picker/__tests__/showTime.test.js +++ b/components/date-picker/__tests__/showTime.test.js @@ -65,13 +65,11 @@ describe('RangePicker with showTime', () => { ); - let calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + const calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); expect(calendarWrapper.find('.ant-calendar-time-picker-btn').hasClass('ant-calendar-time-picker-btn-disabled')).toBe(true); expect(calendarWrapper.find('.ant-calendar-ok-btn').hasClass('ant-calendar-ok-btn-disabled')).toBe(true); calendarWrapper.find('.ant-calendar-date').at(10).simulate('click'); - calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! TODO: calendarWrapper cannot get the latest state from wrapper calendarWrapper.find('.ant-calendar-date').at(11).simulate('click'); - calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! expect(calendarWrapper.find('.ant-calendar-time-picker-btn').hasClass('ant-calendar-time-picker-btn-disabled')).toBe(false); expect(calendarWrapper.find('.ant-calendar-ok-btn').hasClass('ant-calendar-ok-btn-disabled')).toBe(false); expect(onChangeFn).toHaveBeenCalled(); @@ -86,11 +84,9 @@ describe('RangePicker with showTime', () => { ); - let calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); + const calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); calendarWrapper.find('.ant-calendar-date').at(10).simulate('click'); - calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! calendarWrapper.find('.ant-calendar-date').at(11).simulate('click'); - calendarWrapper = mount(wrapper.find('Trigger').node.getComponent()); // !!! onChangeFn.mockClear(); calendarWrapper.find('.ant-calendar-ok-btn').simulate('click'); expect(onOkFn).toHaveBeenCalled(); From af89c14e4ae2dee32b4ae28bf3d2fc361860ca62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=90=E4=BB=AA?= Date: Wed, 31 May 2017 15:20:11 +0800 Subject: [PATCH 53/55] bump 2.10.3 --- CHANGELOG.en-US.md | 19 +++++++++++++++++++ CHANGELOG.zh-CN.md | 19 +++++++++++++++++++ package.json | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 65bbb78a3e..40ba71e74d 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -17,6 +17,25 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi --- +## 2.10.3 + +`2017-05-31` + +- **Calendar** + - Fix disabledDate not be supported, and make supplement for the types and documentation. [#6074](https://github.com/ant-design/ant-design/issues/6074) + - Upgrade rc-calendar to 8.4.0, support Bulgarian, and user can select end date first. [commit/a4a6db](https://github.com/ant-design/ant-design/commit/a4a6db76de57ac2559a2be80208121ab5e168fbf) +- **Alert** Remove default margin-bottom. [commit/5ef482](https://github.com/ant-design/ant-design/commit/5ef48289747409b6d962f75627ddb11e2765f965) +- **Tabs** Fix inactive tab panel behavious. [#6237](https://github.com/ant-design/ant-design/issues/6237) +- **Layout** Fix children in the collapsed Sider not be hidden. [#6131](https://github.com/ant-design/ant-design/issues/6131) +- **Table** Fix table filter menu overflow issue. [#6245](https://github.com/ant-design/ant-design/issues/6245) +- **InputNumber** Fix hasFeedback misplaced validated icon. [#6289](https://github.com/ant-design/ant-design/issues/6289) +- **Typescript** + - Upgrade TypeScript to 2.3.x. [#6263](https://github.com/ant-design/ant-design/issues/6263) + - Add missing props in Table. [commit/acdc56](https://github.com/ant-design/ant-design/commit/acdc563a547c49960521b2b48cd5c707ac1e4cf2) [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254) + - Fix wrong type in Mention and Form. [pull/6268](https://github.com/ant-design/ant-design/pull/6268) [@jch254](https://github.com/jch254) + - Fix wrong type in Badge. [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254) + - Add missing props in Input related Components. [pull/6276](https://github.com/ant-design/ant-design/pull/6276/commits/94901de2e8c0a2ed6f62f5aa50c98994aad71844) [@panjiesw](https://github.com/panjiesw) [commit/220264](https://github.com/ant-design/ant-design/commit/2202648d6e1c53409ade2141955232922b0040d6#diff-26cb6da96d10397e18e7dbd6c5d8f7a1L265) [@clinyong](https://github.com/clinyong) + ## 2.10.2 `2017-05-23` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index d7d0444c09..24a63be939 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -17,6 +17,25 @@ timeline: true --- +## 2.10.3 + +`2017-05-31` + +- **Calendar** + - 修复了样式问题以支持 disabledDate,补充了 Type 定义及文档。[#6074](https://github.com/ant-design/ant-design/issues/6074) + - rc-calendar 依赖升级至 8.4.0,支持保加利亚语,支持首先选择结束日期。[commit/a4a6db](https://github.com/ant-design/ant-design/commit/a4a6db76de57ac2559a2be80208121ab5e168fbf) +- **Alert** 去掉了默认的下边距。[commit/5ef482](https://github.com/ant-design/ant-design/commit/5ef48289747409b6d962f75627ddb11e2765f965) +- **Tabs** 修复了隐藏标签下内容的表现问题。[#6237](https://github.com/ant-design/ant-design/issues/6237) +- **Layout** 修复了折叠侧边栏中的内容不能自动隐藏的问题。[#6131](https://github.com/ant-design/ant-design/issues/6131) +- **Table** 修复了 filter 被 Table 截断的问题。[#6245](https://github.com/ant-design/ant-design/issues/6245) +- **InputNumber** 修复了配置 hasFeedback 时校验结果图标位置有误的问题。[#6289](https://github.com/ant-design/ant-design/issues/6289) +- **Typescript** + - typescript 升级至 2.3.x。[#6263](https://github.com/ant-design/ant-design/issues/6263) + - 补充了 Table 的 type 定义. [commit/acdc56](https://github.com/ant-design/ant-design/commit/acdc563a547c49960521b2b48cd5c707ac1e4cf2) [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254) + - 修复了 Mention、Form 组件中错误的 type 定义. [pull/6268](https://github.com/ant-design/ant-design/pull/6268) [@jch254](https://github.com/jch254) + - 修复了 Badge 组件中错误的 type 定义. [pull/6291](https://github.com/ant-design/ant-design/pull/6291) [@jch254](https://github.com/jch254) + - 补充了 Input 相关组件的 type 定义。[pull/6276](https://github.com/ant-design/ant-design/pull/6276/commits/94901de2e8c0a2ed6f62f5aa50c98994aad71844) [@panjiesw](https://github.com/panjiesw) [commit/220264](https://github.com/ant-design/ant-design/commit/2202648d6e1c53409ade2141955232922b0040d6#diff-26cb6da96d10397e18e7dbd6c5d8f7a1L265) [@clinyong](https://github.com/clinyong) + ## 2.10.2 `2017-05-23` diff --git a/package.json b/package.json index 9115fbd73b..c942499b84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "2.10.2", + "version": "2.10.3", "title": "Ant Design", "description": "An enterprise-class UI design language and React-based implementation", "homepage": "http://ant.design/", From fd625ef1a0aa12a901b17557a0cf72f041bf77d8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 31 May 2017 15:48:11 +0800 Subject: [PATCH 54/55] upgrade and fix tslint problems --- components/badge/index.tsx | 2 +- components/date-picker/RangePicker.tsx | 4 ++-- components/date-picker/createPicker.tsx | 2 +- components/modal/confirm.tsx | 6 +++--- components/tabs/index.tsx | 2 +- components/tag/index.tsx | 2 +- package.json | 2 +- tsconfig.json | 2 ++ 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 35a23bf333..4bce3e94ff 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -110,7 +110,7 @@ export default class Badge extends React.Component { component="" showProp="data-show" transitionName={children ? `${prefixCls}-zoom` : ''} - transitionAppear={true} + transitionAppear > {scrollNumber} diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index f1e91ed0fe..e2f257e29b 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -224,7 +224,7 @@ export default class RangePicker extends React.Component { { ~ {props.cancelText} - + {props.okText}
    @@ -65,7 +65,7 @@ export default function confirm(config) { } else { footer = (
    - + {props.okText}
    @@ -80,7 +80,7 @@ export default function confirm(config) { { className={cls} tabBarPosition={tabPosition} renderTabBar={renderTabBar} - renderTabContent={() => } + renderTabContent={() => } onChange={this.handleChange} > {childrenWithClose || children} diff --git a/components/tag/index.tsx b/components/tag/index.tsx index a1ca504c6a..7351e9261e 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -104,7 +104,7 @@ export default class Tag extends React.Component { component="" showProp="data-show" transitionName={`${prefixCls}-zoom`} - transitionAppear={true} + transitionAppear onEnd={this.animationEnd} > {tag} diff --git a/package.json b/package.json index c942499b84..3b9c7abeb2 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "@types/react": "^15.0.8", "@types/react-dom": "~0.14.18", "antd-demo-jest": "^1.0.5", - "antd-tools": "^1.2.0", + "antd-tools": "^1.4.2", "babel-cli": "^6.18.0", "babel-eslint": "^7.1.0", "babel-jest": "^19.0.0", diff --git a/tsconfig.json b/tsconfig.json index fa6a181338..a651b256de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,8 @@ "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "jsx": "preserve", + "noUnusedParameters": true, + "noUnusedLocals": true, "target": "es6", "lib": [ "dom", From 47c58fb0b2c711deee19e396240c3ab64badf8e2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 31 May 2017 18:23:52 +0800 Subject: [PATCH 55/55] tsc ignore lib and es folders --- tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index a651b256de..dd6df7d6d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,8 @@ ] }, "exclude": [ - "node_modules" + "node_modules", + "lib", + "es" ] }