From 01df1f733cd6e22aeee817728d9bde48a97794e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 15 Feb 2022 16:57:18 +0800 Subject: [PATCH 01/23] chore: script update (#34060) --- .github/workflows/pr-check-ci.yml | 2 +- .github/workflows/release-helper.yml | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pr-check-ci.yml b/.github/workflows/pr-check-ci.yml index a8d492dd5f..d9599590a5 100644 --- a/.github/workflows/pr-check-ci.yml +++ b/.github/workflows/pr-check-ci.yml @@ -13,7 +13,7 @@ jobs: with: filter-label: 'BranchAutoMerge' filter-creator-authority: 'write' - filter-head-ref: 'master, feature, master-merge-feature, feature-merge-master' + filter-head-ref: 'master, feature, next, master-merge-feature, feature-merge-master, next-merge-master' filter-support-fork: false skip-run-names: 'deploy preview, pr-check-ci, build preview failed, suggest-related-links' conflict-review-body: '😅 This branch has conflicts that must be resolved!' diff --git a/.github/workflows/release-helper.yml b/.github/workflows/release-helper.yml index 66d96a6e6b..05ee24a927 100644 --- a/.github/workflows/release-helper.yml +++ b/.github/workflows/release-helper.yml @@ -16,25 +16,12 @@ jobs: runs-on: ubuntu-latest steps: - name: make release - uses: actions-cool/release-helper@v1 + uses: actions-cool/release-helper@v2 with: triger: 'tag' changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md' branch: 'master' - dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} - dingding-msg: 'CHANGELOG.zh-CN.md' - msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' - msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志' - prettier: true - prerelease-filter: '-, a, b, A, B' - - - name: make release - Bigfish - uses: actions-cool/release-helper@v1 - with: - triger: 'tag' - changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md' - branch: 'master' - dingding-token: ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} + dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} dingding-msg: 'CHANGELOG.zh-CN.md' msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志' From 0bfcf36d27f3cac38c2743377e58282138caa1f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 18:18:41 +0800 Subject: [PATCH 02/23] chore(deps): update dependency stylelint-config-standard to v25 (#34028) * chore(deps): update dependency stylelint-config-standard to v25 * fix stylelint lint Co-authored-by: Renovate Bot Co-authored-by: tanghui --- .stylelintrc.json | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index 5a03e7f8aa..b5af6dd10a 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -8,6 +8,25 @@ "plugins": ["stylelint-declaration-block-no-ignored-properties"], "rules": { "function-name-case": ["lower", { "ignoreFunctions": ["/colorPalette/"] }], + "function-no-unknown": [ + true, + { + "ignoreFunctions": [ + "fade", + "tint", + "darken", + "ceil", + "fadein", + "floor", + "unit", + "shade", + "lighten", + "percentage", + "-", + "~`colorPalette" + ] + } + ], "no-descending-specificity": null, "no-invalid-position-at-import-rule": null, "declaration-empty-line-before": null, diff --git a/package.json b/package.json index 79f76016c2..63c3fffb70 100644 --- a/package.json +++ b/package.json @@ -277,7 +277,7 @@ "stylelint": "^14.0.0", "stylelint-config-prettier": "^9.0.2", "stylelint-config-rational-order": "^0.1.2", - "stylelint-config-standard": "^24.0.0", + "stylelint-config-standard": "^25.0.0", "stylelint-declaration-block-no-ignored-properties": "^2.1.0", "stylelint-order": "^5.0.0", "theme-switcher": "^1.0.2", From fcd6ab67eca96cac7c12bee9e5b5489e5cadcb5f Mon Sep 17 00:00:00 2001 From: Filip Seman Date: Wed, 16 Feb 2022 03:04:09 +0100 Subject: [PATCH 03/23] chore: Update sk_SK locales (#34061) * chore: Update sk_SK locales * Disable eslint rule, based on defaults (EN) --- components/locale/sk_SK.tsx | 77 +++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/components/locale/sk_SK.tsx b/components/locale/sk_SK.tsx index 2a24b6126b..3de5d74a35 100644 --- a/components/locale/sk_SK.tsx +++ b/components/locale/sk_SK.tsx @@ -1,9 +1,12 @@ +/* eslint-disable no-template-curly-in-string */ import Pagination from 'rc-pagination/lib/locale/sk_SK'; import DatePicker from '../date-picker/locale/sk_SK'; import TimePicker from '../time-picker/locale/sk_SK'; import Calendar from '../calendar/locale/sk_SK'; import { Locale } from '../locale-provider'; +const typeTemplate = '${label} nie je platný ${type}'; + const localeValues: Locale = { locale: 'sk', Pagination, @@ -11,17 +14,26 @@ const localeValues: Locale = { TimePicker, Calendar, global: { - placeholder: 'Prosím vyberte', + placeholder: 'Prosím vyber', }, Table: { filterTitle: 'Filter', filterConfirm: 'OK', filterReset: 'Obnoviť', - selectAll: 'Vybrať všetko', - selectInvert: 'Vybrať opačné', + filterEmptyText: 'Žiadne filtre', + filterCheckall: 'Vyber všetky položky', + filterSearchPlaceholder: 'Vyhľadaj vo filtroch', + emptyText: 'Žiadne dáta', + selectAll: 'Označ všetky položky', + selectInvert: 'Opačný výber položiek', + selectNone: 'Odznač všetko', + selectionAll: 'Označ všetko', sortTitle: 'Zoradiť', expand: 'Rozbaliť riadok', collapse: 'Zbaliť riadok', + triggerDesc: 'Kliknutím zoradíš zostupne', + triggerAsc: 'Kliknutím zoradíš vzostupne', + cancelSort: 'Kliknutím zrušíš zoradenie', }, Modal: { okText: 'OK', @@ -37,6 +49,12 @@ const localeValues: Locale = { searchPlaceholder: 'Vyhľadávanie', itemUnit: 'položka', itemsUnit: 'položiek', + remove: 'Odstráň', + selectCurrent: 'Vyber aktuálnu stranu', + removeCurrent: 'Zmaž aktuálnu stranu', + selectAll: 'Označ všetko', + removeAll: 'Odznač všetko', + selectInvert: 'Opačný výber', }, Upload: { uploading: 'Nahrávanie...', @@ -60,6 +78,59 @@ const localeValues: Locale = { PageHeader: { back: 'Späť', }, + Form: { + optional: '(nepovinné)', + defaultValidateMessages: { + default: 'Validačná chyba poľa pre ${label}', + required: 'Prosím vlož ${label}', + enum: '${label} musí byť jeden z [${enum}]', + whitespace: '${label} nemôže byť prázdny znak', + date: { + format: '${label} formát dátumu je neplatný', + parse: '${label} nie je možné konvertovať na dátum', + invalid: '${label} je neplatný dátum', + }, + types: { + string: typeTemplate, + method: typeTemplate, + array: typeTemplate, + object: typeTemplate, + number: typeTemplate, + date: typeTemplate, + boolean: typeTemplate, + integer: typeTemplate, + float: typeTemplate, + regexp: typeTemplate, + email: typeTemplate, + url: typeTemplate, + hex: typeTemplate, + }, + string: { + len: '${label} musí byť ${len} znakov', + min: '${label} musí byť aspoň ${min} znakov', + max: '${label} musí byť do ${max} znakov', + range: '${label} musí byť medzi ${min}-${max} znakmi', + }, + number: { + len: '${label} musí byť rovnaký ako ${len}', + min: '${label} musí byť minimálne ${min}', + max: '${label} musí byť maximálne ${max}', + range: '${label} musí byť medzi ${min}-${max}', + }, + array: { + len: 'Musí byť ${len} ${label}', + min: 'Aspoň ${min} ${label}', + max: 'Najviac ${max} ${label}', + range: 'Počet ${label} musí byť medzi ${min}-${max}', + }, + pattern: { + mismatch: '${label} nezodpovedá vzoru ${pattern}', + }, + }, + }, + Image: { + preview: 'Náhľad', + }, }; export default localeValues; From 904ef933ef3370d0158162f180840f463b4916b5 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Wed, 16 Feb 2022 16:28:05 +0800 Subject: [PATCH 04/23] ci: add MadCcc assign --- .github/workflows/verify-files-modify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-files-modify.yml b/.github/workflows/verify-files-modify.yml index 0411746d35..d76777352f 100644 --- a/.github/workflows/verify-files-modify.yml +++ b/.github/workflows/verify-files-modify.yml @@ -14,7 +14,7 @@ jobs: forbid-paths: '.github/, scripts/' forbid-files: 'CHANGELOG.zh-CN.md, CHANGELOG.en-US.md, LICENSE' skip-verify-authority: 'write' - assignees: 'afc163, zombieJ, xrkffgg' + assignees: 'afc163, zombieJ, xrkffgg, MadCcc' comment: | Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution. The path `.github/` or `scripts/` and `CHANGELOG` `package.json` is only maintained by team members. This current PR will be closed and team members will help on this. close: true From 0596e338caf1b3f838d5e51cae491b11f3b7b025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 16 Feb 2022 17:24:29 +0800 Subject: [PATCH 05/23] perf: OPT table render perf (#34075) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63c3fffb70..d7362c4705 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "rc-slider": "~9.7.4", "rc-steps": "~4.1.0", "rc-switch": "~3.2.0", - "rc-table": "~7.22.2", + "rc-table": "~7.23.0", "rc-tabs": "~11.10.0", "rc-textarea": "~0.3.0", "rc-tooltip": "~5.1.1", From 58c1998e1e10d8074e9a9662821b869565689408 Mon Sep 17 00:00:00 2001 From: opopeieie Date: Wed, 16 Feb 2022 19:41:06 +0800 Subject: [PATCH 06/23] fix: Typography copyable in clipboard incorrect (#34034) Co-authored-by: chenxq --- components/typography/Base/index.tsx | 5 +--- components/typography/__tests__/copy.test.tsx | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/components/typography/Base/index.tsx b/components/typography/Base/index.tsx index ea81ea7441..0b99e4ed49 100644 --- a/components/typography/Base/index.tsx +++ b/components/typography/Base/index.tsx @@ -197,10 +197,7 @@ const Base = React.forwardRef((props: InternalBlockProps, ref: any) => { e?.preventDefault(); e?.stopPropagation(); - if (copyConfig.text === undefined) { - copyConfig.text = String(children); - } - copy(copyConfig.text || ''); + copy(copyConfig.text || String(children) || ''); setCopied(true); diff --git a/components/typography/__tests__/copy.test.tsx b/components/typography/__tests__/copy.test.tsx index d831d5c7de..20ceb9d5a1 100644 --- a/components/typography/__tests__/copy.test.tsx +++ b/components/typography/__tests__/copy.test.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { SmileOutlined, LikeOutlined } from '@ant-design/icons'; +import * as copyObj from 'copy-to-clipboard'; import Base from '../Base'; @@ -206,5 +207,34 @@ describe('Typography copy', () => { wrapper.find('.ant-typography-copy').first().simulate('click'); expect(onDivClick).not.toBeCalled(); }); + + it('copy to clipboard', done => { + const spy = jest.spyOn(copyObj, 'default'); + const originText = 'origin text.'; + const nextText = 'next text.'; + const Test = () => { + const [dynamicText, setDynamicText] = React.useState(originText); + React.useEffect(() => { + setTimeout(() => { + setDynamicText(nextText); + }, 500); + }); + return ( + + {dynamicText} + + ); + }; + const wrapper = mount(); + const copyBtn = wrapper.find('.ant-typography-copy').first(); + copyBtn.simulate('click'); + expect(spy.mock.calls[0][0]).toEqual(originText); + setTimeout(() => { + spy.mockReset(); + copyBtn.simulate('click'); + expect(spy.mock.calls[0][0]).toEqual(nextText); + done(); + }, 500); + }); }); }); From d38363e161baeeb72e7c19e0ea301be6a54343ba Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 16 Feb 2022 19:50:38 +0800 Subject: [PATCH 07/23] docs: fix procomponents links --- components/list/index.zh-CN.md | 2 +- docs/react/practical-projects.en-US.md | 8 ++++---- docs/react/practical-projects.zh-CN.md | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/list/index.zh-CN.md b/components/list/index.zh-CN.md index 4643b9e3ae..623ad6b880 100644 --- a/components/list/index.zh-CN.md +++ b/components/list/index.zh-CN.md @@ -15,7 +15,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/5FrZKStG_/List.svg ## API -另外我们封装了 [ProList](https://prolist.ant.design/),在 `antd` List 之上扩展了更多便捷易用的功能,比如多选,展开等功能,使用体验贴近 Table,欢迎尝试使用。 +另外我们封装了 [ProList](https://procomponents.ant.design/components/list),在 `antd` List 之上扩展了更多便捷易用的功能,比如多选,展开等功能,使用体验贴近 Table,欢迎尝试使用。 ### List diff --git a/docs/react/practical-projects.en-US.md b/docs/react/practical-projects.en-US.md index 1d8452f73a..e5b3e7a283 100644 --- a/docs/react/practical-projects.en-US.md +++ b/docs/react/practical-projects.en-US.md @@ -210,7 +210,7 @@ export default ( ); ``` -Click here [Quick Start](https://prolayout.ant.design/getting-started). +Click here [Quick Start](https://procomponents.ant.design/en-US/components/layout). ## ProTable @@ -263,7 +263,7 @@ const Products = () => { }; ``` -ProTable provides preset logic to handle loading, pagination and search forms, which can greatly reduce the amount of code, click here [Quick Start](https://protable.ant.design/getting-started). +ProTable provides preset logic to handle loading, pagination and search forms, which can greatly reduce the amount of code, click here [ProTable](https://procomponents.ant.design/en-US/components/table). ## Build @@ -293,5 +293,5 @@ You can: - Know [the umi routes](https://umijs.org/zh/guide/router.html) - Know [how to deploy umi application](https://umijs.org/zh/guide/deploy.html) - Scaffolding out of the box [Ant Design Pro](https://pro.ant.design) -- Advanced Layout [ProLayout](https://prolayout.ant.design) -- Advanced Table [ProTable](https://protable.ant.design) +- Advanced Layout [ProLayout](https://procomponents.ant.design/en-US/components/layout) +- Advanced Table [ProTable](https://procomponents.ant.design/en-US/components/table) diff --git a/docs/react/practical-projects.zh-CN.md b/docs/react/practical-projects.zh-CN.md index a303560b0f..522eb823d3 100644 --- a/docs/react/practical-projects.zh-CN.md +++ b/docs/react/practical-projects.zh-CN.md @@ -213,7 +213,7 @@ export default ( ); ``` -点击这里[快速开始](https://prolayout.ant.design/getting-started)。 +点击这里[快速开始](https://procomponents.ant.design/components/layout)。 ## ProTable @@ -266,7 +266,7 @@ const Products = () => { }; ``` -ProTable 提供了预设逻辑来处理 loading,分页 和搜索表单,可以大大减少代码量,点击这里[快速开始](https://protable.ant.design/getting-started)。 +ProTable 提供了预设逻辑来处理 loading,分页 和搜索表单,可以大大减少代码量,点击这里[快速开始](https://procomponents.ant.design/components/table)。 ## 构建应用 @@ -296,5 +296,5 @@ $ yarn build - 理解 [umi 的路由](https://umijs.org/zh/guide/router.html) - 理解 [如何部署 umi 应用](https://umijs.org/zh/guide/deploy.html) - 开箱即用的脚手架 [Ant Design Pro](https://pro.ant.design) -- 高级布局 [ProLayout](https://prolayout.ant.design) -- 高级表格 [ProTable](https://protable.ant.design) +- 高级布局 [ProLayout](https://procomponents.ant.design/components/layout) +- 高级表格 [ProTable](https://procomponents.ant.design/components/table) From fc60b1f656d67a8245ac273fc80cc7a073f65aa9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 16 Feb 2022 19:54:58 +0800 Subject: [PATCH 08/23] test: skip layout demo which failed a lot in argoci --- components/layout/__tests__/image.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/layout/__tests__/image.test.ts b/components/layout/__tests__/image.test.ts index 15deaf9ed1..4013073eb5 100644 --- a/components/layout/__tests__/image.test.ts +++ b/components/layout/__tests__/image.test.ts @@ -1,5 +1,5 @@ import { imageDemoTest } from '../../../tests/shared/imageTest'; describe('Layout image', () => { - imageDemoTest('layout', { skip: ['countdown.md '] }); + imageDemoTest('layout', { skip: ['fixed-sider.md'] }); }); From 106acb7d5ba63a5a9095550b240b2cfe37a15a11 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 16 Feb 2022 20:00:57 +0800 Subject: [PATCH 09/23] docs: improve Umi documentation --- docs/react/practical-projects.en-US.md | 16 ++++++++-------- docs/react/practical-projects.zh-CN.md | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/react/practical-projects.en-US.md b/docs/react/practical-projects.en-US.md index e5b3e7a283..b94699ad91 100644 --- a/docs/react/practical-projects.en-US.md +++ b/docs/react/practical-projects.en-US.md @@ -3,13 +3,13 @@ order: 3 title: Real project with umi --- -In real project development, you may need data flow solutions such as Redux or MobX. Ant Design React is a UI library that can be used with data flow solutions and application frameworks in any React ecosystem. Based on the business scenario, we launched a pluggable enterprise-level application framework umi, which is recommended for use in the project. +In real project development, you may need data flow solutions such as Redux or MobX. Ant Design React is a UI library that can be used with data flow solutions and application frameworks in any React ecosystem. Based on the business scenario, we launched a pluggable enterprise-level application framework [Umi](https://umijs.org), which is recommended for use in the project. -And [umi](https://umijs.org) is a routing-based framework that supports [next.js-like conventional routing](https://umijs.org/docs/convention-routing) and various advanced routing functions, such as [routing-level on-demand loading](https://umijs.org/config#dynamicimport). With a complete [plugin system](https://umijs.org/plugins/api) that covers every life cycle from source code to build product, umi is able to support various functional extensions and business needs; meanwhile [Umi UI](https://umijs.org/docs/use-umi-ui) is provided to enhance the development experience and development efficiency through Visual Aided Programming (VAP). +And [Umi](https://umijs.org) is a routing-based framework that supports [next.js-like conventional routing](https://umijs.org/docs/convention-routing) and various advanced routing functions, such as [routing-level on-demand loading](https://umijs.org/config#dynamicimport). With a complete [plugin system](https://umijs.org/plugins/api) that covers every life cycle from source code to build product, Umi is able to support various functional extensions and business needs; meanwhile [Umi UI](https://umijs.org/docs/use-umi-ui) is provided to enhance the development experience and development efficiency through Visual Aided Programming (VAP). -> You may also be interested in [Ant Design Pro](https://pro.ant.design/), an Out-of-box UI solution for enterprise applications based on umi, dva and ant design. +> You may also be interested in [Ant Design Pro](https://pro.ant.design/), an Out-of-box UI solution for enterprise applications based on Umi and antd. -This article will guide you to create a simple application from zero using Umi, dva and antd. +This article will guide you to create a simple application from zero using Umi and antd. ## Install Umi @@ -62,7 +62,7 @@ run `yarn start` then open [http://localhost:8000/products](http://localhost:800 ## Write UI Components -As your application grows and you notice you are sharing UI elements between multiple pages (or using them multiple times on the same page), in umi it's called reusable components. +As your application grows and you notice you are sharing UI elements between multiple pages (or using them multiple times on the same page), in Umi it's called reusable components. Let's create a `ProductList` component that we can use in multiple places to show a list of products. @@ -289,9 +289,9 @@ We have completed a simple application, but you may still have lots of questions You can: -- Visit [umi official website](https://umijs.org/) and [dva official website](https://dvajs.com/) -- Know [the umi routes](https://umijs.org/zh/guide/router.html) -- Know [how to deploy umi application](https://umijs.org/zh/guide/deploy.html) +- Visit [Umi official website](https://umijs.org/) +- Know [Umi routes](https://umijs.org/docs/routing) +- Know [how to deploy Umi application](https://umijs.org/docs/deployment) - Scaffolding out of the box [Ant Design Pro](https://pro.ant.design) - Advanced Layout [ProLayout](https://procomponents.ant.design/en-US/components/layout) - Advanced Table [ProTable](https://procomponents.ant.design/en-US/components/table) diff --git a/docs/react/practical-projects.zh-CN.md b/docs/react/practical-projects.zh-CN.md index 522eb823d3..773e7c404d 100644 --- a/docs/react/practical-projects.zh-CN.md +++ b/docs/react/practical-projects.zh-CN.md @@ -5,11 +5,11 @@ title: 项目实战 在真实项目开发中,你可能会需要 Redux 或者 MobX 这样的数据流方案,Ant Design React 作为一个 UI 库,可以和任何 React 生态圈内的数据流方案以及应用框架搭配使用。我们基于业务场景的场景,推出了可插拔的企业级应用框架 umi,推荐你在项目中使用。 -[umi](https://umijs.org/zh-CN) 则是一个可插拔的企业级 react 应用框架。umi 以路由为基础的,支持[类 next.js 的约定式路由](https://umijs.org/zh-CN/docs/convention-routing),以及各种进阶的路由功能,并以此进行功能扩展,比如[支持路由级的按需加载](https://umijs.org/zh-CN/config#dynamicimport)。然后配以完善的[插件体系](https://umijs.org/zh-CN/plugins/api),覆盖从源码到构建产物的每个生命周期,支持各种功能扩展和业务需求,同时提供 [Umi UI](https://umijs.org/zh-CN/docs/use-umi-ui) 通过可视化辅助编程(VAP)提高开发体验和研发效率。 +[umi](https://umijs.org/zh-CN) 则是一个可插拔的企业级 react 应用框架。Umi 以路由为基础的,支持[类 next.js 的约定式路由](https://umijs.org/zh-CN/docs/convention-routing),以及各种进阶的路由功能,并以此进行功能扩展,比如[支持路由级的按需加载](https://umijs.org/zh-CN/config#dynamicimport)。然后配以完善的[插件体系](https://umijs.org/zh-CN/plugins/api),覆盖从源码到构建产物的每个生命周期,支持各种功能扩展和业务需求,同时提供 [Umi UI](https://umijs.org/zh-CN/docs/use-umi-ui) 通过可视化辅助编程(VAP)提高开发体验和研发效率。 -> 你可能也会对 [Ant Design Pro](https://pro.ant.design/) 感兴趣,这是一个基于 umi、dva 和 ant design 的开箱即用的中台前端/设计解决方案。 +> 你可能也会对 [Ant Design Pro](https://pro.ant.design/) 感兴趣,这是一个基于 Umi 和 antd 的开箱即用的中台前端/设计解决方案。 -本文会引导你使用 Umi、dva 和 antd 从 0 开始创建一个简单应用。 +本文会引导你使用 Umi 和 antd 从 0 开始创建一个简单应用。 ## 安装 Umi @@ -56,7 +56,7 @@ export default defineConfig({ ## 编写 UI Component -随着应用的发展,你会需要在多个页面分享 UI 元素 (或在一个页面使用多次),在 umi 里你可以把这部分抽成 component 。 +随着应用的发展,你会需要在多个页面分享 UI 元素 (或在一个页面使用多次),在 Umi 里你可以把这部分抽成 component 。 我们来编写一个 `ProductList` component,这样就能在不同的地方显示产品列表了。 @@ -292,9 +292,9 @@ $ yarn build 你可以: -- 访问 [umi 官网](https://umijs.org/)和 [dva 官网](https://dvajs.com/) -- 理解 [umi 的路由](https://umijs.org/zh/guide/router.html) -- 理解 [如何部署 umi 应用](https://umijs.org/zh/guide/deploy.html) +- 访问 [Umi 官网](https://umijs.org/) +- 理解 [Umi 的路由](https://umijs.org/zh-CN/docs/routing) +- 理解 [如何部署 Umi 应用](https://umijs.org/zh-CN/docs/deployment) - 开箱即用的脚手架 [Ant Design Pro](https://pro.ant.design) - 高级布局 [ProLayout](https://procomponents.ant.design/components/layout) - 高级表格 [ProTable](https://procomponents.ant.design/components/table) From 9f602aa7105b31d69b7f46ab57b829d05e5c2dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Thu, 17 Feb 2022 18:11:33 +0800 Subject: [PATCH 10/23] fix: Table render twice on first mount (#34106) * fix: Table render twice * chore: clean up * test: Fix test case --- components/grid/hooks/useBreakpoint.tsx | 15 +- components/table/Table.tsx | 16 +- .../table/__tests__/Table.filter.test.js | 11 +- .../__snapshots__/Table.filter.test.js.snap | 504 ------------------ components/table/hooks/useSelection.tsx | 6 +- 5 files changed, 33 insertions(+), 519 deletions(-) diff --git a/components/grid/hooks/useBreakpoint.tsx b/components/grid/hooks/useBreakpoint.tsx index ec34395904..519bd2d470 100644 --- a/components/grid/hooks/useBreakpoint.tsx +++ b/components/grid/hooks/useBreakpoint.tsx @@ -1,18 +1,23 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useRef } from 'react'; +import useForceUpdate from '../../_util/hooks/useForceUpdate'; import ResponsiveObserve, { ScreenMap } from '../../_util/responsiveObserve'; -function useBreakpoint(): ScreenMap { - const [screens, setScreens] = useState({}); +function useBreakpoint(refreshOnChange: boolean = true): ScreenMap { + const screensRef = useRef({}); + const forceUpdate = useForceUpdate(); useEffect(() => { const token = ResponsiveObserve.subscribe(supportScreens => { - setScreens(supportScreens); + screensRef.current = supportScreens; + if (refreshOnChange) { + forceUpdate(); + } }); return () => ResponsiveObserve.unsubscribe(token); }, []); - return screens; + return screensRef.current; } export default useBreakpoint; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index f409d30c5c..aed6bb309e 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -139,15 +139,25 @@ function InternalTable( '`index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.', ); - const screens = useBreakpoint(); + const baseColumns = React.useMemo( + () => columns || convertChildrenToColumns(children), + [columns, children], + ); + const needResponsive = React.useMemo( + () => baseColumns.some((col: ColumnType) => col.responsive), + [baseColumns], + ); + + const screens = useBreakpoint(needResponsive); + const mergedColumns = React.useMemo(() => { const matched = new Set(Object.keys(screens).filter((m: Breakpoint) => screens[m])); - return (columns || convertChildrenToColumns(children)).filter( + return baseColumns.filter( (c: ColumnType) => !c.responsive || c.responsive.some((r: Breakpoint) => matched.has(r)), ); - }, [children, columns, screens]); + }, [baseColumns, screens]); const tableProps = omit(props, ['className', 'style', 'columns']) as TableProps; diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js index 9aeeed49d4..7f93412439 100644 --- a/components/table/__tests__/Table.filter.test.js +++ b/components/table/__tests__/Table.filter.test.js @@ -1100,7 +1100,7 @@ describe('Table.filter', () => { it('should support getPopupContainer', () => { const getPopupContainer = jest.fn(node => node.parentNode); - const wrapper = mount( + mount( createTable({ columns: [ { @@ -1111,13 +1111,14 @@ describe('Table.filter', () => { getPopupContainer, }), ); - expect(wrapper.render()).toMatchSnapshot(); expect(getPopupContainer).toHaveBeenCalled(); }); it('should support getPopupContainer from ConfigProvider', () => { - const wrapper = mount( - node.parentNode}> + const getPopupContainer = jest.fn(node => node.parentNode); + + mount( + {createTable({ columns: [ { @@ -1128,7 +1129,7 @@ describe('Table.filter', () => { })} , ); - expect(wrapper.render()).toMatchSnapshot(); + expect(getPopupContainer).toHaveBeenCalled(); }); it('pass visible prop to filterDropdown', () => { diff --git a/components/table/__tests__/__snapshots__/Table.filter.test.js.snap b/components/table/__tests__/__snapshots__/Table.filter.test.js.snap index be83e86870..c01f5d3957 100644 --- a/components/table/__tests__/__snapshots__/Table.filter.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.filter.test.js.snap @@ -509,507 +509,3 @@ exports[`Table.filter renders filter correctly 1`] = ` exports[`Table.filter renders menu correctly 1`] = `
`; exports[`Table.filter renders radio filter correctly 1`] = `
`; - -exports[`Table.filter should support getPopupContainer 1`] = ` -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
-
- - Name - - - - - - -
-
-
- - -
-
-
-
-
-
- Jack -
- Lucy -
- Tom -
- Jerry -
-
-
-
-
-
-
-`; - -exports[`Table.filter should support getPopupContainer from ConfigProvider 1`] = ` -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
-
- - Name - - - - - - -
-
-
- - -
-
-
-
-
-
- Jack -
- Lucy -
- Tom -
- Jerry -
-
-
-
-
-
-
-`; diff --git a/components/table/hooks/useSelection.tsx b/components/table/hooks/useSelection.tsx index aa0898447d..582a9b989c 100644 --- a/components/table/hooks/useSelection.tsx +++ b/components/table/hooks/useSelection.tsx @@ -33,6 +33,8 @@ export const SELECTION_ALL = 'SELECT_ALL' as const; export const SELECTION_INVERT = 'SELECT_INVERT' as const; export const SELECTION_NONE = 'SELECT_NONE' as const; +const EMPTY_LIST: React.Key[] = []; + interface UseSelectionConfig { prefixCls: string; pageData: RecordType[]; @@ -108,7 +110,7 @@ export default function useSelection( // ========================= Keys ========================= const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState( - selectedRowKeys || defaultSelectedRowKeys || [], + selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, { value: selectedRowKeys, }, @@ -215,7 +217,7 @@ export default function useSelection( // Reset if rowSelection reset React.useEffect(() => { if (!rowSelection) { - setMergedSelectedKeys([]); + setMergedSelectedKeys(EMPTY_LIST); } }, [!!rowSelection]); From e0c1e0650c48991c389c52280959f2b0ecc00184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 18 Feb 2022 15:02:26 +0800 Subject: [PATCH 11/23] docs: Multiple displayRender support (#34116) --- components/cascader/index.en-US.md | 2 +- components/cascader/index.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cascader/index.en-US.md b/components/cascader/index.en-US.md index d0d9a698a4..c4ef48b1e4 100644 --- a/components/cascader/index.en-US.md +++ b/components/cascader/index.en-US.md @@ -28,7 +28,7 @@ Cascade selection box. | className | The additional css class | string | - | | | defaultValue | Initial selected value | string\[] \| number\[] | \[] | | | disabled | Whether disabled select | boolean | false | | -| displayRender | The render function of displaying single selected options. You can use tagRender for multiple mode | (label, selectedOptions) => ReactNode | label => label.join(`/`) | | +| displayRender | The render function of displaying selected options | (label, selectedOptions) => ReactNode | label => label.join(`/`) | `multiple`: 4.18.0 | | dropdownClassName | The additional className of popup overlay | string | - | 4.17.0 | | dropdownRender | Customize dropdown content | (menus: ReactNode) => ReactNode | - | 4.4.0 | | expandIcon | Customize the current item expand icon | ReactNode | - | 4.4.0 | diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index 8fc6a4efda..f80a9f95f8 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -29,7 +29,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/UdS8y8xyZ/Cascader.svg | className | 自定义类名 | string | - | | | defaultValue | 默认的选中项 | string\[] \| number\[] | \[] | | | disabled | 禁用 | boolean | false | | -| displayRender | 单选模式下选择后展示的渲染函数,多选请使用 tagRender | (label, selectedOptions) => ReactNode | label => label.join(`/`) | | +| displayRender | 选择后展示的渲染函数 | (label, selectedOptions) => ReactNode | label => label.join(`/`) | `multiple`: 4.18.0 | | dropdownClassName | 自定义浮层类名 | string | - | 4.17.0 | | dropdownRender | 自定义下拉框内容 | (menus: ReactNode) => ReactNode | - | 4.4.0 | | expandIcon | 自定义次级菜单展开图标 | ReactNode | - | 4.4.0 | From 386ede929702660089cb2961c9e342de74e0917a Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Feb 2022 15:46:59 +0800 Subject: [PATCH 12/23] fix: Form layout when Select has long text (#34117) * fix: Form layout when Select has long text close #33773 * chore: update snapshot --- .../__snapshots__/demo-extend.test.ts.snap | 298 +++++++++++++++++- .../__tests__/__snapshots__/demo.test.js.snap | 134 +++++++- components/form/demo/advanced-search.md | 15 +- components/form/style/horizontal.less | 8 +- 4 files changed, 422 insertions(+), 33 deletions(-) diff --git a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap index 377859a68c..07e2d782c3 100644 --- a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -76,13 +76,148 @@ exports[`renders ./components/form/demo/advanced-search.md extend context correc
- +
+
+ + + + + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +
+
+
+
+
+
+ 1 +
+
+ 2 +
+
+
+
+
+
+
+
+ 1 +
+
+
+
+ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +
+
+
+
+
+
+
+
+
+ +
@@ -193,13 +328,148 @@ exports[`renders ./components/form/demo/advanced-search.md extend context correc
- +
+
+ + + + + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +
+
+
+
+
+
+ 1 +
+
+ 2 +
+
+
+
+
+
+
+
+ 1 +
+
+
+
+ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong +
+
+
+
+
+
+
+
+
+ +
diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 8dbd143577..07041fb0b3 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -76,13 +76,66 @@ exports[`renders ./components/form/demo/advanced-search.md correctly 1`] = `
- +
+
+ + + + + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +
+ +
@@ -193,13 +246,66 @@ exports[`renders ./components/form/demo/advanced-search.md correctly 1`] = `
- +
+
+ + + + + longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong + +
+ +
diff --git a/components/form/demo/advanced-search.md b/components/form/demo/advanced-search.md index e2ee2be8cb..1792c61fd3 100644 --- a/components/form/demo/advanced-search.md +++ b/components/form/demo/advanced-search.md @@ -21,9 +21,11 @@ Because the width of label is not fixed, you may need to adjust it by customizin ```tsx import React, { useState } from 'react'; -import { Form, Row, Col, Input, Button } from 'antd'; +import { Form, Row, Col, Input, Button, Select } from 'antd'; import { DownOutlined, UpOutlined } from '@ant-design/icons'; +const { Option } = Select; + const AdvancedSearchForm = () => { const [expand, setExpand] = useState(false); const [form] = Form.useForm(); @@ -44,7 +46,16 @@ const AdvancedSearchForm = () => { }, ]} > - + {i % 3 !== 1 ? ( + + ) : ( + + )} , ); diff --git a/components/form/style/horizontal.less b/components/form/style/horizontal.less index f8238982ae..a879c4bd71 100644 --- a/components/form/style/horizontal.less +++ b/components/form/style/horizontal.less @@ -9,10 +9,12 @@ } .@{form-item-prefix-cls}-control { flex: 1 1 0; - } - // https://github.com/ant-design/ant-design/issues/32980 - .@{form-item-prefix-cls}-control:not(.@{ant-prefix}-col) { // https://github.com/ant-design/ant-design/issues/32777 + // https://github.com/ant-design/ant-design/issues/33773 min-width: 0; } + // https://github.com/ant-design/ant-design/issues/32980 + .@{form-item-prefix-cls}-label.@{ant-prefix}-col-24 + .@{form-item-prefix-cls}-control { + min-width: unset; + } } From a09a3255f3050f27fb1e1960e5b9debf0e0ba97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 18 Feb 2022 17:07:23 +0800 Subject: [PATCH 13/23] fix: not crash ConfigProvider.config on server side (#34118) --- .../config-provider/__tests__/theme.test.ts | 27 +++++++++++++++++++ components/config-provider/cssVariables.tsx | 14 +++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/components/config-provider/__tests__/theme.test.ts b/components/config-provider/__tests__/theme.test.ts index ddadd4de1b..0fd4ea4468 100644 --- a/components/config-provider/__tests__/theme.test.ts +++ b/components/config-provider/__tests__/theme.test.ts @@ -1,7 +1,17 @@ import { kebabCase } from 'lodash'; +import canUseDom from 'rc-util/lib/Dom/canUseDom'; import ConfigProvider from '..'; +import { resetWarned } from '../../_util/devWarning'; + +let mockCanUseDom = true; + +jest.mock('rc-util/lib/Dom/canUseDom', () => () => mockCanUseDom); describe('ConfigProvider.Theme', () => { + beforeEach(() => { + mockCanUseDom = true; + }); + const colorList = ['primaryColor', 'successColor', 'warningColor', 'errorColor', 'infoColor']; colorList.forEach(colorName => { @@ -22,4 +32,21 @@ describe('ConfigProvider.Theme', () => { expect(themeStyle.innerHTML).toContain(`--bamboo-${kebabCase(colorName)}: rgb(0, 0, 255)`); }); }); + + it('warning for SSR', () => { + resetWarned(); + + const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + mockCanUseDom = false; + expect(canUseDom()).toBeFalsy(); + + ConfigProvider.config({ + theme: {}, + }); + + expect(errorSpy).toHaveBeenCalledWith( + 'Warning: [antd: ConfigProvider] SSR do not support dynamic theme with css variables.', + ); + errorSpy.mockRestore(); + }); }); diff --git a/components/config-provider/cssVariables.tsx b/components/config-provider/cssVariables.tsx index 96f3dde0a8..e3b3c0c2cb 100644 --- a/components/config-provider/cssVariables.tsx +++ b/components/config-provider/cssVariables.tsx @@ -1,9 +1,11 @@ /* eslint-disable import/prefer-default-export, prefer-destructuring */ import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; +import canUseDom from 'rc-util/lib/Dom/canUseDom'; import { TinyColor } from '@ctrl/tinycolor'; import { generate } from '@ant-design/colors'; import { Theme } from './context'; +import devWarning from '../_util/devWarning'; const dynamicStyleMark = `-ant-${Date.now()}-${Math.random()}`; @@ -86,12 +88,16 @@ export function registerTheme(globalPrefixCls: string, theme: Theme) { key => `--${globalPrefixCls}-${key}: ${variables[key]};`, ); - updateCSS( - ` + if (canUseDom()) { + updateCSS( + ` :root { ${cssList.join('\n')} } `, - `${dynamicStyleMark}-dynamic-theme`, - ); + `${dynamicStyleMark}-dynamic-theme`, + ); + } else { + devWarning(false, 'ConfigProvider', 'SSR do not support dynamic theme with css variables.'); + } } From 15f4452f148716a18756fa2f06a3350170ee2fd2 Mon Sep 17 00:00:00 2001 From: Di Wu Date: Fri, 18 Feb 2022 18:34:21 +0800 Subject: [PATCH 14/23] fix: Invalid memoized context value in Menu (#34121) --- .../menu/__tests__/cached-context.test.tsx | 55 +++++++++++++++++++ components/menu/index.tsx | 36 ++++++++---- 2 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 components/menu/__tests__/cached-context.test.tsx diff --git a/components/menu/__tests__/cached-context.test.tsx b/components/menu/__tests__/cached-context.test.tsx new file mode 100644 index 0000000000..1d3a3aff7f --- /dev/null +++ b/components/menu/__tests__/cached-context.test.tsx @@ -0,0 +1,55 @@ +import React, { memo, useState, useRef, useContext } from 'react'; +import { mount } from 'enzyme'; +import Menu from '../index'; +import MenuContext from '../MenuContext'; + +// we use'memo' here in order to only render inner component while context changed. +const CacheInner = memo(() => { + const countRef = useRef(0); + countRef.current++; + // subscribe anchor context + useContext(MenuContext); + return ( +
+ Child Rendering Count: {countRef.current} +
+ ); +}); + +const CacheOuter = () => { + // We use 'useState' here in order to trigger parent component rendering. + const [count, setCount] = useState(1); + const handleClick = () => { + setCount(count + 1); + }; + // During each rendering phase, the cached context value returned from method 'Menu#getMemoizedContextValue' will take effect. + // So 'CacheInner' component won't rerender. + return ( +
+ + Parent Rendering Count: {count} + + + + + +
+ ); +}; + +it("Rendering on Menu without changed MenuContext won't trigger rendering on child component.", () => { + const wrapper = mount(); + const childCount = wrapper.find('#child_count').text(); + wrapper.find('#parent_btn').at(0).simulate('click'); + expect(wrapper.find('#parent_count').text()).toBe('2'); + // child component won't rerender + expect(wrapper.find('#child_count').text()).toBe(childCount); + wrapper.find('#parent_btn').at(0).simulate('click'); + expect(wrapper.find('#parent_count').text()).toBe('3'); + // child component won't rerender + expect(wrapper.find('#child_count').text()).toBe(childCount); + // in order to depress warning "Warning: An update to Menu inside a test was not wrapped in act(...)." + wrapper.unmount(); +}); diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 3e124d758e..1b436d79df 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -6,12 +6,12 @@ import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined'; import memoize from 'memoize-one'; import SubMenu, { SubMenuProps } from './SubMenu'; import Item, { MenuItemProps } from './MenuItem'; -import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; +import { ConfigConsumer, ConfigConsumerProps, DirectionType } from '../config-provider'; import devWarning from '../_util/devWarning'; import { SiderContext, SiderContextProps } from '../layout/Sider'; import collapseMotion from '../_util/motion'; import { cloneElement } from '../_util/reactNode'; -import MenuContext, { MenuTheme } from './MenuContext'; +import MenuContext, { MenuTheme, MenuContextProps } from './MenuContext'; import MenuDivider from './MenuDivider'; export { MenuDividerProps } from './MenuDivider'; @@ -66,6 +66,23 @@ class InternalMenu extends React.Component { return inlineCollapsed; } + getMemoizedContextValue = memoize( + ( + cls: string, + collapsed: boolean | undefined, + the: MenuTheme | undefined, + dir: DirectionType, + disableMenuItemTitleTooltip: boolean | undefined, + ): MenuContextProps => ({ + prefixCls: cls, + inlineCollapsed: collapsed || false, + antdMenuTheme: the, + direction: dir, + firstLevel: true, + disableMenuItemTitleTooltip, + }), + ); + renderMenu = ({ getPopupContainer, getPrefixCls, direction }: ConfigConsumerProps) => { const rootPrefixCls = getPrefixCls(); @@ -91,14 +108,13 @@ class InternalMenu extends React.Component { const menuClassName = classNames(`${prefixCls}-${theme}`, className); // TODO: refactor menu with function component - const contextValue = memoize((cls, collapsed, the, dir, disableMenuItemTitleTooltip) => ({ - prefixCls: cls, - inlineCollapsed: collapsed || false, - antdMenuTheme: the, - direction: dir, - firstLevel: true, - disableMenuItemTitleTooltip, - }))(prefixCls, inlineCollapsed, theme, direction, _internalDisableMenuItemTitleTooltip); + const contextValue = this.getMemoizedContextValue( + prefixCls, + inlineCollapsed, + theme, + direction, + _internalDisableMenuItemTitleTooltip, + ); return ( From 4e54ff693d604ced9b513f8be950bee04a174cae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 20 Feb 2022 15:08:20 +0800 Subject: [PATCH 15/23] chore(deps): update dependency eslint-plugin-unicorn to v41 (#34133) Co-authored-by: Renovate Bot --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7362c4705..227b8b72c7 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,7 @@ "eslint-plugin-markdown": "^2.0.0", "eslint-plugin-react": "^7.20.6", "eslint-plugin-react-hooks": "^4.1.2", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "fetch-jsonp": "^1.1.3", "fs-extra": "^10.0.0", "full-icu": "^1.3.0", From e9179b7f1ec46f4c3cca392686160a9132c15733 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Feb 2022 10:03:56 +0800 Subject: [PATCH 16/23] chore(deps): update actions-cool/issues-helper action to v3 (#34132) Co-authored-by: Renovate Bot --- .github/workflows/issue-check-inactive.yml | 2 +- .github/workflows/issue-close-require.yml | 4 ++-- .github/workflows/issue-labeled.yml | 12 ++++++------ .github/workflows/issue-open-check.yml | 10 +++++----- .github/workflows/issue-remove-inactive.yml | 2 +- .github/workflows/pr-check-merge.yml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/issue-check-inactive.yml b/.github/workflows/issue-check-inactive.yml index 6ca5f9f3e8..df05004109 100644 --- a/.github/workflows/issue-check-inactive.yml +++ b/.github/workflows/issue-check-inactive.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'check-inactive' inactive-label: 'Inactive' diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index 24c1292000..3107470326 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -9,14 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - name: need reproduce - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'close-issues' labels: '🤔 Need Reproduce' inactive-day: 3 - name: needs more info - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'close-issues' labels: 'needs-more-info' diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 226b92d249..889557feca 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -12,7 +12,7 @@ jobs: steps: - name: help wanted if: github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -26,7 +26,7 @@ jobs: - name: 🤔 Need Reproduce if: github.event.label.name == '🤔 Need Reproduce' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -40,7 +40,7 @@ jobs: - name: Usage if: github.event.label.name == 'Usage' || github.event.label.name == 'Question' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -52,7 +52,7 @@ jobs: - name: 3.x if: github.event.label.name == '3.x' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -64,7 +64,7 @@ jobs: - name: invalid if: github.event.label.name == 'Invalid' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -76,7 +76,7 @@ jobs: - name: rtl if: github.event.label.name == 'rtl' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'add-assignees' assignees: 'xrkffgg' diff --git a/.github/workflows/issue-open-check.yml b/.github/workflows/issue-open-check.yml index 1eb22f59fb..443d8f675e 100644 --- a/.github/workflows/issue-open-check.yml +++ b/.github/workflows/issue-open-check.yml @@ -16,7 +16,7 @@ jobs: - name: check invalid if: (contains(github.event.issue.body, 'ant-design-issue-helper') == false) && (steps.checkUser.outputs.result == 'false') - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,add-labels,close-issue' issue-number: ${{ github.event.issue.number }} @@ -27,7 +27,7 @@ jobs: 你好 @${{ github.event.issue.user.login }},为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 [issue 助手](http://new-issue.ant.design) 来创建 issue 以方便我们定位错误。谢谢配合! - name: check website - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 id: checkid with: actions: 'check-issue' @@ -37,7 +37,7 @@ jobs: - name: deal website if: steps.checkid.outputs.check-result == 'true' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' issue-number: ${{ github.event.issue.number }} @@ -63,7 +63,7 @@ jobs: - name: check ie if: contains(github.event.issue.body, 'ant-design-issue-helper') == true && contains(github.event.issue.title, 'IE9') == true || contains(github.event.issue.title, 'IE 9') == true || contains(github.event.issue.title, 'IE10') == true || contains(github.event.issue.title, 'IE 10') == true || contains(github.event.issue.title, 'IE11') == true || contains(github.event.issue.title, 'IE 11') == true || contains(github.event.issue.title, 'Internet Explorer') == true || contains(github.event.issue.body, 'IE9') == true || contains(github.event.issue.body, 'IE 9') == true || contains(github.event.issue.body, 'IE10') == true || contains(github.event.issue.body, 'IE 10') == true || contains(github.event.issue.body, 'IE11') == true || contains(github.event.issue.body, 'IE 11') == true || contains(github.event.issue.body, 'Internet Explorer') == true - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'add-labels' issue-number: ${{ github.event.issue.number }} @@ -71,7 +71,7 @@ jobs: - name: check ie if: contains(github.event.issue.body, 'ant-design-issue-helper') == true && contains(github.event.issue.title, 'IE9') == true || contains(github.event.issue.title, 'IE 9') == true || contains(github.event.issue.title, 'IE10') == true || contains(github.event.issue.title, 'IE 10') == true || contains(github.event.issue.title, 'IE11') == true || contains(github.event.issue.title, 'IE 11') == true || contains(github.event.issue.title, 'Internet Explorer') == true || contains(github.event.issue.body, 'IE9') == true || contains(github.event.issue.body, 'IE 9') == true || contains(github.event.issue.body, 'IE10') == true || contains(github.event.issue.body, 'IE 10') == true - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment, close-issue' issue-number: ${{ github.event.issue.number }} diff --git a/.github/workflows/issue-remove-inactive.yml b/.github/workflows/issue-remove-inactive.yml index f6634e88c8..90556c416d 100644 --- a/.github/workflows/issue-remove-inactive.yml +++ b/.github/workflows/issue-remove-inactive.yml @@ -12,7 +12,7 @@ jobs: steps: - name: remove inactive if: github.event.issue.state == 'open' && github.actor == github.event.issue.user.login - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'remove-labels' issue-number: ${{ github.event.issue.number }} diff --git a/.github/workflows/pr-check-merge.yml b/.github/workflows/pr-check-merge.yml index 1d35c970dd..c2ff3d4e10 100644 --- a/.github/workflows/pr-check-merge.yml +++ b/.github/workflows/pr-check-merge.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest if: (github.event.pull_request.head.ref == 'feature' || github.event.pull_request.head.ref == 'master') && github.event.pull_request.head.user.login == 'ant-design' steps: - - uses: actions-cool/issues-helper@v2 + - uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' issue-number: ${{ github.event.number }} From 6f71af263ef9ae8142b7d43a26ac83711a970353 Mon Sep 17 00:00:00 2001 From: stefango Date: Mon, 21 Feb 2022 10:47:10 +0800 Subject: [PATCH 17/23] docs: fix grammar error (#34138) in customize-theme-variable.zh-CN.md --- docs/react/customize-theme-variable.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/react/customize-theme-variable.zh-CN.md b/docs/react/customize-theme-variable.zh-CN.md index a69d2f07a3..02a0b359d3 100644 --- a/docs/react/customize-theme-variable.zh-CN.md +++ b/docs/react/customize-theme-variable.zh-CN.md @@ -76,6 +76,6 @@ lessc --js --modify-var="ant-prefix=custom" antd/dist/antd.variable.less modifie ### 相关变更 -为了实现 CSS Variable 并保持原始用法兼容性,我们于 `dist/antd.xxx.less` 文件中添加了 `@root-entry-name: xxx;` 入口注入以支持 less 动态加载对应的 less 文件。一般情况下,你不需要关注该变化。但是,如果你的项目中直接引用了 `lib|es` 目录下的 less 文件。你需要在 less 入口处配置 `@root-entry-name: default;` (或者 `@root-entry-name: variable;`)以使 less 可以找到正确的入口。 +为了实现 CSS Variable 并保持原始用法兼容性,我们于 `dist/antd.xxx.less` 文件中添加了 `@root-entry-name: xxx;` 入口注入以支持 less 动态加载对应的 less 文件。一般情况下,你不需要关注该变化。但是,如果你的项目中直接引用了 `lib|es` 目录下的 less 文件,那么你需要在 less 入口处配置 `@root-entry-name: default;` (或者 `@root-entry-name: variable;`)以使 less 可以找到正确的入口。 此外,我们将 `lib|es/style/minxins/index.less` 中的 `@import 'motion'` 和 `@import 'reset'` 迁移至了 `lib|es/style/themes/xxx.less` 中,因为这两个文件依赖了主题相关变量。如果你使用了相关内部方法,请自行调整。当然,我们还是建议直接使用 `dist` 目录下的 `antd.less` 文件而非调用内部文件,因为它们经常会受重构影响。 From 537f4c357bf799f9b7c4fb9592d2e17d138457d4 Mon Sep 17 00:00:00 2001 From: TrickyPi <33021497+TrickyPi@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:31:39 +0800 Subject: [PATCH 18/23] fix: del messageInstance when configuring getContainer (#34123) * fix: del messageInstance when configuring getContainer * test: move the new test to the bottom of the test lists --- components/message/__tests__/config.test.js | 31 +++++++++++++++++++++ components/message/index.tsx | 1 + 2 files changed, 32 insertions(+) diff --git a/components/message/__tests__/config.test.js b/components/message/__tests__/config.test.js index dc71498b48..a3e4c0c401 100644 --- a/components/message/__tests__/config.test.js +++ b/components/message/__tests__/config.test.js @@ -125,4 +125,35 @@ describe('message.config', () => { transitionName: 'ant-move-up', }); }); + + it('should be able to config getContainer, although messageInstance already exists', () => { + function createContainer() { + const container = document.createElement('div'); + document.body.appendChild(container); + return [ + container, + () => { + document.body.removeChild(container); + }, + ]; + } + const [container1, removeContainer1] = createContainer(); + const [container2, removeContainer2] = createContainer(); + expect(container1.querySelector('.ant-message-notice')).toBeFalsy(); + expect(container2.querySelector('.ant-message-notice')).toBeFalsy(); + message.config({ + getContainer: () => container1, + }); + const messageText1 = 'mounted in container1'; + message.info(messageText1); + expect(container1.querySelector('.ant-message-notice').textContent).toEqual(messageText1); + message.config({ + getContainer: () => container2, + }); + const messageText2 = 'mounted in container2'; + message.info(messageText2); + expect(container2.querySelector('.ant-message-notice').textContent).toEqual(messageText2); + removeContainer1(); + removeContainer2(); + }); }); diff --git a/components/message/index.tsx b/components/message/index.tsx index a61d6a571c..278ca80a53 100755 --- a/components/message/index.tsx +++ b/components/message/index.tsx @@ -54,6 +54,7 @@ function setMessageConfig(options: ConfigOptions) { } if (options.getContainer !== undefined) { getContainer = options.getContainer; + messageInstance = null; // delete messageInstance for new getContainer } if (options.transitionName !== undefined) { transitionName = options.transitionName; From 246f90f03e19a9a9bbf9c13f4df959a8e9c92023 Mon Sep 17 00:00:00 2001 From: Picsong <312465087@qq.com> Date: Mon, 21 Feb 2022 13:16:27 +0800 Subject: [PATCH 19/23] fix: Layout component SiderProps type not exported (#34137) --- components/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/index.tsx b/components/index.tsx index 48c4253dcb..053e09c9ba 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -101,7 +101,7 @@ export { default as Image } from './image'; export type { InputNumberProps } from './input-number'; export { default as InputNumber } from './input-number'; -export type { LayoutProps } from './layout'; +export type { LayoutProps, SiderProps } from './layout'; export { default as Layout } from './layout'; export type { ListProps } from './list'; From 07dec4cb00c25cce662ec1165699bcb2e8741663 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 21 Feb 2022 16:48:39 +0800 Subject: [PATCH 20/23] perf: Improve Components render perfermance when it's not reponsive (#34122) * perf: Improve List render perfermance when grid is undefined https://github.com/ant-design/ant-design/pull/34106/files#diff-9e016ea02fe7dd0ea42d8774d29d45e1a10b8dd108de9c89d50c828c74b993b8R146-R151 * chore: do not export useBreakpoint param Co-authored-by: zombiej --- components/avatar/avatar.tsx | 5 ++++- components/grid/index.tsx | 7 ++++++- components/list/index.tsx | 5 ++++- components/pagination/Pagination.tsx | 5 +++-- components/steps/index.tsx | 8 ++++---- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/components/avatar/avatar.tsx b/components/avatar/avatar.tsx index 26028390dd..26b7ccf587 100644 --- a/components/avatar/avatar.tsx +++ b/components/avatar/avatar.tsx @@ -102,7 +102,10 @@ const InternalAvatar: React.ForwardRefRenderFunction = (pr const size = customSize === 'default' ? groupSize : customSize; - const screens = useBreakpoint(); + const needResponsive = Object.keys(typeof size === 'object' ? size || {} : {}).some(key => + ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(key), + ); + const screens = useBreakpoint(needResponsive); const responsiveSizeStyle: React.CSSProperties = React.useMemo(() => { if (typeof size !== 'object') { return {}; diff --git a/components/grid/index.tsx b/components/grid/index.tsx index 80aee3f9be..81474e9641 100644 --- a/components/grid/index.tsx +++ b/components/grid/index.tsx @@ -1,6 +1,11 @@ import Row from './row'; import Col from './col'; -import useBreakpoint from './hooks/useBreakpoint'; +import useInternalBreakpoint from './hooks/useBreakpoint'; + +// Do not export params +function useBreakpoint() { + return useInternalBreakpoint(); +} export { RowProps } from './row'; diff --git a/components/list/index.tsx b/components/list/index.tsx index ca6b174bb3..0f4ba9718d 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -213,7 +213,10 @@ function List({ } } - const screens = useBreakpoint(); + const needResponsive = Object.keys(grid || {}).some(key => + ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(key), + ); + const screens = useBreakpoint(needResponsive); const currentBreakpoint = React.useMemo(() => { for (let i = 0; i < responsiveArray.length; i += 1) { const breakpoint: Breakpoint = responsiveArray[i]; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index b55a25636f..1974199922 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -39,9 +39,10 @@ const Pagination: React.FC = ({ size, locale: customLocale, selectComponentClass, + responsive, ...restProps }) => { - const { xs } = useBreakpoint(); + const { xs } = useBreakpoint(responsive); const { getPrefixCls, direction } = React.useContext(ConfigContext); const prefixCls = getPrefixCls('pagination', customizePrefixCls); @@ -91,7 +92,7 @@ const Pagination: React.FC = ({ const renderPagination = (contextLocale: PaginationLocale) => { const locale = { ...contextLocale, ...customLocale }; - const isSmall = size === 'small' || !!(xs && !size && restProps.responsive); + const isSmall = size === 'small' || !!(xs && !size && responsive); const selectPrefixCls = getPrefixCls('select', customizeSelectPrefixCls); const extendedClassName = classNames( { diff --git a/components/steps/index.tsx b/components/steps/index.tsx index 7e5916cb81..69e5a52795 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import omit from 'rc-util/lib/omit'; import RcSteps from 'rc-steps'; import type { ProgressDotRender } from 'rc-steps/lib/Steps'; import CheckOutlined from '@ant-design/icons/CheckOutlined'; @@ -44,8 +43,8 @@ interface StepsType extends React.FC { } const Steps: StepsType = props => { - const { percent, size, className, direction, responsive } = props; - const { xs } = useBreakpoint(); + const { percent, size, className, direction, responsive, ...restProps } = props; + const { xs } = useBreakpoint(responsive); const { getPrefixCls, direction: rtlDirection } = React.useContext(ConfigContext); const getDirection = React.useCallback( @@ -98,7 +97,8 @@ const Steps: StepsType = props => { return ( Date: Mon, 21 Feb 2022 19:23:47 +0800 Subject: [PATCH 21/23] docs: 4.18.8 changelog (#34146) * chore: bump version to 4.18.8 * docs: 4.18.8 changelog * docs: update changelog * docs: update changelog * docs: update changelog --- CHANGELOG.en-US.md | 17 +++++++++++++++++ CHANGELOG.zh-CN.md | 17 +++++++++++++++++ package.json | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 078a005814..0bf07bb9f2 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,23 @@ timeline: true --- +## 4.18.8 + +`2022-02-21` + +- 🐞 Fix `getContainer` config not working bug when called multi-times via `message.config`. [#34123](https://github.com/ant-design/ant-design/pull/34123) [@TrickyPi](https://github.com/TrickyPi) +- 🐞 Fix invalid context value cache in Menu component. [#34121](https://github.com/ant-design/ant-design/pull/34121) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix ConfigProvider config theme on server side crash, and warning for useless in SSR instead. [#34118](https://github.com/ant-design/ant-design/pull/34118) +- Table + - ⚡️ Fix Table render twice on first mount. [#34106](https://github.com/ant-design/ant-design/pull/34106) + - ⚡️ Optimized Table rendering performance, now will skip useless rendering when deprecated `column.render: () => { children, props }` method is not used. [#34075](https://github.com/ant-design/ant-design/pull/34075) +- 🐞 Fix incorrect copy text of Typography after children is updated when enable `copyable`. [#34034](https://github.com/ant-design/ant-design/pull/34034) [@opopeieie](https://github.com/opopeieie) +- ⚡️ Optimize Avatar, List, Pagination, Steps to avoid additional render on mount if unnecessary. [34122](https://github.com/ant-design/ant-design/pull/34122) +- 💄 Fix Form broken style when Select item is too long in horizontal layout. [#34117](https://github.com/ant-design/ant-design/pull/34117) +- 🇸🇰 Improve texts for Table, Form and Modal in `sk_SK`. [#34061](https://github.com/ant-design/ant-design/pull/34061) [@xseman](https://github.com/xseman) +- TypeScript + - 🤖 Export `SiderProps` type from Layout component. [#34137](https://github.com/ant-design/ant-design/pull/34137) [@Picsong](https://github.com/Picsong) + ## 4.18.7 `2022-02-14` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 5398ac318f..78f1ed521a 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,23 @@ timeline: true --- +## 4.18.8 + +`2022-02-21` + +- 🐞 修复 `message.config` 多次配置 `getContainer` 时无法生效的问题。[#34123](https://github.com/ant-design/ant-design/pull/34123) [@TrickyPi](https://github.com/TrickyPi) +- 🐞 修复 Menu 组件中无效的缓存逻辑。[#34121](https://github.com/ant-design/ant-design/pull/34121) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 ConfigProvider 在服务端配置主题会崩溃的问题,同时现在会提示动态主题于 SSR 上无效。[#34118](https://github.com/ant-design/ant-design/pull/34118) +- Table + - ⚡️ 修复 Table 在首次加载时会渲染两次的问题。[#34106](https://github.com/ant-design/ant-design/pull/34106) + - ⚡️ 优化 Table 渲染性能,现在不使用废弃 `column.render: () => { children, props }` 方法时默认会跳过无用渲染。[#34075](https://github.com/ant-design/ant-design/pull/34075) +- 🐞 修复 Typography 启用 `copyable` 时 `children` 内容变化后复制内容没变的问题。[#34034](https://github.com/ant-design/ant-design/pull/34034) [@opopeieie](https://github.com/opopeieie) +- ⚡️ 优化 Avatar、List、Pagination、Steps 以防止初始化时非必要的额外渲染。[34122](https://github.com/ant-design/ant-design/pull/34122) +- 💄 修复 Form 下 Select 内容太长导致布局换行的问题。[#34117](https://github.com/ant-design/ant-design/pull/34117) +- 🇸🇰 完善 `sk-SK` 中 Table、Form、Modal 的文案。[#34061](https://github.com/ant-design/ant-design/pull/34061) [@xseman](https://github.com/xseman) +- TypeScript + - 🤖 导出 Layout 组件的 `SiderProps` 类型。[#34137](https://github.com/ant-design/ant-design/pull/34137) [@Picsong](https://github.com/Picsong) + ## 4.18.7 `2022-02-14` diff --git a/package.json b/package.json index 227b8b72c7..5ce00266e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.18.7", + "version": "4.18.8", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ From c05fd4ac55e546711be9cf1e9f9b56de8660a92f Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Tue, 22 Feb 2022 14:51:48 +0800 Subject: [PATCH 22/23] fix: form initial values get modified (#34153) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ce00266e5..0080cb9732 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "rc-dialog": "~8.6.0", "rc-drawer": "~4.4.2", "rc-dropdown": "~3.2.5", - "rc-field-form": "~1.22.0-2", + "rc-field-form": "~1.23.0", "rc-image": "~5.2.5", "rc-input-number": "~7.3.0", "rc-mentions": "~1.6.1", From eecf0da7e42470d9440aa60557da3ac9578972b1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 23 Feb 2022 17:08:39 +0800 Subject: [PATCH 23/23] chore: fix ts error in site --- site/theme/template/Layout/Header/SearchBar.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/site/theme/template/Layout/Header/SearchBar.tsx b/site/theme/template/Layout/Header/SearchBar.tsx index cf851f591e..9c71dd9021 100644 --- a/site/theme/template/Layout/Header/SearchBar.tsx +++ b/site/theme/template/Layout/Header/SearchBar.tsx @@ -185,6 +185,7 @@ const SearchBar = ({ initialQuery={searchModalQuery} placeholder={searchPlaceholder} hitComponent={Hit} + appId={algoliaConfig.appId} apiKey={algoliaConfig.apiKey} indexName={algoliaConfig.indexName} transformItems={algoliaConfig.transformData}