From 06a34ca23536bdc7f41f12efa3c0286b8bb773c1 Mon Sep 17 00:00:00 2001 From: Peach Date: Mon, 11 Oct 2021 15:13:28 +0800 Subject: [PATCH 1/9] docs: 4.17.0-alpha.6 changelog (#32428) * docs: 4.17.0-alpha.6 changelog * chore: bump version * docs: update CHANGELOG.zh-CN.md Co-authored-by: afc163 * docs: sort changelog by type * Update CHANGELOG.en-US.md * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Co-authored-by: xrkffgg --- CHANGELOG.en-US.md | 12 ++++++++++++ CHANGELOG.zh-CN.md | 12 ++++++++++++ package.json | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 261c95e0b6..d644c0e164 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,18 @@ timeline: true --- +## 4.17.0-alpha.6 + +`2021-10-11` + +- 🐞 Fix InputNumber handler arrow not align center. [#32409](https://github.com/ant-design/ant-design/pull/32409) +- 🐞 Fix `closeIcon` overwriting bug when Notification is called multiple times. [#32359](https://github.com/ant-design/ant-design/pull/32359) [@KAROTT7](https://github.com/KAROTT7) +- 🐞 Fix Button align issue with `icon` and `href`. [#32373](https://github.com/ant-design/ant-design/pull/32373) +- 💄 Optimize Drawer open animation. [#32342](https://github.com/ant-design/ant-design/pull/32342) +- 💄 Fix Mentions error style in Form. [#32385](https://github.com/ant-design/ant-design/pull/32385) +- TypeScript + - 🤖 Fix args type for `getPopupContainer` in ConfigProvider. [#32406](https://github.com/ant-design/ant-design/pull/32406) [@mtadams007](https://github.com/mtadams007) + ## 4.17.0-alpha.5 `2021-09-30` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index eaf9d7cbc3..2c73305957 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,18 @@ timeline: true --- +## 4.17.0-alpha.6 + +`2021-10-11` + +- 🐞 修复 InputNumber 操作杆箭头未居中对齐的问题。[#32409](https://github.com/ant-design/ant-design/pull/32409) +- 🐞 修复多次调用 Notification 时 `closeIcon` 配置会被覆盖的问题。[#32359](https://github.com/ant-design/ant-design/pull/32359) [@KAROTT7](https://github.com/KAROTT7) +- 🐞 修复 Button 有 `icon` 和 `href` 时的对齐问题。[#32373](https://github.com/ant-design/ant-design/pull/32373) +- 💄 优化 Drawer 弹出动画。[#32342](https://github.com/ant-design/ant-design/pull/32342) +- 💄 修复 Mentions 在 Form 下错误样式丢失的问题。[#32385](https://github.com/ant-design/ant-design/pull/32385) +- TypeScript + - 🤖 修复 ConfigProvider 中 `getPopupContainer` 的参数类型。[#32406](https://github.com/ant-design/ant-design/pull/32406) [@mtadams007](https://github.com/mtadams007) + ## 4.17.0-alpha.5 `2021-09-30` diff --git a/package.json b/package.json index b5ca33c1d1..270004e1f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.17.0-alpha.5", + "version": "4.17.0-alpha.6", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ From 08fabf9ff957e251bf57297c5ba6439eb23b693d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 19:45:44 +0800 Subject: [PATCH 2/9] chore(deps-dev): bump jsdom from 17.0.0 to 18.0.0 (#32436) Bumps [jsdom](https://github.com/jsdom/jsdom) from 17.0.0 to 18.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/17.0.0...18.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> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 270004e1f2..28ed85798e 100644 --- a/package.json +++ b/package.json @@ -227,7 +227,7 @@ "jest-image-snapshot": "^4.5.1", "jest-puppeteer": "^6.0.0", "jquery": "^3.4.1", - "jsdom": "^17.0.0", + "jsdom": "^18.0.0", "jsonml.js": "^0.1.0", "less-vars-to-js": "^1.3.0", "lz-string": "^1.4.4", From 6d3973fb9528861d935ebd88add93582412b016a Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 12 Oct 2021 13:14:26 +0800 Subject: [PATCH 3/9] chore(deps-dev): bump eslint-plugin-jest from 24.7.0 to 25.0.1 (#32444) * chore(deps-dev): bump eslint-plugin-jest from 24.7.0 to 25.0.1 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.7.0 to 25.0.1. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.7.0...v25.0.1) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: fix eslint errors and warnings * fix rc-slider version Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- components/alert/__tests__/index.test.tsx | 1 + components/cascader/__tests__/index.test.js | 17 +++++++++-------- .../__tests__/components.test.js | 1 - package.json | 4 ++-- scripts/css-variable-sync.js | 1 + tests/shared/excludeWarning.tsx | 1 + webpack.config.js | 1 + 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/components/alert/__tests__/index.test.tsx b/components/alert/__tests__/index.test.tsx index 11ee125e88..038985c21a 100644 --- a/components/alert/__tests__/index.test.tsx +++ b/components/alert/__tests__/index.test.tsx @@ -77,6 +77,7 @@ describe('Alert', () => { it('ErrorBoundary', () => { jest.spyOn(console, 'error').mockImplementation(() => undefined); + // eslint-disable-next-line no-console expect(console.error).toBeCalledTimes(0); // @ts-expect-error // eslint-disable-next-line react/jsx-no-undef diff --git a/components/cascader/__tests__/index.test.js b/components/cascader/__tests__/index.test.js index 479d654178..d953665a45 100644 --- a/components/cascader/__tests__/index.test.js +++ b/components/cascader/__tests__/index.test.js @@ -327,14 +327,15 @@ describe('Cascader', () => { }); // FIXME: Move to `rc-tree-select` instead - // it('should warning if not find `value` in `options`', () => { - // const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); - // mount(); - // expect(errorSpy).toHaveBeenCalledWith( - // 'Warning: [antd: Cascader] Not found `value` in `options`.', - // ); - // errorSpy.mockRestore(); - // }); + // eslint-disable-next-line jest/no-disabled-tests + it.skip('should warning if not find `value` in `options`', () => { + const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + mount(); + expect(errorSpy).toHaveBeenCalledWith( + 'Warning: [antd: Cascader] Not found `value` in `options`.', + ); + errorSpy.mockRestore(); + }); // https://github.com/ant-design/ant-design/issues/17690 it('should not breaks when children is null', () => { diff --git a/components/config-provider/__tests__/components.test.js b/components/config-provider/__tests__/components.test.js index 562f994568..85eb188909 100644 --- a/components/config-provider/__tests__/components.test.js +++ b/components/config-provider/__tests__/components.test.js @@ -60,7 +60,6 @@ jest.mock('rc-util/lib/Portal'); describe('ConfigProvider', () => { describe('components', () => { function testPair(name, renderComponent) { - // eslint-disable-next-line jest/valid-describe describe(`${name}`, () => { // normal it('normal', () => { diff --git a/package.json b/package.json index 28ed85798e..963edc90bb 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "rc-rate": "~2.9.0", "rc-resize-observer": "^1.0.0", "rc-select": "~13.1.0-alpha.0", - "rc-slider": "~9.7.1", + "rc-slider": "~9.7.4", "rc-steps": "~4.1.0", "rc-switch": "~3.2.0", "rc-table": "~7.18.0", @@ -204,7 +204,7 @@ "eslint-plugin-babel": "^5.3.0", "eslint-plugin-compat": "^3.9.0", "eslint-plugin-import": "^2.21.1", - "eslint-plugin-jest": "^24.0.1", + "eslint-plugin-jest": "^25.0.1", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-markdown": "^2.0.0", "eslint-plugin-react": "^7.20.6", diff --git a/scripts/css-variable-sync.js b/scripts/css-variable-sync.js index c0749a56b2..f46cb13c16 100644 --- a/scripts/css-variable-sync.js +++ b/scripts/css-variable-sync.js @@ -218,4 +218,5 @@ replaceVariable('alert-error-bg-color', '@error-color-deprecated-bg'); fse.writeFileSync(targetPath, variableContent, 'utf8'); +// eslint-disable-next-line no-console console.log(chalk.green('Success! Replaced path:'), targetPath); diff --git a/tests/shared/excludeWarning.tsx b/tests/shared/excludeWarning.tsx index 0aa24c5ee1..f619e50526 100644 --- a/tests/shared/excludeWarning.tsx +++ b/tests/shared/excludeWarning.tsx @@ -1,3 +1,4 @@ +// eslint-disable-next-line no-console const originError = console.error; /** This function will remove `useLayoutEffect` server side warning. Since it's useless. */ diff --git a/webpack.config.js b/webpack.config.js index d7fda02373..31ee02bcc2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -92,6 +92,7 @@ function processWebpackThemeConfig(themeConfig, theme, vars) { if (originPath.length === 1 && originPath[0] === './index') { replacedPath = ['./index-style-only']; } else { + // eslint-disable-next-line no-console console.log(chalk.red('🆘 Seems entry has changed! It should be `./index`')); } From 3b27f47097fba516cace0762b1bf32789a7ea5ef Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 12 Oct 2021 17:18:59 +0800 Subject: [PATCH 4/9] fix: Typography ellipsis not working in Table (#32447) * chore: add reproduce demo * fix: Typography ellipsis in Table close #32432 --- components/typography/Base.tsx | 8 ++++++-- components/typography/util.tsx | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index 26972388a4..07be17d2bb 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -314,10 +314,14 @@ class Base extends React.Component { const { ellipsisText, isEllipsis, expanded } = this.state; const { rows, suffix, onEllipsis } = this.getEllipsis(); const { children } = this.props; - if (!rows || rows < 0 || !this.contentRef.current || expanded) return; + if (!rows || rows < 0 || !this.contentRef.current || expanded) { + return; + } // Do not measure if css already support ellipsis - if (this.canUseCSSEllipsis()) return; + if (this.canUseCSSEllipsis()) { + return; + } devWarning( toArray(children).every((child: React.ReactNode) => typeof child === 'string'), diff --git a/components/typography/util.tsx b/components/typography/util.tsx index 52ce76f9e2..6ad6503bfe 100644 --- a/components/typography/util.tsx +++ b/components/typography/util.tsx @@ -106,8 +106,9 @@ export default ( // Get origin style const originStyle = window.getComputedStyle(originElement); const lineHeight = getRealLineHeight(originElement); - const maxHeight = - Math.floor(lineHeight) * (rows + 1) + + const overflowRows = rows + 1; + const oneRowMaxHeight = + Math.floor(lineHeight) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom); @@ -128,7 +129,9 @@ export default ( // Check if ellipsis in measure div is height enough for content function inRange() { - return Math.ceil(ellipsisContainer.getBoundingClientRect().height) < maxHeight; + return ( + Math.ceil(ellipsisContainer.getBoundingClientRect().height / overflowRows) < oneRowMaxHeight + ); } // Skip ellipsis if already match @@ -223,6 +226,7 @@ export default ( reactNode: null, }; } + if (type === TEXT_NODE) { const fullText = childNode.textContent || ''; const textNode = document.createTextNode(fullText); From ee703c187efb0c69f62bc7bae30a9d3c2215b489 Mon Sep 17 00:00:00 2001 From: Mohammad Arsalan Date: Wed, 13 Oct 2021 08:55:55 +0500 Subject: [PATCH 5/9] fix: TextArea missing maxLength attribute (#32448) --- components/input/TextArea.tsx | 1 + components/input/__tests__/__snapshots__/demo.test.js.snap | 1 + components/input/__tests__/__snapshots__/textarea.test.js.snap | 1 + 3 files changed, 3 insertions(+) diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 136b2dca8c..65c8c813f3 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -135,6 +135,7 @@ const TextArea = React.forwardRef( onChange={handleChange} onCompositionEnd={onInternalCompositionEnd} ref={innerRef} + maxLength={maxLength} /> ); diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index c4883630c8..5644c061e0 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -3317,6 +3317,7 @@ exports[`renders ./components/input/demo/textarea-show-count.md correctly 1`] = >