From fd2db7614f15b29aa2e9f79d6370d17211eeaf1f Mon Sep 17 00:00:00 2001 From: carla-cn <75775973+carla-cn@users.noreply.github.com> Date: Fri, 17 Feb 2023 15:45:29 +0800 Subject: [PATCH 01/21] fix: diabled Input abbdon should not have status style (#40744) Co-authored-by: zhouling --- .../__snapshots__/components.test.tsx.snap | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 2 +- .../__snapshots__/demo.test.tsx.snap | 2 +- components/input/Input.tsx | 1 + components/input/style/index.ts | 20 ++++++++++++------- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 494ae8f053..4a41303780 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -16015,7 +16015,7 @@ exports[`ConfigProvider components Input configProvider componentDisabled 1`] = value="" /> ((props, ref) => { [`${prefixCls}-group-wrapper-sm`]: mergedSize === 'small', [`${prefixCls}-group-wrapper-lg`]: mergedSize === 'large', [`${prefixCls}-group-wrapper-rtl`]: direction === 'rtl', + [`${prefixCls}-group-wrapper-disabled`]: mergedDisabled, }, getStatusClassNames(`${prefixCls}-group-wrapper`, mergedStatus, hasFeedback), hashId, diff --git a/components/input/style/index.ts b/components/input/style/index.ts index abb141fa3a..c67412c0ac 100644 --- a/components/input/style/index.ts +++ b/components/input/style/index.ts @@ -1,9 +1,9 @@ import type { CSSObject } from '@ant-design/cssinjs'; -import type { FullToken, GenerateStyle } from '../../theme/internal'; -import { genComponentStyleHook, mergeToken } from '../../theme/internal'; -import type { GlobalToken } from '../../theme/interface'; import { clearFix, resetComponent } from '../../style'; import { genCompactItemStyle } from '../../style/compact-item'; +import type { GlobalToken } from '../../theme/interface'; +import type { FullToken, GenerateStyle } from '../../theme/internal'; +import { genComponentStyleHook, mergeToken } from '../../theme/internal'; export type InputToken> = T & { inputAffixPadding: number; @@ -669,7 +669,7 @@ const genAffixStyle: GenerateStyle = (token: InputToken) => { }; const genGroupStyle: GenerateStyle = (token: InputToken) => { - const { componentCls, colorError, colorSuccess, borderRadiusLG, borderRadiusSM } = token; + const { componentCls, colorError, colorWarning, borderRadiusLG, borderRadiusSM } = token; return { [`${componentCls}-group`]: { @@ -711,9 +711,15 @@ const genGroupStyle: GenerateStyle = (token: InputToken) => { }, }, '&-status-warning': { - [`${componentCls}-group-addon:last-child`]: { - color: colorSuccess, - borderColor: colorSuccess, + [`${componentCls}-group-addon`]: { + color: colorWarning, + borderColor: colorWarning, + }, + }, + + '&-disabled': { + [`${componentCls}-group-addon`]: { + ...genDisabledStyle(token), }, }, }, From 5199344d09954fb16d7cf216905a63256408bada Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 17 Feb 2023 18:27:35 +0800 Subject: [PATCH 02/21] docs: fix unsupported syntax (#40779) --- components/theme/interface/seeds.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/theme/interface/seeds.ts b/components/theme/interface/seeds.ts index 27ebd46b70..51cbf69082 100644 --- a/components/theme/interface/seeds.ts +++ b/components/theme/interface/seeds.ts @@ -50,7 +50,7 @@ export interface SeedToken extends PresetColorType { /** * @nameZH 基础文本色 * @nameEN Seed Text Color - * @desc 用于派生文本色梯度的基础变量,v5 中我们添加了一层文本色的派生算法可以产出梯度明确的文本色的梯度变量。但**请不要在代码中直接使用该 Seed Token**! + * @desc 用于派生文本色梯度的基础变量,v5 中我们添加了一层文本色的派生算法可以产出梯度明确的文本色的梯度变量。但请不要在代码中直接使用该 Seed Token ! * @descEN Used to derive the base variable of the text color gradient. In v5, we added a layer of text color derivation algorithm to produce gradient variables of text color gradient. But please do not use this Seed Token directly in the code! */ colorTextBase: string; @@ -58,7 +58,7 @@ export interface SeedToken extends PresetColorType { /** * @nameZH 基础背景色 * @nameEN Seed Background Color - * @desc 用于派生背景色梯度的基础变量,v5 中我们添加了一层背景色的派生算法可以产出梯度明确的背景色的梯度变量。但 **请不要在代码中直接使用该 Seed Token** ! + * @desc 用于派生背景色梯度的基础变量,v5 中我们添加了一层背景色的派生算法可以产出梯度明确的背景色的梯度变量。但请不要在代码中直接使用该 Seed Token ! * @descEN Used to derive the base variable of the background color gradient. In v5, we added a layer of background color derivation algorithm to produce map token of background color. But PLEASE DO NOT USE this Seed Token directly in the code! */ colorBgBase: string; From 51200e77323e16cccedcfdad37acd2157a0a20b9 Mon Sep 17 00:00:00 2001 From: shitian9 <33782196+shitian9@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:10:23 +0800 Subject: [PATCH 03/21] demo: fix lazy.tsx type (#40778) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Demo 有问题,会在 VSCode中 引用 `loadData`、`onChange` 时 会报错 --- components/cascader/demo/lazy.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cascader/demo/lazy.tsx b/components/cascader/demo/lazy.tsx index 6693da2ffc..49f3c91d63 100644 --- a/components/cascader/demo/lazy.tsx +++ b/components/cascader/demo/lazy.tsx @@ -2,8 +2,8 @@ import React, { useState } from 'react'; import { Cascader } from 'antd'; interface Option { - value: string; - label: string; + value?: string | number | null; + label: React.ReactNode; children?: Option[]; isLeaf?: boolean; loading?: boolean; @@ -25,7 +25,7 @@ const optionLists: Option[] = [ const App: React.FC = () => { const [options, setOptions] = useState(optionLists); - const onChange = (value: string[], selectedOptions: Option[]) => { + const onChange = (value: (string | number)[], selectedOptions: Option[]) => { console.log(value, selectedOptions); }; From de82a15b22eab4fb05629740639eec55f691e0b3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 17 Feb 2023 22:11:06 +0800 Subject: [PATCH 04/21] type: simplify getPlacement return type (#40775) --- components/select/index.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index fdc91fa358..fe28f1dfde 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -1,7 +1,7 @@ // TODO: 4.0 - codemod should help to change `filterOption` to support node props. import classNames from 'classnames'; +import type { BaseSelectRef, SelectProps as RcSelectProps } from 'rc-select'; import RcSelect, { OptGroup, Option } from 'rc-select'; -import type { SelectProps as RcSelectProps, BaseSelectRef } from 'rc-select'; import type { OptionProps } from 'rc-select/lib/Option'; import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select'; import omit from 'rc-util/lib/omit'; @@ -18,10 +18,10 @@ import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; import getIcons from './utils/iconUtil'; -import useStyle from './style'; +import { useCompactItemContext } from '../space/Compact'; import genPurePanel from '../_util/PurePanel'; import warning from '../_util/warning'; -import { useCompactItemContext } from '../space/Compact'; +import useStyle from './style'; type RawValue = string | number; @@ -182,13 +182,11 @@ const InternalSelect = { + const getPlacement = (): SelectCommonPlacement => { if (placement !== undefined) { return placement; } - return direction === 'rtl' - ? ('bottomRight' as SelectCommonPlacement) - : ('bottomLeft' as SelectCommonPlacement); + return direction === 'rtl' ? 'bottomRight' : 'bottomLeft'; }; // ====================== Warning ====================== From 12a6f7182dec1d685eaa30e5e4e708be63ff37c1 Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:12:19 +0800 Subject: [PATCH 05/21] chore: add lint cache (#40369) --- .eslintignore | 1 + package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1d60062b10..6fbfa158dc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,6 +14,7 @@ server .dumi/tmp-production !.dumi/ node_modules +.eslintcache _site dist coverage diff --git a/package.json b/package.json index 0654d510fb..59bb595c1d 100644 --- a/package.json +++ b/package.json @@ -76,9 +76,9 @@ "lint:deps": "antd-tools run deps-lint", "lint:md": "remark . -f -q", "lint:style": "ts-node --project tsconfig.node.json scripts/check-cssinjs.js", - "lint:script": "eslint . --ext .js,.jsx,.ts,.tsx", + "lint:script": "eslint . --ext .js,.jsx,.ts,.tsx --cache", "pre-publish": "npm run test-all -- --skip-build", - "prettier": "prettier -c --write **/*", + "prettier": "prettier -c --write **/* --cache", "pub": "npm run version && npm run collect-token-statistic && npm run token-meta && antd-tools run pub", "rome:format": "rome format --write .", "prepublishOnly": "antd-tools run guard", From 66e2b146dd3137c7b0b63bf859a90401c908783c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Feb 2023 23:15:30 +0800 Subject: [PATCH 06/21] chore(deps-dev): bump @testing-library/dom from 8.20.0 to 9.0.0 (#40780) Bumps [@testing-library/dom](https://github.com/testing-library/dom-testing-library) from 8.20.0 to 9.0.0. - [Release notes](https://github.com/testing-library/dom-testing-library/releases) - [Changelog](https://github.com/testing-library/dom-testing-library/blob/main/CHANGELOG.md) - [Commits](https://github.com/testing-library/dom-testing-library/compare/v8.20.0...v9.0.0) --- updated-dependencies: - dependency-name: "@testing-library/dom" 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 59bb595c1d..e5bb4e8776 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,7 @@ "@qixian.cs/github-contributors-list": "^1.0.3", "@size-limit/file": "^8.1.0", "@stackblitz/sdk": "^1.3.0", - "@testing-library/dom": "^8.17.1", + "@testing-library/dom": "^9.0.0", "@testing-library/jest-dom": "^5.16.3", "@testing-library/react": "^13.0.0", "@testing-library/user-event": "^14.4.2", From 0a246768456b0e57f6884fc39bca4a39f9bc589b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=A2=E6=9E=9C=E6=B1=81?= Date: Sun, 19 Feb 2023 12:48:28 +0800 Subject: [PATCH 07/21] fix: use loading delay not delay at first time (#40751) (#40759) * fix: use loading delay not delay at first time * perf: test code * refactor: optimization code * fix: lint problem * refactor: prefer code * refactor: prefer code * refactor: prefer code --- .../button/__tests__/delay-timer.test.tsx | 5 +++ components/button/button.tsx | 43 ++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/components/button/__tests__/delay-timer.test.tsx b/components/button/__tests__/delay-timer.test.tsx index 4deb8d5c8b..42bdca9207 100644 --- a/components/button/__tests__/delay-timer.test.tsx +++ b/components/button/__tests__/delay-timer.test.tsx @@ -91,3 +91,8 @@ it('Delay loading timer in Button component', () => { jest.restoreAllMocks(); }); +it('Delay loading while use loading delay at first time', () => { + const Demo = () =>