From 59553253396147aab42fb55afba5b11b9c14aae8 Mon Sep 17 00:00:00 2001 From: zhanglei66 <38252062+zhanglei66@users.noreply.github.com> Date: Tue, 26 Jul 2022 15:54:51 +0800 Subject: [PATCH] Sync 4.21.7 version from Antd (#83) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Convert part demo to ts version (#35641) * docs(badge): replace class component with hooks * docs(button): replace class component with hooks * docs(calendar): replace class component with hooks * docs(card): replace class component with hooks * docs(button): replace class component with hooks * chore(deps): remove webpack devDependencies * docs(cascader): replace class component with hooks * docs(checkbox): replace class component with hooks * docs(collapse): replace class component with hooks * docs(comment): replace class component with hooks * docs(descriptions): replace class component with hooks * docs(config-provider): replace class component with hooks * docs(date-picker): replace class component with hooks * docs(drawer): replace class component with hooks * docs(dropdown): replace class component with hooks * docs(dropdown): replace class component with hooks * docs(empty): replace class component with hooks * docs(grid): replace class component with hooks * docs(input): replace class component with hooks * docs(input-number): replace class component with hooks * docs(demo): fix lint error * docs(layout): replace class component with hooks * docs(list): replace class component with hooks * docs(mentions): replace class component with hooks * docs: fix code review issue * docs(modal): replace class component with hooks * docs(pagination): replace class component with hooks * docs(popconfirm): replace class component with hooks * docs(popover): replace class component with hooks * docs(progress): replace class component with hooks * docs(rate): replace class component with hooks * docs(radio): replace class component with hooks * docs: jsx to TS demo * test: improve Select test case (#35633) * docs(mentions): fix debounce demo bug (#35653) * chore(deps-dev): bump @types/react-resizable from 1.7.4 to 3.0.0 (#35658) Bumps [@types/react-resizable](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-resizable) from 1.7.4 to 3.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-resizable) --- updated-dependencies: - dependency-name: "@types/react-resizable" 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> * test: refactor test cases of Timeline with testing library (#35654) * test: refactor test cases of TimeLine * fix: lint errors * chore(deps-dev): bump react-intl from 5.25.1 to 6.0.1 (#35659) Bumps [react-intl](https://github.com/formatjs/formatjs) from 5.25.1 to 6.0.1. - [Release notes](https://github.com/formatjs/formatjs/releases) - [Commits](https://github.com/formatjs/formatjs/compare/react-intl@5.25.1...react-intl@6.0.1) --- updated-dependencies: - dependency-name: react-intl 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> * chore: fix cheerio for enzyme fix (#35666) * docs: 4.20.6 changelog (#35671) * docs: 4.20.6 changelog * docs: fix build * test: Update snapshot * refactor: align with popover (#35676) * chore: short auto merge time * chore: update issue check mirror (#35680) * fix: division in less for Segmented (#35701) * fix: division in less for Segmented * fix: update * chore: increase bundle size (#35709) * docs: fix mistype (#35714) * docs: update demo code (#35695) * docs: update demo code * chore: increase bundle size * Revert "chore: increase bundle size" This reverts commit 1c75e5ab5a85259f4d610e33009072e3e9c9acd4. * fix: drawer can not ref form instance when open (#35706) * fix: drawer can not ref form instance when open * fix: test * feat: div ref * feat: test * feat: test * feat: test * feat: test * chore: lock stylelint (#35725) * fix: Popover arrow style (#35717) * feat: config provider support componentDisabled (#35718) * feat: config provider support componentDisable * test: update snapshot * docs: update * chore: code * docs: componentDisabled version (#35730) * test: Replace alert part test with testing lib (#35736) Co-authored-by: chenkan1 * chore(deps-dev): bump typescript from 4.6.4 to 4.7.2 (#35737) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.4 to 4.7.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.4...v4.7.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(select): fix type (#35726) * fix: demo ts type * mend * Update select-users.md * chore: move `@types/qs` from deps to devDeps (#35747) * feat: Config provider pagination showSizeChanger (#35750) * feat: support showSizeChanger * test: test case * fix: the ts wrong of card inteface (#35753) * fix: the ts wrong of card inteface * fix: add export cardproprs * feat: add card type test * docs(👍): update recommendation (#35758) * docs: update recommendation * Update recommendation.en-US.md * docs: fix skeleton demo (#35760) * refactor: Collapse replace expandIconPosition with logical position (#35770) * refactor: change collapse to logic position * test: Update snapshot * chore: force trigger CI * ci: use jest shard (#35622) * refactor: bump rc-collapse to stable dom (#35781) * chore: bump rc-collapse to stable dom * chore: clean up * test: Replace card component test with testing lib (#35751) * test: Replace card component test with testing lib * test: update the snapshot * docs: add note to custom BackTop demo (#35625) * docs: add note to custom BackTop demo * Apply suggestions from code review Co-authored-by: afc163 * test: lock eslint-plugin-jest version for false positive https://github.com/jest-community/eslint-plugin-jest/issues/1128 * test: move test cases to @testing/library for Tabs (#35796) * chore(deps): update dependency eslint-plugin-jest to ~26.4.0 (#35801) * chore(deps): update dependency eslint-plugin-jest to ~26.4.0 * Update package.json Co-authored-by: Renovate Bot Co-authored-by: afc163 * test: move test cases to @testing/library for Image (#35806) * docs: changelog for 4.20.7 (#35804) * docs: changelog for 4.20.7 * chore: bump version to 4.20.7 * docs: update changelog * refactor: Fix Dropdown nesting menu injection logic (#35810) * refactor: Dependency Inversion * test: update snapshot * test: Update snapshot * test: more * fix: table dropdown logic * fix: menu lint * chore: upgrade to jest-image-snapshot 5.x (#35818) * test: move test cases to @testing/library for Modal (#35785) * test: move test cases to @testing/library for Modal * update * fix: test * test: add test case for mouse position * chore: revert * fix: Progress type="line" strokeLinecap (#35822) * docs: fix typo of Menu items code example (#35832) * test: move test cases to @testing/library for Drawer (#35839) * perf: active skeleton animated with transform (#35836) * active skeleton animated with transform * properties order fixed * properties order fixed * properties order fixed Co-authored-by: afc163 * style: tweak Skeleton margin top style (#35848) * docs: update FAQ titles * test: move test cases to @testing/library for List (#35850) * chore: bump rc-dialog & update snapshot * fix: set jest shard to 2 (#35831) * fix: drawer close twice children is undefined (#35853) * fix: drawer close twice children is undefined * fix: drawer close twice children is undefined * chore: code * fix: test * test: update snapshot * fix: remove extraneous space from rc-segmented version (#35863) The extra spaces confuses third-party tooling * feat: Progress steps support custom strokeColor for each step (#35855) * feat: could accept string[] as strokeColor close #35852 close #26858 * fix: tsx demo * docs: add version column * chore: stlye patch of statistic (#35874) * chore: stlye patch of statistic * test: Udpate snapshot * test: replace Input part test with test lib (#35754) * test: replace Input part test with test lib * test: test input case * test: update textarea case Co-authored-by: z1399 Co-authored-by: afc163 * refactor: pagination mini className (#35881) * refactor: pagination mini cls * test: update snapshot * test: update snapshot * chore: code clean * chore: code clean * test: update snapshot * test: update snapshot * refactor: Wave in React 18 StrictMode (#35889) * feat: tabs support popupClassName (#35892) * feat: tabs support popupClassName * docs: update * fix:border-style for inputNumber addon when rtl (#35876) * chore(deps): update dependency @types/jest to v28 (#35907) Co-authored-by: Renovate Bot * ci: fix typo * fix: 类型“FormListFieldData”上不存在属性“fieldKey”。(#35883) (#35884) * fix: 类型“FormListFieldData”上不存在属性“fieldKey”。(#35883) * add deprecated tag to fieldKey * add changelog * Revert "add changelog" This reverts commit 2cc174f6338dbf073aa38133042f3d594a40b7b6. * chore: update changelog script (#35916) * docs: add typography format version * fix: remove important in radio style (#35920) * fix: remove important in radio style * chore: code clean * docs: correct types (#35919) * docs: correct types * ++ Co-authored-by: afc163 * test: migrate part of Button tests (#35869) * test: migrate part of Affix tests (#35860) * docs: add changelog 4.21.0 (#35915) * docs: add changelog 4.21.0 * Update CHANGELOG.en-US.md Co-authored-by: Amumu * Update CHANGELOG.zh-CN.md Co-authored-by: Amumu * docs: add * Update CHANGELOG.en-US.md * docs: fix * docs: add * docs: update * docs: fix * docs: remove 35407 Co-authored-by: Amumu * Feat: support 'treeExpandAction' prop for TreeSelect (#35618) * Feat: support 'treeExpandAction' prop for TreeSelect * chore: bump rc-tree * chore: fix lint * fix: fix directory tree duplicate expandAction * fix: fix directory tree duplicate expandAction * fix: fix directory tree duplicate expandAction * chore: add docs Co-authored-by: zombiej Co-authored-by: afc163 * chore: bump bundle size of babel runtime * docs: Update 4.21.0 changelog * docs: fix tree demo (#35927) * fix: Form.Item noStyle should not be affected by parent Form.Item (#35849) * fix: Form.Item noStyle should not be affected by parent Form.Item * test: update snapshot * fix: status * chore: code clean * fix: modal and drawer * test: fix lint * chore: code clean * refactor: noFormStyle * chore: code clean * revert: revert change in Form.Item * chore: code clean * test: replace test case with test library (#35925) * test: replace test case with test library * test: replace test case with test library * test: update snapshots * docs: clean up useless space * test: refactor tree with testing lib (#35937) * test: tree test * test: clean up * chore: bump rc-tree * test: Update snapshot * test: Update for react 18 * test: move test cases to testing lib (#35909) * test: move test cases to testing lib (#35900) * fix: menu items typings (#35790) * Fix menu items typings * add test case for menu item type checking * fix: cubic-bezier should be animation-timing-function (#35943) * chore: upgrade react-slick to 0.29.1 (#35959) * chore: upgrade react-slick to 0.29.0 * Update package.json * chore: fix code (#35949) * Fix color generation for grey colors (#35954) Co-authored-by: afc163 * test: move test cases to @testing/library for Typography (#35955) * test: move test cases to @testing/library for Typography * fix: waitFor for tooltip test * fix: sleep to wait copy hide * test: refactor focus test * chore: Update it_IT.tsx (#35970) Fix italian translation for Table.cancelSort key * docs: Segmented API type (#35974) * Update index.en-US.md * Update index.zh-CN.md * chore: fix typo * chore: bump rc-dialog version (#35969) * chore: bump rc-dialog version * chore: trigger * chore: trigger * docs: RM peer conflict demo * chore: bump deps version * chore: bump ver * chore: bump * chore: bump * chore: test * chore: rm peer * chore: clean all peer * chor: bump rc-image * fix: Button has no disabled style when link type (#35975) Co-authored-by: MadCcc <1075746765@qq.com> * fix: `DropdownProps` definition (#35990) Co-authored-by: jhonebee Co-authored-by: MadCcc <1075746765@qq.com> * chore(deps-dev): bump stylelint from 14.8.3 to 14.9.0 (#35998) Bumps [stylelint](https://github.com/stylelint/stylelint) from 14.8.3 to 14.9.0. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/14.8.3...14.9.0) --- updated-dependencies: - dependency-name: stylelint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: update ts config (#36000) * fix: Fixed the getContainer property in Image not reading the settings in ConfigProvider (#36002) * fix: 35942 * test: 添加测试用例 * fix: * fix: * fix: missing semicolon (#36008) * Update package.json * docs: fix onChange description repeated twice (#36013) * chore(deps): update dependency stylelint-config-standard to v26 (#36017) * chore(deps): update dependency stylelint-config-standard to v26 * chore: ignore selector-not-notation rule Co-authored-by: Renovate Bot Co-authored-by: afc163 * test: move test cases to testing lib for Statistic (#36019) Co-authored-by: afc163 * test: replace Table part test with test lib (#35989) * test: replace Table part test with test lib * test: replace table test with test library * test: update snapshot * test: replace last mount * test: fix 18 testing Co-authored-by: zombiej * docs: add changelog 4.21.1 (#36022) * docs: title is no loger supported by SubMenuType (#36037) * docs: fix menu API table (#36043) * docs: fix menu API table * Update index.en-US.md * docs: fix demos (#36040) * docs: fix demos * ++ * fix: fix incorrect form status with noStyle (#36054) * fix: form status * test: update test case * docs: 4.21.2 (#36055) * test: improve test cases for Statistic (#36034) * test: move test cases to testing lib for Badge (#36033) * fix:when props.value is not undefined, can't reset value and focus (#34728) * fix: when props.value is not undefined, can't reset value and focus * test: add test case Co-authored-by: MadCcc <1075746765@qq.com> * test: move test cases to @testing/library for Upload (#36024) * test: move test cases to @testing/library for Upload * refactor: use jest.fn to replace done logic * test: sample of moving test to testing lib * test: check for 17 * refactor: manual control timer for React18 * refactor: animateEnd for useless middle state snapshot for 'handle error' Co-authored-by: zombiej * fix: exporting Rule, FormListFieldData, FormListOperation from form (#34735) * fix: exporting RefSelectProps from select (#34732) * fix: Typescript - Tree component DirectoryTreeProps, missing Node Type (#36092) * fix: edit DirectoryTreeProps * test: add DirectoryTree type test * fix: edit type Co-authored-by: JaylanChen * fix: Table customize filterDropdown with Menu should not block default selectable (#36098) * fix: Table customize Menu should be selectable * test: Add test case * test: Update snapshow * test: change to fakeTimer when error happens sometimes (#36102) * docs(:sparkles:): release 4.21.3 (#36105) * docs: add locale link in Calender (#36108) close https://github.com/ant-design/ant-design/issues/36107#issuecomment-1158630726 * fix: exporting UploadFile from upload (#34733) * fix: Skeleton active style in dark theme (#36116) close #36114 * fix: Table multiple dropdown not closed (#36132) * fix: Table dropdown can not close * test: Test case * test: cov * chore: bump rc-util * chore: reorder * chore: bump rc-util * chore: rm test * chore: clean up * fix: component.displayName To distinguish the environment (#36126) Co-authored-by: afc163 * fix: repeat a css class in readOnly, which has been declared in rc-input-number (#36120) Co-authored-by: afc163 * chore(deps): update dependency inquirer to v9 (#36121) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: afc163 * chore(deps-dev): bump jsdom from 19.0.0 to 20.0.0 (#36133) Bumps [jsdom](https://github.com/jsdom/jsdom) from 19.0.0 to 20.0.0. - [Release notes](https://github.com/jsdom/jsdom/releases) - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md) - [Commits](https://github.com/jsdom/jsdom/compare/19.0.0...20.0.0) --- updated-dependencies: - dependency-name: jsdom 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> Co-authored-by: afc163 * docs(Input): add proper type for `inputRef` (#36135) * docs(Input): add proper type for `inputRef` * docs: use `InputRef` instead of `ElementRef` Co-authored-by: afc163 * style: enlarge draggable area for Slider handle (#36018) * active skeleton animated with transform * properties order fixed * properties order fixed * properties order fixed * bigger dragable area for slider handle * Update components/slider/style/index.less Co-authored-by: afc163 * Update index.less 6px Co-authored-by: afc163 * docs: update demo code (#36127) (#36143) * fix: Dropdown with group menu can not close (#36148) * test: test driven * fix: Dropdown with Menu list group * style: Code style optimization (#36144) * style: code style optimization * style: code style optimization * style: code style optimization * style: Remove methed of Array push (#36157) * style: code style optimization * style: code style optimization * style: code style optimization * style: code style optimization * style: fix Button loading icon margin issue (#36168) * style: fix Button loading icon margin issue * test: update snapshot * test: fix tsx demo error * chore: prettier components (#36171) * test: replace pagination test with test-library (#36178) * refactor: performance optimization (#36177) * style: code style optimization * style: code style optimization * style: code style optimization * style: code style optimization * fix: Code style optimization * style: format * Corrected grammar in comment in hooks.md (#36185) * Fix breaks (#36186) * Added type assertion so function no longer returns any/unknown * Add type constraint since Object.keys is called on this value * chore: fix Menu deprecated warning when item={undefined} (#36190) * fix: type incompatibility in strict mode (#36189) * fix: type incompatibility * fix: type * fix: Reset the last selection key (#34705) * fix: reset last selection key * reset last selection key when deselect * fix: add test case * fix: remove unused code * fix: enzyme bug * fix: update test * styles: remove empty line * fix: lint error * test: migrate to testing-libary * fix: xxx.simulate is not a function * fix: lint error * fix: use wrong * fix: solved test not work Co-authored-by: dengqing * fix: Upload listType="picture-card" select button when children is empty (#36196) * fix: Upload listType="picture-card" select button should be hidden when children is empty close #36183 * test: fix test case * perf: unify regeneratorRuntime import path for bundle size (#36200) * perf: unify regeneratorRuntime import path for bundle size close #36198 * Update package.json * Docs: FAQ add explanation of null in controlled components. (#36082) * docs: fix Chinese language grammar mistake in FAQ * docs: FAQ add explanation of null in controlled components * docs: update null in controlled components FAQ * docs: update null in controlled components FAQ (add lost word) * docs: null in controlled components FAQ optimization * docs: FAQ add explanation of null in controlled components (English) * docs: update faq docs * docs: update faq docs(chinese) * docs: optimize faq docs * Update faq.en-US.md * Update faq.en-US.md * Update faq.en-US.md * Update faq.zh-CN.md * Update faq.en-US.md Co-authored-by: shezhangzhang Co-authored-by: MadCcc <1075746765@qq.com> * chore: bump rc-util (#36210) * fix: nested Table margin style (#36209) * fix: nested Table margin style * fix: tsx demo * test: update snapshot * style: fix Table expand icon align issue (#36215) * docs: fix English FAQ title (#36222) * docs: update valueStyle description (#36226) close #36219 * chore: fix eslint warning and bisheng terminal log (#36220) * chore: fix eslint warning * chore: fix bisheng log * Update basic.md * docs: update Tabs demo code (#36217) * docs:update demo code * docs: update Tabs demo code * docs: update Tabs demo code * chore(deps-dev): bump @types/jest-image-snapshot from 4.3.2 to 5.1.0 (#36229) Bumps [@types/jest-image-snapshot](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest-image-snapshot) from 4.3.2 to 5.1.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest-image-snapshot) --- updated-dependencies: - dependency-name: "@types/jest-image-snapshot" 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> * chore(deps): update dependency remark-cli to v11 (#36237) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: dev config (#36240) * fix: popover arrow support custom color (#36241) * refactor: wrap Wave with FC (#36248) * refactor: wrap Wave with FC * test: update test case * docs: add 4.21.4 changelog (#36246) * docs: add 4.21.4 changelog * fix * reset * chore(deps-dev): bump cheerio from 1.0.0-rc.10 to 1.0.0-rc.12 (#36255) Bumps [cheerio](https://github.com/cheeriojs/cheerio) from 1.0.0-rc.10 to 1.0.0-rc.12. - [Release notes](https://github.com/cheeriojs/cheerio/releases) - [Changelog](https://github.com/cheeriojs/cheerio/blob/main/History.md) - [Commits](https://github.com/cheeriojs/cheerio/compare/v1.0.0-rc.10...v1.0.0-rc.12) --- updated-dependencies: - dependency-name: cheerio 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> * chore: update Belarusian locale (#36265) * Edited Belarusian locale: - Added missed entries - Fixed some mistakes * test: update snapshot Co-authored-by: Aliaksiej Razumaŭ * docs: update English sketch file link (#36269) * docs: English sketch file links from communicatity * Update resources.en-US.md * style(Divider): replace fixed class name with variable (#36271) * test: replace test case with test lib (#36276) * style: fix Table shadow bug in nested situation (#36277) close #36203 * test: Fix table empty test (#36290) * chore: reduce css bundle size (#36307) * fix: arrow compatibility (#36266) * fix: arrow campatibility * chore: code clean * chore: rm useless style * chore: code clean * fix: use inset * chore: bundlesize optimization * chore: rm useless style * chore: rm useless style * fix: Fixed an error when the loading property of the Button component… (#36288) * fix: Fixed an error when the loading property of the Button component was passed into null * Update components/button/button.tsx Obviously, this suggestion is more concise , thanks a lot Co-authored-by: afc163 * Update components/button/button.tsx * Update components/button/button.tsx Co-authored-by: kejianfeng Co-authored-by: afc163 * test: move test cases to testing lib for Spin (#36317) * test: move test cases to testing lib for Spin * fix: types * fix: lint * test: move test cases to testing lib for Switch (#36326) * add * test: wave * fix: type * test: update snapshot (#36344) * test: update snapshot * test: update snapshot * fix: checkbox should be disabled by form (#36345) * fix: checkbox should be disabled by form * chore: code clean * test: update snapshot * chore: snapshot * test: move test cases to @testing/library for Carousel (#35926) * test: move test cases to @testing/library for Carousel * fix: wait for animation * test: replace layout test case with test lib (#36323) * test: replace layout test case with test lib * test: fix react 18 * test: clean up Co-authored-by: zombiej * docs: v4.21.5 (#36353) * docs: v4.21.5 * chore: add try time * chore: update changelog * chore(deps): update dependency eslint-plugin-unicorn to v43 (#36350) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * style: Radio focus shadow should be transparency (#36335) * fix: ErrorList shaking (#36358) * fix: ErrorList shaking * fix: React 18 test case * docs: replace lib with es (#36367) * fix: Table hover perf (#36383) * fix: correct border radius when table has title (#36384) * style: fix size of close icon on Modal header (#36309) * fix: update default.less, set the @modal-header-close-size to @modal-header-title-line-height + 2 * @modal-header-padding-vertical to keep the close icon in the center of vertical Signed-off-by: Chang Wei * fix: update variable.less, set the @modal-header-close-size to @modal-header-title-line-height + 2 * @modal-header-padding-vertical to keep the close icon in the center of vertical Signed-off-by: Chang Wei * fix: update compact.less, set the @modal-header-close-size to @modal-header-title-line-height + 2 * @modal-header-padding-vertical to keep the close icon in the center of vertical Signed-off-by: Chang Wei * Update index.en-US.md (#36400) Fixed a typo * docs: fix customize calendar example (#36356) * docs: fix customize calendar example * test: changed calendar snapshot Co-authored-by: lico * docs(Typography): translate docs from English to Chinese (#36417) * fix: fix table container z-index (#36420) * fix: fix wrong color of date picker with status set (#35685) * fix: fix wrong color of date picker with status set * Update status.less Co-authored-by: afc163 * feat: Update Doc (#36437) Co-authored-by: meng.jia * docs(Typography): fix `editable.onChange` parameter (#36443) * fix: Upload item removed should keep status className (#36439) * fix: Upload item removed should keep status className * add test case * test: fix act warning * revert act test * test: update snapshot * docs: fix typo (#36450) 面包屑部分, "是"应该改为"时" * fix: breadcrumb seperators hidden when used in list (#36448) * style: fix Skeleton active lost border-radius in Safari (#36445) * style: fix Skeleton active lost border-radius in Safari * perf: reduce skeleton css bundle size * chore: fix bundle size limit * chore: fix active typing * docs: 4.21.6 changelog (#36455) * feat: Add support to Skeleton, which allow deployer use custom node as prop. (#36441) * feat: Skeleton component supports for custom node * fix: Clear redundant code * refactor: Remove changes in package.json * test: Update the snapshot of Skeleton demo * Update components/skeleton/demo/element.md Co-authored-by: afc163 Co-authored-by: afc163 * docs: fix typo (#36457) fix typo in useWatch.md * docs: update index.zh-CN.md (#36471) 去掉文案描述中多的标点 * docs: moment version mismatched issue (#36473) https://github.com/ant-design/ant-design/issues/36465#issuecomment-1181275538 * chore: bump mentions (#36479) * fix: Select with percent width leaves unexpected height in Form (#36484) * ci: add conch msg (#36481) * ci: add conch msg * Update release-helper.yml * fix: tooltip cannot close on disabled Radio (#36483) * fix: tooltip cannot close on disabled Radio * test: add test * ci: split notice (#36495) * style: Table expandIcon style when column is fixed and ellipsis (#36496) close #36485 * docs: simplified `Layout` component sample code (#36497) the component example code expands to take up the entire monitor screen and is not well read * chore: bump rc-tooltip (#36501) * fix: SVG Upload Preview Error (#36402) * Update utils.tsx * style: unify img styling Unify the styling of img attribute setting. * test: add previewImage test for svg file Add previewImage test for SVG upload * fix: remove charset Remove charset in data url for text content. * test: fix test * fix: typo * fix: correct patching for svg upload error * fix: correct patching for svg upload error * test: update test * fix: fixed the non draggable element did not hide the draggable icon (#36511) fix #33708 * docs: update select documentation * refactor: move popconfirm content out (#36530) * refactor: move popconfirm content out * fix: lint * test: update snapshot * chore: update .gitignore (#36534) * add Modal @modal-border-radius less variable (#36527) * add Modal @modal-border-radius less variable * fix: add less variable * chore(deps): update dependency eslint-plugin-markdown to v3 (#36560) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: form disabeld support Upload (#36573) Co-authored-by: ranrui.cwj * docs: changelog for 4.21.7 (#36572) * docs: changelog for 4.21.7 * chore: bump version to 4.21.7 * docs: update changelog * docs: append a new changelog * ci: fix publish (#36580) * docs: menu faq (#36604) * docs: menu faq * docs: patch codesandbox * style: fix Table tree data ellipsis style problem (#36608) close #36583 * style: fix Table extra shadow and scrollbar when all columns are fixed Co-authored-by: weiwang * feat: Replace input-number part test with testing lib (#36080) * feat: Replace input-number part test with testing lib * feat: update rc-input-number version * test: move test cases to testing lib for Collapse (#36227) * test: move test cases to testing lib for Collapse * chore: remove useless file * fix: react 18 concurrent * chore: remove useless file * docs: tabpane add `disabled` (#36634) close #36610 * docs: faq for internal API (#36643) * fix(Tree): DraggableFn params type (#36648) * fix(Tree): DraggableFn params type * chore: add blank line * test: add typ test for draggable Fn * test: add typ test for draggable Fn Co-authored-by: tianyuan233 * fix(modal): Modal.xxx onCancel close argument is not a function (#36600) * fix(modal): fix the error of `onCancel` parameter of modal returned by `useModal` resolve: 36581 ref: https://github.com/ant-design/ant-design/issues/36581#issuecomment-1189396007 * test(confirm): 补充 modal 测试用例 * test(modal): 添加测试用例 * Revert "fix(modal): fix the error of `onCancel` parameter of modal returned by `useModal`" This reverts commit e4fcb3e62add63193ec9081b2c21e657379bebfb. * fix(modal): fix modal onOk/onCancel method is not a valid function when there is a close parameter closed: #36581 * chore: cancel the introduction of `noop` from third-party library * chore: write React.ChangeEvent once (#36644) * docs: renew Select dropdownRender demo and FAQ (#36665) * docs: renew Select dropdownRender FAQ and demo * chore: update snapshot * chore: fix Select demo tsc * chore: fix Select demo tsc * test: move-test-cases-to-testing-lib-for-Radio (#36664) * test: move-test-cases-to-testing-lib-for-Radio * update toMatchSnapshot Co-authored-by: ranrui.cwj Co-authored-by: dingkang Co-authored-by: 黑雨 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zack Chang <73225408+jrr997@users.noreply.github.com> Co-authored-by: 二货机器人 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MadCcc <1075746765@qq.com> Co-authored-by: vagusX Co-authored-by: Niyaz Akhmetov Co-authored-by: 叶枫 <7971419+crazyair@users.noreply.github.com> Co-authored-by: 社长长 Co-authored-by: chenkan1 Co-authored-by: zhao-huo-long Co-authored-by: Cong Zhang Co-authored-by: Long Hao (龙濠) <45565100+LongHaoo@users.noreply.github.com> Co-authored-by: afc163 Co-authored-by: Gabriel Haruki Co-authored-by: yykoypj <601924094@qq.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot Co-authored-by: Peach Co-authored-by: Yuki Zhang Co-authored-by: MrHadEnough Co-authored-by: slotDumpling <67586451+slotDumpling@users.noreply.github.com> Co-authored-by: Mehdi Salem Naraghi Co-authored-by: 郑国庆 Co-authored-by: z1399 Co-authored-by: Luobo Zhang Co-authored-by: xrkffgg Co-authored-by: chenxiang <597219320@qq.com> Co-authored-by: 元凛 Co-authored-by: kalykun <984757534@qq.com> Co-authored-by: Shang Song <14830727+zggmd@users.noreply.github.com> Co-authored-by: Amumu Co-authored-by: Heaven <18418010+NE-SmallTown@users.noreply.github.com> Co-authored-by: MasaoBlue <16271994+MasaoBlue@users.noreply.github.com> Co-authored-by: 龙风 <455947455@qq.com> Co-authored-by: Christian Lechner <6638938+christian-lechner@users.noreply.github.com> Co-authored-by: Umberto Gariggio Co-authored-by: XIN HU Co-authored-by: muxin Co-authored-by: 苯苯 <91561865+robothot@users.noreply.github.com> Co-authored-by: jhonebee Co-authored-by: Taisuke Hinata Co-authored-by: csr632 <632882184@qq.com> Co-authored-by: Humble <745653239@qq.com> Co-authored-by: zhang lay Co-authored-by: C. T. Lin Co-authored-by: Jaylan Co-authored-by: JaylanChen Co-authored-by: RainyLiao <90637572+RainyLiao@users.noreply.github.com> Co-authored-by: Dennis Chen Co-authored-by: pfsu Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: Andrew Horn Co-authored-by: Ryan Cavanaugh Co-authored-by: Dunqing Co-authored-by: dengqing Co-authored-by: shezhangzhang Co-authored-by: Tianyuan Zhang Co-authored-by: 陈帅 Co-authored-by: Aliaksiej Razumaŭ Co-authored-by: Alan Deng Co-authored-by: Jamki <13414367591@163.com> Co-authored-by: kejianfeng Co-authored-by: Yunwoo Ji Co-authored-by: Chang Wei Co-authored-by: Kirill Barsukov <43782731+KirillSBarsukov@users.noreply.github.com> Co-authored-by: hsk-kr <57546034+hsk-kr@users.noreply.github.com> Co-authored-by: lico Co-authored-by: 舜岳 <1277952981@qq.com> Co-authored-by: simplejason Co-authored-by: NinJa <386805508@qq.com> Co-authored-by: meng.jia Co-authored-by: 王小王 Co-authored-by: Leon Kattendick <75811671+LeonKattendick@users.noreply.github.com> Co-authored-by: Dawnlck Co-authored-by: Sg Co-authored-by: bobo <625391250@qq.com> Co-authored-by: Wuxh Co-authored-by: Jon <31494475+jonioni@users.noreply.github.com> Co-authored-by: Wuxh Co-authored-by: Neil <100huming@gmail.com> Co-authored-by: fairyland Co-authored-by: ranrui.cwj Co-authored-by: dashaowang <40166750+dashaowang@users.noreply.github.com> Co-authored-by: weiwang Co-authored-by: tianyuan233 Co-authored-by: Zheeeng --- .github/workflows/release-helper.yml | 2 +- .gitignore | 1 + CHANGELOG.en-US.md | 15 + CHANGELOG.zh-CN.md | 15 + components/_util/ActionButton.tsx | 17 +- .../{demo.test.js.snap => demo.test.ts.snap} | 0 ...index.test.js.snap => index.test.tsx.snap} | 0 .../__tests__/{demo.test.js => demo.test.ts} | 0 .../{index.test.js => index.test.tsx} | 69 +- .../__snapshots__/components.test.js.snap | 35 +- .../__snapshots__/demo-extend.test.ts.snap | 78 ++ .../__tests__/__snapshots__/demo.test.js.snap | 78 ++ .../__snapshots__/index.test.js.snap | 48 ++ components/form/__tests__/index.test.js | 5 +- components/form/demo/disabled.md | 12 +- .../input-number/__tests__/index.test.js | 31 +- .../input-number/__tests__/prefix.test.js | 15 +- components/input/Input.tsx | 8 +- .../__snapshots__/demo-extend.test.ts.snap | 114 ++- .../__tests__/__snapshots__/demo.test.js.snap | 114 ++- components/layout/demo/fixed-sider.md | 105 +-- components/locale-provider/index.tsx | 2 +- components/menu/index.en-US.md | 11 + components/menu/index.zh-CN.md | 11 + components/modal/__tests__/confirm.test.js | 149 +++- components/modal/__tests__/hook.test.tsx | 112 ++- components/modal/confirm.tsx | 2 +- components/modal/style/modal.less | 6 +- components/modal/useModal/HookModal.tsx | 2 +- components/popconfirm/PurePanel.tsx | 81 ++ components/popconfirm/index.tsx | 66 +- .../__snapshots__/group.test.js.snap | 2 +- .../__snapshots__/radio-button.test.js.snap | 3 +- .../__snapshots__/radio.test.js.snap | 1 + components/radio/__tests__/group.test.js | 124 +-- .../radio/__tests__/radio-button.test.js | 125 ++-- components/radio/__tests__/radio.test.js | 13 +- .../__snapshots__/demo-extend.test.ts.snap | 12 +- .../select/demo/custom-dropdown-menu.md | 28 +- components/select/index.en-US.md | 10 +- components/select/index.zh-CN.md | 8 +- components/style/themes/default.less | 1 + components/style/themes/variable.less | 1 + .../__snapshots__/demo-extend.test.ts.snap | 703 ++++++++++++++++++ .../__tests__/__snapshots__/demo.test.js.snap | 703 ++++++++++++++++++ components/table/demo/tree-table-ellipsis.md | 136 ++++ components/table/style/index.less | 21 +- components/tabs/index.en-US.md | 5 +- components/tabs/index.zh-CN.md | 7 +- components/tree/Tree.tsx | 3 +- components/tree/__tests__/type.test.tsx | 22 + components/tree/style/mixin.less | 25 +- components/upload/Upload.tsx | 16 +- .../upload/__tests__/uploadlist.test.js | 29 + components/upload/style/index.less | 1 + components/upload/utils.tsx | 11 +- docs/react/faq.en-US.md | 4 + docs/react/faq.zh-CN.md | 4 + package.json | 8 +- scripts/notice-seaTalk.js | 2 +- 60 files changed, 2782 insertions(+), 450 deletions(-) rename components/collapse/__tests__/__snapshots__/{demo.test.js.snap => demo.test.ts.snap} (100%) rename components/collapse/__tests__/__snapshots__/{index.test.js.snap => index.test.tsx.snap} (100%) rename components/collapse/__tests__/{demo.test.js => demo.test.ts} (100%) rename components/collapse/__tests__/{index.test.js => index.test.tsx} (66%) create mode 100644 components/popconfirm/PurePanel.tsx create mode 100644 components/table/demo/tree-table-ellipsis.md diff --git a/.github/workflows/release-helper.yml b/.github/workflows/release-helper.yml index 6c5d376bf672..401f67d71ebe 100644 --- a/.github/workflows/release-helper.yml +++ b/.github/workflows/release-helper.yml @@ -28,7 +28,6 @@ jobs: branch: 'master' dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} dingding-msg: 'CHANGELOG.zh-CN.md' - dingding-delay-minute: 10 msg-title: '# Ant Design {{v}} 发布日志' msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志' @@ -44,6 +43,7 @@ jobs: dingding-token: ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} dingding-msg: 'CHANGELOG.zh-CN.md' dingding-delay-minute: 10 + release: false antd-conch-msg: '🐟 当前 Bigfish 内嵌 antd 版本:' msg-title: '# Ant Design {{v}} 发布日志' msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' diff --git a/.gitignore b/.gitignore index 5be4d3cb0b5e..16ffbbdab3c4 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ site/theme/template/Resources/**/*.jsx site/theme/template/NotFound.jsx scripts/previewEditor/index.html components/version/version.tsx +components/version/token.tsx # Image snapshot diff __diff_output__/ diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 8b665065aae0..95421371bf56 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -9,6 +9,7 @@ timeline: true | infrad version | antd version | update content | time | | --- | --- | --- | --- | +| 4.21.7 | 4.21.7 | Synchronize the update of antd 4.21.7 version | 2022-07-25 | | 4.21.6 | 4.21.6 | Synchronize the update of antd 4.21.6 version | 2022-07-15 | | 4.21.4 | 4.21.4 | 1.Synchronize the update of antd 4.21.4 version
2.Modified some styles of the table component
3.The tooltip component has been rolled back to keep it consistent with antd
4.Fix the style problem in the small state of the progress component
5.Fixed the enter event penetration problem of the sorting cell of the table component | 2022-07-04 | | 4.21.1 | 4.21.2 | 1.Synchronize the update of antd 4.20.2 version
2.Temporarily removed QuickPicker | 2022-06-16 | @@ -37,6 +38,20 @@ if you have some problem, welcome to connect `taofeng.yang@shopee.com` or `lay.z --- +## 4.21.7 + +`2022-07-18` + +- 🆕 Add Skeleton.Node sub-component, allow user customize content of Skeleton. [#36441](https://github.com/ant-design/ant-design/pull/36441) [@DawnLck](https://github.com/DawnLck) +- Form + - 🐞 Fix Form with percentage width Select may leaves unexpected height. [#36484](https://github.com/ant-design/ant-design/pull/36484) + - 🐞 Fix Form disabled but Upload component still uploadable in it. [#36573](https://github.com/ant-design/ant-design/pull/36573) [@cwjTerrace](https://github.com/cwjTerrace) +- 🐞 Fix Tree non-draggable element still render the draggable icon. [#36511](https://github.com/ant-design/ant-design/pull/36511) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 Fix Upload preview error on SVG with `` and cross-origin links. [#36402](https://github.com/ant-design/ant-design/pull/36402) [@jonioni](https://github.com/jonioni) +- 🐞 Fix that Tooltip cannot close automaticly on disabled Radio. [#36483](https://github.com/ant-design/ant-design/pull/36483) +- 💄 Add Modal Less variable `@modal-border-radius`. [#36527](https://github.com/ant-design/ant-design/pull/36527) [@kkkisme](https://github.com/kkkisme) +- 💄 Fix Table expand icon wrap style when column is fixed and ellipsis. [#36496](https://github.com/ant-design/ant-design/pull/36496) + ## 4.21.6 `2022-07-11` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 15f72be25097..161cee006f29 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -9,6 +9,7 @@ timeline: true | infrad 版本号 | 对应 antd 版本号 | 更新内容 | 时间 | | --- | --- | --- | --- | +| 4.21.7 | 4.21.7 | 同步 antd 4.21.7 版本的更新 | 2022-07-25 | | 4.21.6 | 4.21.6 | 同步 antd 4.21.6 版本的更新 | 2022-07-15 | | 4.21.4 | 4.21.4 | 1.同步 antd 4.21.4 版本的更新
2.修改了 table 组件的部分样式
3.回退 tooltip 组件保持与 Antd 一致
4.修复 progress 组件在 small 状态下的样式问题
5.修复了 table 组件排序单元格 enter 事件穿透问题 | 2022-07-04 | | 4.21.1 | 4.21.2 | 1.同步 antd 4.21.2 版本的更新
2.暂时移除了 QuickPicker 组件 | 2022-06-16 | @@ -38,6 +39,20 @@ timeline: true --- +## 4.21.7 + +`2022-07-18` + +- 🆕 新增 Skeleton.Node 子组件,允许用户自定义 Skeleton 的内容。[#36441](https://github.com/ant-design/ant-design/pull/36441) [@DawnLck](https://github.com/DawnLck) +- Form + - 🐞 修复 Form 下设置 Select 百分比宽度时会有未预期空行问题。[#36484](https://github.com/ant-design/ant-design/pull/36484) + - 🐞 修复 Form 设为禁用时、内部的 Upload 组件仍能上传文件的问题。[#36573](https://github.com/ant-design/ant-design/pull/36573) [@cwjTerrace](https://github.com/cwjTerrace) +- 🐞 修复 Tree 非 `draggable` 依然展示可拖拽图标的问题。[#36511](https://github.com/ant-design/ant-design/pull/36511) [@Wxh16144](https://github.com/Wxh16144) +- 🐞 修复 Upload 在预览包含 `` 及跨域链接的 SVG 文件时发生错误的问题。[#36402](https://github.com/ant-design/ant-design/pull/36402) [@jonioni](https://github.com/jonioni) +- 🐞 修复 Tooltip 在被禁用的 Radio 上时无法自动关闭的问题。[#36483](https://github.com/ant-design/ant-design/pull/36483) +- 💄 添加 Modal Less 变量 `@modal-border-radius`。[#36527](https://github.com/ant-design/ant-design/pull/36527) [@kkkisme](https://github.com/kkkisme) +- 💄 修复 Table 开启固定和省略功能的列内的展开按钮换行样式。[#36496](https://github.com/ant-design/ant-design/pull/36496) + ## 4.21.6 `2022-07-11` diff --git a/components/_util/ActionButton.tsx b/components/_util/ActionButton.tsx index b8ce013a2a47..adc57edf9cfc 100644 --- a/components/_util/ActionButton.tsx +++ b/components/_util/ActionButton.tsx @@ -7,7 +7,7 @@ import { convertLegacyProps } from '../button/button'; export interface ActionButtonProps { type?: LegacyButtonType; actionFn?: (...args: any[]) => any | PromiseLike; - close: Function; + close?: Function; autoFocus?: boolean; prefixCls: string; buttonProps?: ButtonProps; @@ -24,6 +24,10 @@ const ActionButton: React.FC = props => { const clickedRef = React.useRef(false); const ref = React.useRef(); const [loading, setLoading] = useState(false); + const { close } = props; + const onInternalClose = (...args: any[]) => { + close?.(...args); + }; React.useEffect(() => { let timeoutId: any; @@ -39,7 +43,6 @@ const ActionButton: React.FC = props => { }, []); const handlePromiseOnOk = (returnValueOfOnOk?: PromiseLike) => { - const { close } = props; if (!isThenable(returnValueOfOnOk)) { return; } @@ -47,7 +50,7 @@ const ActionButton: React.FC = props => { returnValueOfOnOk!.then( (...args: any[]) => { setLoading(false, true); - close(...args); + onInternalClose(...args); clickedRef.current = false; }, (e: Error) => { @@ -62,13 +65,13 @@ const ActionButton: React.FC = props => { }; const onClick = (e: React.MouseEvent) => { - const { actionFn, close } = props; + const { actionFn } = props; if (clickedRef.current) { return; } clickedRef.current = true; if (!actionFn) { - close(); + onInternalClose(); return; } let returnValueOfOnOk; @@ -76,7 +79,7 @@ const ActionButton: React.FC = props => { returnValueOfOnOk = actionFn(e); if (props.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) { clickedRef.current = false; - close(e); + onInternalClose(e); return; } } else if (actionFn.length) { @@ -86,7 +89,7 @@ const ActionButton: React.FC = props => { } else { returnValueOfOnOk = actionFn(); if (!returnValueOfOnOk) { - close(); + onInternalClose(); return; } } diff --git a/components/collapse/__tests__/__snapshots__/demo.test.js.snap b/components/collapse/__tests__/__snapshots__/demo.test.ts.snap similarity index 100% rename from components/collapse/__tests__/__snapshots__/demo.test.js.snap rename to components/collapse/__tests__/__snapshots__/demo.test.ts.snap diff --git a/components/collapse/__tests__/__snapshots__/index.test.js.snap b/components/collapse/__tests__/__snapshots__/index.test.tsx.snap similarity index 100% rename from components/collapse/__tests__/__snapshots__/index.test.js.snap rename to components/collapse/__tests__/__snapshots__/index.test.tsx.snap diff --git a/components/collapse/__tests__/demo.test.js b/components/collapse/__tests__/demo.test.ts similarity index 100% rename from components/collapse/__tests__/demo.test.js rename to components/collapse/__tests__/demo.test.ts diff --git a/components/collapse/__tests__/index.test.js b/components/collapse/__tests__/index.test.tsx similarity index 66% rename from components/collapse/__tests__/index.test.js rename to components/collapse/__tests__/index.test.tsx index f6eda414df6b..a054eca1ba20 100644 --- a/components/collapse/__tests__/index.test.js +++ b/components/collapse/__tests__/index.test.tsx @@ -1,7 +1,6 @@ -import { mount } from 'enzyme'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { render, sleep } from '../../../tests/utils'; +import { sleep, render, fireEvent } from '../../../tests/utils'; import { resetWarned } from '../../_util/warning'; describe('Collapse', () => { @@ -10,6 +9,15 @@ describe('Collapse', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + // fix React concurrent + function triggerAllTimer() { + for (let i = 0; i < 10; i += 1) { + act(() => { + jest.runAllTimers(); + }); + } + } + beforeEach(() => { resetWarned(); }); @@ -23,16 +31,16 @@ describe('Collapse', () => { }); it('should support remove expandIcon', () => { - const wrapper = mount( + const { asFragment } = render( null}> , ); - expect(wrapper.render()).toMatchSnapshot(); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('should keep the className of the expandIcon', () => { - const wrapper = mount( + const { container } = render( ( } /> action} /> , ); - expect(wrapper.render()).toMatchSnapshot(); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('could be expand and collapse', async () => { - const wrapper = mount( + const { container } = render( content , ); - expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(false); - wrapper.find('.ant-collapse-header').at(0).simulate('click'); - wrapper.update(); + expect( + container.querySelector('.ant-collapse-item')?.classList.contains('ant-collapse-item-active'), + ).toBe(false); + fireEvent.click(container.querySelector('.ant-collapse-header')!); await sleep(400); - wrapper.update(); - expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(true); + expect( + container.querySelector('.ant-collapse-item')?.classList.contains('ant-collapse-item-active'), + ).toBe(true); }); it('could override default openMotion', () => { - const wrapper = mount( + const { container, asFragment } = render( content , ); - wrapper.find('.ant-collapse-header').at(0).simulate('click'); - expect(wrapper.render()).toMatchSnapshot(); + fireEvent.click(container.querySelector('.ant-collapse-header')!); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('should trigger warning and keep compatibility when using disabled in Panel', () => { - const wrapper = mount( + const { container } = render( content @@ -98,19 +108,19 @@ describe('Collapse', () => { 'Warning: [antd: Collapse.Panel] `disabled` is deprecated. Please use `collapsible="disabled"` instead.', ); - expect(wrapper.find('.ant-collapse-item-disabled').length).toBe(1); + expect(container.querySelectorAll('.ant-collapse-item-disabled').length).toBe(1); - wrapper.find('.ant-collapse-header').simulate('click'); - expect(wrapper.find('.ant-collapse-item-active').length).toBe(0); + fireEvent.click(container.querySelector('.ant-collapse-header')!); + expect(container.querySelectorAll('.ant-collapse-item-active').length).toBe(0); }); it('should end motion when set activeKey while hiding', async () => { jest.useFakeTimers(); - jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => { - setTimeout(cb, 16.66); - }); + const spiedRAF = jest + .spyOn(window, 'requestAnimationFrame') + .mockImplementation(cb => setTimeout(cb, 16.66)); - let setActiveKeyOuter; + let setActiveKeyOuter: React.Dispatch>; const Test = () => { const [activeKey, setActiveKey] = React.useState(); setActiveKeyOuter = setActiveKey; @@ -125,17 +135,18 @@ describe('Collapse', () => { ); }; - const wrapper = mount(); + const { container } = render(); await act(async () => { setActiveKeyOuter('1'); await Promise.resolve(); - jest.runAllTimers(); }); - expect(wrapper.render().find('.ant-motion-collapse').length).toBe(0); + triggerAllTimer(); + + expect(container.querySelectorAll('.ant-motion-collapse').length).toBe(0); - window.requestAnimationFrame.mockRestore(); + spiedRAF.mockRestore(); jest.useRealTimers(); }); diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 0ea665bde57a..e79cc7468e6e 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -42627,12 +42627,11 @@ exports[`ConfigProvider components Upload configProvider componentDisabled 1`] = class="" >
- - + />
diff --git a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap index d71d3ddcce61..79da07c6b948 100644 --- a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -4885,6 +4885,84 @@ exports[`renders ./components/form/demo/disabled.md extend context correctly 1`] +
+
+ +
+
+
+
+ +
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+
+
+
+
+
diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 493dd2c20f9a..9cfdefaabeb9 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -2368,6 +2368,84 @@ exports[`renders ./components/form/demo/disabled.md correctly 1`] = `
+
+
+ +
+
+
+
+ +
+
+ + +
+ + + +
+ Upload +
+
+
+
+
+
+
+
+
+
diff --git a/components/form/__tests__/__snapshots__/index.test.js.snap b/components/form/__tests__/__snapshots__/index.test.js.snap index 80ea07db9da3..2702ec432b47 100644 --- a/components/form/__tests__/__snapshots__/index.test.js.snap +++ b/components/form/__tests__/__snapshots__/index.test.js.snap @@ -838,6 +838,54 @@ exports[`Form form should support disabled 1`] = `
+
+
+ +
+
+
+
+ + +
+ +
+
+
+
diff --git a/components/form/__tests__/index.test.js b/components/form/__tests__/index.test.js index 95772f66cb42..34f63c1dcfb9 100644 --- a/components/form/__tests__/index.test.js +++ b/components/form/__tests__/index.test.js @@ -8,7 +8,7 @@ import * as Util from '../util'; import Button from '../../button'; import Input from '../../input'; import Select from '../../select'; - +import Upload from '../../upload'; import Cascader from '../../cascader'; import Checkbox from '../../checkbox'; import DatePicker from '../../date-picker'; @@ -945,6 +945,9 @@ describe('Form', () => { + + + diff --git a/components/form/demo/disabled.md b/components/form/demo/disabled.md index 454f999968c6..5d0f4de33f8b 100644 --- a/components/form/demo/disabled.md +++ b/components/form/demo/disabled.md @@ -14,6 +14,8 @@ title: Set component disabled, only works for antd components. ```tsx +import React, { useState } from 'react'; +import { PlusOutlined } from 'infra-design-icons'; import { Button, Cascader, @@ -26,8 +28,8 @@ import { Select, Switch, TreeSelect, + Upload, } from 'infrad'; -import React, { useState } from 'react'; const { RangePicker } = DatePicker; const { TextArea } = Input; @@ -102,6 +104,14 @@ const FormDisabledDemo = () => { + + +
+ +
Upload
+
+
+
diff --git a/components/input-number/__tests__/index.test.js b/components/input-number/__tests__/index.test.js index 1cb4be61a2ae..77129eb17bff 100644 --- a/components/input-number/__tests__/index.test.js +++ b/components/input-number/__tests__/index.test.js @@ -1,10 +1,10 @@ -import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons'; -import { mount } from 'enzyme'; import React from 'react'; +import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons'; import InputNumber from '..'; import focusTest from '../../../tests/shared/focusTest'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; +import { fireEvent, render } from '../../../tests/utils'; describe('InputNumber', () => { focusTest(InputNumber, { refFocus: true }); @@ -14,32 +14,35 @@ describe('InputNumber', () => { // https://github.com/ant-design/ant-design/issues/13896 it('should return null when blur a empty input number', () => { const onChange = jest.fn(); - const wrapper = mount(); - wrapper.find('input').simulate('change', { target: { value: '' } }); + const { container } = render(); + fireEvent.change(container.querySelector('input'), { target: { value: '' } }); expect(onChange).toHaveBeenLastCalledWith(null); }); it('should call onStep when press up or down button', () => { const onStep = jest.fn(); - const wrapper = mount(); - wrapper.find('.ant-input-number-handler-up').simulate('mousedown'); + const { container } = render(); + fireEvent.mouseDown(container.querySelector('.ant-input-number-handler-up')); expect(onStep).toBeCalledTimes(1); expect(onStep).toHaveBeenLastCalledWith(2, { offset: 1, type: 'up' }); - wrapper.find('.ant-input-number-handler-down').simulate('mousedown'); + + fireEvent.mouseDown(container.querySelector('.ant-input-number-handler-down')); expect(onStep).toBeCalledTimes(2); expect(onStep).toHaveBeenLastCalledWith(1, { offset: 1, type: 'down' }); }); it('renders correctly when controls is boolean', () => { - expect(mount().render()).toMatchSnapshot(); + const { asFragment } = render(); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('renders correctly when controls is {}', () => { - expect(mount().render()).toMatchSnapshot(); + const { asFragment } = render(); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('renders correctly when controls has custom upIcon and downIcon', () => { - const wrapper = mount( + const { asFragment } = render( , @@ -47,11 +50,11 @@ describe('InputNumber', () => { }} />, ); - expect(wrapper.render()).toMatchSnapshot(); + expect(asFragment().firstChild).toMatchSnapshot(); }); it('should support className', () => { - const wrapper = mount( + const { container } = render( , @@ -59,11 +62,11 @@ describe('InputNumber', () => { }} />, ); - expect(wrapper.find('.anticon-arrow-up').getDOMNode().className.includes('my-class-name')).toBe( + expect(container.querySelector('.anticon-arrow-up')?.className.includes('my-class-name')).toBe( true, ); expect( - wrapper.find('.anticon-arrow-down').getDOMNode().className.includes('my-class-name'), + container.querySelector('.anticon-arrow-down')?.className.includes('my-class-name'), ).toBe(true); }); }); diff --git a/components/input-number/__tests__/prefix.test.js b/components/input-number/__tests__/prefix.test.js index 96f1b797aa14..1f9bee8eeff5 100644 --- a/components/input-number/__tests__/prefix.test.js +++ b/components/input-number/__tests__/prefix.test.js @@ -1,25 +1,24 @@ -import { render } from '@testing-library/react'; -import { mount } from 'enzyme'; -import React from 'react'; +import React, { forwardRef } from 'react'; import InputNumber from '..'; import focusTest from '../../../tests/shared/focusTest'; +import { fireEvent, render } from '../../../tests/utils'; describe('prefix', () => { focusTest( - React.forwardRef((props, ref) => ), + forwardRef((props, ref) => ), { refFocus: true }, ); it('should support className when has prefix', () => { const { container } = render(); - expect(container.firstChild.className.includes('my-class-name')).toBe(true); + expect(container.firstChild?.className.includes('my-class-name')).toBe(true); expect(container.querySelector('input')?.className.includes('my-class-name')).toBe(false); }); it('should trigger focus when prefix is clicked', () => { - const wrapper = mount(123} />); + const { container } = render(123} />); - const mockFocus = jest.spyOn(wrapper.find('input').getDOMNode(), 'focus'); - wrapper.find('i').simulate('mouseUp'); + const mockFocus = jest.spyOn(container.querySelector('input'), 'focus'); + fireEvent.mouseUp(container.querySelector('i')); expect(mockFocus).toBeCalled(); }); }); diff --git a/components/input/Input.tsx b/components/input/Input.tsx index c57bfc4ddccf..4bd285858c62 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -39,7 +39,7 @@ export function resolveOnChange; if (e.type === 'click') { // Clone a new target for event. @@ -63,7 +63,7 @@ export function resolveOnChange); + onChange(event); return; } @@ -75,10 +75,10 @@ export function resolveOnChange); + onChange(event); return; } - onChange(event as React.ChangeEvent); + onChange(event); } export function triggerFocus( diff --git a/components/layout/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/layout/__tests__/__snapshots__/demo-extend.test.ts.snap index 34671947cad8..54ee4e3640ee 100644 --- a/components/layout/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/layout/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1361,9 +1361,12 @@ exports[`renders ./components/layout/demo/fixed-sider.md extend context correctl class="site-layout-background" style="padding:24px;text-align:center" > +

+ long content +

...
- Really + ...
...
@@ -1371,7 +1374,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md extend context correctl
...
- long + ...
...
@@ -1401,6 +1404,8 @@ exports[`renders ./components/layout/demo/fixed-sider.md extend context correctl
...
+ more +
...
... @@ -1439,6 +1444,110 @@ exports[`renders ./components/layout/demo/fixed-sider.md extend context correctl
...
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
...
... @@ -1455,7 +1564,6 @@ exports[`renders ./components/layout/demo/fixed-sider.md extend context correctl
...
- content
+

+ long content +

...
- Really + ...
...
@@ -741,7 +744,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
...
- long + ...
...
@@ -771,6 +774,8 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
...
+ more +
...
... @@ -809,6 +814,110 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
...
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ more +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
+ ... +
...
... @@ -825,7 +934,6 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
...
- content