From b15a2f2bfc8bfd0dc7f6a40b7c5defa5a0cf675c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <7971419+crazyair@users.noreply.github.com> Date: Sun, 12 May 2024 20:15:10 +0800 Subject: [PATCH 1/6] fix: fix cascader type (#48879) * fix: fix cascader type * feat: add test * feat: test * feat: panel * feat: panel * feat: CascaderAutoProps --- components/cascader/Panel.tsx | 10 ++++++++-- components/cascader/__tests__/type.test.tsx | 16 +++++++++++++++- components/cascader/index.tsx | 9 +++++++-- components/index.ts | 3 ++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/components/cascader/Panel.tsx b/components/cascader/Panel.tsx index 71cfe1742b..68db70def4 100644 --- a/components/cascader/Panel.tsx +++ b/components/cascader/Panel.tsx @@ -21,11 +21,17 @@ export type CascaderPanelProps< Multiple extends boolean = false, > = Pick, PanelPickType>; +export type CascaderPanelAutoProps< + OptionType extends DefaultOptionType = DefaultOptionType, + ValueField extends keyof OptionType = keyof OptionType, +> = + | CascaderPanelProps + | (CascaderPanelProps & { multiple: true }); + function CascaderPanel< OptionType extends DefaultOptionType = DefaultOptionType, ValueField extends keyof OptionType = keyof OptionType, - Multiple extends boolean = false, ->(props: CascaderPanelProps) { +>(props: CascaderPanelAutoProps) { const { prefixCls: customizePrefixCls, className, diff --git a/components/cascader/__tests__/type.test.tsx b/components/cascader/__tests__/type.test.tsx index e7e812420d..e876dcb5ae 100644 --- a/components/cascader/__tests__/type.test.tsx +++ b/components/cascader/__tests__/type.test.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; -import type { BaseOptionType } from '..'; +import type { BaseOptionType, CascaderAutoProps } from '..'; import Cascader from '..'; import { render } from '../../../tests/utils'; +import type { CascaderPanelAutoProps } from '../Panel'; describe('Cascader.typescript', () => { it('options value', () => { @@ -88,4 +89,17 @@ describe('Cascader.typescript', () => { const { container } = render( values} />); expect(container).toBeTruthy(); }); + it('props', () => { + const list: { props?: CascaderAutoProps }[] = [ + { props: { multiple: true, onChange: (value) => value } }, + { props: { multiple: false, onChange: (value) => value } }, + ]; + expect(list).toBeTruthy(); + + const list2: { props?: CascaderPanelAutoProps }[] = [ + { props: { multiple: true, onChange: (value) => value } }, + { props: { multiple: false, onChange: (value) => value } }, + ]; + expect(list2).toBeTruthy(); + }); }); diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 3a0ebf5500..c3537359d6 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -135,6 +135,12 @@ export interface CascaderProps< */ variant?: Variant; } +export type CascaderAutoProps< + OptionType extends DefaultOptionType = DefaultOptionType, + ValueField extends keyof OptionType = keyof OptionType, +> = + | CascaderProps + | (CascaderProps & { multiple: true }); export interface CascaderRef { focus: () => void; @@ -348,9 +354,8 @@ const Cascader = React.forwardRef>((props, ref) }) as unknown as (< OptionType extends DefaultOptionType = DefaultOptionType, ValueField extends keyof OptionType = keyof OptionType, - Multiple extends boolean = false, >( - props: React.PropsWithChildren> & + props: React.PropsWithChildren> & React.RefAttributes, ) => React.ReactElement) & { displayName: string; diff --git a/components/index.ts b/components/index.ts index c1f5f82764..11188036cc 100644 --- a/components/index.ts +++ b/components/index.ts @@ -27,7 +27,8 @@ export type { CardProps } from './card'; export { default as Carousel } from './carousel'; export type { CarouselProps } from './carousel'; export { default as Cascader } from './cascader'; -export type { CascaderProps } from './cascader'; +export type { CascaderProps, CascaderAutoProps } from './cascader'; +export type { CascaderPanelProps, CascaderPanelAutoProps } from './cascader/Panel'; export { default as Checkbox } from './checkbox'; export type { CheckboxOptionType, CheckboxProps, CheckboxRef } from './checkbox'; export { default as Col } from './col'; From 8b8021083ee9b6b1db305b62ff007503f8106ccd Mon Sep 17 00:00:00 2001 From: LonelySnowman <111493458+LonelySnowman@users.noreply.github.com> Date: Sun, 12 May 2024 20:16:58 +0800 Subject: [PATCH 2/6] fix: button component add colorErrorBgActive token (#48876) --- components/button/style/index.ts | 2 +- components/theme/interface/maps/colors.ts | 8 ++++++++ components/theme/themes/shared/genColorMapToken.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/button/style/index.ts b/components/button/style/index.ts index 20e9d37210..f5c3acc73f 100644 --- a/components/button/style/index.ts +++ b/components/button/style/index.ts @@ -374,7 +374,7 @@ const genTextButtonStyle: GenerateStyle = (token) => ({ }, { color: token.colorErrorHover, - background: token.colorErrorBg, + background: token.colorErrorBgActive, }, ), }, diff --git a/components/theme/interface/maps/colors.ts b/components/theme/interface/maps/colors.ts index 659209d8df..06e4019030 100644 --- a/components/theme/interface/maps/colors.ts +++ b/components/theme/interface/maps/colors.ts @@ -476,6 +476,14 @@ interface ColorErrorMapToken { */ colorErrorBgHover: string; // 2 + /** + * @nameZH 错误色的浅色背景色激活态 + * @nameEN Error background color active state + * @desc 错误色的浅色背景色激活态 + * @descEN The active state background color of the error state. + */ + colorErrorBgActive: string; // 3 + /** * @nameZH 错误色的描边色 * @nameEN Error border color diff --git a/components/theme/themes/shared/genColorMapToken.ts b/components/theme/themes/shared/genColorMapToken.ts index df18501f8d..9c1a6813d1 100644 --- a/components/theme/themes/shared/genColorMapToken.ts +++ b/components/theme/themes/shared/genColorMapToken.ts @@ -60,6 +60,7 @@ export default function genColorMapToken( colorErrorBg: errorColors[1], colorErrorBgHover: errorColors[2], + colorErrorBgActive: errorColors[3], colorErrorBorder: errorColors[3], colorErrorBorderHover: errorColors[4], colorErrorHover: errorColors[5], From 65063943f0646efafed78d3688a8ee31f12da361 Mon Sep 17 00:00:00 2001 From: kiner-tang <1127031143@qq.com> Date: Mon, 13 May 2024 10:51:01 +0800 Subject: [PATCH 3/6] fix: solve tooltip's content isn't align center when pass into a sigle char issue (#48890) --- components/tooltip/style/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tooltip/style/index.ts b/components/tooltip/style/index.ts index 7063b2d253..3019f4ec35 100644 --- a/components/tooltip/style/index.ts +++ b/components/tooltip/style/index.ts @@ -61,7 +61,7 @@ const genTooltipStyle: GenerateStyle = (token) => { // Wrapper for the tooltip content [`${componentCls}-inner`]: { - minWidth: controlHeight, + minWidth: '1em', minHeight: controlHeight, padding: `${unit(token.calc(paddingSM).div(2).equal())} ${unit(paddingXS)}`, color: tooltipColor, From 973305dc85d9186145bb0044d5b6f18f9ac43b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 13 May 2024 22:38:04 +0800 Subject: [PATCH 4/6] docs: add 5.17.1 changelog (#48892) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: add 5.17.1 changelog * change version * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: 陈帅 * update docs * Update CHANGELOG.en-US.md Co-authored-by: afc163 Signed-off-by: 陈帅 * update docs * Update CHANGELOG.zh-CN.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: 陈帅 --------- Signed-off-by: 陈帅 Co-authored-by: afc163 Co-authored-by: lijianan <574980606@qq.com> --- CHANGELOG.en-US.md | 20 ++++++++++++++++++++ CHANGELOG.zh-CN.md | 20 ++++++++++++++++++++ package.json | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 084cf0d964..f014c50131 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -16,6 +16,26 @@ tag: vVERSION --- +## 5.17.1 + +`2024-05-13`. + +- 🐞 Fix visually not centered when Tooltip content is only one character. [#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) +- Button + - 🐞 Fix hover and active styles not differentiating when Button `type="text"`and `type="danger"` are used together. [#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman) +- Fix issue where some components throw findDOMNode warnings + - 🐞 Fix Button throwing `findDOMNode` warning. [#48830](https://github.com/ant-design/ant-design/pull/48830) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix Badge throwing `findDOMNode` warnings. [#48878](https://github.com/ant-design/ant-design/pull/48878) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix Alert throwing `findDOMNode` warnings. [#48868](https://github.com/ant-design/ant-design/pull/48868) [@wanpan11](https://github.com/wanpan11) + - 🐞 Fix FloatButton.BackTop throwing `findDOMNode` warnings. [#48865](https://github.com/ant-design/ant-design/pull/48865) [@wanpan11](https://github.com/wanpan11) +- 💄 Add className to internal component Spin given by Drawer to prevent internal Spin styles from overriding user-passed Spin styles. [#48857](https://github.com/ant-design/ant-design/pull/48857) [@li-jia-nan](https://github.com/li-jia-nan) +- 💄 Fix missing bottom border when Card `size="small"`. [#48787](https://github.com/ant-design/ant-design/pull/48787) [@wanpan11](https://github.com/wanpan11) +- 🐞 Fix AutoComplete `tagRender` not working for maxTag and clicking on an edge triggering unexpected closure of the layer. [#48798](https://github.com/ant-design/ant-design/pull/48798) +- RTL + - 💄 Fix Button's missing icon order and margins under RTL. [#48821](https://github.com/ant-design/ant-design/pull/48821) +- TypeScript + - 🤖 Fix Cascader redundant generalization issue. [#48879](https://github.com/ant-design/ant-design/pull/48879) [@crazyair](https://github.com/crazyair) + ## 5.17.0 `2024-05-03` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index ba30fde093..6c597782b0 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,26 @@ tag: vVERSION --- +## 5.17.1 + +`2024-05-13` + +- 🐞 修复 Tooltip 内容只有一个字符时视觉不居中的问题。[#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) +- Button + - 🐞 修复 Button `type="text"` 和`type="danger"` 同时使用时 hover 和 active 样式没有区分的问题。[#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman) +- 修复部分组件抛出 findDOMNode 警告的问题 + - 🐞 修复 Button 抛出 `findDOMNode` 警告的问题。[#48830](https://github.com/ant-design/ant-design/pull/48830) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 Badge 抛出 `findDOMNode` 警告的问题。[#48878](https://github.com/ant-design/ant-design/pull/48878) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 Alert 抛出 `findDOMNode` 警告的问题。[#48868](https://github.com/ant-design/ant-design/pull/48868) [@wanpan11](https://github.com/wanpan11) + - 🐞 修复 FloatButton.BackTop 抛出 `findDOMNode` 警告的问题。[#48865](https://github.com/ant-design/ant-design/pull/48865) [@wanpan11](https://github.com/wanpan11) +- 💄 给 Drawer 的内部组件 Spin 添加 className,防止内部 Spin 样式覆盖用户传入的 Spin 样式。[#48857](https://github.com/ant-design/ant-design/pull/48857) [@li-jia-nan](https://github.com/li-jia-nan) +- 💄 修复 Card `size="small"` 时下边框丢失的问题。[#48787](https://github.com/ant-design/ant-design/pull/48787) [@wanpan11](https://github.com/wanpan11) +- 🐞 AutoComplete 修复 `tagRender` 对 maxTag 无效的问题和点击边缘会触发弹层意外关闭的问题。[#48798](https://github.com/ant-design/ant-design/pull/48798) +- RTL + - 💄 修复 Button 在 RTL 下的图标顺序和边距缺失问题。[#48821](https://github.com/ant-design/ant-design/pull/48821) +- TypeScript + - 🤖 修复 Cascader 多余泛型问题。[#48879](https://github.com/ant-design/ant-design/pull/48879) [@crazyair](https://github.com/crazyair) + ## 5.17.0 `2024-05-03` diff --git a/package.json b/package.json index d324e1af57..8262c40293 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.17.0", + "version": "5.17.1", "description": "An enterprise-class UI design language and React components implementation", "keywords": [ "ant", From a2d8659014c8052bad75536a51a27f883b6312a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Tue, 14 May 2024 10:22:45 +0800 Subject: [PATCH 5/6] test: revert test (#48909) --- components/theme/__tests__/token.test.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/components/theme/__tests__/token.test.tsx b/components/theme/__tests__/token.test.tsx index affa211abe..e74b76c46c 100644 --- a/components/theme/__tests__/token.test.tsx +++ b/components/theme/__tests__/token.test.tsx @@ -5,8 +5,8 @@ import theme from '..'; import { render, renderHook } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; import type { ThemeConfig } from '../../config-provider/context'; +import Input from '../../input'; import Row from '../../row'; -import Slider from '../../slider'; import genRadius from '../themes/shared/genRadius'; const { useToken } = theme; @@ -314,30 +314,24 @@ describe('Theme', () => { - + ); const { container, rerender } = render(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#91caff', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#4096ff' }); rerender(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#6ce0a4', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#20c77c' }); rerender(); - expect(container.querySelector('.ant-slider-track')).toHaveStyle({ - 'background-color': '#0e462e', - }); + expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#1fb572' }); }); }); From 787cd941253b214b2e1bd9307cbf1a4af2bdcf8e Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Tue, 14 May 2024 11:04:53 +0800 Subject: [PATCH 6/6] docs: update docs (#48905) * docs: update docs * Update CHANGELOG.en-US.md Co-authored-by: kiner-tang <1127031143@qq.com> Signed-off-by: lijianan <574980606@qq.com> * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Signed-off-by: lijianan <574980606@qq.com> --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: kiner-tang <1127031143@qq.com> Co-authored-by: afc163 --- CHANGELOG.en-US.md | 3 ++- CHANGELOG.zh-CN.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index f014c50131..8abf9213d4 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -18,8 +18,9 @@ tag: vVERSION ## 5.17.1 -`2024-05-13`. +`2024-05-14` +- 🐞 Optimize the internal logic of the Form, fix the problem that antd takes too long time to build in Next.js. [react-component/async-validator#9](https://github.com/react-component/async-validator/pull/9) - 🐞 Fix visually not centered when Tooltip content is only one character. [#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) - Button - 🐞 Fix hover and active styles not differentiating when Button `type="text"`and `type="danger"` are used together. [#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 6c597782b0..46dbf9c0c0 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -17,8 +17,9 @@ tag: vVERSION ## 5.17.1 -`2024-05-13` +`2024-05-14` +- 🐞 优化 Form 组件底层逻辑,修复了 antd 在 Next.js 中构建时间太长的问题。[react-component/async-validator#9](https://github.com/react-component/async-validator/pull/9) - 🐞 修复 Tooltip 内容只有一个字符时视觉不居中的问题。[#48890](https://github.com/ant-design/ant-design/pull/48890) [@kiner-tang](https://github.com/kiner-tang) - Button - 🐞 修复 Button `type="text"` 和`type="danger"` 同时使用时 hover 和 active 样式没有区分的问题。[#48876](https://github.com/ant-design/ant-design/pull/48876) [@LonelySnowman](https://github.com/LonelySnowman)