From a6180008c5c7dbfa1cd747c66d01dd41b9079660 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, 26 Aug 2020 21:36:21 +0800 Subject: [PATCH 01/11] Revert "fix: ref lost in Radio.Group (#25328)" (#26418) This reverts commit 0a8641fc02c2db2cfa853e437e3af1cf1e966b71. --- components/radio/group.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/radio/group.tsx b/components/radio/group.tsx index f2fcf7f409..830de8000b 100644 --- a/components/radio/group.tsx +++ b/components/radio/group.tsx @@ -7,7 +7,7 @@ import { ConfigContext } from '../config-provider'; import SizeContext from '../config-provider/SizeContext'; import { RadioGroupContextProvider } from './context'; -const RadioGroup = React.forwardRef((props, ref) => { +const RadioGroup: React.FC = props => { const { getPrefixCls, direction } = React.useContext(ConfigContext); const size = React.useContext(SizeContext); @@ -53,7 +53,6 @@ const RadioGroup = React.forwardRef((props, ref) => { // 此处类型自动推导为 string return ( ((props, ref) => { // 此处类型自动推导为 { label: string value: string } return ( ((props, ref) => { {renderGroup()} ); -}); +}; RadioGroup.defaultProps = { buttonStyle: 'outline' as RadioGroupButtonStyle, From dd547aabfd33046afbe2432cf5c1d7704618792b Mon Sep 17 00:00:00 2001 From: ZHANGYU <723156735@qq.com> Date: Thu, 27 Aug 2020 11:45:10 +0800 Subject: [PATCH 02/11] docs: fix Tree prop autoExpandParent default value (#26426) --- components/tree/index.en-US.md | 2 +- components/tree/index.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tree/index.en-US.md b/components/tree/index.en-US.md index c931db1717..4c69a2d3a5 100644 --- a/components/tree/index.en-US.md +++ b/components/tree/index.en-US.md @@ -17,7 +17,7 @@ Almost anything can be represented in a tree structure. Examples include directo | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | -| autoExpandParent | Whether to automatically expand a parent treeNode | boolean | true | | +| autoExpandParent | Whether to automatically expand a parent treeNode | boolean | false | | | blockNode | Whether treeNode fill remaining horizontal space | boolean | false | | | checkable | Add a Checkbox before the treeNodes | boolean | false | | | checkedKeys | (Controlled) Specifies the keys of the checked treeNodes (PS: When this specifies the key of a treeNode which is also a parent treeNode, all the children treeNodes of will be checked; and vice versa, when it specifies the key of a treeNode which is a child treeNode, its parent treeNode will also be checked. When `checkable` and `checkStrictly` is true, its object has `checked` and `halfChecked` property. Regardless of whether the child or parent treeNode is checked, they won't impact each other | string\[] \| {checked: string\[], halfChecked: string\[]} | \[] | | diff --git a/components/tree/index.zh-CN.md b/components/tree/index.zh-CN.md index 3613efff2d..e0a4009c16 100644 --- a/components/tree/index.zh-CN.md +++ b/components/tree/index.zh-CN.md @@ -18,7 +18,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | -| autoExpandParent | 是否自动展开父节点 | boolean | true | | +| autoExpandParent | 是否自动展开父节点 | boolean | false | | | blockNode | 是否节点占据一行 | boolean | false | | | checkable | 节点前添加 Checkbox 复选框 | boolean | false | | | checkedKeys | (受控)选中复选框的树节点(注意:父子节点有关联,如果传入父节点 key,则子节点自动选中;相应当子节点 key 都传入,父节点也自动选中。当设置`checkable`和`checkStrictly`,它是一个有`checked`和`halfChecked`属性的对象,并且父子节点的选中与否不再关联 | string\[] \| {checked: string\[], halfChecked: string\[]} | \[] | | From 948ba88629561395b7f7f25361a3eeaed2ebf685 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Thu, 27 Aug 2020 17:02:02 +0800 Subject: [PATCH 03/11] docs: update image cover (#26431) * docs: update image cover * docs: update image cover --- components/image/index.en-US.md | 2 +- components/image/index.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/image/index.en-US.md b/components/image/index.en-US.md index 11809217a4..e95f376cf8 100644 --- a/components/image/index.en-US.md +++ b/components/image/index.en-US.md @@ -3,7 +3,7 @@ category: Components type: Data Display title: Image cols: 2 -cover: https://gw.alipayobjects.com/zos/bmw-prod/a77ae075-27de-49c9-9f44-a505f2be07fa.svg +cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg --- Previewable image. diff --git a/components/image/index.zh-CN.md b/components/image/index.zh-CN.md index 6257cfd581..d991e6fe11 100644 --- a/components/image/index.zh-CN.md +++ b/components/image/index.zh-CN.md @@ -4,7 +4,7 @@ subtitle: 图片 type: 数据展示 title: Image cols: 2 -cover: https://gw.alipayobjects.com/zos/bmw-prod/a77ae075-27de-49c9-9f44-a505f2be07fa.svg +cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg --- 可预览的图片。 From 3507a01798337863db835744bc83c1c87a647893 Mon Sep 17 00:00:00 2001 From: baidumap <460807394@qq.com> Date: Thu, 27 Aug 2020 21:15:52 +0800 Subject: [PATCH 04/11] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DdisabledTime?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=96=87=E6=A1=A3=20(#26439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复disabledTime参数文档 * fix: 英文版dates -> date Co-authored-by: jingruoyu --- components/date-picker/index.en-US.md | 2 +- components/date-picker/index.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index e7ad7f7033..64f17e2803 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -156,7 +156,7 @@ Added in `4.1.0`. | defaultValue | To set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | | | defaultPickerValue | To set default picker date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)\] | - | | | disabled | If disable start or end | \[boolean, boolean] | - | | -| disabledTime | To specify the time that cannot be selected | function(dates: \[moment, moment], partial: `start` \| `end`) | - | | +| disabledTime | To specify the time that cannot be selected | function(date: moment, partial: `start` \| `end`) | - | | | format | To set the date format, refer to [moment.js](http://momentjs.com/). When an array is provided, all values are used for parsing and first value is used for formatting | string \| string[] | `YYYY-MM-DD HH:mm:ss` | | | ranges | The preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | | | renderExtraFooter | Render extra footer in panel | () => React.ReactNode | - | | diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index 24c4f42022..aad5d41c72 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -157,7 +157,7 @@ import locale from 'antd/es/locale/zh_CN'; | defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | - | | | defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/)\[] | - | | | disabled | 禁用起始项 | \[boolean, boolean] | - | | -| disabledTime | 不可选择的时间 | function(dates: \[moment, moment\], partial: `start` \| `end`) | - | | +| disabledTime | 不可选择的时间 | function(date: moment, partial: `start` \| `end`) | - | | | format | 展示的日期格式 | string | `YYYY-MM-DD HH:mm:ss` | | | ranges | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | | | renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | | From d561d736143efe3bbaa0130e81d6e6df40cf00ae 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: Fri, 28 Aug 2020 11:29:37 +0800 Subject: [PATCH 05/11] fix: Space should support fragement (#26444) --- components/space/demo/debug.md | 6 ++++-- components/space/index.tsx | 7 ++++--- package.json | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/space/demo/debug.md b/components/space/demo/debug.md index 9ff81d81ce..78c4e7cf2e 100644 --- a/components/space/demo/debug.md +++ b/components/space/demo/debug.md @@ -19,8 +19,10 @@ import { Space, Button, Popconfirm } from 'antd'; ReactDOM.render( - Button - + <> + Button + + Button diff --git a/components/space/index.tsx b/components/space/index.tsx index 4d43ebbcf2..011ae6bd93 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import classNames from 'classnames'; +import toArray from 'rc-util/lib/Children/toArray'; import { ConfigConsumerProps, ConfigContext } from '../config-provider'; import { SizeType } from '../config-provider/SizeContext'; import Item from './Item'; @@ -31,9 +32,9 @@ const Space: React.FC = props => { ...otherProps } = props; - const len = React.Children.count(children); + const childNodes = toArray(children, { keepEmpty: true }); - if (len === 0) { + if (childNodes.length === 0) { return null; } @@ -55,7 +56,7 @@ const Space: React.FC = props => { // Calculate latest one let latestIndex = 0; - const nodes = React.Children.map(children, (child, i) => { + const nodes = childNodes.map((child, i) => { if (child !== null && child !== undefined) { latestIndex = i; } diff --git a/package.json b/package.json index 6032a2952c..d21adbeb9f 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "rc-tree-select": "~4.1.1", "rc-trigger": "~4.4.0", "rc-upload": "~3.2.0", - "rc-util": "^5.0.1", + "rc-util": "^5.1.0", "scroll-into-view-if-needed": "^2.2.25", "warning": "^4.0.3" }, From 77cbf724cf43a234a2b4ab631a8d919bd27d3a0d 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: Fri, 28 Aug 2020 11:46:35 +0800 Subject: [PATCH 06/11] fix: TimePicker.RangePicker props (#26446) --- components/time-picker/__tests__/type.test.tsx | 10 ++++++++++ components/time-picker/index.tsx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 components/time-picker/__tests__/type.test.tsx diff --git a/components/time-picker/__tests__/type.test.tsx b/components/time-picker/__tests__/type.test.tsx new file mode 100644 index 0000000000..92cdb9ce38 --- /dev/null +++ b/components/time-picker/__tests__/type.test.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +import TimePicker from '..'; + +describe('TimePicker.typescript', () => { + it('No need picker props', () => { + const rangePicker = ; + + expect(rangePicker).toBeTruthy(); + }); +}); diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index e83b4e89c1..ddf46c07ae 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -12,7 +12,7 @@ export interface TimePickerLocale { rangePlaceholder?: [string, string]; } -export interface TimeRangePickerProps extends RangePickerTimeProps {} +export interface TimeRangePickerProps extends Omit, 'picker'> {} const RangePicker = React.forwardRef((props, ref) => { return ; From c47bfb0c918de3d5a512c5bcd9afcc66e1204788 Mon Sep 17 00:00:00 2001 From: zhangchen Date: Fri, 28 Aug 2020 15:48:19 +0800 Subject: [PATCH 07/11] fix: Table topPaginationNode display logic should same with bottomPaginationNode (#26143) * fix: Tree bottomPaginationNode display logic should same with bottomPaginationNode * update: test --- components/table/Table.tsx | 4 +- .../table/__tests__/Table.pagination.test.js | 47 +++++++------------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 4d4f9d5e24..1bff7e2fe8 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -420,7 +420,7 @@ function Table(props: TableProps) { let topPaginationNode: React.ReactNode; let bottomPaginationNode: React.ReactNode; - if (pagination !== false) { + if (pagination !== false && mergedPagination?.total) { let paginationSize: TablePaginationConfig['size']; if (mergedPagination.size) { paginationSize = mergedPagination.size; @@ -495,7 +495,7 @@ function Table(props: TableProps) { internalRefs={internalRefs as any} transformColumns={transformColumns} /> - {mergedData && mergedData.length > 0 && bottomPaginationNode} + {bottomPaginationNode} ); diff --git a/components/table/__tests__/Table.pagination.test.js b/components/table/__tests__/Table.pagination.test.js index da85ba5792..f6a56bba14 100644 --- a/components/table/__tests__/Table.pagination.test.js +++ b/components/table/__tests__/Table.pagination.test.js @@ -378,39 +378,24 @@ describe('Table.pagination', () => { ); }); - it('should render pagination after last item on last page being removed with async mode', () => { - const lastPageNum = data.length; + it('should render pagination after last item on last page being removed', () => { + const total = data.length; + const paginationProp = { + pageSize: 1, + total, + current: total, + position: ['topLeft', 'bottomLeft'], + }; const wrapper = mount( - createTable({ pagination: { pageSize: 1, total: data.length, current: lastPageNum } }), + createTable({ + pagination: paginationProp, + }), ); - const newCol = [ - { - title: 'Name', - dataIndex: 'name', - }, - { - title: 'Action', - dataIndex: 'name', - render(_, record) { - const deleteRow = () => { - const newData = data.filter(d => d.key !== record.key); - wrapper.setProps({ - dataSource: newData, - pagination: { pageSize: 1, total: newData.length, current: lastPageNum }, - }); - }; - return ( - - Delete - - ); - }, - }, - ]; - - wrapper.setProps({ columns: newCol }); - wrapper.find('.btn-delete').simulate('click'); - expect(wrapper.find('.ant-pagination')).toHaveLength(1); + wrapper.setProps({ + dataSource: data.slice(total - 1), + pagination: { ...paginationProp, total: total - 1 }, + }); + expect(wrapper.find('.ant-pagination')).toHaveLength(2); }); }); From 2005546d227534210ab80fadfb6a120235b2a733 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 28 Aug 2020 21:43:44 +0800 Subject: [PATCH 08/11] test: update snap (#26467) --- .../__snapshots__/index.test.js.snap | 2 +- .../__snapshots__/index.test.js.snap | 24 +- .../__snapshots__/components.test.js.snap | 96 ++-- .../__snapshots__/DatePicker.test.js.snap | 4 +- .../__snapshots__/RangePicker.test.js.snap | 2 +- .../__snapshots__/other.test.js.snap | 4 +- .../__snapshots__/index.test.js.snap | 4 +- .../__snapshots__/pagination.test.js.snap | 2 +- .../__snapshots__/index.test.js.snap | 462 +++++++++--------- .../__snapshots__/index.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- .../__snapshots__/index.test.js.snap | 6 +- .../__snapshots__/Table.filter.test.js.snap | 6 +- .../Table.rowSelection.test.js.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 23 +- .../__snapshots__/index.test.js.snap | 2 +- .../__snapshots__/index.test.js.snap | 2 +- 17 files changed, 336 insertions(+), 311 deletions(-) diff --git a/components/auto-complete/__tests__/__snapshots__/index.test.js.snap b/components/auto-complete/__tests__/__snapshots__/index.test.js.snap index 3f5e48c3cc..0770affef5 100644 --- a/components/auto-complete/__tests__/__snapshots__/index.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/index.test.js.snap @@ -30,7 +30,7 @@ exports[`AutoComplete legacy dataSource should accept react element option 1`] =
                    @@ -37267,7 +37267,7 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize large
                    @@ -37385,7 +37385,7 @@ exports[`ConfigProvider components TreeSelect configProvider componentSize middl
                    @@ -37503,7 +37503,7 @@ exports[`ConfigProvider components TreeSelect configProvider virtual and dropdow
                    @@ -37621,7 +37621,7 @@ exports[`ConfigProvider components TreeSelect normal 1`] = `
                    @@ -37739,7 +37739,7 @@ exports[`ConfigProvider components TreeSelect prefixCls 1`] = `
                    diff --git a/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap b/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap index 9df2139763..890d36b55f 100644 --- a/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap @@ -45,7 +45,7 @@ Array [
                    menu @@ -32,7 +32,7 @@ Array [
                    string diff --git a/components/list/__tests__/__snapshots__/pagination.test.js.snap b/components/list/__tests__/__snapshots__/pagination.test.js.snap index 071b121c2a..e9174ede74 100644 --- a/components/list/__tests__/__snapshots__/pagination.test.js.snap +++ b/components/list/__tests__/__snapshots__/pagination.test.js.snap @@ -396,7 +396,7 @@ exports[`List.pagination should change page size work 2`] = `
                        - + + + + + + + + diff --git a/components/time-picker/__tests__/__snapshots__/index.test.js.snap b/components/time-picker/__tests__/__snapshots__/index.test.js.snap index 01262c9178..9de3b18aff 100644 --- a/components/time-picker/__tests__/__snapshots__/index.test.js.snap +++ b/components/time-picker/__tests__/__snapshots__/index.test.js.snap @@ -118,7 +118,7 @@ Array [
                        From ae650485a0f9484a01078d96e86b74fbf9f5eb42 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 28 Aug 2020 22:55:16 +0800 Subject: [PATCH 09/11] docs: optimize site menu sort (#26471) --- site/theme/template/Content/MainContent.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index 574b9dc9cc..dc514fbcc8 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -135,7 +135,7 @@ class MainContent extends Component { return ( {menuItem.children - .sort((a, b) => a.title.charCodeAt(0) - b.title.charCodeAt(0)) + .sort((a, b) => a.title.localeCompare(b.title)) .map(leaf => this.generateMenuItem(false, leaf, footerNavIcons))} ); From 221a38db915e1f4a08ced650ac74794796ad9448 Mon Sep 17 00:00:00 2001 From: Rainy Date: Fri, 28 Aug 2020 23:08:33 +0800 Subject: [PATCH 10/11] fix: no shadow in the style of the Select focus. (#26465) Fix #26255 style error. --- components/select/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/select/style/index.less b/components/select/style/index.less index f2833afff7..35fbb95daa 100644 --- a/components/select/style/index.less +++ b/components/select/style/index.less @@ -28,7 +28,7 @@ } } - .@{select-prefix-cls}-focused&:not(.@{select-prefix-cls}-disabled&) { + .@{select-prefix-cls}-focused:not(.@{select-prefix-cls}-disabled)& { .active(); } From 7e223c1edc41d07027b9ccfa7558ec947df2c12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20K=C3=9C=C3=87=C3=9CK?= Date: Sat, 29 Aug 2020 07:11:22 +0300 Subject: [PATCH 11/11] Update index.en-US.md (#26476) Type for Checkbox.Group Options is not valid on docs. --- components/checkbox/index.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/checkbox/index.en-US.md b/components/checkbox/index.en-US.md index b813651fb3..fa4f177dc5 100644 --- a/components/checkbox/index.en-US.md +++ b/components/checkbox/index.en-US.md @@ -34,7 +34,7 @@ Checkbox component. | defaultValue | Default selected value | string\[] | \[] | | | disabled | If disable all checkboxes | boolean | false | | | name | The `name` property of all `input[type="checkbox"]` children | string | - | | -| options | Specifies options | string\[] | \[] | | +| options | Specifies options | Array[] | \[] | | | value | Used for setting the currently selected value | string\[] | \[] | | | onChange | The callback function that is triggered when the state changes | function(checkedValue) | - | |