From 483c8d39bd6859813c73d2096fdf436a95b6f1e2 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Mon, 27 Jun 2022 16:57:34 +0800 Subject: [PATCH 1/3] refactor: wrap Wave with FC (#36248) * refactor: wrap Wave with FC * test: update test case --- components/_util/__tests__/util.test.js | 55 ------------------- components/_util/__tests__/wave.test.js | 51 ++++++++++++++++- components/_util/wave.tsx | 9 ++- .../config-provider/__tests__/index.test.js | 2 +- components/switch/__tests__/wave.test.js | 3 +- 5 files changed, 60 insertions(+), 60 deletions(-) diff --git a/components/_util/__tests__/util.test.js b/components/_util/__tests__/util.test.js index d9e9544fb6..cb2eeb3835 100644 --- a/components/_util/__tests__/util.test.js +++ b/components/_util/__tests__/util.test.js @@ -12,7 +12,6 @@ import { throttleByAnimationFrameDecorator, } from '../throttleByAnimationFrame'; import TransButton from '../transButton'; -import Wave from '../wave'; describe('Test utils function', () => { describe('throttle', () => { @@ -140,60 +139,6 @@ describe('Test utils function', () => { }); }); - describe('wave', () => { - it('bindAnimationEvent should return when node is null', () => { - const wrapper = mount( - - - , - ) - .find(Wave) - .instance(); - expect(wrapper.bindAnimationEvent()).toBe(undefined); - }); - - it('bindAnimationEvent.onClick should return when children is hidden', () => { - const wrapper = mount( - - - , - ) - .find(Wave) - .instance(); - expect(wrapper.bindAnimationEvent()).toBe(undefined); - }); - - it('bindAnimationEvent.onClick should return when children is input', () => { - const wrapper = mount( - - - , - ) - .find(Wave) - .instance(); - expect(wrapper.bindAnimationEvent()).toBe(undefined); - }); - - it('should not throw when click it', () => { - expect(() => { - const wrapper = mount( - -
- , - ); - wrapper.simulate('click'); - }).not.toThrow(); - }); - - it('should not throw when no children', () => { - expect(() => mount()).not.toThrow(); - }); - }); - describe('TransButton', () => { it('can be focus/blur', () => { const ref = React.createRef(); diff --git a/components/_util/__tests__/wave.test.js b/components/_util/__tests__/wave.test.js index 44213d925e..7e733b9e3b 100644 --- a/components/_util/__tests__/wave.test.js +++ b/components/_util/__tests__/wave.test.js @@ -1,7 +1,7 @@ import { mount } from 'enzyme'; import React from 'react'; import mountTest from '../../../tests/shared/mountTest'; -import { sleep } from '../../../tests/utils'; +import { render, sleep } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; import Wave from '../wave'; @@ -148,4 +148,53 @@ describe('Wave component', () => { expect(styles[0].getAttribute('nonce')).toBe('YourNonceCode'); wrapper.unmount(); }); + + it('bindAnimationEvent should return when node is null', () => { + const ref = React.createRef(); + render( + + + , + ); + expect(ref.current?.bindAnimationEvent()).toBe(undefined); + }); + + it('bindAnimationEvent.onClick should return when children is hidden', () => { + const ref = React.createRef(); + render( + + + , + ); + expect(ref.current?.bindAnimationEvent()).toBe(undefined); + }); + + it('bindAnimationEvent.onClick should return when children is input', () => { + const ref = React.createRef(); + render( + + + , + ); + expect(ref.current?.bindAnimationEvent()).toBe(undefined); + }); + + it('should not throw when click it', () => { + expect(() => { + const wrapper = mount( + +
+ , + ); + wrapper.simulate('click'); + }).not.toThrow(); + }); + + it('should not throw when no children', () => { + expect(() => mount()).not.toThrow(); + }); }); diff --git a/components/_util/wave.tsx b/components/_util/wave.tsx index 5f7d699850..18a918ae44 100644 --- a/components/_util/wave.tsx +++ b/components/_util/wave.tsx @@ -1,6 +1,7 @@ import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; import { composeRef, supportRef } from 'rc-util/lib/ref'; import * as React from 'react'; +import { forwardRef } from 'react'; import type { ConfigConsumerProps, CSPConfig } from '../config-provider'; import { ConfigConsumer, ConfigContext } from '../config-provider'; import raf from './raf'; @@ -31,7 +32,7 @@ export interface WaveProps { children?: React.ReactNode; } -export default class Wave extends React.Component { +class InternalWave extends React.Component { static contextType = ConfigContext; private instance?: { @@ -226,3 +227,9 @@ export default class Wave extends React.Component { return {this.renderWave}; } } + +const Wave = forwardRef((props, ref) => ( + +)); + +export default Wave; diff --git a/components/config-provider/__tests__/index.test.js b/components/config-provider/__tests__/index.test.js index 5a39cae0a9..a8a680a2c0 100644 --- a/components/config-provider/__tests__/index.test.js +++ b/components/config-provider/__tests__/index.test.js @@ -23,7 +23,7 @@ describe('ConfigProvider', () => { , ); - expect(wrapper.find('Wave').instance().csp).toBe(csp); + expect(wrapper.find('InternalWave').instance().csp).toBe(csp); }); it('autoInsertSpaceInButton', () => { diff --git a/components/switch/__tests__/wave.test.js b/components/switch/__tests__/wave.test.js index e1a1fc6557..79014d25cf 100644 --- a/components/switch/__tests__/wave.test.js +++ b/components/switch/__tests__/wave.test.js @@ -2,7 +2,6 @@ import { mount } from 'enzyme'; import React from 'react'; import Switch from '..'; import { sleep } from '../../../tests/utils'; -import Wave from '../../_util/wave'; describe('click wave effect', () => { async function click(wrapper) { @@ -16,7 +15,7 @@ describe('click wave effect', () => { it('should have click wave effect', async () => { const wrapper = mount(); await click(wrapper); - const waveInstance = wrapper.find(Wave).instance(); + const waveInstance = wrapper.find('InternalWave').instance(); const resetEffect = jest.spyOn(waveInstance, 'resetEffect'); await click(wrapper); expect(resetEffect).toHaveBeenCalledTimes(1); From 2d233fb1472dd27a95c1c83b7ea39e10bfe8610b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 27 Jun 2022 18:05:48 +0800 Subject: [PATCH 2/3] docs: add 4.21.4 changelog (#36246) * docs: add 4.21.4 changelog * fix * reset --- CHANGELOG.en-US.md | 21 +++++++++++++++++++++ CHANGELOG.zh-CN.md | 21 +++++++++++++++++++++ package.json | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index b3929d19bf..dcba67ce82 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -14,6 +14,27 @@ timeline: true - Major version release is not included in this schedule for breaking change and new features. --- +## 4.21.4 + +`2022-06-27` + +- Table + - 🐞 Fix Table expand icon not align center. [#36215](https://github.com/ant-design/ant-design/pull/36215) + - 💄 Fix nested Table margin style. [#36209](https://github.com/ant-design/ant-design/pull/36209) + - 🐞 Fix Table filter dropdown with multiple subMenu may not closed. [#36132](https://github.com/ant-design/ant-design/pull/36132) + - 🐞 Table reset the last selection key when deselect or bulk operations. [#34705](https://github.com/ant-design/ant-design/pull/34705) [@Dunqing](https://github.com/Dunqing) +- 🐞 Fix Popover arrow color with custom `color` prop. [#36241](https://github.com/ant-design/ant-design/pull/36241) [@MadCcc](https://github.com/MadCcc) +- 🐞 Fix Upload `listType="picture-card"` select button not being hidden when children is empty. [#36196](https://github.com/ant-design/ant-design/pull/36196) +- 🐞 Fix Menu deprecated warning when `item={undefined}`. [#36190](https://github.com/ant-design/ant-design/pull/36190) +- 💄 Fix Button `loading` icon margin style lost. [#36168](https://github.com/ant-design/ant-design/pull/36168) +- 🐞 Fix Dropdown using Menu with group item can not close by click. [#36148](https://github.com/ant-design/ant-design/pull/36148) +- 💄 Enlarge dragable area for Slider handler. [#36018](https://github.com/ant-design/ant-design/pull/36018) [@slotDumpling](https://github.com/slotDumpling) +- 🐞 Fix: repeat a css class in readOnly, which has been declared in rc-input-number. [#36120](https://github.com/ant-design/ant-design/pull/36120) [@RainyLiao](https://github.com/RainyLiao) +- 💄 Fix Skeleton active background color in dark theme. [#36116](https://github.com/ant-design/ant-design/pull/36116) +- TypeScript + - 🤖 Fix type incompatibility. [#36189](https://github.com/ant-design/ant-design/pull/36189) [@Dunqing](https://github.com/Dunqing) + - 🤖 exporting `UploadFile` from `Upload`. [#34733](https://github.com/ant-design/ant-design/pull/34733) [@chentsulin](https://github.com/chentsulin) + ## 4.21.3 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index eb41c15c6b..6e448cc249 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,27 @@ timeline: true --- +## 4.21.4 + +`2022-06-27` + +- Table + - 🐞 修复 Table 展开图标未居中的问题。[#36215](https://github.com/ant-design/ant-design/pull/36215) + - 💄 修复 Table 内嵌 Table 时的边距问题。[#36209](https://github.com/ant-design/ant-design/pull/36209) + - 🐞 Table 取消选择或批量操作时重置上一次选择的 key。[#34705](https://github.com/ant-design/ant-design/pull/34705) [@Dunqing](https://github.com/Dunqing) + - 🐞 修复 Table 过滤列表在某些场景下多级展开无法关闭的问题。[#36132](https://github.com/ant-design/ant-design/pull/36132) +- 🐞 修复 Upload `listType="picture-card"` 当 children 为空时上传文件按钮没有隐藏的问题。[#36196](https://github.com/ant-design/ant-design/pull/36196) +- 🐞 修复 Popover 自定义 `color` 时箭头颜色问题。[#36241](https://github.com/ant-design/ant-design/pull/36241) [@MadCcc](https://github.com/MadCcc) +- 🐞 修复 Menu `item={undefined}` 时会有废弃警告的问题。[#36190](https://github.com/ant-design/ant-design/pull/36190) +- 💄 修复 Button `loading` 图标的间距丢失的问题。[#36168](https://github.com/ant-design/ant-design/pull/36168) +- 🐞 修复 Dropdown 中 Menu 分组下的 Item 点击不会关闭的问题。[#36148](https://github.com/ant-design/ant-design/pull/36148) +- 💄 优化 Slider 拖拽手柄的可交互区域。[#36018](https://github.com/ant-design/ant-design/pull/36018) [@slotDumpling](https://github.com/slotDumpling) +- 🐞 修复重复添加 readOnly 的 css 类名,它已在 rc-input-number 中被声明了。[#36120](https://github.com/ant-design/ant-design/pull/36120) [@RainyLiao](https://github.com/RainyLiao) +- 💄 修复 Skeleton 在 `active` 时的背景色样式。[#36116](https://github.com/ant-design/ant-design/pull/36116) +- TypeScript + - 🤖 修复 TreeSelect `switcherIcon` 类型不兼容。[#36189](https://github.com/ant-design/ant-design/pull/36189) [@Dunqing](https://github.com/Dunqing) + - 🤖 从 `Upload` 导出类型 `UploadFile`。[#34733](https://github.com/ant-design/ant-design/pull/34733) [@chentsulin](https://github.com/chentsulin) + ## 4.21.3 `2022-06-17` diff --git a/package.json b/package.json index 964c6c71b4..ead5061d5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.21.3", + "version": "4.21.4", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ @@ -231,7 +231,7 @@ "identity-obj-proxy": "^3.0.0", "immer": "^9.0.1", "immutability-helper": "^3.0.0", - "inquirer": "^9.0.0", + "inquirer": "^8.0.0", "intersection-observer": "^0.12.0", "isomorphic-fetch": "^3.0.0", "jest": "^28.0.3", From 4439891ced2f124c381b2a5090511fe2d900a8a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jun 2022 21:56:06 +0800 Subject: [PATCH 3/3] 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> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ead5061d5d..e0f8b54394 100644 --- a/package.json +++ b/package.json @@ -197,7 +197,7 @@ "bisheng-plugin-toc": "^0.4.4", "bundlesize": "^0.18.0", "chalk": "^4.0.0", - "cheerio": "1.0.0-rc.10", + "cheerio": "1.0.0-rc.12", "concurrently": "^7.0.0", "cross-env": "^7.0.0", "css-minimizer-webpack-plugin": "^1.3.0",