From 8800b56e47705ecced11dc97cc6f944ad0627d00 Mon Sep 17 00:00:00 2001 From: Omri Grossman Date: Thu, 30 Jul 2020 05:16:44 +0300 Subject: [PATCH 01/57] fix: The 'indentSize' in the Table component couldn't be zero value (#25890) * - Fixed the indentSize prop of Table.tsx to also accept 0 values * - Undo Cascader component test snapshots * - Added test case - Used check with typeof === number instead of `undefined` and `null` Co-authored-by: omri.g --- components/table/Table.tsx | 23 ++++--- .../table/__tests__/Table.expand.test.js | 60 ++++++------------- 2 files changed, 28 insertions(+), 55 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index cc9f57675a..be99cdb5ee 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -222,18 +222,13 @@ function Table(props: TableProps) { } if (onChange) { - onChange( - changeInfo.pagination!, - changeInfo.filters!, - changeInfo.sorter!, - { - currentDataSource: getFilterData( - getSortData(rawData, changeInfo.sorterStates!, childrenColumnName), - changeInfo.filterStates!, - ), - action, - }, - ); + onChange(changeInfo.pagination!, changeInfo.filters!, changeInfo.sorter!, { + currentDataSource: getFilterData( + getSortData(rawData, changeInfo.sorterStates!, childrenColumnName), + changeInfo.filterStates!, + ), + action, + }); } }; @@ -409,7 +404,9 @@ function Table(props: TableProps) { } // Indent size - mergedExpandable.indentSize = mergedExpandable.indentSize || indentSize || 15; + if (typeof mergedExpandable.indentSize !== 'number') { + mergedExpandable.indentSize = typeof indentSize === 'number' ? indentSize : 15; + } // ============================ Render ============================ const transformColumns = React.useCallback( diff --git a/components/table/__tests__/Table.expand.test.js b/components/table/__tests__/Table.expand.test.js index 37444f1b7c..858a834ec0 100644 --- a/components/table/__tests__/Table.expand.test.js +++ b/components/table/__tests__/Table.expand.test.js @@ -40,10 +40,7 @@ const data = [ describe('Table.expand', () => { it('click to expand', () => { const wrapper = mount(); - wrapper - .find('.ant-table-row-expand-icon') - .last() - .simulate('click'); + wrapper.find('.ant-table-row-expand-icon').last().simulate('click'); expect(wrapper.render()).toMatchSnapshot(); }); @@ -59,10 +56,7 @@ describe('Table.expand', () => { />, ); - wrapper - .find('.ant-table-row-expand-icon') - .first() - .simulate('click'); + wrapper.find('.ant-table-row-expand-icon').first().simulate('click'); expect( wrapper .find('.ant-table-row-expand-icon') @@ -70,10 +64,7 @@ describe('Table.expand', () => { .hasClass('ant-table-row-expand-icon-expanded'), ).toBeTruthy(); - wrapper - .find('.ant-table-row-expand-icon') - .first() - .simulate('click'); + wrapper.find('.ant-table-row-expand-icon').first().simulate('click'); expect( wrapper .find('.ant-table-row-expand-icon') @@ -96,6 +87,16 @@ describe('Table.expand', () => { expect(wrapper.find('.expand-icon')).toHaveLength(1); }); + it('row indent padding should be 0px when indentSize defined as 0', () => { + const wrapper = mount(
); + const button = wrapper.find('.ant-table-row-expand-icon').at(0); + button.simulate('click'); + expect(wrapper.find('.indent-level-1').at(0).prop('style')).toHaveProperty( + 'paddingLeft', + '0px', + ); + }); + describe('expandIconColumnIndex', () => { it('basic', () => { const wrapper = mount( @@ -109,18 +110,8 @@ describe('Table.expand', () => { />, ); - expect( - wrapper - .find('td') - .at(0) - .text(), - ).toEqual('bamboo'); - expect( - wrapper - .find('td') - .at(1) - .find('.ant-table-row-expand-icon').length, - ).toBeTruthy(); + expect(wrapper.find('td').at(0).text()).toEqual('bamboo'); + expect(wrapper.find('td').at(1).find('.ant-table-row-expand-icon').length).toBeTruthy(); }); it('work with selection', () => { @@ -136,24 +127,9 @@ describe('Table.expand', () => { />, ); - expect( - wrapper - .find('td') - .at(0) - .find('.ant-checkbox-input').length, - ).toBeTruthy(); - expect( - wrapper - .find('td') - .at(1) - .text(), - ).toEqual('bamboo'); - expect( - wrapper - .find('td') - .at(2) - .find('.ant-table-row-expand-icon').length, - ).toBeTruthy(); + expect(wrapper.find('td').at(0).find('.ant-checkbox-input').length).toBeTruthy(); + expect(wrapper.find('td').at(1).text()).toEqual('bamboo'); + expect(wrapper.find('td').at(2).find('.ant-table-row-expand-icon').length).toBeTruthy(); }); }); }); From cdefaec1904665762f588714a5f0a04e80b25ec9 Mon Sep 17 00:00:00 2001 From: zombiej Date: Thu, 30 Jul 2020 13:56:18 +0800 Subject: [PATCH 02/57] docs: Update DatePicker docs --- components/date-picker/index.en-US.md | 39 ++++++++++++++++++--------- components/date-picker/index.zh-CN.md | 38 +++++++++++++++++--------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index a966a9b588..94b88b34b2 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -29,6 +29,7 @@ The default locale is en-US, if you need to use other languages, recommend to us If there are special needs (only modifying single component language), Please use the property: local. Example: [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json). ```jsx +import 'moment/locale/zh-cn'; import locale from 'antd/es/date-picker/locale/zh_CN'; ; @@ -37,8 +38,12 @@ import locale from 'antd/es/date-picker/locale/zh_CN'; ```jsx // The default locale is en-US, if you want to use other locale, just set locale in entry file globally. import moment from 'moment'; +import 'moment/locale/zh-cn'; +import locale from 'antd/es/locale/zh_CN'; -; + + +; ``` ### Common API @@ -159,7 +164,7 @@ Added in `4.1.0`. | showTime | To provide an additional time selection | object \| boolean | [TimePicker Options](/components/time-picker/#API) | | | showTime.defaultValue | To set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | | | value | To set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | | -| onCalendarChange | Callback function, can be executed when the start time or the end time of the range is changing. `info` argument is added in 4.4.0 | function(dates: \[moment, moment], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | | +| onCalendarChange | Callback function, can be executed when the start time or the end time of the range is changing. `info` argument is added in 4.4.0 | function(dates: \[moment, moment], dateStrings: \[string, string], info: { range:`start`\|`end` }) | - | | | onChange | Callback function, can be executed when the selected time is changing | function(dates: \[moment, moment], dateStrings: \[string, string]) | - | | - ## FAQ ### When set mode to DatePicker/RangePicker, cannot select year or month anymore? diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index 54bb5ce08a..24c4f42022 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -168,15 +168,6 @@ import locale from 'antd/es/locale/zh_CN'; | onCalendarChange | 待选日期发生变化的回调。`info` 参数自 4.4.0 添加 | function(dates: \[moment, moment\], dateStrings: \[string, string\], info: { range:`start`\|`end` }) | - | | | onChange | 日期范围发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | - | | - - ## FAQ ### 当我指定了 DatePicker/RangePicker 的 mode 属性后,点击后无法选择年份/月份? From 2d04bef3b362997c1bc92cf0c66e6e79d9fc530a Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Thu, 30 Jul 2020 20:59:41 +0800 Subject: [PATCH 12/57] test: add test for slider (#25917) * test: add slider test * add test --- .../__snapshots__/index.test.js.snap | 53 +++++++++++++++++++ components/slider/__tests__/index.test.js | 8 +++ 2 files changed, 61 insertions(+) diff --git a/components/slider/__tests__/__snapshots__/index.test.js.snap b/components/slider/__tests__/__snapshots__/index.test.js.snap index 817f0744a6..25cab26b44 100644 --- a/components/slider/__tests__/__snapshots__/index.test.js.snap +++ b/components/slider/__tests__/__snapshots__/index.test.js.snap @@ -84,6 +84,59 @@ exports[`Slider should render in RTL direction 1`] = ` `; +exports[`Slider should show correct placement tooltip when set tooltipPlacement 1`] = ` +
+
+
+
+ +
+ +
+
+
+`; + +exports[`Slider should show correct placement tooltip when set tooltipPlacement 2`] = ` +
+
+
+
+ +
+ +
+
+
+`; + exports[`Slider should show tooltip when hovering slider handler 1`] = `
{ expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot(); }); + it('should show correct placement tooltip when set tooltipPlacement', () => { + const wrapper = mount(); + wrapper.find('.ant-slider-handle').at(0).simulate('mouseEnter'); + expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot(); + wrapper.find('.ant-slider-handle').at(0).simulate('mouseLeave'); + expect(render(wrapper.find('Trigger').instance().getComponent())).toMatchSnapshot(); + }); + it('when tooltipVisible is true, tooltip should show always, or should never show', () => { let wrapper = mount(); expect(wrapper.find('.ant-tooltip-content').at(0).hasClass('ant-tooltip-hidden')).toBe(false); From fed87f407de14a903f3750486bc9320686dfeb4b Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 31 Jul 2020 11:44:32 +0800 Subject: [PATCH 13/57] fix: divider color in dark (#25922) * fix: divider color in dark * Update components/style/themes/dark.less --- components/style/themes/dark.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/style/themes/dark.less b/components/style/themes/dark.less index 3dee0155a5..2a5b427abf 100644 --- a/components/style/themes/dark.less +++ b/components/style/themes/dark.less @@ -230,6 +230,10 @@ // --- @descriptions-bg: @background-color-light; +// Divider +// --- +@divider-color: rgba(255, 255, 255, 12%); + // Modal // --- @modal-header-bg: @popover-background; From 43189ed43a52774f5d07d4741460c2236f1e6cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Fri, 31 Jul 2020 14:01:28 +0800 Subject: [PATCH 14/57] =?UTF-8?q?docs:=20=F0=9F=93=96=20update=20Table=20T?= =?UTF-8?q?ypeScript=20usage=20(#25928)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update index.zh-CN.md * Update index.en-US.md --- components/table/index.en-US.md | 31 +++++++++++++------------------ components/table/index.zh-CN.md | 30 +++++++++++++----------------- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/components/table/index.en-US.md b/components/table/index.en-US.md index 9aa688d754..6187607cf8 100644 --- a/components/table/index.en-US.md +++ b/components/table/index.en-US.md @@ -224,7 +224,7 @@ import { Table } from 'antd'; import { ColumnsType } from 'antd/es/table'; interface User { - key: number, + key: number; name: string; } @@ -239,25 +239,20 @@ const data: User[] = [{ name: 'Jack', }]; -class UserTable extends Table {} - - - -// Use JSX style API -class NameColumn extends Table.Column {} - - - - - -// after TypeScript 2.9 can write like this -// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#generic-type-arguments-in-jsx-elements - columns={columns} dataSource={data} /> - dataSource={data}> - key="name" title="Name" dataIndex="name" /> -
+export default () => ( + <> + columns={columns} dataSource={data} /> + + /* JSX style usage */ + dataSource={data}> + key="name" title="Name" dataIndex="name" /> + + +); ``` +Here is the [CodeSandbox for TypeScript](https://codesandbox.io/s/serene-platform-0jo5t). + ## Note According to the [React documentation](https://facebook.github.io/react/docs/lists-and-keys.html#keys), every child in an array should be assigned a unique key. The values inside the Table's `dataSource` and `columns` should follow this rule. By default, `dataSource[i].key` will be treated as the key value for `dataSource`. diff --git a/components/table/index.zh-CN.md b/components/table/index.zh-CN.md index 3c716b422f..358e81a53a 100644 --- a/components/table/index.zh-CN.md +++ b/components/table/index.zh-CN.md @@ -235,7 +235,7 @@ interface User { name: string; } -const columns: ColumnsType[] = [{ +const columns: ColumnsType = [{ key: 'name', title: 'Name', dataIndex: 'name', @@ -246,24 +246,20 @@ const data: User[] = [{ name: 'Jack', }]; -class UserTable extends Table {} - - -// 使用 JSX 风格的 API -class NameColumn extends Table.Column {} - - - - - -// TypeScript 2.9 之后也可以这样写 -// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#generic-type-arguments-in-jsx-elements - columns={columns} dataSource={data} /> - dataSource={data}> - key="name" title="Name" dataIndex="name" /> - +export default () => ( + <> + columns={columns} dataSource={data} /> + + /* 使用 JSX 风格的 API */ + dataSource={data}> + key="name" title="Name" dataIndex="name" /> + + +); ``` +TypeScript 里使用 Table 的 [CodeSandbox 实例](https://codesandbox.io/s/serene-platform-0jo5t)。 + ## 注意 按照 [React 的规范](https://zh-hans.reactjs.org/docs/lists-and-keys.html#keys),所有的数组组件必须绑定 `key`。在 Table 中,`dataSource` 和 `columns` 里的数据值都需要指定 `key` 值。对于 `dataSource` 默认将每列数据的 `key` 属性作为唯一的标识。 From 82c2554ce7b5d0db9a13226669a38fe55402f482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Fri, 31 Jul 2020 15:02:33 +0800 Subject: [PATCH 15/57] test: update compressed-size file list (#25930) --- .github/workflows/compressed-size.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index e28318a30e..fcfbf90b42 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -14,3 +14,4 @@ jobs: - uses: preactjs/compressed-size-action@v2 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + pattern: "./dist/**/*.min.{js,css}" From ec042c66c2f0e448c415e38524bda783031b9fbf Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 31 Jul 2020 15:18:00 +0800 Subject: [PATCH 16/57] fix: badge rtl.less import (#25931) --- components/badge/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/badge/style/index.less b/components/badge/style/index.less index 81619c91b6..d86c22ec0e 100644 --- a/components/badge/style/index.less +++ b/components/badge/style/index.less @@ -190,5 +190,5 @@ } } -@import './rtl'; @import './ribbon'; +@import './rtl'; From 0b27e54be5e9cbcb505f90e4e643ae1639db27eb Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 31 Jul 2020 16:43:12 +0800 Subject: [PATCH 17/57] fix: tabs card type rtl style (#25936) --- components/tabs/style/rtl.less | 78 ++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/components/tabs/style/rtl.less b/components/tabs/style/rtl.less index 63e0a57782..214dceb735 100644 --- a/components/tabs/style/rtl.less +++ b/components/tabs/style/rtl.less @@ -3,58 +3,64 @@ @tab-prefix-cls: ~'@{ant-prefix}-tabs'; -.@{tab-prefix-cls}-rtl { - direction: rtl; +.@{tab-prefix-cls} { + &-rtl { + direction: rtl; - .@{tab-prefix-cls}-nav { - .@{tab-prefix-cls}-tab { - margin: @tabs-horizontal-margin-rtl; + .@{tab-prefix-cls}-nav { + .@{tab-prefix-cls}-tab { + margin: @tabs-horizontal-margin-rtl; - &:last-of-type { - margin-left: 0; - } - - .@{iconfont-css-prefix} { - margin-right: 0; - margin-left: @margin-sm; - } - - .@{tab-prefix-cls}-tab-remove { - margin-right: @margin-xs; - margin-left: -@margin-xss; + &:last-of-type { + margin-left: 0; + } .@{iconfont-css-prefix} { - margin: 0; + margin-right: 0; + margin-left: @margin-sm; + } + + .@{tab-prefix-cls}-tab-remove { + margin-right: @margin-xs; + margin-left: -@margin-xss; + + .@{iconfont-css-prefix} { + margin: 0; + } } } } - } - &.@{tab-prefix-cls}-left { - > .@{tab-prefix-cls}-nav { - order: 1; + &.@{tab-prefix-cls}-left { + > .@{tab-prefix-cls}-nav { + order: 1; + } + > .@{tab-prefix-cls}-content-holder { + order: 0; + } } - > .@{tab-prefix-cls}-content-holder { - order: 0; - } - } - &.@{tab-prefix-cls}-right { - > .@{tab-prefix-cls}-nav { - order: 0; - } - > .@{tab-prefix-cls}-content-holder { - order: 1; + &.@{tab-prefix-cls}-right { + > .@{tab-prefix-cls}-nav { + order: 0; + } + > .@{tab-prefix-cls}-content-holder { + order: 1; + } } } // ====================== Card ====================== - &.@{tab-prefix-cls}-card { + &-card { &.@{tab-prefix-cls}-top, &.@{tab-prefix-cls}-bottom { - > .@{tab-prefix-cls}-nav { - button.@{tab-prefix-cls}-tab:not(:last-of-type) { - margin: 0 0 0 @tabs-card-gutter; + > .@{tab-prefix-cls}-nav, + > div > .@{tab-prefix-cls}-nav { + .@{tab-prefix-cls}-tab:not(:last-of-type) { + .@{tab-prefix-cls}-rtl& { + margin-right: 0; + margin-left: @tabs-card-gutter; + } } } } From f1154d4f0953ee6afa1d05500d03f5498df1dbe3 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 31 Jul 2020 17:19:51 +0800 Subject: [PATCH 18/57] fix: table nested table rtl style (#25938) --- components/table/style/rtl.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/table/style/rtl.less b/components/table/style/rtl.less index ee5f97ef2b..5438a48f0c 100644 --- a/components/table/style/rtl.less +++ b/components/table/style/rtl.less @@ -44,7 +44,7 @@ > tr { // ========================= Nest Table =========================== .@{table-prefix-cls}-wrapper:only-child { - .@{table-prefix-cls}-rtl { + .@{table-prefix-cls}.@{table-prefix-cls}-rtl { margin: -@table-padding-vertical (@table-padding-horizontal + ceil(@font-size-sm * 1.4)) -@table-padding-vertical -@table-padding-horizontal; } } From 2a18b55a8d5c46a0456496d4990944013d825dab Mon Sep 17 00:00:00 2001 From: lihqi <455711093@qq.com> Date: Sat, 1 Aug 2020 15:53:26 +0800 Subject: [PATCH 19/57] fix: Slider tooltip visible abnormal (#25945) --- components/slider/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 29b65f7ed2..3411d22167 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -73,9 +73,9 @@ const Slider = React.forwardRef(( const [visibles, setVisibles] = React.useState({}); const toggleTooltipVisible = (index: number, visible: boolean) => { - const temp = { ...visibles }; - temp[index] = visible; - setVisibles(temp); + setVisibles((prev: Visibles) => { + return { ...prev, [index]: visible }; + }); }; const getTooltipPlacement = (tooltipPlacement?: TooltipPlacement, vertical?: boolean) => { From a87c3a8997b4934ec945258d61c7b0e3908f82ee Mon Sep 17 00:00:00 2001 From: PeakFish Date: Sat, 1 Aug 2020 21:35:19 +0800 Subject: [PATCH 20/57] docs: fix typo in demo --- components/form/index.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 2fb73d547c..dc2073aed6 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -206,7 +206,7 @@ Form.List 渲染表单相关操作函数。 | 名称 | 说明 | 类型 | 版本 | | --- | --- | --- | --- | -| getFieldInstance | 获取对应字段示例 | (name: [NamePath](#NamePath)) => any | 4.4.0 | +| getFieldInstance | 获取对应字段实例 | (name: [NamePath](#NamePath)) => any | 4.4.0 | | getFieldValue | 获取对应字段名的值 | (name: [NamePath](#NamePath)) => any | | | getFieldsValue | 获取一组字段名对应的值,会按照对应结构返回 | (nameList?: [NamePath](#NamePath)[], filterFunc?: (meta: { touched: boolean, validating: boolean }) => boolean) => any | | | getFieldError | 获取对应字段名的错误信息 | (name: [NamePath](#NamePath)) => string[] | | From b91b30c48a1d0025ad391bf0e83524390a9f1cfc Mon Sep 17 00:00:00 2001 From: Ivan Yakovlev Date: Sun, 2 Aug 2020 08:41:44 +0300 Subject: [PATCH 21/57] chore: localization update (#25958) * chore: add missed variable (#25954) * chore: add missed variables (#25954) * chore: transform to uppercase (#25954) * chore: add missed varibles (#25954) Co-authored-by: Ivan.Yakovlev --- components/date-picker/locale/ru_RU.tsx | 7 +++++++ components/locale/default.tsx | 1 + components/locale/ru_RU.tsx | 18 +++++++++++++----- components/time-picker/locale/ru_RU.tsx | 1 + 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/components/date-picker/locale/ru_RU.tsx b/components/date-picker/locale/ru_RU.tsx index 75bcce1f02..a0e9fe1282 100644 --- a/components/date-picker/locale/ru_RU.tsx +++ b/components/date-picker/locale/ru_RU.tsx @@ -10,7 +10,14 @@ import { PickerLocale } from '../generatePicker'; const locale: PickerLocale = { lang: { placeholder: 'Выберите дату', + yearPlaceholder: 'Выберите год', + quarterPlaceholder: 'Выберите квартал', + monthPlaceholder: 'Выберите месяц', + weekPlaceholder: 'Выберите неделю', rangePlaceholder: ['Начальная дата', 'Конечная дата'], + rangeYearPlaceholder: ['Начальный годr', 'Год окончания'], + rangeMonthPlaceholder: ['Начальный месяц', 'Конечный месяц'], + rangeWeekPlaceholder: ['Начальная неделя', 'Конечная неделя'], ...CalendarLocale, }, timePickerLocale: { diff --git a/components/locale/default.tsx b/components/locale/default.tsx index 0a59ec430c..369e75b329 100644 --- a/components/locale/default.tsx +++ b/components/locale/default.tsx @@ -21,6 +21,7 @@ const localeValues: Locale = { filterConfirm: 'OK', filterReset: 'Reset', filterEmptyText: 'No filters', + emptyText: 'No data', selectAll: 'Select current page', selectInvert: 'Invert current page', selectionAll: 'Select all data', diff --git a/components/locale/ru_RU.tsx b/components/locale/ru_RU.tsx index c4fc447e7b..067766e18f 100644 --- a/components/locale/ru_RU.tsx +++ b/components/locale/ru_RU.tsx @@ -21,6 +21,7 @@ const localeValues: Locale = { filterTitle: 'Фильтр', filterConfirm: 'OK', filterReset: 'Сбросить', + filterEmptyText: 'Без фильтров', emptyText: 'Нет данных', selectAll: 'Выбрать всё', selectInvert: 'Инвертировать выбор', @@ -42,9 +43,16 @@ const localeValues: Locale = { cancelText: 'Отмена', }, Transfer: { + titles: ['', ''], searchPlaceholder: 'Поиск', itemUnit: 'элем.', itemsUnit: 'элем.', + remove: 'Удалить', + selectAll: 'Выбрать все данные', + selectCurrent: 'Выбрать текущую страницу', + selectInvert: 'Показать в обратном порядке', + removeAll: 'Удалить все данные', + removeCurrent: 'Удалить текущую страницу', }, Upload: { uploading: 'Загрузка...', @@ -60,13 +68,13 @@ const localeValues: Locale = { icon: 'иконка', }, Text: { - edit: 'редактировать', - copy: 'копировать', - copied: 'скопировано', - expand: 'раскрыть', + edit: 'Редактировать', + copy: 'Копировать', + copied: 'Скопировано', + expand: 'Раскрыть', }, PageHeader: { - back: 'назад', + back: 'Назад', }, Form: { defaultValidateMessages: { diff --git a/components/time-picker/locale/ru_RU.tsx b/components/time-picker/locale/ru_RU.tsx index 0b97fc658c..db298e00a4 100644 --- a/components/time-picker/locale/ru_RU.tsx +++ b/components/time-picker/locale/ru_RU.tsx @@ -5,6 +5,7 @@ import { TimePickerLocale } from '../index'; const locale: TimePickerLocale = { placeholder: 'Выберите время', + rangePlaceholder: ['Время начала', 'Время окончания'], }; export default locale; From f2fa15640874fcb92155186783113776f8e17d6b Mon Sep 17 00:00:00 2001 From: xz Date: Sun, 2 Aug 2020 14:03:14 +0800 Subject: [PATCH 22/57] chore: added english translations for illustrations (#25948) --- docs/spec/illustration.en-US.md | 106 ++++++++++++++++++ ...{illustration.md => illustration.zh-CN.md} | 0 2 files changed, 106 insertions(+) create mode 100644 docs/spec/illustration.en-US.md rename docs/spec/{illustration.md => illustration.zh-CN.md} (100%) diff --git a/docs/spec/illustration.en-US.md b/docs/spec/illustration.en-US.md new file mode 100644 index 0000000000..bdb31fecd7 --- /dev/null +++ b/docs/spec/illustration.en-US.md @@ -0,0 +1,106 @@ +--- +order: 5 +title: + zh-CN: 图形化 + en-US: Illustrations +--- + +
+ General +
+ +## Background information + +Illustrations are a key component of a brand's recognition. It is prevalent in both digital products and offline goods. Contrasting from Copyrighted information, illustrations not only carry information through intuition but also carries emotions and resulting in higher immersion and empathy for the customer. This leads to better user experience while accomplishing business goals. Illustrations contains inherit complexity due to the apparent personal style of the artist. It is a challenge to reproduce a consistent style between a team of artists, on the other hand, there is inherit risk when relying on a single artist for all the illustrations in a project. An illustration system is particular crucial in providing consistent branding. improving productivity. Avoiding risk in this regard is of great importance. + +
+ Background +
+ +## Design Principles + +From the most foundational design principles to the uppermost design techniques, HiTu adopted the design inspired by ETCG. Illustrations are grouped. Usable as templates when divided and entire use flows when congregated. This supplements the design with great flexibility and customization ability. + +
+ Design principle +
+ +#### HiTu Pyramid Model + +We concretized the 4 abstract cornerstones that make up our design strategy; Technology, Certainty, Nature, Growth. Technology represents a strong engineering foundation, providing strong support for all digital products while opening a window of possibility. As the diagram shows, we can visualize the relationships between personality and products, between past experiences and the future. The combinations between each of them could meet the demands of many different business requirements. + +
+ Pyramid model +
+ +## Colors + +### Sea Hare Swatch + + + +Sea Hare's color matching system is inspired by Ant Design's application of color palette in scenes. Differing from the UI's color scheme. The color matching system used in illustrations will be relatively more vibrant and flexible. Taking inspiration from Ant Design's basic color palette, we tweaked brightness and tolerance. The result is more efficient and easy to use. Since it originates from Any Design's color palette, it integrates seamlessly with other UI assets. + +### Default Asset Colors of Sea Hare + + + +Through research, we discovered blue and white accounts for a large proportion among enterprise products. We chose Geek Blue as our primary color for its technological, exploration and focused vibes. + +
+ + + +Sea Hare's palette combined with Adobe's ternary color picker and mosaic ball, you can easily obtain the Dedult version of the basic color palette. + +
+ +# Design Assets + +### Illustrations of People + +Natural head-to-body ratio + +In view of the natural design principle, we do not recommend using Q version cartoons and overly exaggerated artistic styles. Rather, we recommend a realistic head-to-body ratio. + +
+ +9 variants of common professioal character design + +Concurrently, we integrated emotions when designing the 9 common professional roles. Fusing some characteristics of the role while radiating vastly different personalities, meeting the needs of varies business requirements. + +
+ +Breakdown of each character + +HiTu skeletal system + +Reusing different postures + +Taking the basic character design, we break down each character and rearrange them to match the desired skeleton structure. This means various postures can be reused and extended. + +
+ +### Elementary Components + + + +Elementary components designed for business settings + +Memory comes from difference and professionalism from uniformity. Elementary Components refers to some status in the business settings that are constantly shifting and changing. We hope to achieve uniformity while not constraining creativity. To achieve a consistent sense of rhythm, we recommend a 1024\*1024 grid while maintaining a rounded corner with sizes that are multiples of 8. + +
+ +# Usage + + + + + + + + + +How do I utilize this wealth of assets? With HiTu's design principles as a guide, I recommend designers to construct a sense of spatial awareness along the Z-axis, dividing the illustration into 3 layers of foreground, middle ground and background. Placing the key elements in the foreground (such as people, elementary components, etc), environment and context in the middle and creating atmosphere in the background. The foreground should also have the highest saturation and visibility, both decreasing in level as the level decreases. + +
diff --git a/docs/spec/illustration.md b/docs/spec/illustration.zh-CN.md similarity index 100% rename from docs/spec/illustration.md rename to docs/spec/illustration.zh-CN.md From 58a72a2b28aa34e6e9c895d3c60ccb23bc46d502 Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Sun, 2 Aug 2020 18:49:18 +0800 Subject: [PATCH 23/57] fix: date-fns format string compatible (#25962) Co-authored-by: zoomdong --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ece07f83ff..60427f7696 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "rc-menu": "~8.5.0", "rc-notification": "~4.4.0", "rc-pagination": "~2.4.1", - "rc-picker": "~1.15.0", + "rc-picker": "~1.15.1", "rc-progress": "~3.0.0", "rc-rate": "~2.8.2", "rc-resize-observer": "^0.2.3", From 2e3fbaf1176525062e40fc0660b2912fd02dd816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Sun, 2 Aug 2020 18:49:36 +0800 Subject: [PATCH 24/57] fix: List actions default cursor style (#25961) close #25952 --- components/list/style/index.less | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/list/style/index.less b/components/list/style/index.less index 4fbbeb64b3..ddb14a128a 100644 --- a/components/list/style/index.less +++ b/components/list/style/index.less @@ -105,11 +105,12 @@ font-size: @font-size-base; line-height: @line-height-base; text-align: center; - cursor: pointer; - } - & > li:first-child { - padding-left: 0; + + &:first-child { + padding-left: 0; + } } + &-split { position: absolute; top: 50%; From 6d614f7d48707fe2d4d6d49f614898c275017187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Sun, 2 Aug 2020 23:13:24 +0800 Subject: [PATCH 25/57] docs: :sparkles: release 4.5.2 (#25963) --- CHANGELOG.en-US.md | 16 ++++++++++++++++ CHANGELOG.zh-CN.md | 16 ++++++++++++++++ package.json | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 0ea9d47001..e0e89d94e8 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,22 @@ timeline: true --- +## 4.5.2 + +`2020-08-02` + +- 🐞 Fix Slider tooltip abnormal visibility. [#25945](https://github.com/ant-design/ant-design/pull/25945) [@lihqi](https://github.com/lihqi) +- 🐞 Fix Divider color in dark mode. [#25922](https://github.com/ant-design/ant-design/pull/25922) +- 🐞 Fix Radio.Button text color when `disabled` and `checked`. [#25911](https://github.com/ant-design/ant-design/pull/25911) +- 🐞 Fix Carousel children height smaller then parent node issue. [#25906](https://github.com/ant-design/ant-design/pull/25906) +- 🐞 Fix Table `indentSize` couldn't be zero value. [#25890](https://github.com/ant-design/ant-design/pull/25890) [@OmriGM](https://github.com/OmriGM) +- 🐞 Fix List `actions` show cursor outside clickable area. [#25961](https://github.com/ant-design/ant-design/pull/25961) +- 🇷🇺 Improve Russian locale. [#25958](https://github.com/ant-design/ant-design/pull/25958) [@addictional](https://github.com/addictional) +- RTL + - 🐞 Fixed vertical Slider default `tooltipPlacement` in RTL mode. [#25909](https://github.com/ant-design/ant-design/pull/25909) + - 🐞 Fix Tabs RTL style of `card` type. [#25936](https://github.com/ant-design/ant-design/pull/25936) + - 🐞 Fix nested Table RTL style under dark theme. [#25938](https://github.com/ant-design/ant-design/pull/25938) + ## 4.5.1 `2020-07-28` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index f237d3f6bc..8f78d17d4b 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,22 @@ timeline: true --- +## 4.5.2 + +`2020-08-02` + +- 🐞 修复 Slider `tooltip` 显隐异常的问题。[#25945](https://github.com/ant-design/ant-design/pull/25945) [@lihqi](https://github.com/lihqi) +- 🐞 修复 Divider 暗黑模式下分割线颜色。[#25922](https://github.com/ant-design/ant-design/pull/25922) +- 🐞 修正 Radio.Button 在 `disabled` 和 `checked` 状态下的文字颜色。[#25911](https://github.com/ant-design/ant-design/pull/25911) +- 🐞 修复 Carousel 内子节点高度和容器相差几个像素的问题。[#25906](https://github.com/ant-design/ant-design/pull/25906) +- 🐞 修复 Table `indentSize` 设置为 `0` 无效的问题。[#25890](https://github.com/ant-design/ant-design/pull/25890) [@OmriGM](https://github.com/OmriGM) +- 🐞 修复 List `actions` 不必要的 `cursor: pointer` 样式。[#25961](https://github.com/ant-design/ant-design/pull/25961) +- 🇷🇺 补充俄罗斯语本地化文案。[#25958](https://github.com/ant-design/ant-design/pull/25958) [@addictional](https://github.com/addictional) +- RTL + - 🐞 修复嵌套 Table 在其他主题下的 RTL 样式。[#25938](https://github.com/ant-design/ant-design/pull/25938) + - 🐞 修复 Tabs `card` 类型的 RTL 样式。[#25936](https://github.com/ant-design/ant-design/pull/25936) + - 🐞 修复垂直方向 Slider 在 RTL 模式下默认的 `tooltipPlacement`。[#25909](https://github.com/ant-design/ant-design/pull/25909) + ## 4.5.1 `2020-07-28` diff --git a/package.json b/package.json index 60427f7696..d6031e4ca1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.5.1", + "version": "4.5.2", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ From 915d94b1dce4d5c1a978aacac2bc730e650730d4 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 2 Aug 2020 23:48:36 +0800 Subject: [PATCH 26/57] fix eslint --- .eslintignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 0a27282b21..40e29b4ac4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -26,4 +26,5 @@ dist coverage **/*.d.ts # Scripts -scripts/previewEditor/**/* \ No newline at end of file +scripts/previewEditor/**/* +jest-stare From 9fdad14dc0cf70b2c5953cc21ae83c0dfeb9aeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Mon, 3 Aug 2020 11:41:08 +0800 Subject: [PATCH 27/57] fix: useModal missing prefix (#25967) * fix: useModal hooks missing style * add test case --- components/config-provider/context.tsx | 4 ++-- components/modal/__tests__/hook.test.js | 2 ++ components/modal/useModal/HookModal.tsx | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/components/config-provider/context.tsx b/components/config-provider/context.tsx index 4da2f6f00a..cd9d8c2442 100644 --- a/components/config-provider/context.tsx +++ b/components/config-provider/context.tsx @@ -11,7 +11,7 @@ export interface ConfigConsumerProps { getTargetContainer?: () => HTMLElement; getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; rootPrefixCls?: string; - getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string; + getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string; renderEmpty: RenderEmptyHandler; csp?: CSPConfig; autoInsertSpaceInButton?: boolean; @@ -32,7 +32,7 @@ export interface ConfigConsumerProps { export const ConfigContext = React.createContext({ // We provide a default function for Context without provider - getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => { + getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => { if (customizePrefixCls) return customizePrefixCls; return suffixCls ? `ant-${suffixCls}` : 'ant'; diff --git a/components/modal/__tests__/hook.test.js b/components/modal/__tests__/hook.test.js index 79e4e57e37..df263d0ee4 100644 --- a/components/modal/__tests__/hook.test.js +++ b/components/modal/__tests__/hook.test.js @@ -35,6 +35,8 @@ describe('Modal.hook', () => { wrapper.find('button').simulate('click'); expect(wrapper.find('.test-hook').text()).toEqual('bamboo'); + expect(wrapper.find('.ant-btn').length).toBeTruthy(); + expect(wrapper.find('.ant-modal-body').length).toBeTruthy(); // Update instance instance.update({ diff --git a/components/modal/useModal/HookModal.tsx b/components/modal/useModal/HookModal.tsx index 4c8688394c..6f97d89c4b 100644 --- a/components/modal/useModal/HookModal.tsx +++ b/components/modal/useModal/HookModal.tsx @@ -27,7 +27,10 @@ const HookModal: React.ForwardRefRenderFunction = ) => { const [visible, setVisible] = React.useState(true); const [innerConfig, setInnerConfig] = React.useState(config); - const { direction } = React.useContext(ConfigContext); + const { direction, getPrefixCls } = React.useContext(ConfigContext); + + const prefixCls = getPrefixCls('modal'); + const rootPrefixCls = getPrefixCls(); function close() { setVisible(false); @@ -47,6 +50,8 @@ const HookModal: React.ForwardRefRenderFunction = {(modalLocale: ModalLocale) => ( Date: Mon, 3 Aug 2020 13:56:58 +0800 Subject: [PATCH 28/57] Update index.zh-CN.md --- components/space/index.zh-CN.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/space/index.zh-CN.md b/components/space/index.zh-CN.md index adb6f66582..2a2c7d3a8b 100644 --- a/components/space/index.zh-CN.md +++ b/components/space/index.zh-CN.md @@ -13,6 +13,9 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/wc6%263gJ0Y8/Space.svg 避免组件紧贴在一起,拉开统一的空间。 +- 适合行内元素的水平间距。 +- 可以设置各种水平对齐方式。 + ## API | 参数 | 说明 | 类型 | 默认值 | 版本 | From bc76e846190dd544aaad76cc35506cded5d5e298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 3 Aug 2020 14:35:11 +0800 Subject: [PATCH 29/57] docs: fix site problem (#25968) close #23332 --- components/config-provider/index.en-US.md | 4 ++-- components/config-provider/index.zh-CN.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/config-provider/index.en-US.md b/components/config-provider/index.en-US.md index 29f6afb6ac..7c79bebe39 100644 --- a/components/config-provider/index.en-US.md +++ b/components/config-provider/index.en-US.md @@ -17,8 +17,8 @@ import { ConfigProvider } from 'antd'; // ... -return ( - +export default () => ( + ); diff --git a/components/config-provider/index.zh-CN.md b/components/config-provider/index.zh-CN.md index 7f9eb042d2..92d70a510d 100644 --- a/components/config-provider/index.zh-CN.md +++ b/components/config-provider/index.zh-CN.md @@ -18,8 +18,8 @@ import { ConfigProvider } from 'antd'; // ... -return ( - +export default () => ( + ); From ea49b01f0e0e62955bb06f3f18d9d36a1b64dd6c Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Mon, 3 Aug 2020 14:36:16 +0800 Subject: [PATCH 30/57] fix: cascader disabled border color (#25970) --- components/cascader/style/index.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index 024724b84b..20d5faa80c 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -119,7 +119,9 @@ // https://github.com/ant-design/ant-design/pull/12407#issuecomment-424657810 &-picker-label:hover + &-input { - .hover; + &:not(.@{cascader-prefix-cls}-picker-disabled &) { + .hover; + } } &-picker-small &-picker-clear, From c5a7f031e41427e98541c80972ac25bb49232af9 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Mon, 3 Aug 2020 15:01:16 +0800 Subject: [PATCH 31/57] docs: format api (#25973) --- components/auto-complete/index.en-US.md | 2 +- components/auto-complete/index.zh-CN.md | 2 +- components/form/index.en-US.md | 4 ++-- components/form/index.zh-CN.md | 18 +++++++++--------- components/input-number/index.zh-CN.md | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/auto-complete/index.en-US.md b/components/auto-complete/index.en-US.md index 771d343e86..30b913775c 100644 --- a/components/auto-complete/index.en-US.md +++ b/components/auto-complete/index.en-US.md @@ -24,7 +24,7 @@ When there is a need for autocomplete functionality. | defaultActiveFirstOption | Whether active first option by default | boolean | true | | | defaultValue | Initial selected option | string | - | | | disabled | Whether disabled select | boolean | false | | -| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded | boolean \| function(inputValue, option) | true | | +| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded | boolean \| function(inputValue, option) | true | | | placeholder | The placeholder of input | string | - | | | value | Selected option | string | - | | | onBlur | Called when leaving the component | function() | - | | diff --git a/components/auto-complete/index.zh-CN.md b/components/auto-complete/index.zh-CN.md index 603f97683c..bd69792b81 100644 --- a/components/auto-complete/index.zh-CN.md +++ b/components/auto-complete/index.zh-CN.md @@ -25,7 +25,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg | defaultActiveFirstOption | 是否默认高亮第一个选项 | boolean | true | | | defaultValue | 指定默认选中的条目 | string | - | | | disabled | 是否禁用 | boolean | false | | -| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false` | boolean \| function(inputValue, option) | true | | +| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 true,反之则返回 false | boolean \| function(inputValue, option) | true | | | getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codesandbox.io/s/4j168r7jw0) | function(triggerNode) | () => document.body | | | placeholder | 输入框提示 | string | - | | | value | 指定当前选中的条目 | string | - | | diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index a0aef7acba..0711f11683 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -184,8 +184,8 @@ Provide linkage between forms. If a sub form with `name` prop update, it will au | Property | Description | Type | Default | | --- | --- | --- | --- | -| onFormChange | Triggered when a sub form field updates | Function(formName: string, info: { changedFields, forms }) | - | -| onFormFinish | Triggered when a sub form submits | Function(formName: string, info: { values, forms }) | - | +| onFormChange | Triggered when a sub form field updates | function(formName: string, info: { changedFields, forms }) | - | +| onFormFinish | Triggered when a sub form submits | function(formName: string, info: { values, forms }) | - | ```jsx any | - | | | getValueProps | 为子元素添加额外的属性 | (value: any) => any | - | 4.2.0 | | hasFeedback | 配合 `validateStatus` 属性使用,展示校验状态图标,建议只配合 Input 组件使用 | boolean | false | | -| help | 提示信息,如不设置,则会根据校验规则自动生成 | string\|ReactNode | - | | +| help | 提示信息,如不设置,则会根据校验规则自动生成 | string \| ReactNode | - | | | htmlFor | 设置子元素 label `htmlFor` 属性 | string | - | | | initialValue | 设置子元素默认值,如果与 Form 的 `initialValues` 冲突则以 Form 为准 | string | - | 4.2.0 | | noStyle | 为 `true` 时不带样式,作为纯字段控件使用 | boolean | false | | -| label | `label` 标签的文本 | string\|ReactNode | - | | +| label | `label` 标签的文本 | string \| ReactNode | - | | | labelAlign | 标签文本对齐方式 | `left` \| `right` | `right` | | | labelCol | `label` 标签布局,同 `` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` 或 `sm: {span: 3, offset: 12}`。你可以通过 Form 的 `labelCol` 进行统一设置。当和 Form 同时设置时,以 Item 为准 | [object](/components/grid/#Col) | - | | | name | 字段名,支持数组 | [NamePath](#NamePath) | - | | @@ -186,8 +186,8 @@ Form.List 渲染表单相关操作函数。 | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| onFormChange | 子表单字段更新时触发 | Function(formName: string, info: { changedFields, forms }) | - | -| onFormFinish | 子表单提交时触发 | Function(formName: string, info: { values, forms }) | - | +| onFormChange | 子表单字段更新时触发 | function(formName: string, info: { changedFields, forms }) | - | +| onFormFinish | 子表单提交时触发 | function(formName: string, info: { values, forms }) | - | ```jsx Date: Mon, 3 Aug 2020 16:14:46 +0800 Subject: [PATCH 32/57] style: adjust mentions readonly cursor (#25977) --- components/mentions/style/index.less | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/mentions/style/index.less b/components/mentions/style/index.less index edb3c1ace3..b2476bfc47 100644 --- a/components/mentions/style/index.less +++ b/components/mentions/style/index.less @@ -64,10 +64,6 @@ background-color: transparent; } .placeholder(); - - &:read-only { - cursor: default; - } } &-measure { From 8c7f7b4295848cbefe0e16b59792c24e202030b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 3 Aug 2020 16:27:56 +0800 Subject: [PATCH 33/57] site: fix toc active menu (#25978) --- site/theme/template/Content/MainContent.jsx | 28 ++++++++------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index ef5b75f175..574b9dc9cc 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -59,11 +59,11 @@ function getSideBarOpenKeys(nextProps) { } function updateActiveToc(id) { - [].forEach.call(document.querySelectorAll('.toc-affix li a'), node => { - node.className = ''; - }); const currentNode = document.querySelectorAll(`.toc-affix li a[href="#${id}"]`)[0]; if (currentNode) { + [].forEach.call(document.querySelectorAll('.toc-affix li a'), node => { + node.className = ''; + }); currentNode.className = 'current'; } } @@ -76,8 +76,7 @@ class MainContent extends Component { }; componentDidMount() { - this.componentDidUpdate(); - window.addEventListener('load', this.handleInitialHashOnLoad); + window.addEventListener('load', this.handleLoad); window.addEventListener('hashchange', this.handleHashChange); } @@ -188,18 +187,11 @@ class MainContent extends Component { this.setState({ openKeys }); }; - handleInitialHashOnLoad = () => { - setTimeout(() => { - if (!window.location.hash) { - return; - } - const element = document.getElementById( - decodeURIComponent(window.location.hash.replace('#', '')), - ); - if (element && document.documentElement.scrollTop === 0) { - element.scrollIntoView(); - } - }, 0); + handleLoad = () => { + if (window.location.hash) { + updateActiveToc(window.location.hash.replace(/^#/, '')); + } + this.bindScroller(); }; handleHashChange = () => { @@ -223,7 +215,7 @@ class MainContent extends Component { this.scroller .setup({ step: '.markdown > h2, .code-box', // required - offset: 0, + offset: '10px', }) .onStepEnter(({ element }) => { updateActiveToc(element.id); From ebd693ab64b61d397a9497532ed32e6c5630cf95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 3 Aug 2020 18:33:00 +0800 Subject: [PATCH 34/57] =?UTF-8?q?test:=20=F0=9F=93=A6=20compressed-size.ym?= =?UTF-8?q?l=20(#25986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/compressed-size.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index fcfbf90b42..d96eb68dc7 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -1,6 +1,6 @@ name: 📦 Compressed Size -on: [pull_request] +on: [pull_request, push] jobs: build: From 038ce0e1b1c093a7e0649571a72b5b3ee414b8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 3 Aug 2020 18:37:32 +0800 Subject: [PATCH 35/57] =?UTF-8?q?Revert=20"test:=20=F0=9F=93=A6=20compress?= =?UTF-8?q?ed-size.yml=20(#25986)"=20(#25987)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ebd693ab64b61d397a9497532ed32e6c5630cf95. --- .github/workflows/compressed-size.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index d96eb68dc7..fcfbf90b42 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -1,6 +1,6 @@ name: 📦 Compressed Size -on: [pull_request, push] +on: [pull_request] jobs: build: From e6dd15f01f9d5da0a849a6543d7a34f64736382c Mon Sep 17 00:00:00 2001 From: flyerH Date: Mon, 3 Aug 2020 17:22:51 +0800 Subject: [PATCH 36/57] fix: fix breadcrumb separator --- components/breadcrumb/BreadcrumbItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index 9274a15842..7e2201e68f 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -17,7 +17,7 @@ interface BreadcrumbItemInterface extends React.FC { } const BreadcrumbItem: BreadcrumbItemInterface = ({ prefixCls: customizePrefixCls, - separator, + separator = '/', children, overlay, dropdownProps, From 3950dce5e37ca5caf2b91ec3140583077a4412ca Mon Sep 17 00:00:00 2001 From: flyerH Date: Mon, 3 Aug 2020 21:34:29 +0800 Subject: [PATCH 37/57] add test snapshot --- .../breadcrumb/__tests__/Breadcrumb.test.js | 19 ++++++++ .../__snapshots__/Breadcrumb.test.js.snap | 45 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.js b/components/breadcrumb/__tests__/Breadcrumb.test.js index 3cb4cad451..32fe92d43a 100644 --- a/components/breadcrumb/__tests__/Breadcrumb.test.js +++ b/components/breadcrumb/__tests__/Breadcrumb.test.js @@ -138,4 +138,23 @@ describe('Breadcrumb', () => { ); expect(wrapper).toMatchSnapshot(); }); + + // https://github.com/ant-design/ant-design/issues/25975 + it('should support Breadcrumb.Item default separator', () => { + const MockComponent = () => { + return ( + + Mock Node + + ); + }; + const wrapper = render( + + Location + + Application Center + + ); + expect(wrapper).toMatchSnapshot(); + }); }); diff --git a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap index 6e4412319d..2befd1bb32 100644 --- a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap +++ b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap @@ -185,6 +185,51 @@ exports[`Breadcrumb should render a menu 1`] = ` `; +exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = ` +
+ + + Location + + + / + + + + + + Mock Node + + + / + + + + + + Application Center + + + / + + +
+`; + exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
Date: Mon, 3 Aug 2020 21:53:13 +0800 Subject: [PATCH 38/57] code lint --- components/breadcrumb/__tests__/Breadcrumb.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.js b/components/breadcrumb/__tests__/Breadcrumb.test.js index 32fe92d43a..1878b497d5 100644 --- a/components/breadcrumb/__tests__/Breadcrumb.test.js +++ b/components/breadcrumb/__tests__/Breadcrumb.test.js @@ -153,7 +153,7 @@ describe('Breadcrumb', () => { Location Application Center - + , ); expect(wrapper).toMatchSnapshot(); }); From 2a05d5a93f3f26cd586abc0ff055b543d6a9fd19 Mon Sep 17 00:00:00 2001 From: Ivan Yakovlev Date: Mon, 3 Aug 2020 18:21:29 +0300 Subject: [PATCH 39/57] fix: remove typo (#25954) (#25990) Co-authored-by: Ivan.Yakovlev --- components/date-picker/locale/ru_RU.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/date-picker/locale/ru_RU.tsx b/components/date-picker/locale/ru_RU.tsx index a0e9fe1282..2c5a2bd315 100644 --- a/components/date-picker/locale/ru_RU.tsx +++ b/components/date-picker/locale/ru_RU.tsx @@ -15,7 +15,7 @@ const locale: PickerLocale = { monthPlaceholder: 'Выберите месяц', weekPlaceholder: 'Выберите неделю', rangePlaceholder: ['Начальная дата', 'Конечная дата'], - rangeYearPlaceholder: ['Начальный годr', 'Год окончания'], + rangeYearPlaceholder: ['Начальный год', 'Год окончания'], rangeMonthPlaceholder: ['Начальный месяц', 'Конечный месяц'], rangeWeekPlaceholder: ['Начальная неделя', 'Конечная неделя'], ...CalendarLocale, From 8d7cbbdb0ff4c048cdbfa45d5563212242b216e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Tue, 4 Aug 2020 11:43:11 +0800 Subject: [PATCH 40/57] fix: Table empty filters throw warning (#26001) close #25979 --- .../table/__tests__/Table.filter.test.js | 23 +++++++++++------- .../table/hooks/useFilter/FilterDropdown.tsx | 24 +++++++++++-------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js index 8a4990d9a5..ffff2c32ab 100644 --- a/components/table/__tests__/Table.filter.test.js +++ b/components/table/__tests__/Table.filter.test.js @@ -82,16 +82,23 @@ describe('Table.filter', () => { }); it('renders empty menu correctly', () => { - const wrapper = mount(createTable({ - columns: [ - { - ...column, - filters: [], - }, - ], - })); + jest.spyOn(console, 'error').mockImplementation(() => undefined); + const wrapper = mount( + createTable({ + columns: [ + { + ...column, + filters: [], + }, + ], + }), + ); wrapper.find('span.ant-dropdown-trigger').simulate('click', nativeEvent); expect(wrapper.find('Empty').length).toBe(1); + // eslint-disable-next-line no-console + expect(console.error).not.toHaveBeenCalled(); + // eslint-disable-next-line no-console + console.error.mockRestore(); }); it('renders radio filter correctly', () => { diff --git a/components/table/hooks/useFilter/FilterDropdown.tsx b/components/table/hooks/useFilter/FilterDropdown.tsx index 19d1e895df..cdd1d5c3ca 100644 --- a/components/table/hooks/useFilter/FilterDropdown.tsx +++ b/components/table/hooks/useFilter/FilterDropdown.tsx @@ -34,17 +34,21 @@ function renderFilterItems({ locale: TableLocale; }) { if (filters.length === 0) { + // wrapped with <> to avoid react warning + // https://github.com/ant-design/ant-design/issues/25979 return ( - + <> + + ); } return filters.map((filter, index) => { From de1941fa5ba9e6f1a95bb19f0ec4753d5fb94ee1 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 11:48:13 +0800 Subject: [PATCH 41/57] fix: select disabled icon cursor style (#26002) --- components/select/style/index.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/select/style/index.less b/components/select/style/index.less index be0e1fc6f6..d57a53ac47 100644 --- a/components/select/style/index.less +++ b/components/select/style/index.less @@ -124,6 +124,10 @@ pointer-events: auto; } } + + .@{select-prefix-cls}-disabled & { + cursor: not-allowed; + } } // ========================== Clear ========================== From 87555eb5a9dda92af7fb7a4d6146c08cfb1f98c3 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 11:56:18 +0800 Subject: [PATCH 42/57] style: optimize select multiple disabled style (#25980) * style: optimize select multiple disabled style * add var * add dark --- .../__tests__/__snapshots__/demo.test.js.snap | 283 ++++++++++++------ components/select/demo/multiple.md | 31 +- components/select/style/multiple.less | 11 + components/style/themes/dark.less | 3 + components/style/themes/default.less | 3 + 5 files changed, 236 insertions(+), 95 deletions(-) diff --git a/components/select/__tests__/__snapshots__/demo.test.js.snap b/components/select/__tests__/__snapshots__/demo.test.js.snap index 93756e3796..82a4633ea7 100644 --- a/components/select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/select/__tests__/__snapshots__/demo.test.js.snap @@ -1089,112 +1089,223 @@ exports[`renders ./components/select/demo/label-in-value.md correctly 1`] = ` `; exports[`renders ./components/select/demo/multiple.md correctly 1`] = ` - +
+ , +
, + , +] `; exports[`renders ./components/select/demo/optgroup.md correctly 1`] = ` diff --git a/components/select/demo/multiple.md b/components/select/demo/multiple.md index 30c9bf3bea..7f56fb0e37 100644 --- a/components/select/demo/multiple.md +++ b/components/select/demo/multiple.md @@ -28,15 +28,28 @@ function handleChange(value) { } ReactDOM.render( - , + <> + +
+ + , mountNode, ); ``` diff --git a/components/select/style/multiple.less b/components/select/style/multiple.less index b17fef7af3..3a7f1d0218 100644 --- a/components/select/style/multiple.less +++ b/components/select/style/multiple.less @@ -30,6 +30,11 @@ cursor: text; } + .@{select-prefix-cls}-disabled& { + background: @select-multiple-disabled-background; + cursor: not-allowed; + } + &::after { display: inline-block; width: 0; @@ -64,6 +69,12 @@ transition: font-size 0.3s, line-height 0.3s, height 0.3s; user-select: none; + .@{select-prefix-cls}-disabled& { + color: @select-multiple-item-disabled-color; + border-color: @select-multiple-item-disabled-border-color; + cursor: not-allowed; + } + // It's ok not to do this, but 24px makes bottom narrow in view should adjust &-content { display: inline-block; diff --git a/components/style/themes/dark.less b/components/style/themes/dark.less index 2a5b427abf..55c59ec50d 100644 --- a/components/style/themes/dark.less +++ b/components/style/themes/dark.less @@ -273,6 +273,9 @@ @select-clear-background: @component-background; @select-selection-item-bg: fade(@white, 8); @select-selection-item-border-color: @border-color-split; +@select-multiple-disabled-background: @component-background; +@select-multiple-item-disabled-color: #595959; +@select-multiple-item-disabled-border-color: @popover-background; // Cascader // --- diff --git a/components/style/themes/default.less b/components/style/themes/default.less index 265cdd30e6..3f07a58a58 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -433,6 +433,9 @@ @select-multiple-item-height: @input-height-base - @input-padding-vertical-base * 2; // Normal 24px @select-multiple-item-height-lg: 32px; @select-multiple-item-spacing-half: ceil(@input-padding-vertical-base / 2); +@select-multiple-disabled-background: @input-disabled-bg; +@select-multiple-item-disabled-color: #bfbfbf; +@select-multiple-item-disabled-border-color: @select-border-color; // Cascader // --- From 5461934f54a61422b38b43bf65ed34e816fbc5c5 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 15:00:42 +0800 Subject: [PATCH 43/57] fix: transfer disabled header dropdown cursor (#26005) --- components/transfer/style/index.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/transfer/style/index.less b/components/transfer/style/index.less index 13d513d49b..3e4d2b4e2e 100644 --- a/components/transfer/style/index.less +++ b/components/transfer/style/index.less @@ -94,6 +94,10 @@ transform: translateY(10%); cursor: pointer; .iconfont-size-under-12px(10px); + + &[disabled] { + cursor: not-allowed; + } } } From a33dc19ec8269f139c6327f8d5fcfbddddb6c2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Tue, 4 Aug 2020 15:35:03 +0800 Subject: [PATCH 44/57] =?UTF-8?q?chore:=20=F0=9F=9B=A0=20quit=20pub=20scri?= =?UTF-8?q?pt=20when=20throw=20error=20(#26006)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * eslint * chore: quit pub script when throw error close #25965 https://stackoverflow.com/a/2871034 * revert --- package.json | 2 +- scripts/test-all.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d6031e4ca1..82a2e724fb 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "start:preact": "antd-tools run clean && cross-env NODE_ENV=development REACT_ENV=preact concurrently \"npm run color-less\" \"bisheng start -c ./site/bisheng.config.js\"", "test": "jest --config .jest.js --no-cache", "test:update": "jest --config .jest.js --no-cache --update-snapshot", - "test-all": "./scripts/test-all.sh", + "test-all": "sh -e ./scripts/test-all.sh", "test-node": "jest --config .jest.node.js --no-cache", "tsc": "tsc --noEmit", "site:test": "jest --config .jest.site.js --cache=false", diff --git a/scripts/test-all.sh b/scripts/test-all.sh index edf8b0103f..92e40ad124 100755 --- a/scripts/test-all.sh +++ b/scripts/test-all.sh @@ -1,5 +1,11 @@ #!/bin/sh +echo "[TEST ALL] check-commit" +npm run check-commit + +echo "[TEST ALL] lint" +npm run lint + if [ "$1" != "--skip-build" ]; then echo "[TEST ALL] dist" npm run dist @@ -10,12 +16,6 @@ else echo "Skip build..." fi -echo "[TEST ALL] check-commit" -npm run check-commit - -echo "[TEST ALL] lint" -npm run lint - echo "[TEST ALL] dekko dist" node ./tests/dekko/dist.test.js From 81e21c18dcb655130371e8270882196f0f33483f Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 16:10:27 +0800 Subject: [PATCH 45/57] style: optimize pagination simple disabled --- components/pagination/demo/mini.md | 8 ++++++++ components/pagination/demo/simple.md | 9 ++++++++- components/pagination/style/index.less | 14 ++++++++++++++ package.json | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/components/pagination/demo/mini.md b/components/pagination/demo/mini.md index 1b226549bc..c4c785d4de 100644 --- a/components/pagination/demo/mini.md +++ b/components/pagination/demo/mini.md @@ -25,6 +25,14 @@ ReactDOM.render( + , mountNode, ); diff --git a/components/pagination/demo/simple.md b/components/pagination/demo/simple.md index 9e4d80abdf..91829496c6 100644 --- a/components/pagination/demo/simple.md +++ b/components/pagination/demo/simple.md @@ -16,5 +16,12 @@ Simple mode. ```jsx import { Pagination } from 'antd'; -ReactDOM.render(, mountNode); +ReactDOM.render( + <> + +
+ + , + mountNode, +); ``` diff --git a/components/pagination/style/index.less b/components/pagination/style/index.less index 4225a85eb4..ad858f89dc 100644 --- a/components/pagination/style/index.less +++ b/components/pagination/style/index.less @@ -282,6 +282,13 @@ &:hover { border-color: @primary-color; } + + &[disabled] { + color: @disabled-color; + background: @disabled-bg; + border-color: @border-color-base; + cursor: not-allowed; + } } } @@ -377,6 +384,9 @@ background: @disabled-bg; border-color: @border-color-base; cursor: not-allowed; + .@{pagination-prefix-cls}-simple& { + background: transparent; + } } .@{pagination-prefix-cls}-item-link-icon { @@ -386,6 +396,10 @@ .@{pagination-prefix-cls}-item-ellipsis { opacity: 1; } + + .@{pagination-prefix-cls}-simple-pager { + color: @disabled-color; + } } } diff --git a/package.json b/package.json index d6031e4ca1..309b288887 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "rc-mentions": "~1.4.0", "rc-menu": "~8.5.0", "rc-notification": "~4.4.0", - "rc-pagination": "~2.4.1", + "rc-pagination": "~2.4.5", "rc-picker": "~1.15.1", "rc-progress": "~3.0.0", "rc-rate": "~2.8.2", From b9ce4a869feec45a1c2b0b7ea0f06e15fb3739bd Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 16:13:27 +0800 Subject: [PATCH 46/57] update snap --- .../__tests__/__snapshots__/demo.test.js.snap | 452 +++++++++++++++--- 1 file changed, 374 insertions(+), 78 deletions(-) diff --git a/components/pagination/__tests__/__snapshots__/demo.test.js.snap b/components/pagination/__tests__/__snapshots__/demo.test.js.snap index da7d1630d0..24217b6fd3 100644 --- a/components/pagination/__tests__/__snapshots__/demo.test.js.snap +++ b/components/pagination/__tests__/__snapshots__/demo.test.js.snap @@ -2159,6 +2159,212 @@ Array [ , +
    +
  • + Total 50 items +
  • +
  • + +
  • +
  • + + 1 + +
  • +
  • + + 2 + +
  • +
  • + + 3 + +
  • +
  • + + 4 + +
  • +
  • + + 5 + +
  • +
  • + +
  • +
  • +
    +
    + + + + + 10 / page + +
    + +
    +
    + Go to + +
    +
  • +
, ] `; @@ -2455,92 +2661,182 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = ` `; exports[`renders ./components/pagination/demo/simple.md correctly 1`] = ` -
    -
  • - -
  • -
  • - - - / - - 5 -
  • -
  • - +
  • +
  • + - + / - -
  • -
+ 5 + +
  • + +
  • + , +
    , +
      +
    • + +
    • +
    • + + + / + + 5 +
    • +
    • + +
    • +
    , +] `; exports[`renders ./components/pagination/demo/total.md correctly 1`] = ` From b0536c2a43a30edbe301b3bb16e4cc1be9e8588b Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 17:49:31 +0800 Subject: [PATCH 47/57] docs: update table demo action (#26010) --- .../__tests__/__snapshots__/demo.test.js.snap | 705 ++++++++++-------- components/table/demo/dynamic-settings.md | 8 +- .../table/demo/nest-table-border-debug.md | 6 +- components/table/demo/nested-table.md | 6 +- components/table/demo/pagination.md | 18 +- 5 files changed, 430 insertions(+), 313 deletions(-) diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index aa6646f39e..3256f13669 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -2919,38 +2919,47 @@ Array [ - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + - - + +
    - More actions - - - - - + + + +
    + @@ -11463,16 +11553,25 @@ exports[`renders ./components/table/demo/pagination.md correctly 1`] = ` - - + + + - - + + + - - + + + diff --git a/components/table/demo/dynamic-settings.md b/components/table/demo/dynamic-settings.md index f82548b3de..d9e7e62125 100644 --- a/components/table/demo/dynamic-settings.md +++ b/components/table/demo/dynamic-settings.md @@ -14,7 +14,7 @@ title: Select different settings to see the result. ```jsx -import { Table, Switch, Radio, Form } from 'antd'; +import { Table, Switch, Radio, Form, Space } from 'antd'; import { DownOutlined } from '@ant-design/icons'; const columns = [ @@ -47,12 +47,12 @@ const columns = [ key: 'action', sorter: true, render: () => ( - - Delete + + Delete More actions - + ), }, ]; diff --git a/components/table/demo/nest-table-border-debug.md b/components/table/demo/nest-table-border-debug.md index dacc4c59c8..59151e24a9 100644 --- a/components/table/demo/nest-table-border-debug.md +++ b/components/table/demo/nest-table-border-debug.md @@ -15,7 +15,7 @@ debug: true To see if bordered style applied to other tables. ```jsx -import { Table, Badge, Menu, Dropdown, Switch, Form } from 'antd'; +import { Table, Badge, Menu, Dropdown, Switch, Form, Space } from 'antd'; import { DownOutlined } from '@ant-design/icons'; const menu = ( @@ -47,7 +47,7 @@ function NestedTable() { dataIndex: 'operation', key: 'operation', render: () => ( - + Pause Stop @@ -55,7 +55,7 @@ function NestedTable() { More - + ), }, ]; diff --git a/components/table/demo/nested-table.md b/components/table/demo/nested-table.md index c9305f176f..66ed9a07a6 100644 --- a/components/table/demo/nested-table.md +++ b/components/table/demo/nested-table.md @@ -14,7 +14,7 @@ title: Showing more detailed info of every row. ```jsx -import { Table, Badge, Menu, Dropdown } from 'antd'; +import { Table, Badge, Menu, Dropdown, Space } from 'antd'; import { DownOutlined } from '@ant-design/icons'; const menu = ( @@ -45,7 +45,7 @@ function NestedTable() { dataIndex: 'operation', key: 'operation', render: () => ( - + Pause Stop @@ -53,7 +53,7 @@ function NestedTable() { More - + ), }, ]; diff --git a/components/table/demo/pagination.md b/components/table/demo/pagination.md index 268fca7f6f..a4a7605151 100644 --- a/components/table/demo/pagination.md +++ b/components/table/demo/pagination.md @@ -14,7 +14,7 @@ title: Table pagination settings. ```jsx -import { Table, Tag, Radio } from 'antd'; +import { Table, Tag, Radio, Space } from 'antd'; const topOptions = [ { label: 'topLeft', value: 'topLeft' }, @@ -35,7 +35,7 @@ const columns = [ title: 'Name', dataIndex: 'name', key: 'name', - render: (text) => {text}, + render: text => {text}, }, { title: 'Age', @@ -51,9 +51,9 @@ const columns = [ title: 'Tags', key: 'tags', dataIndex: 'tags', - render: (tags) => ( + render: tags => ( - {tags.map((tag) => { + {tags.map(tag => { let color = tag.length > 5 ? 'geekblue' : 'green'; if (tag === 'loser') { color = 'volcano'; @@ -71,10 +71,10 @@ const columns = [ title: 'Action', key: 'action', render: (text, record) => ( - - Invite {record.name} + + Invite {record.name} Delete - + ), }, ]; @@ -117,7 +117,7 @@ class Demo extends React.Component { style={{ marginBottom: 10 }} options={topOptions} value={this.state.top} - onChange={(e) => { + onChange={e => { this.setState({ top: e.target.value }); }} /> @@ -126,7 +126,7 @@ class Demo extends React.Component { style={{ marginBottom: 10 }} options={bottomOptions} value={this.state.bottom} - onChange={(e) => { + onChange={e => { this.setState({ bottom: e.target.value }); }} /> From a2e4b22f545e2c950c5f8b5b6fb5864c8ed9067c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Tue, 4 Aug 2020 19:53:38 +0800 Subject: [PATCH 48/57] fix: Cascader text overflow in Firefox (#26011) close #25969 --- components/cascader/style/index.less | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index 20d5faa80c..81fda49683 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -192,8 +192,10 @@ } &-menu-item { padding: @cascader-dropdown-vertical-padding @control-padding-horizontal; + overflow: hidden; line-height: @cascader-dropdown-line-height; white-space: nowrap; + text-overflow: ellipsis; cursor: pointer; transition: all 0.3s; &:hover { From 93d8d661719d2259b52bf370faf01fb10d5527e0 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 19:56:10 +0800 Subject: [PATCH 49/57] style: add @btn-line-height (#26014) --- components/button/style/index.less | 2 +- components/style/themes/default.less | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/button/style/index.less b/components/button/style/index.less index 6344ded981..db6918f6f8 100644 --- a/components/button/style/index.less +++ b/components/button/style/index.less @@ -19,7 +19,7 @@ // Fixing https://github.com/ant-design/ant-design/issues/13214 // It is a render problem of chrome, which is only happened in the codesandbox demo // 0.001px solution works and I don't why - line-height: @line-height-base; + line-height: @btn-line-height; .btn; .btn-default; diff --git a/components/style/themes/default.less b/components/style/themes/default.less index 3f07a58a58..deca4764e5 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -205,6 +205,8 @@ @btn-height-lg: @height-lg; @btn-height-sm: @height-sm; +@btn-line-height: @line-height-base; + @btn-circle-size: @btn-height-base; @btn-circle-size-lg: @btn-height-lg; @btn-circle-size-sm: @btn-height-sm; From 7acb6d1cdcc285a7be047238b9e9984a844d2969 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Tue, 4 Aug 2020 20:00:21 +0800 Subject: [PATCH 50/57] fix: transfer pagination disabled (#26009) --- components/transfer/ListBody.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/transfer/ListBody.tsx b/components/transfer/ListBody.tsx index 4e46b03ea0..9608ab103e 100644 --- a/components/transfer/ListBody.tsx +++ b/components/transfer/ListBody.tsx @@ -114,6 +114,7 @@ class ListBody extends React.Component Date: Tue, 4 Aug 2020 23:07:49 +0800 Subject: [PATCH 51/57] chore: update snapshot --- .../__tests__/__snapshots__/index.test.js.snap | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index 54b0184ddd..b996d901db 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -1074,6 +1074,7 @@ exports[`Cascader should highlight keyword and filter when search in Cascader 1` >
    Date: Wed, 5 Aug 2020 09:55:53 +0900 Subject: [PATCH 52/57] docs: fix typo in resposive.md (#26019) --- components/list/demo/resposive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/list/demo/resposive.md b/components/list/demo/resposive.md index d58bc5ad48..4852836257 100644 --- a/components/list/demo/resposive.md +++ b/components/list/demo/resposive.md @@ -7,7 +7,7 @@ title: ## zh-CN -响应式的栅格列表。尺寸与 [Layout Grid](/components/grid-cn/#Col) 保持一致。 +响应式的栅格列表。尺寸与 [Layout Grid](/components/grid/#Col) 保持一致。 ## en-US From 683750c3961ecb8439f78e1fa0b54223cae7abbd Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Tue, 4 Aug 2020 21:06:17 -0400 Subject: [PATCH 53/57] docs: add en translation for buttons page (#25997) * spec: add en translation for buttons page * fix typo --- docs/spec/buttons.en-US.md | 170 +++++++++++++++++++++ docs/spec/{buttons.md => buttons.zh-CN.md} | 21 +-- 2 files changed, 176 insertions(+), 15 deletions(-) create mode 100644 docs/spec/buttons.en-US.md rename docs/spec/{buttons.md => buttons.zh-CN.md} (95%) diff --git a/docs/spec/buttons.en-US.md b/docs/spec/buttons.en-US.md new file mode 100644 index 0000000000..fa02f6910d --- /dev/null +++ b/docs/spec/buttons.en-US.md @@ -0,0 +1,170 @@ +--- +category: Design Patterns +type: Global Rules +order: 6 +title: Button +--- + +## Design Principal + +- Guide users to achieve the desired actions. +- Prevent user to make mistakes. + +## Types + +### Common Button Types + +
    + buttons +
    + +#### ① Default Button + +Default buttons are used for non-primary actions. If not sure which button type to choose from, the default button is always a safe bet. + +#### ② Primary Button + +Emphasize on "complete" or "recommend" action. There is at most one primary button per a button group. + +#### ③ Text Button + +Low emphasis and light-weight button type, such as actions in a table. + +#### ④ Icon Button + +Icon provides a visual clue. + +- It could fit more buttons in a small space. +- Buttons with icon only need to provide Tooltip to indicate the meaning of the button. + +#### ⑤ Text Button with Icon + +Provides supplementary meaning to the button. + +### Emphasis + + + +Common button types could be used to showcase to different **emphasis**. + +### Do & Don't + +Don't +Do + +Don't +Do + +### Special Button Types + +#### Dashed Button + + + +Guide users to add content in an area. + +#### Danger Button + + + +Do + +Do + +Warns users that there are risks involved in the action. + +#### Ghost Button + +Used in the dark or colored background. + + + +#### Call to Action + + + +Usually appeared alone and intend to used as a command. For example, it is used in the landing page or welcome banner. It could be as wide as its parent container. It is recommend to have just 1 "Call to Action" button in 1 screen. + +## Placement + + + +Place buttons in the users' reading pattern for the ease of discovery, such as the "F-Shaped Reading Pattern" and "Z-Shaped Reading Pattern". + +### How to Decide Button Placement? + +#### Page/Card/Section presents a subject, where it could be broken into 3 areas: + + + +- Header: subject's heading, summary and navigation +- Body: detailed content +- Footer: supplementary information or toolbar + +Place buttons in different areas could have different meanings. + +### When to Put Buttons in the Footer? + + + +- Body section has collapsed or hidden content, such as it could not show the entire content in one screen; +- Body section has complex content. For example, it has multiple subgroups and each subgroup has its own actions. Now it is needed to separate "Complete" action from body section to avoid confusion. + +In short, footer's purpose is to have a separation from body. + +## Ordering + +### Button Ordering + + + +Recommend to start from the reading flow, collapsed content should always be on the right. + +**How to Decide Button Ordering** + +- Conversation Flow: place buttons in the order similar to a conversation between computers and users. **Ask users the needed actions or your desired actions, then present the risks involved.** +- Navigation Flow: for example, if a button represents going back, should be placed on the left implying it is going to the previous step. + +### Button Group + +Do + +Don't + +When multiple buttons form a group, align buttons in one line with spaces in between. + +### Grouping Buttons + +When there are too many buttons on the screen, we could group relevant buttons together and use similar design for that group. If one of the buttons is primary action, we could still use emphasis. + + + +**Collapse buttons in the order of importance** + +
    + +Do +Don't + +**Flat display of all the buttons**: could separate different groups using space; or use divider to group similar buttons. + +## Label + +Do + +Don't + +Labels should clearly indicate to users what would happen when buttons got clicked. + +- Should use verb (except dropdown buttons) +- Should be relevant to the context and be concise. + +Ant Design use "OK / Cancel" as default label, but you could still use below methods to customize the label text: + +- Describe the action result. + + > Publish, Login, Register. + +- If primary action means negative, stress the consequences. + + > Are you sure to delete it? Delete / Cancel diff --git a/docs/spec/buttons.md b/docs/spec/buttons.zh-CN.md similarity index 95% rename from docs/spec/buttons.md rename to docs/spec/buttons.zh-CN.md index dd1fac5e77..21f48806aa 100644 --- a/docs/spec/buttons.md +++ b/docs/spec/buttons.zh-CN.md @@ -1,14 +1,8 @@ --- -category: - zh-CN: 设计模式 - en-US: Design Patterns -type: - zh-CN: 全局规则 - en-US: Global Rules +category: 设计模式 +type: 全局规则 order: 6 -title: - zh-CN: 按钮 - en-US: Button +title: 按钮 --- ## 设计目标 @@ -55,14 +49,11 @@ title: ### Do&Don't -错误示范 -正确示范 +错误示范 +正确示范 错误示范 -正确示范 - - - +正确示范 ### 特殊按钮 From c345580ea2b99f9b935f4a4dc6cf90c662c01cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 5 Aug 2020 10:08:57 +0800 Subject: [PATCH 54/57] fix: hidden should higher than noStyle (#26020) --- components/form/FormItem.tsx | 2 +- .../__snapshots__/index.test.js.snap | 31 ++++++++++++++++++- components/form/__tests__/index.test.js | 31 +++++++++++++------ 3 files changed, 53 insertions(+), 11 deletions(-) diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 1fec7126f2..547886afbf 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -142,7 +142,7 @@ function FormItem(props: FormItemProps): React.ReactElement { meta?: Meta, isRequired?: boolean, ): React.ReactNode { - if (noStyle) { + if (noStyle && !hidden) { return baseChildren; } diff --git a/components/form/__tests__/__snapshots__/index.test.js.snap b/components/form/__tests__/__snapshots__/index.test.js.snap index 16d0ba7a33..bffb463d61 100644 --- a/components/form/__tests__/__snapshots__/index.test.js.snap +++ b/components/form/__tests__/__snapshots__/index.test.js.snap @@ -1,6 +1,35 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Form Form item hidden 1`] = ` +exports[`Form Form item hidden noStyle should not work when hidden 1`] = ` +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +`; + +exports[`Form Form item hidden should work 1`] = `
    diff --git a/components/form/__tests__/index.test.js b/components/form/__tests__/index.test.js index 0e88c355b0..36b3e77944 100644 --- a/components/form/__tests__/index.test.js +++ b/components/form/__tests__/index.test.js @@ -699,14 +699,27 @@ describe('Form', () => { expect(wrapper.find('input').prop('onBlur')).toBeTruthy(); }); - it('Form item hidden', () => { - const wrapper = mount( - - -
    , - ); - expect(wrapper).toMatchRenderedSnapshot(); + describe('Form item hidden', () => { + it('should work', () => { + const wrapper = mount( +
    + +
    , + ); + expect(wrapper).toMatchRenderedSnapshot(); + }); + + it('noStyle should not work when hidden', () => { + const wrapper = mount( +
    + +
    , + ); + expect(wrapper).toMatchRenderedSnapshot(); + }); }); }); From c72be7bdda2bb2f3f320e8350464428d40f07c46 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Wed, 5 Aug 2020 11:28:57 +0800 Subject: [PATCH 55/57] docs: update grid demo (#26022) --- .../__tests__/__snapshots__/demo.test.js.snap | 28 ++----------------- components/grid/demo/flex-align.md | 12 ++------ components/grid/demo/flex-order.md | 8 ++---- components/grid/demo/flex-stretch.md | 12 ++------ components/grid/demo/flex.md | 20 ++++--------- components/grid/demo/gutter.md | 16 ++++------- components/grid/demo/playground.md | 6 ++-- components/grid/index.zh-CN.md | 2 +- 8 files changed, 25 insertions(+), 79 deletions(-) diff --git a/components/grid/__tests__/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap index 3d34c9e4e4..bc7923e065 100644 --- a/components/grid/__tests__/__snapshots__/demo.test.js.snap +++ b/components/grid/__tests__/__snapshots__/demo.test.js.snap @@ -76,7 +76,6 @@ Array [ , - + Vertical Gutter (px): ,
    , - + Column Count: ,

    {props.children} ReactDOM.render( <> - - Align Top - + Align Top col-4 @@ -38,9 +36,7 @@ ReactDOM.render( - - Align Middle - + Align Middle col-4 @@ -56,9 +52,7 @@ ReactDOM.render( - - Align Bottom - + Align Bottom col-4 diff --git a/components/grid/demo/flex-order.md b/components/grid/demo/flex-order.md index e6e1cdfe77..f394fbda36 100644 --- a/components/grid/demo/flex-order.md +++ b/components/grid/demo/flex-order.md @@ -18,9 +18,7 @@ import { Row, Col, Divider } from 'antd'; ReactDOM.render( <> - - Normal - + Normal 1 col-order-4 @@ -35,9 +33,7 @@ ReactDOM.render( 4 col-order-1 - - Responsive - + Responsive 1 col-order-responsive diff --git a/components/grid/demo/flex-stretch.md b/components/grid/demo/flex-stretch.md index a543157282..c94180a4a8 100644 --- a/components/grid/demo/flex-stretch.md +++ b/components/grid/demo/flex-stretch.md @@ -18,23 +18,17 @@ import { Row, Col, Divider } from 'antd'; ReactDOM.render( <> - - Percentage columns - + Percentage columns 2 / 5 3 / 5 - - Fill rest - + Fill rest 100px Fill Rest - - Raw flex style - + Raw flex style 1 1 200px 0 1 300px diff --git a/components/grid/demo/flex.md b/components/grid/demo/flex.md index 05b06d08c1..422916fcc9 100644 --- a/components/grid/demo/flex.md +++ b/components/grid/demo/flex.md @@ -20,9 +20,7 @@ import { Row, Col, Divider } from 'antd'; ReactDOM.render( <> - - sub-element align left - + sub-element align left col-4 col-4 @@ -30,9 +28,7 @@ ReactDOM.render( col-4 - - sub-element align center - + sub-element align center col-4 col-4 @@ -40,9 +36,7 @@ ReactDOM.render( col-4 - - sub-element align right - + sub-element align right col-4 col-4 @@ -50,9 +44,7 @@ ReactDOM.render( col-4 - - sub-element monospaced arrangement - + sub-element monospaced arrangement col-4 col-4 @@ -60,9 +52,7 @@ ReactDOM.render( col-4 - - sub-element align full - + sub-element align full col-4 col-4 diff --git a/components/grid/demo/gutter.md b/components/grid/demo/gutter.md index 5e006a64a3..e4487e8851 100644 --- a/components/grid/demo/gutter.md +++ b/components/grid/demo/gutter.md @@ -7,7 +7,7 @@ title: ## zh-CN -栅格常常需要和间隔进行配合,你可以使用 `Row` 的 `gutter` 属性,我们推荐使用 `(16+8n)px` 作为栅格间隔。(n 是自然数) +栅格常常需要和间隔进行配合,你可以使用 `Row` 的 `gutter` 属性,我们推荐使用 `(16+8n)px` 作为栅格间隔(n 是自然数)。 如果要支持响应式,可以写成 `{ xs: 8, sm: 16, md: 24, lg: 32 }`。 @@ -17,7 +17,7 @@ title: ## en-US -You can use the `gutter` property of `Row` as grid spacing, we recommend set it to `(16 + 8n) px`. (`n` stands for natural number.) +You can use the `gutter` property of `Row` as grid spacing, we recommend set it to `(16 + 8n) px` (`n` stands for natural number). You can set it to a object like `{ xs: 8, sm: 16, md: 24, lg: 32 }` for responsive design. @@ -32,9 +32,7 @@ const style = { background: '#0092ff', padding: '8px 0' }; ReactDOM.render( <> - - Horizontal - + Horizontal

    col-6
    @@ -49,9 +47,7 @@ ReactDOM.render(
    col-6
    - - Responsive - + Responsive
    col-6
    @@ -66,9 +62,7 @@ ReactDOM.render(
    col-6
    - - Vertical - + Vertical
    col-6
    diff --git a/components/grid/demo/playground.md b/components/grid/demo/playground.md index b2df71701b..d331f4c8e3 100644 --- a/components/grid/demo/playground.md +++ b/components/grid/demo/playground.md @@ -64,7 +64,7 @@ class App extends React.Component { } return ( <> - Horizontal Gutter (px): + Horizontal Gutter (px):
    gutters[value]} />
    - Vertical Gutter (px): + Vertical Gutter (px):
    vgutters[value]} />
    - Column Count: + Column Count:
    Date: Wed, 5 Aug 2020 14:50:52 +0800 Subject: [PATCH 56/57] docs: perfect site (#26025) --- components/affix/demo/debug.md | 2 +- components/affix/index.en-US.md | 2 +- components/affix/index.zh-CN.md | 2 +- components/breadcrumb/demo/basic.md | 2 +- components/breadcrumb/demo/separator-indepent.md | 2 +- components/breadcrumb/demo/separator.md | 2 +- components/breadcrumb/index.en-US.md | 4 ++-- components/breadcrumb/index.zh-CN.md | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/affix/demo/debug.md b/components/affix/demo/debug.md index abb3c0ebb1..5300bf5230 100644 --- a/components/affix/demo/debug.md +++ b/components/affix/demo/debug.md @@ -2,7 +2,7 @@ order: 99 title: zh-CN: 调整浏览器大小,观察 Affix 容器是否发生变化。跟随变化为正常。#17678 - en-US: + en-US: debug debug: true --- diff --git a/components/affix/index.en-US.md b/components/affix/index.en-US.md index 75a671b307..0d308594cb 100644 --- a/components/affix/index.en-US.md +++ b/components/affix/index.en-US.md @@ -19,8 +19,8 @@ Please note that Affix should not cover other content on the page, especially wh | --- | --- | --- | --- | | offsetBottom | Offset from the bottom of the viewport (in pixels) | number | - | | offsetTop | Offset from the top of the viewport (in pixels) | number | 0 | +| onChange | Callback for when Affix state is changed | function(affixed) | - | | target | Specifies the scrollable area DOM node | () => HTMLElement | () => window | -| onChange | Callback for when Affix state is changed | Function(affixed) | - | **Note:** Children of `Affix` must not have the property `position: absolute`, but you can set `position: absolute` on `Affix` itself: diff --git a/components/affix/index.zh-CN.md b/components/affix/index.zh-CN.md index 2bd659ac30..e053e73c27 100644 --- a/components/affix/index.zh-CN.md +++ b/components/affix/index.zh-CN.md @@ -20,8 +20,8 @@ cover: https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg | --- | --- | --- | --- | | offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | - | | offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | - | +| onChange | 固定状态改变时触发的回调函数 | function(affixed) | - | | target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | () => HTMLElement | () => window | -| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | - | **注意:**`Affix` 内的元素不要使用绝对定位,如需要绝对定位的效果,可以直接设置 `Affix` 为绝对定位: diff --git a/components/breadcrumb/demo/basic.md b/components/breadcrumb/demo/basic.md index 37d777fa01..63c31aa564 100644 --- a/components/breadcrumb/demo/basic.md +++ b/components/breadcrumb/demo/basic.md @@ -11,7 +11,7 @@ title: ## en-US -The simplest use +The simplest use. ```jsx import { Breadcrumb } from 'antd'; diff --git a/components/breadcrumb/demo/separator-indepent.md b/components/breadcrumb/demo/separator-indepent.md index b9b4a001d3..f889d49a51 100644 --- a/components/breadcrumb/demo/separator-indepent.md +++ b/components/breadcrumb/demo/separator-indepent.md @@ -11,7 +11,7 @@ title: ## en-US -The separator can be customized by setting the separator property: `Breadcrumb.Separator` +The separator can be customized by setting the separator property: `Breadcrumb.Separator`. ```jsx import { Breadcrumb } from 'antd'; diff --git a/components/breadcrumb/demo/separator.md b/components/breadcrumb/demo/separator.md index ccb4643f90..086794584a 100644 --- a/components/breadcrumb/demo/separator.md +++ b/components/breadcrumb/demo/separator.md @@ -11,7 +11,7 @@ title: ## en-US -The separator can be customized by setting the separator property: separator=">" +The separator can be customized by setting the separator property: separator=">". ```jsx import { Breadcrumb } from 'antd'; diff --git a/components/breadcrumb/index.en-US.md b/components/breadcrumb/index.en-US.md index c5ece2a2cb..aad519220a 100644 --- a/components/breadcrumb/index.en-US.md +++ b/components/breadcrumb/index.en-US.md @@ -28,10 +28,10 @@ A breadcrumb displays the current location within a hierarchy. It allows going b | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | +| dropdownProps | The dropdown props | [Dropdown](/components/dropdown) | - | | | href | Target of hyperlink | string | - | | | overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | | -| onClick | Set the handler to handle `click` event | (e:MouseEvent)=>void | - | | -| dropdownProps | The dropdown props | [Dropdown](/components/dropdown) | - | | +| onClick | Set the handler to handle `click` event | (e:MouseEvent) => void | - | | ### Breadcrumb.Separator diff --git a/components/breadcrumb/index.zh-CN.md b/components/breadcrumb/index.zh-CN.md index 4b425f8b4c..b2062fada9 100644 --- a/components/breadcrumb/index.zh-CN.md +++ b/components/breadcrumb/index.zh-CN.md @@ -29,10 +29,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | +| dropdownProps | 弹出下拉菜单的自定义配置 | [Dropdown](/components/dropdown) | - | | | href | 链接的目的地 | string | - | | | overlay | 下拉菜单的内容 | [Menu](/components/menu) \| () => Menu | - | | -| onClick | 单击事件 | (e:MouseEvent)=>void | - | | -| dropdownProps | 弹出下拉菜单的自定义配置 | [Dropdown](/components/dropdown) | - | | +| onClick | 单击事件 | (e:MouseEvent) => void | - | | ### Breadcrumb.Separator From 4dbf74afae3dbe668b02b699af7833019fcb1c7c Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 5 Aug 2020 15:00:35 +0800 Subject: [PATCH 57/57] fix typography snapshot --- .../typography/__tests__/__snapshots__/demo.test.js.snap | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/typography/__tests__/__snapshots__/demo.test.js.snap b/components/typography/__tests__/__snapshots__/demo.test.js.snap index cfb5d31009..d8b324f6a2 100644 --- a/components/typography/__tests__/__snapshots__/demo.test.js.snap +++ b/components/typography/__tests__/__snapshots__/demo.test.js.snap @@ -391,9 +391,8 @@ Array [
    - , -
    , - , +
    This is a copyable text.