Merge pull request #48911 from ant-design/master

chore: merge master into feature
This commit is contained in:
afc163 2024-05-14 11:33:39 +08:00 committed by GitHub
commit b49f70fb74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 92 additions and 21 deletions

View File

@ -16,6 +16,27 @@ tag: vVERSION
---
## 5.17.1
`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)
- 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`

View File

@ -15,6 +15,27 @@ tag: vVERSION
---
## 5.17.1
`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)
- 修复部分组件抛出 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`

View File

@ -359,7 +359,7 @@ const genTextButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token) => ({
},
{
color: token.colorErrorHover,
background: token.colorErrorBg,
background: token.colorErrorBgActive,
},
),
},

View File

@ -21,11 +21,17 @@ export type CascaderPanelProps<
Multiple extends boolean = false,
> = Pick<CascaderProps<OptionType, ValueField, Multiple>, PanelPickType>;
export type CascaderPanelAutoProps<
OptionType extends DefaultOptionType = DefaultOptionType,
ValueField extends keyof OptionType = keyof OptionType,
> =
| CascaderPanelProps<OptionType, ValueField>
| (CascaderPanelProps<OptionType, ValueField, true> & { multiple: true });
function CascaderPanel<
OptionType extends DefaultOptionType = DefaultOptionType,
ValueField extends keyof OptionType = keyof OptionType,
Multiple extends boolean = false,
>(props: CascaderPanelProps<OptionType, ValueField, Multiple>) {
>(props: CascaderPanelAutoProps<OptionType, ValueField>) {
const {
prefixCls: customizePrefixCls,
className,

View File

@ -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(<Cascader multiple onChange={(values) => 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();
});
});

View File

@ -135,6 +135,12 @@ export interface CascaderProps<
*/
variant?: Variant;
}
export type CascaderAutoProps<
OptionType extends DefaultOptionType = DefaultOptionType,
ValueField extends keyof OptionType = keyof OptionType,
> =
| CascaderProps<OptionType, ValueField>
| (CascaderProps<OptionType, ValueField, true> & { multiple: true });
export interface CascaderRef {
focus: () => void;
@ -348,9 +354,8 @@ const Cascader = React.forwardRef<CascaderRef, CascaderProps<any>>((props, ref)
}) as unknown as (<
OptionType extends DefaultOptionType = DefaultOptionType,
ValueField extends keyof OptionType = keyof OptionType,
Multiple extends boolean = false,
>(
props: React.PropsWithChildren<CascaderProps<OptionType, ValueField, Multiple>> &
props: React.PropsWithChildren<CascaderAutoProps<OptionType, ValueField>> &
React.RefAttributes<CascaderRef>,
) => React.ReactElement) & {
displayName: string;

View File

@ -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';

View File

@ -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', () => {
<ConfigProvider
theme={{
components: {
Slider: {
Input: {
colorPrimary: '#00B96B',
algorithm,
},
},
}}
>
<Slider value={5} />
<Input />
</ConfigProvider>
);
const { container, rerender } = render(<Demo />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#91caff',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#4096ff' });
rerender(<Demo algorithm />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#6ce0a4',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#20c77c' });
rerender(<Demo algorithm={theme.darkAlgorithm} />);
expect(container.querySelector('.ant-slider-track')).toHaveStyle({
'background-color': '#0e462e',
});
expect(container.querySelector('input')).toHaveStyle({ 'border-color': '#1fb572' });
});
});

View File

@ -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

View File

@ -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],

View File

@ -61,7 +61,7 @@ const genTooltipStyle: GenerateStyle<TooltipToken> = (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,

View File

@ -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",