From 299592d9b7f5590946d0ddf682234b839642faa9 Mon Sep 17 00:00:00 2001 From: "@linhf2023" <32009993+linhf123@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:34:54 +0800 Subject: [PATCH 1/9] fix(popConfirm): visible prop compatible (#45702) * fix: visible compatible * chore: add test --------- Co-authored-by: linhf123 Co-authored-by: MadCcc --- .../popconfirm/__tests__/index.test.tsx | 32 +++++++++++++++++++ components/popconfirm/index.tsx | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/components/popconfirm/__tests__/index.test.tsx b/components/popconfirm/__tests__/index.test.tsx index 2d6f11e080..b238a95113 100644 --- a/components/popconfirm/__tests__/index.test.tsx +++ b/components/popconfirm/__tests__/index.test.tsx @@ -128,6 +128,38 @@ describe('Popconfirm', () => { jest.useRealTimers(); }); + it('should be controlled by visible', () => { + jest.useFakeTimers(); + const popconfirm = render( + + show me your code + , + ); + + expect(popconfirm.container.querySelector('.ant-popover')).toBe(null); + popconfirm.rerender( + + show me your code + , + ); + + expect(popconfirm.container.querySelector('.ant-popover')).not.toBe(null); + expect(popconfirm.container.querySelector('.ant-popover')?.className).not.toContain( + 'ant-popover-hidden', + ); + + popconfirm.rerender( + + show me your code + , + ); + act(() => { + jest.runAllTimers(); + }); + expect(popconfirm.container.querySelector('.ant-popover')).not.toBe(null); + jest.useRealTimers(); + }); + it('should trigger onConfirm and onCancel', async () => { const confirm = jest.fn(); const cancel = jest.fn(); diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index b18ac6cd53..de36dd66a9 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -54,8 +54,8 @@ const Popconfirm = React.forwardRef((props, ref) => const { getPrefixCls } = React.useContext(ConfigContext); const [open, setOpen] = useMergedState(false, { - value: props.open, - defaultValue: props.defaultOpen, + value: props.open ?? props.visible, + defaultValue: props.defaultOpen ?? props.defaultVisible, }); const settingOpen = ( From b99902ab76ef05746f72fe69f4575de77552f57a Mon Sep 17 00:00:00 2001 From: Kilig <1775814844@qq.com> Date: Wed, 8 Nov 2023 14:46:05 +0800 Subject: [PATCH 2/9] docs:(Tree): Parameter type repair (#45715) --- components/tree/index.en-US.md | 6 +++--- components/tree/index.zh-CN.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/tree/index.en-US.md b/components/tree/index.en-US.md index 8d890db815..35c1106d74 100644 --- a/components/tree/index.en-US.md +++ b/components/tree/index.en-US.md @@ -71,17 +71,17 @@ Common props ref:[Common props](/docs/react/common-props) | titleRender | Customize tree node title render | (nodeData) => ReactNode | - | 4.5.0 | | treeData | The treeNodes data Array, if set it then you need not to construct children TreeNode. (key should be unique across the whole array) | array<{ key, title, children, \[disabled, selectable] }> | - | | | virtual | Disable virtual scroll when set to false | boolean | true | 4.1.0 | -| onCheck | Callback function for when the onCheck event occurs | function(checkedKeys, e:{checked: bool, checkedNodes, node, event, halfCheckedKeys}) | - | | +| onCheck | Callback function for when the onCheck event occurs | function(checkedKeys, e:{checked: boolean, checkedNodes, node, event, halfCheckedKeys}) | - | | | onDragEnd | Callback function for when the onDragEnd event occurs | function({event, node}) | - | | | onDragEnter | Callback function for when the onDragEnter event occurs | function({event, node, expandedKeys}) | - | | | onDragLeave | Callback function for when the onDragLeave event occurs | function({event, node}) | - | | | onDragOver | Callback function for when the onDragOver event occurs | function({event, node}) | - | | | onDragStart | Callback function for when the onDragStart event occurs | function({event, node}) | - | | | onDrop | Callback function for when the onDrop event occurs | function({event, node, dragNode, dragNodesKeys}) | - | | -| onExpand | Callback function for when a treeNode is expanded or collapsed | function(expandedKeys, {expanded: bool, node}) | - | | +| onExpand | Callback function for when a treeNode is expanded or collapsed | function(expandedKeys, {expanded: boolean, node}) | - | | | onLoad | Callback function for when a treeNode is loaded | function(loadedKeys, {event, node}) | - | | | onRightClick | Callback function for when the user right clicks a treeNode | function({event, node}) | - | | -| onSelect | Callback function for when the user clicks a treeNode | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - | | +| onSelect | Callback function for when the user clicks a treeNode | function(selectedKeys, e:{selected: boolean, selectedNodes, node, event}) | - | | ### TreeNode props diff --git a/components/tree/index.zh-CN.md b/components/tree/index.zh-CN.md index c2812e6f76..0db46fa183 100644 --- a/components/tree/index.zh-CN.md +++ b/components/tree/index.zh-CN.md @@ -73,17 +73,17 @@ demo: | titleRender | 自定义渲染节点 | (nodeData) => ReactNode | - | 4.5.0 | | treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(key 在整个树范围内唯一) | array<{key, title, children, \[disabled, selectable]}> | - | | | virtual | 设置 false 时关闭虚拟滚动 | boolean | true | 4.1.0 | -| onCheck | 点击复选框触发 | function(checkedKeys, e:{checked: bool, checkedNodes, node, event, halfCheckedKeys}) | - | | +| onCheck | 点击复选框触发 | function(checkedKeys, e:{checked: boolean, checkedNodes, node, event, halfCheckedKeys}) | - | | | onDragEnd | dragend 触发时调用 | function({event, node}) | - | | | onDragEnter | dragenter 触发时调用 | function({event, node, expandedKeys}) | - | | | onDragLeave | dragleave 触发时调用 | function({event, node}) | - | | | onDragOver | dragover 触发时调用 | function({event, node}) | - | | | onDragStart | 开始拖拽时调用 | function({event, node}) | - | | | onDrop | drop 触发时调用 | function({event, node, dragNode, dragNodesKeys}) | - | | -| onExpand | 展开/收起节点时触发 | function(expandedKeys, {expanded: bool, node}) | - | | +| onExpand | 展开/收起节点时触发 | function(expandedKeys, {expanded: boolean, node}) | - | | | onLoad | 节点加载完毕时触发 | function(loadedKeys, {event, node}) | - | | | onRightClick | 响应右键点击 | function({event, node}) | - | | -| onSelect | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - | | +| onSelect | 点击树节点触发 | function(selectedKeys, e:{selected: boolean, selectedNodes, node, event}) | - | | ### TreeNode props From c3a63a99272fd624e7dbb4a92585006eb92fb43c Mon Sep 17 00:00:00 2001 From: MadCcc Date: Wed, 8 Nov 2023 16:27:50 +0800 Subject: [PATCH 3/9] fix: component token should work (#45721) --- components/message/__tests__/hooks.test.tsx | 30 ++++++++++++++++++- .../theme/util/genComponentStyleHook.ts | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/components/message/__tests__/hooks.test.tsx b/components/message/__tests__/hooks.test.tsx index 4d5cf68f78..d5ba98c426 100644 --- a/components/message/__tests__/hooks.test.tsx +++ b/components/message/__tests__/hooks.test.tsx @@ -1,5 +1,5 @@ /* eslint-disable jsx-a11y/control-has-associated-label */ -import React from 'react'; +import React, { useEffect } from 'react'; import { act } from 'react-dom/test-utils'; import { StyleProvider, createCache, extractStyle } from '@ant-design/cssinjs'; import message from '..'; @@ -271,4 +271,32 @@ describe('message.hooks', () => { const styleText = extractStyle(cache, true); expect(styleText).not.toContain('.ant-message'); }); + + it('component fontSize should work', () => { + const Demo = () => { + const [api, holder] = message.useMessage(); + + useEffect(() => { + api.info({ + content:
, + className: 'fontSize', + }); + }, []); + + return ( + + {holder} + + ); + }; + + render(); + + const msg = document.querySelector('.fontSize'); + + expect(msg).toBeTruthy(); + expect(msg).toHaveStyle({ + fontSize: '20px', + }); + }); }); diff --git a/components/theme/util/genComponentStyleHook.ts b/components/theme/util/genComponentStyleHook.ts index 74fa3d2501..ea1f7d3da3 100644 --- a/components/theme/util/genComponentStyleHook.ts +++ b/components/theme/util/genComponentStyleHook.ts @@ -170,7 +170,7 @@ export default function genComponentStyleHook Date: Wed, 8 Nov 2023 16:40:25 +0800 Subject: [PATCH 4/9] docs: fix TreeSelect demo onChange log (#45722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 伐宿 --- components/tree-select/demo/checkable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tree-select/demo/checkable.tsx b/components/tree-select/demo/checkable.tsx index da48d91a65..91f6d81b23 100644 --- a/components/tree-select/demo/checkable.tsx +++ b/components/tree-select/demo/checkable.tsx @@ -44,7 +44,7 @@ const App: React.FC = () => { const [value, setValue] = useState(['0-0-0']); const onChange = (newValue: string[]) => { - console.log('onChange ', value); + console.log('onChange ', newValue); setValue(newValue); }; From 39a5d2b260481d0133ecf576cd6eda0cdf3a5a1f Mon Sep 17 00:00:00 2001 From: Mattis Abrahamsson <60041024+MattisAbrahamsson@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:13:00 +0100 Subject: [PATCH 5/9] docs: Fix typo in Drawer documentation (#45726) Signed-off-by: Mattis Abrahamsson <60041024+MattisAbrahamsson@users.noreply.github.com> --- components/drawer/index.en-US.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drawer/index.en-US.md b/components/drawer/index.en-US.md index 2f92b52414..e86bbe0da7 100644 --- a/components/drawer/index.en-US.md +++ b/components/drawer/index.en-US.md @@ -49,7 +49,7 @@ Common props ref:[Common props](/docs/react/common-props) | afterOpenChange | Callback after the animation ends when switching drawers | function(open) | - | | | className | Config Drawer Panel className. Use `rootClassName` if want to config top dom style | string | - | | | classNames | Config Drawer build-in module's className | `header?: string; body?: string; footer?: string; mask?: string; wrapper?: string;` | - | | -| styles | onfig Drawer build-in module's style | `header?: CSSProperties; body?: CSSProperties; footer?: CSSProperties; mask?: CSSProperties; wrapper?: CSSProperties;` | - | 5.10.0 | +| styles | Config Drawer build-in module's style | `header?: CSSProperties; body?: CSSProperties; footer?: CSSProperties; mask?: CSSProperties; wrapper?: CSSProperties;` | - | 5.10.0 | | closeIcon | Custom close icon. 5.7.0: close button will be hidden when setting to `null` or `false` | boolean \| ReactNode | <CloseOutlined /> | | | contentWrapperStyle | Style of the drawer wrapper of content part | CSSProperties | - | | | destroyOnClose | Whether to unmount child components on closing drawer or not | boolean | false | | From 406e4aeb6fa8178885affa6c315bf9b8d63522a6 Mon Sep 17 00:00:00 2001 From: vagusX Date: Wed, 8 Nov 2023 20:43:18 +0800 Subject: [PATCH 6/9] docs: add Upload disabled demo for debug usage (#45723) --- .../__snapshots__/demo-extend.test.ts.snap | 754 ++++++++++++++++++ .../__tests__/__snapshots__/demo.test.ts.snap | 714 +++++++++++++++++ components/upload/demo/debug-disabled.md | 7 + components/upload/demo/debug-disabled.tsx | 69 ++ components/upload/index.en-US.md | 3 +- components/upload/index.zh-CN.md | 3 +- 6 files changed, 1548 insertions(+), 2 deletions(-) create mode 100644 components/upload/demo/debug-disabled.md create mode 100644 components/upload/demo/debug-disabled.tsx diff --git a/components/upload/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/upload/__tests__/__snapshots__/demo-extend.test.ts.snap index 13880f9a24..12d27c861c 100644 --- a/components/upload/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/upload/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -519,6 +519,760 @@ exports[`renders components/upload/demo/customize-progress-bar.tsx extend contex exports[`renders components/upload/demo/customize-progress-bar.tsx extend context correctly 2`] = `[]`; +exports[`renders components/upload/demo/debug-disabled.tsx extend context correctly 1`] = ` +
+
+ +
+ + + Click Text to Upload + +
+
+ +
+
+ +
+ + + + +
+
+ +
+
+ +
+ + +
+
+
+ Uploading... +
+ + image.png + +
+
+
+
+
+ + + +
+ + image.png + + + + + + + + +
+
+
+
+ +
+
+
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+ +
+
+ +
+ + +
+
+
+ Uploading... +
+ + image.png + +
+
+
+
+
+ + + +
+ + image.png + + + + + + + + +
+
+
+
+ +
+
+
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+ +
+
+ +
+ + +
+

+ + + +

+

+ Click or drag file to this area to upload +

+

+ Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files. +

+
+
+
+
+ +
+
+`; + +exports[`renders components/upload/demo/debug-disabled.tsx extend context correctly 2`] = `[]`; + exports[`renders components/upload/demo/defaultFileList.tsx extend context correctly 1`] = ` `; +exports[`renders components/upload/demo/debug-disabled.tsx correctly 1`] = ` +
+
+ +
+ + + Click Text to Upload + +
+
+ +
+
+ +
+ + + + +
+
+ +
+
+ +
+ + +
+
+
+ Uploading... +
+ + image.png + +
+
+
+
+
+ + + +
+ + image.png + + + + + + + + +
+
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+
+
+
+ +
+ + +
+
+
+ Uploading... +
+ + image.png + +
+
+
+
+
+ + + +
+ + image.png + + + + + + + + +
+
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+
+
+
+ +
+ + +
+

+ + + +

+

+ Click or drag file to this area to upload +

+

+ Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files. +

+
+
+
+
+ +
+
+`; + exports[`renders components/upload/demo/defaultFileList.tsx correctly 1`] = ` { + const uploadButton = ( +
+ +
Upload
+
+ ); + + return ( + + Click Text to Upload + + + + + {uploadButton} + + + {uploadButton} + + +

+ +

+

Click or drag file to this area to upload

+

+ Support for a single or bulk upload. Strictly prohibited from uploading company data or + other banned files. +

+
+
+ ); +}; + +export default App; diff --git a/components/upload/index.en-US.md b/components/upload/index.en-US.md index d7c32eb5a9..1321dbd6da 100644 --- a/components/upload/index.en-US.md +++ b/components/upload/index.en-US.md @@ -42,6 +42,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v Crop image before uploading Customize Progress Bar Component Token +Debug Disabled Styles ## API @@ -56,7 +57,7 @@ Common props ref:[Common props](/docs/react/common-props) | data | Uploading extra params or function which can return uploading extra params | object \| (file) => object \| Promise<object> | - | | | defaultFileList | Default list of files that have been uploaded | object\[] | - | | | directory | Support upload whole directory ([caniuse](https://caniuse.com/#feat=input-file-directory)) | boolean | false | | -| disabled | Disable upload button | boolean | false | | +| disabled | Disable upload button | boolean | false | When customizing Upload children, please pass the disabled attribute to the child node at the same time to ensure the disabled rendering effect is consistent. | | fileList | List of files that have been uploaded (controlled). Here is a common issue [#2423](https://github.com/ant-design/ant-design/issues/2423) when using it | [UploadFile](#uploadfile)\[] | - | | | headers | Set request headers, valid above IE10 | object | - | | | iconRender | Custom show icon | (file: UploadFile, listType?: UploadListType) => ReactNode | - | | diff --git a/components/upload/index.zh-CN.md b/components/upload/index.zh-CN.md index 58ecfc11c9..644f8ff739 100644 --- a/components/upload/index.zh-CN.md +++ b/components/upload/index.zh-CN.md @@ -43,6 +43,7 @@ demo: 上传前裁切图片 自定义进度条样式 组件 Token +Debug Disabled Styles ## API @@ -57,7 +58,7 @@ demo: | data | 上传所需额外参数或返回上传额外参数的方法 | object\|(file) => object \| Promise<object> | - | | | defaultFileList | 默认已经上传的文件列表 | object\[] | - | | | directory | 支持上传文件夹([caniuse](https://caniuse.com/#feat=input-file-directory)) | boolean | false | | -| disabled | 是否禁用 | boolean | false | | +| disabled | 是否禁用 | boolean | false | 对于自定义 Upload children 时请将 disabled 属性同时传给 child node 确保 disabled 渲染效果保持一致 | | fileList | 已经上传的文件列表(受控),使用此参数时,如果遇到 `onChange` 只调用一次的问题,请参考 [#2423](https://github.com/ant-design/ant-design/issues/2423) | [UploadFile](#uploadfile)\[] | - | | | headers | 设置上传的请求头部,IE10 以上有效 | object | - | | | iconRender | 自定义显示 icon | (file: UploadFile, listType?: UploadListType) => ReactNode | - | | From 6edc1d18a548a57f9cda2a94c07bcc818d226fb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 22:55:35 +0800 Subject: [PATCH 7/9] chore(deps-dev): bump @types/isomorphic-fetch from 0.0.38 to 0.0.39 (#45731) Bumps [@types/isomorphic-fetch](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/isomorphic-fetch) from 0.0.38 to 0.0.39. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/isomorphic-fetch) --- updated-dependencies: - dependency-name: "@types/isomorphic-fetch" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bdec8adbcf..40547ba35f 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,7 @@ "@types/gtag.js": "^0.0.17", "@types/http-server": "^0.12.1", "@types/inquirer": "^9.0.3", - "@types/isomorphic-fetch": "^0.0.38", + "@types/isomorphic-fetch": "^0.0.39", "@types/jest": "^29.0.0", "@types/jest-axe": "^3.5.3", "@types/jest-environment-puppeteer": "^5.0.0", From 7fda232405270ab607337c1ad3b76e13699e764f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 01:39:34 +0800 Subject: [PATCH 8/9] chore(deps-dev): bump @dnd-kit/sortable from 7.0.2 to 8.0.0 (#45729) Bumps [@dnd-kit/sortable](https://github.com/clauderic/dnd-kit/tree/HEAD/packages/sortable) from 7.0.2 to 8.0.0. - [Release notes](https://github.com/clauderic/dnd-kit/releases) - [Changelog](https://github.com/clauderic/dnd-kit/blob/master/packages/sortable/CHANGELOG.md) - [Commits](https://github.com/clauderic/dnd-kit/commits/@dnd-kit/sortable@8.0.0/packages/sortable) --- updated-dependencies: - dependency-name: "@dnd-kit/sortable" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40547ba35f..5366a35c21 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "@codesandbox/sandpack-react": "^2.9.0", "@dnd-kit/core": "^6.0.7", "@dnd-kit/modifiers": "^6.0.1", - "@dnd-kit/sortable": "^7.0.2", + "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.1", "@emotion/react": "^11.10.4", "@emotion/server": "^11.4.0", From 8dc11ee7f3828a9bbf92c6fbd56c2bec1582e2b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 01:45:22 +0800 Subject: [PATCH 9/9] chore(deps-dev): bump @dnd-kit/modifiers from 6.0.1 to 7.0.0 (#45728) Bumps [@dnd-kit/modifiers](https://github.com/clauderic/dnd-kit/tree/HEAD/packages/modifiers) from 6.0.1 to 7.0.0. - [Release notes](https://github.com/clauderic/dnd-kit/releases) - [Changelog](https://github.com/clauderic/dnd-kit/blob/master/packages/modifiers/CHANGELOG.md) - [Commits](https://github.com/clauderic/dnd-kit/commits/@dnd-kit/modifiers@7.0.0/packages/modifiers) --- updated-dependencies: - dependency-name: "@dnd-kit/modifiers" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5366a35c21..33000bae2e 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,7 @@ "@biomejs/biome": "^1.0.0", "@codesandbox/sandpack-react": "^2.9.0", "@dnd-kit/core": "^6.0.7", - "@dnd-kit/modifiers": "^6.0.1", + "@dnd-kit/modifiers": "^7.0.0", "@dnd-kit/sortable": "^8.0.0", "@dnd-kit/utilities": "^3.2.1", "@emotion/react": "^11.10.4",