chore: auto merge branches (#41731)

feature merge master
This commit is contained in:
github-actions[bot] 2023-04-10 08:25:32 +00:00 committed by GitHub
commit 01ca6acd18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 342 additions and 120 deletions

View File

@ -21,14 +21,14 @@ function getDefaultTarget() {
// Affix // Affix
export interface AffixProps { export interface AffixProps {
/** 距离窗口顶部达到指定偏移量后触发 */ /** Triggered when the specified offset is reached from the top of the window */
offsetTop?: number; offsetTop?: number;
/** 距离窗口底部达到指定偏移量后触发 */ /** Triggered when the specified offset is reached from the bottom of the window */
offsetBottom?: number; offsetBottom?: number;
style?: React.CSSProperties; style?: React.CSSProperties;
/** 固定状态改变时触发的回调函数 */ /** Callback function triggered when fixed state changes */
onChange?: (affixed?: boolean) => void; onChange?: (affixed?: boolean) => void;
/** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */ /** Set the element that Affix needs to listen to its scroll event, the value is a function that returns the corresponding DOM element */
target?: () => Window | HTMLElement | null; target?: () => Window | HTMLElement | null;
prefixCls?: string; prefixCls?: string;
className?: string; className?: string;

View File

@ -132,7 +132,7 @@ const Alert: CompoundedComponent = ({
if (type !== undefined) { if (type !== undefined) {
return type; return type;
} }
// banner 模式默认为警告 // banner mode defaults to 'warning'
return banner ? 'warning' : 'info'; return banner ? 'warning' : 'info';
}; };
@ -140,7 +140,7 @@ const Alert: CompoundedComponent = ({
const isClosable = closeText ? true : closable; const isClosable = closeText ? true : closable;
const type = getType(); const type = getType();
// banner 模式默认有 Icon // banner mode defaults to Icon
const isShowIcon = banner && showIcon === undefined ? true : showIcon; const isShowIcon = banner && showIcon === undefined ? true : showIcon;
const alertCls = classNames( const alertCls = classNames(

View File

@ -53,7 +53,7 @@ describe('Avatar Render', () => {
it('should handle onError correctly', () => { it('should handle onError correctly', () => {
const LOAD_FAILURE_SRC = 'http://error.url/'; const LOAD_FAILURE_SRC = 'http://error.url/';
const LOAD_SUCCESS_SRC = 'https://joesch.moe/api/v1/random'; const LOAD_SUCCESS_SRC = 'https://xsgames.co/randomusers/avatar.php?g=pixel';
const Foo: React.FC = () => { const Foo: React.FC = () => {
const [avatarSrc, setAvatarSrc] = useState<typeof LOAD_FAILURE_SRC | typeof LOAD_SUCCESS_SRC>( const [avatarSrc, setAvatarSrc] = useState<typeof LOAD_FAILURE_SRC | typeof LOAD_SUCCESS_SRC>(
LOAD_FAILURE_SRC, LOAD_FAILURE_SRC,
@ -75,7 +75,7 @@ describe('Avatar Render', () => {
it('should show image on success after a failure state', () => { it('should show image on success after a failure state', () => {
const LOAD_FAILURE_SRC = 'http://error.url'; const LOAD_FAILURE_SRC = 'http://error.url';
const LOAD_SUCCESS_SRC = 'https://joesch.moe/api/v1/random'; const LOAD_SUCCESS_SRC = 'https://xsgames.co/randomusers/avatar.php?g=pixel';
const div = global.document.createElement('div'); const div = global.document.createElement('div');
global.document.body.appendChild(div); global.document.body.appendChild(div);
@ -172,7 +172,7 @@ describe('Avatar Render', () => {
}); });
it('should exist crossorigin attribute', () => { it('should exist crossorigin attribute', () => {
const LOAD_SUCCESS_SRC = 'https://joesch.moe/api/v1/random'; const LOAD_SUCCESS_SRC = 'https://xsgames.co/randomusers/avatar.php?g=pixel';
const crossOrigin = 'anonymous'; const crossOrigin = 'anonymous';
const { container } = render( const { container } = render(
<Avatar src={LOAD_SUCCESS_SRC} crossOrigin={crossOrigin}> <Avatar src={LOAD_SUCCESS_SRC} crossOrigin={crossOrigin}>
@ -184,7 +184,7 @@ describe('Avatar Render', () => {
}); });
it('should not exist crossorigin attribute', () => { it('should not exist crossorigin attribute', () => {
const LOAD_SUCCESS_SRC = 'https://joesch.moe/api/v1/random'; const LOAD_SUCCESS_SRC = 'https://xsgames.co/randomusers/avatar.php?g=pixel';
const { container } = render(<Avatar src={LOAD_SUCCESS_SRC}>crossorigin</Avatar>); const { container } = render(<Avatar src={LOAD_SUCCESS_SRC}>crossorigin</Avatar>);
expect(container.querySelector('img')?.crossOrigin).toBeFalsy(); expect(container.querySelector('img')?.crossOrigin).toBeFalsy();
expect(container.querySelector('img')?.crossOrigin).toEqual(''); expect(container.querySelector('img')?.crossOrigin).toEqual('');

View File

@ -140,7 +140,7 @@ exports[`Avatar Render should handle onError correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
`; `;
@ -163,7 +163,7 @@ exports[`Avatar Render should show image on success after a failure state 2`] =
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
`; `;

View File

@ -415,7 +415,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
<a <a
@ -512,7 +512,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
<span <span
@ -638,7 +638,7 @@ Array [
class="ant-avatar ant-avatar-lg ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-lg ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
<span <span

View File

@ -415,7 +415,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
<a <a
@ -493,7 +493,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
<span <span
@ -530,7 +530,7 @@ Array [
class="ant-avatar ant-avatar-lg ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-lg ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
<span <span

View File

@ -36,7 +36,7 @@ export interface AvatarProps {
crossOrigin?: '' | 'anonymous' | 'use-credentials'; crossOrigin?: '' | 'anonymous' | 'use-credentials';
onClick?: (e?: React.MouseEvent<HTMLElement>) => void; onClick?: (e?: React.MouseEvent<HTMLElement>) => void;
/* callback when img load error */ /* callback when img load error */
/* return false to prevent Avatar show default fallback behavior, then you can do fallback by your self */ /* return false to prevent Avatar show default fallback behavior, then you can do fallback by yourself */
onError?: () => boolean; onError?: () => boolean;
} }

View File

@ -5,7 +5,7 @@ import React from 'react';
const App: React.FC = () => ( const App: React.FC = () => (
<> <>
<Avatar.Group> <Avatar.Group>
<Avatar src="https://joesch.moe/api/v1/random?key=1" /> <Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1" />
<a href="https://ant.design"> <a href="https://ant.design">
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar> <Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
</a> </a>
@ -16,7 +16,7 @@ const App: React.FC = () => (
</Avatar.Group> </Avatar.Group>
<Divider /> <Divider />
<Avatar.Group maxCount={2} maxStyle={{ color: '#f56a00', backgroundColor: '#fde3cf' }}> <Avatar.Group maxCount={2} maxStyle={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>
<Avatar src="https://joesch.moe/api/v1/random?key=2" /> <Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2" />
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar> <Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
<Tooltip title="Ant User" placement="top"> <Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} /> <Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} />
@ -29,7 +29,7 @@ const App: React.FC = () => (
size="large" size="large"
maxStyle={{ color: '#f56a00', backgroundColor: '#fde3cf' }} maxStyle={{ color: '#f56a00', backgroundColor: '#fde3cf' }}
> >
<Avatar src="https://joesch.moe/api/v1/random?key=3" /> <Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3" />
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar> <Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
<Tooltip title="Ant User" placement="top"> <Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} /> <Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} />

View File

@ -601,7 +601,7 @@ exports[`renders components/card/demo/meta.tsx extend context correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>

View File

@ -601,7 +601,7 @@ exports[`renders components/card/demo/meta.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>

View File

@ -16,7 +16,7 @@ const App: React.FC = () => {
<Switch checked={!loading} onChange={onChange} /> <Switch checked={!loading} onChange={onChange} />
<Card style={{ width: 300, marginTop: 16 }} loading={loading}> <Card style={{ width: 300, marginTop: 16 }} loading={loading}>
<Meta <Meta
avatar={<Avatar src="https://joesch.moe/api/v1/random?key=1" />} avatar={<Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1" />}
title="Card title" title="Card title"
description="This is the description" description="This is the description"
/> />
@ -31,7 +31,7 @@ const App: React.FC = () => {
> >
<Skeleton loading={loading} avatar active> <Skeleton loading={loading} avatar active>
<Meta <Meta
avatar={<Avatar src="https://joesch.moe/api/v1/random?key=2" />} avatar={<Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2" />}
title="Card title" title="Card title"
description="This is the description" description="This is the description"
/> />

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { EditOutlined,EllipsisOutlined,SettingOutlined } from '@ant-design/icons'; import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
import { Avatar,Card } from 'antd'; import { Avatar, Card } from 'antd';
const { Meta } = Card; const { Meta } = Card;
@ -20,7 +20,7 @@ const App: React.FC = () => (
]} ]}
> >
<Meta <Meta
avatar={<Avatar src="https://joesch.moe/api/v1/random" />} avatar={<Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel" />}
title="Card title" title="Card title"
description="This is the description" description="This is the description"
/> />

View File

@ -14855,7 +14855,7 @@ exports[`ConfigProvider components List configProvider 1`] = `
class="config-avatar config-avatar-circle config-avatar-image" class="config-avatar config-avatar-circle config-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>
@ -14907,7 +14907,7 @@ exports[`ConfigProvider components List configProvider componentDisabled 1`] = `
class="config-avatar config-avatar-circle config-avatar-image" class="config-avatar config-avatar-circle config-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>
@ -14959,7 +14959,7 @@ exports[`ConfigProvider components List configProvider componentSize large 1`] =
class="config-avatar config-avatar-circle config-avatar-image" class="config-avatar config-avatar-circle config-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>
@ -15011,7 +15011,7 @@ exports[`ConfigProvider components List configProvider componentSize middle 1`]
class="config-avatar config-avatar-circle config-avatar-image" class="config-avatar config-avatar-circle config-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>
@ -15063,7 +15063,7 @@ exports[`ConfigProvider components List normal 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>
@ -15115,7 +15115,7 @@ exports[`ConfigProvider components List prefixCls 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
</div> </div>

View File

@ -342,7 +342,7 @@ describe('ConfigProvider', () => {
<List.Item {...props}> <List.Item {...props}>
<List.Item.Meta <List.Item.Meta
{...props} {...props}
avatar={<Avatar src="https://joesch.moe/api/v1/random" />} avatar={<Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel" />}
title="Ant Design" title="Ant Design"
description="Ant Design, a design language for background applications, is refined by Ant UED Team" description="Ant Design, a design language for background applications, is refined by Ant UED Team"
/> />

View File

@ -34,6 +34,7 @@ const genSharedEmptyStyle: GenerateStyle<EmptyToken> = (token): CSSObject => {
}, },
svg: { svg: {
maxWidth: '100%',
height: '100%', height: '100%',
margin: 'auto', margin: 'auto',
}, },

View File

@ -186,8 +186,8 @@ export default function ItemHolder(props: ItemHolderProps) {
{/* Label */} {/* Label */}
<FormItemLabel <FormItemLabel
htmlFor={fieldId} htmlFor={fieldId}
requiredMark={requiredMark}
{...props} {...props}
requiredMark={requiredMark}
required={required ?? isRequired} required={required ?? isRequired}
prefixCls={prefixCls} prefixCls={prefixCls}
/> />

View File

@ -51,7 +51,7 @@ const MemoInput = React.memo(
); );
export interface FormItemProps<Values = any> export interface FormItemProps<Values = any>
extends FormItemLabelProps, extends Omit<FormItemLabelProps, 'requiredMark'>,
FormItemInputProps, FormItemInputProps,
RcFieldProps<Values> { RcFieldProps<Values> {
prefixCls?: string; prefixCls?: string;
@ -106,6 +106,7 @@ function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.Rea
trigger = 'onChange', trigger = 'onChange',
validateTrigger, validateTrigger,
hidden, hidden,
help,
} = props; } = props;
const { getPrefixCls } = React.useContext(ConfigContext); const { getPrefixCls } = React.useContext(ConfigContext);
const { name: formName } = React.useContext(FormContext); const { name: formName } = React.useContext(FormContext);
@ -145,7 +146,7 @@ function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.Rea
setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true); setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true);
// Bump to parent since noStyle // Bump to parent since noStyle
if (noStyle && notifyParentMetaChange) { if (noStyle && help !== false && notifyParentMetaChange) {
let namePath = nextMeta.name; let namePath = nextMeta.name;
if (!nextMeta.destroy) { if (!nextMeta.destroy) {
@ -322,9 +323,9 @@ function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.Rea
childProps.id = fieldId; childProps.id = fieldId;
} }
if (props.help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) { if (help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) {
const describedbyArr = []; const describedbyArr = [];
if (props.help || mergedErrors.length > 0) { if (help || mergedErrors.length > 0) {
describedbyArr.push(`${fieldId}_help`); describedbyArr.push(`${fieldId}_help`);
} }
if (props.extra) { if (props.extra) {

View File

@ -38,6 +38,9 @@ export interface FormItemLabelProps {
label?: React.ReactNode; label?: React.ReactNode;
labelAlign?: FormLabelAlign; labelAlign?: FormLabelAlign;
labelCol?: ColProps; labelCol?: ColProps;
/**
* @internal Used for pass `requiredMark` from `<Form />`
*/
requiredMark?: RequiredMark; requiredMark?: RequiredMark;
tooltip?: LabelTooltipType; tooltip?: LabelTooltipType;
} }

View File

@ -171,6 +171,43 @@ describe('Form', () => {
await waitFakeTimer(2000, 2000); await waitFakeTimer(2000, 2000);
expect(container.querySelector('.ant-form-item-explain-error')).toHaveTextContent('aaa'); expect(container.querySelector('.ant-form-item-explain-error')).toHaveTextContent('aaa');
}); });
// https://github.com/ant-design/ant-design/issues/41620
it('should not throw error when `help=false` and `noStyle=true`', async () => {
const App = (props: { help?: boolean | React.ReactNode }) => {
const { help = false } = props || {};
return (
<Form>
<Form.Item name="list" label="List" rules={[{ required: true }]}>
<Form.Item name={['list', 0]} noStyle help={help} rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item name={['list', 1]} noStyle help={help} rules={[{ required: true }]}>
<Input />
</Form.Item>
</Form.Item>
<Form.Item>
<button type="submit">submit</button>
</Form.Item>
</Form>
);
};
const { container, getByRole, rerender } = render(<App />);
// click submit to trigger validate
fireEvent.click(getByRole('button'));
await waitFakeTimer();
expect(container.querySelectorAll('.ant-form-item-explain-error')).toHaveLength(1);
// When noStyle=true but help is not false, help will be displayed
rerender(<App help="help" />);
await waitFakeTimer();
fireEvent.click(getByRole('button'));
await waitFakeTimer();
expect(container.querySelectorAll('.ant-form-item-explain-error')).toHaveLength(3);
});
}); });
it('render functions require either `shouldUpdate` or `dependencies`', () => { it('render functions require either `shouldUpdate` or `dependencies`', () => {
@ -1797,4 +1834,29 @@ describe('Form', () => {
expect(onChange).toHaveBeenNthCalledWith(idx++, 'validating'); expect(onChange).toHaveBeenNthCalledWith(idx++, 'validating');
expect(onChange).toHaveBeenNthCalledWith(idx++, 'success'); expect(onChange).toHaveBeenNthCalledWith(idx++, 'success');
}); });
// https://user-images.githubusercontent.com/32004925/230819163-464fe90d-422d-4a6d-9e35-44a25d4c64f1.png
it('should not render `requiredMark` when Form.Item has no required prop', () => {
// Escaping TypeScript error
const genProps = (value: any) => ({ ...value });
const { container } = render(
<Form name="basic" requiredMark="optional">
<Form.Item
label="First Name"
name="firstName"
required
{...genProps({ requiredMark: false })}
>
<Input />
</Form.Item>
<Form.Item label="Last Name" name="lastName" required {...genProps({ requiredMark: true })}>
<Input />
</Form.Item>
</Form>,
);
expect(container.querySelectorAll('.ant-form-item-required')).toHaveLength(2);
expect(container.querySelectorAll('.ant-form-item-required-mark-optional')).toHaveLength(2);
});
}); });

View File

@ -9,7 +9,7 @@ describe('List Item Layout', () => {
key: 1, key: 1,
href: 'https://ant.design', href: 'https://ant.design',
title: 'ant design', title: 'ant design',
avatar: 'https://joesch.moe/api/v1/random', avatar: 'https://xsgames.co/randomusers/avatar.php?g=pixel',
description: description:
'Ant Design, a design language for background applications, is refined by Ant UED Team.', 'Ant Design, a design language for background applications, is refined by Ant UED Team.',
content: content:
@ -230,4 +230,20 @@ describe('List Item Layout', () => {
rerender(getDom(5)); rerender(getDom(5));
expect(loadId).toEqual([1, 3, 5]); expect(loadId).toEqual([1, 3, 5]);
}); });
it('List.Item.Meta title should have no default margin', () => {
const { container } = render(
<List
dataSource={[{ id: 1, title: `ant design` }]}
renderItem={(item) => (
<List.Item>
<List.Item.Meta title={item.title} />
</List.Item>
)}
/>,
);
const title = container.querySelector('.ant-list-item-meta-title');
expect(title && getComputedStyle(title).margin).toEqual('0px 0px 4px 0px');
});
}); });

View File

@ -26,7 +26,7 @@ exports[`renders components/list/demo/basic.tsx extend context correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -63,7 +63,7 @@ exports[`renders components/list/demo/basic.tsx extend context correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -100,7 +100,7 @@ exports[`renders components/list/demo/basic.tsx extend context correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -137,7 +137,7 @@ exports[`renders components/list/demo/basic.tsx extend context correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>
@ -1360,7 +1360,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -1397,7 +1397,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -1434,7 +1434,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -1471,7 +1471,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>
@ -2079,7 +2079,7 @@ exports[`renders components/list/demo/vertical.tsx extend context correctly 1`]
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -2245,7 +2245,7 @@ exports[`renders components/list/demo/vertical.tsx extend context correctly 1`]
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -2411,7 +2411,7 @@ exports[`renders components/list/demo/vertical.tsx extend context correctly 1`]
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>

View File

@ -26,7 +26,7 @@ exports[`renders components/list/demo/basic.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -63,7 +63,7 @@ exports[`renders components/list/demo/basic.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -100,7 +100,7 @@ exports[`renders components/list/demo/basic.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -137,7 +137,7 @@ exports[`renders components/list/demo/basic.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>
@ -1360,7 +1360,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -1397,7 +1397,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -1434,7 +1434,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -1471,7 +1471,7 @@ Array [
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>
@ -2072,7 +2072,7 @@ exports[`renders components/list/demo/vertical.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -2238,7 +2238,7 @@ exports[`renders components/list/demo/vertical.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -2404,7 +2404,7 @@ exports[`renders components/list/demo/vertical.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>

View File

@ -23,7 +23,7 @@ const App: React.FC = () => (
renderItem={(item, index) => ( renderItem={(item, index) => (
<List.Item> <List.Item>
<List.Item.Meta <List.Item.Meta
avatar={<Avatar src={`https://joesch.moe/api/v1/random?key=${index}`} />} avatar={<Avatar src={`https://xsgames.co/randomusers/avatar.php?g=pixel&key=${index}`} />}
title={<a href="https://ant.design">{item.title}</a>} title={<a href="https://ant.design">{item.title}</a>}
description="Ant Design, a design language for background applications, is refined by Ant UED Team" description="Ant Design, a design language for background applications, is refined by Ant UED Team"
/> />

View File

@ -70,7 +70,9 @@ const App: React.FC = () => {
renderItem={(item, index) => ( renderItem={(item, index) => (
<List.Item> <List.Item>
<List.Item.Meta <List.Item.Meta
avatar={<Avatar src={`https://joesch.moe/api/v1/random?key=${index}`} />} avatar={
<Avatar src={`https://xsgames.co/randomusers/avatar.php?g=pixel&key=${index}`} />
}
title={<a href="https://ant.design">{item.title}</a>} title={<a href="https://ant.design">{item.title}</a>}
description="Ant Design, a design language for background applications, is refined by Ant UED Team" description="Ant Design, a design language for background applications, is refined by Ant UED Team"
/> />

View File

@ -5,7 +5,7 @@ import React from 'react';
const data = Array.from({ length: 23 }).map((_, i) => ({ const data = Array.from({ length: 23 }).map((_, i) => ({
href: 'https://ant.design', href: 'https://ant.design',
title: `ant design part ${i}`, title: `ant design part ${i}`,
avatar: `https://joesch.moe/api/v1/random?key=${i}`, avatar: `https://xsgames.co/randomusers/avatar.php?g=pixel&key=${i}`,
description: description:
'Ant Design, a design language for background applications, is refined by Ant UED Team.', 'Ant Design, a design language for background applications, is refined by Ant UED Team.',
content: content:

View File

@ -187,7 +187,7 @@ const genBaseStyle: GenerateStyle<ListToken> = (token) => {
}, },
[`${componentCls}-item-meta-title`]: { [`${componentCls}-item-meta-title`]: {
marginBottom: token.marginXXS, margin: `0 0 ${token.marginXXS}px 0`,
color: colorText, color: colorText,
fontSize: token.fontSize, fontSize: token.fontSize,
lineHeight: token.lineHeight, lineHeight: token.lineHeight,

View File

@ -21,9 +21,12 @@ const localeValues: Locale = {
filterConfirm: 'ยืนยัน', filterConfirm: 'ยืนยัน',
filterReset: 'รีเซ็ต', filterReset: 'รีเซ็ต',
filterEmptyText: 'ไม่มีตัวกรอง', filterEmptyText: 'ไม่มีตัวกรอง',
filterCheckall: 'เลือกรายการทั้งหมด',
filterSearchPlaceholder: 'ค้นหาตัวกรอง',
emptyText: 'ไม่มีข้อมูล', emptyText: 'ไม่มีข้อมูล',
selectAll: 'เลือกทั้งหมดในหน้านี้', selectAll: 'เลือกทั้งหมดในหน้านี้',
selectInvert: 'กลับสถานะการเลือกในหน้านี้', selectInvert: 'กลับสถานะการเลือกในหน้านี้',
selectNone: 'ไม่เลือกข้อมูลทั้งหมด',
selectionAll: 'เลือกข้อมูลทั้งหมด', selectionAll: 'เลือกข้อมูลทั้งหมด',
sortTitle: 'เรียง', sortTitle: 'เรียง',
expand: 'แสดงแถวข้อมูล', expand: 'แสดงแถวข้อมูล',
@ -32,6 +35,11 @@ const localeValues: Locale = {
triggerAsc: 'คลิกเรียงจากน้อยไปมาก', triggerAsc: 'คลิกเรียงจากน้อยไปมาก',
cancelSort: 'คลิกเพื่อยกเลิกการเรียง', cancelSort: 'คลิกเพื่อยกเลิกการเรียง',
}, },
Tour: {
Next: 'ถัดไป',
Previous: 'ย้อนกลับ',
Finish: 'เสร็จสิ้น',
},
Modal: { Modal: {
okText: 'ตกลง', okText: 'ตกลง',
cancelText: 'ยกเลิก', cancelText: 'ยกเลิก',
@ -125,6 +133,13 @@ const localeValues: Locale = {
}, },
}, },
}, },
Image: {
preview: 'ดูตัวอย่าง',
},
QRCode: {
expired: 'คิวอาร์โค้ดหมดอายุ',
refresh: 'รีเฟรช',
},
}; };
export default localeValues; export default localeValues;

View File

@ -98,13 +98,14 @@ const genPaginationDisabledStyle: GenerateStyle<PaginationToken, CSSObject> = (t
[`${componentCls}-item-link`]: { [`${componentCls}-item-link`]: {
color: token.colorTextDisabled, color: token.colorTextDisabled,
cursor: 'not-allowed', cursor: 'not-allowed',
'&:hover, &:active': { '&:hover, &:active': {
backgroundColor: 'transparent', backgroundColor: 'transparent',
}, },
[`${componentCls}-simple&`]: { [`${componentCls}-simple&`]: {
backgroundColor: 'transparent', backgroundColor: 'transparent',
'&:hover, &:active': {
backgroundColor: 'transparent',
},
}, },
}, },
@ -120,6 +121,15 @@ const genPaginationDisabledStyle: GenerateStyle<PaginationToken, CSSObject> = (t
color: token.colorTextDisabled, color: token.colorTextDisabled,
}, },
}, },
[`&${componentCls}-simple`]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
[`&${componentCls}-disabled ${componentCls}-item-link`]: {
'&:hover, &:active': {
backgroundColor: 'transparent',
},
},
},
},
}; };
}; };
@ -224,7 +234,12 @@ const genPaginationSimpleStyle: GenerateStyle<PaginationToken, CSSObject> = (tok
height: token.paginationItemSizeSM, height: token.paginationItemSizeSM,
backgroundColor: 'transparent', backgroundColor: 'transparent',
border: 0, border: 0,
'&:hover': {
backgroundColor: token.colorBgTextHover,
},
'&:active': {
backgroundColor: token.colorBgTextActive,
},
'&::after': { '&::after': {
height: token.paginationItemSizeSM, height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`, lineHeight: `${token.paginationItemSizeSM}px`,

View File

@ -6,4 +6,83 @@ exports[`Popconfirm should show overlay when trigger is clicked 1`] = `"<div cla
exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"<div class="ant-popover-arrow" style="position: absolute; bottom: 0px; left: 0px;"></div><div class="ant-popover-content"><div class="ant-popover-inner" role="tooltip"><div class="ant-popover-inner-content"><div class="ant-popconfirm-inner-content"><div class="ant-popconfirm-message"><span class="ant-popconfirm-message-icon"><span role="img" aria-label="exclamation-circle" class="anticon anticon-exclamation-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="exclamation-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"></path></svg></span></span><div class="ant-popconfirm-message-title">code</div></div><div class="ant-popconfirm-buttons"><button type="button" class="ant-btn ant-btn-default ant-btn-sm"><span>Cancel</span></button><button type="button" class="ant-btn ant-btn-primary ant-btn-sm"><span>OK</span></button></div></div></div></div></div>"`; exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"<div class="ant-popover-arrow" style="position: absolute; bottom: 0px; left: 0px;"></div><div class="ant-popover-content"><div class="ant-popover-inner" role="tooltip"><div class="ant-popover-inner-content"><div class="ant-popconfirm-inner-content"><div class="ant-popconfirm-message"><span class="ant-popconfirm-message-icon"><span role="img" aria-label="exclamation-circle" class="anticon anticon-exclamation-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="exclamation-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"></path></svg></span></span><div class="ant-popconfirm-message-title">code</div></div><div class="ant-popconfirm-buttons"><button type="button" class="ant-btn ant-btn-default ant-btn-sm"><span>Cancel</span></button><button type="button" class="ant-btn ant-btn-primary ant-btn-sm"><span>OK</span></button></div></div></div></div></div>"`;
exports[`Popconfirm shows content for render functions 1`] = `"<div class="ant-popover-arrow" style="position: absolute; bottom: 0px; left: 0px;"></div><div class="ant-popover-content"><div class="ant-popover-inner" role="tooltip"><div class="ant-popover-inner-content"><div class="ant-popconfirm-inner-content"><div class="ant-popconfirm-message"><span class="ant-popconfirm-message-icon"><span role="img" aria-label="exclamation-circle" class="anticon anticon-exclamation-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="exclamation-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"></path></svg></span></span><div class="ant-popconfirm-message-title">some-title</div></div><div class="ant-popconfirm-buttons"><button type="button" class="ant-btn ant-btn-default ant-btn-sm"><span>Cancel</span></button><button type="button" class="ant-btn ant-btn-primary ant-btn-sm"><span>OK</span></button></div></div></div></div></div>"`; exports[`Popconfirm shows content for render functions 1`] = `
<div
class="ant-popover ant-popconfirm ant-popover-placement-bottom"
style="left: 0px; top: 12px; box-sizing: border-box; transform-origin: 50% 12px;"
>
<div
class="ant-popover-arrow"
style="position: absolute; left: 0px; top: 0px;"
/>
<div
class="ant-popover-content"
>
<div
class="ant-popover-inner"
role="tooltip"
>
<div
class="ant-popover-inner-content"
>
<div
class="ant-popconfirm-inner-content"
>
<div
class="ant-popconfirm-message"
>
<span
class="ant-popconfirm-message-icon"
>
<span
aria-label="exclamation-circle"
class="anticon anticon-exclamation-circle"
role="img"
>
<svg
aria-hidden="true"
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
/>
</svg>
</span>
</span>
<div
class="ant-popconfirm-message-title"
>
some-title
</div>
</div>
<div
class="ant-popconfirm-buttons"
>
<button
class="ant-btn ant-btn-default ant-btn-sm"
type="button"
>
<span>
Cancel
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-sm"
type="button"
>
<span>
OK
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
`;

View File

@ -3,7 +3,7 @@ import React from 'react';
import Popconfirm from '..'; import Popconfirm from '..';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest'; import rtlTest from '../../../tests/shared/rtlTest';
import { render, fireEvent, act, waitFakeTimer } from '../../../tests/utils'; import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import Button from '../../button'; import Button from '../../button';
describe('Popconfirm', () => { describe('Popconfirm', () => {
@ -94,7 +94,7 @@ describe('Popconfirm', () => {
expect(popconfirm.container.querySelector('.ant-popover')).not.toBe(null); expect(popconfirm.container.querySelector('.ant-popover')).not.toBe(null);
expect(popconfirm.container.querySelector('.ant-popover')?.innerHTML).toContain('some-title'); expect(popconfirm.container.querySelector('.ant-popover')?.innerHTML).toContain('some-title');
expect(popconfirm.container.querySelector('.ant-popover')?.innerHTML).toMatchSnapshot(); expect(popconfirm.container.querySelector('.ant-popover')).toMatchSnapshot();
}); });
it('should be controlled by open', () => { it('should be controlled by open', () => {

View File

@ -330,7 +330,7 @@ exports[`renders components/segmented/demo/custom.tsx extend context correctly 1
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
<div> <div>

View File

@ -330,7 +330,7 @@ exports[`renders components/segmented/demo/custom.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random" src="https://xsgames.co/randomusers/avatar.php?g=pixel"
/> />
</span> </span>
<div> <div>

View File

@ -9,7 +9,7 @@ const App: React.FC = () => (
{ {
label: ( label: (
<div style={{ padding: 4 }}> <div style={{ padding: 4 }}>
<Avatar src="https://joesch.moe/api/v1/random" /> <Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel" />
<div>User 1</div> <div>User 1</div>
</div> </div>
), ),

View File

@ -7771,7 +7771,6 @@ exports[`renders components/select/demo/responsive.tsx extend context correctly
exports[`renders components/select/demo/search.tsx extend context correctly 1`] = ` exports[`renders components/select/demo/search.tsx extend context correctly 1`] = `
<div <div
class="ant-select ant-select-single ant-select-show-arrow ant-select-show-search" class="ant-select ant-select-single ant-select-show-arrow ant-select-show-search"
style="width: 160px;"
> >
<div <div
class="ant-select-selector" class="ant-select-selector"

View File

@ -2351,7 +2351,6 @@ exports[`renders components/select/demo/responsive.tsx correctly 1`] = `
exports[`renders components/select/demo/search.tsx correctly 1`] = ` exports[`renders components/select/demo/search.tsx correctly 1`] = `
<div <div
class="ant-select ant-select-single ant-select-show-arrow ant-select-show-search" class="ant-select ant-select-single ant-select-show-arrow ant-select-show-search"
style="width:160px"
> >
<div <div
class="ant-select-selector" class="ant-select-selector"

View File

@ -12,7 +12,6 @@ const onSearch = (value: string) => {
const App: React.FC = () => ( const App: React.FC = () => (
<Select <Select
showSearch showSearch
style={{ width: 160 }}
placeholder="Select a person" placeholder="Select a person"
optionFilterProp="children" optionFilterProp="children"
onChange={onChange} onChange={onChange}

View File

@ -84,16 +84,6 @@ const genSingleStyle: GenerateStyle<SelectToken> = (token) => {
display: 'none', display: 'none',
}, },
'&-empty': {
color: token.colorTextDisabled,
},
// ========================= Options =========================
[`${selectItemCls}-empty`]: {
...genItemStyle(token),
color: token.colorTextDisabled,
},
[`${selectItemCls}`]: { [`${selectItemCls}`]: {
...genItemStyle(token), ...genItemStyle(token),
cursor: 'pointer', cursor: 'pointer',

View File

@ -41,7 +41,7 @@ function genSizeStyle(token: SelectToken, suffix?: string): CSSObject {
`]: { `]: {
padding: 0, padding: 0,
lineHeight: `${selectHeightWithoutBorder}px`, lineHeight: `${selectHeightWithoutBorder}px`,
transition: `all ${token.motionDurationSlow}`, transition: `all ${token.motionDurationSlow}, visibility 0s`,
// Firefox inline-block position calculation is not same as Chrome & Safari. Patch this: // Firefox inline-block position calculation is not same as Chrome & Safari. Patch this:
'@supports (-moz-appearance: meterbar)': { '@supports (-moz-appearance: meterbar)': {

View File

@ -11,7 +11,7 @@ interface IconTextProps {
const listData = Array.from({ length: 3 }).map((_, i) => ({ const listData = Array.from({ length: 3 }).map((_, i) => ({
href: 'https://ant.design', href: 'https://ant.design',
title: `ant design part ${i + 1}`, title: `ant design part ${i + 1}`,
avatar: `https://joesch.moe/api/v1/random?key=${i}`, avatar: `https://xsgames.co/randomusers/avatar.php?g=pixel&key=${i}`,
description: description:
'Ant Design, a design language for background applications, is refined by Ant UED Team.', 'Ant Design, a design language for background applications, is refined by Ant UED Team.',
content: content:

View File

@ -38,17 +38,21 @@ const genSpaceStyle: GenerateStyle<SpaceToken> = (token) => {
alignItems: 'baseline', alignItems: 'baseline',
}, },
}, },
[`${componentCls}-item`]: { [`${componentCls}-item:empty`]: {
'&:empty': { display: 'none',
display: 'none',
},
}, },
}, },
}; };
}; };
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Space', (token) => [ export default genComponentStyleHook(
genSpaceStyle(token), 'Space',
genSpaceCompactStyle(token), (token) => [genSpaceStyle(token), genSpaceCompactStyle(token)],
]); () => ({}),
{
// Space component don't apply extra font style
// https://github.com/ant-design/ant-design/issues/40315
resetStyle: false,
},
);

View File

@ -851,7 +851,7 @@ exports[`renders components/steps/demo/inline.tsx extend context correctly 1`] =
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -1058,7 +1058,7 @@ exports[`renders components/steps/demo/inline.tsx extend context correctly 1`] =
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -1265,7 +1265,7 @@ exports[`renders components/steps/demo/inline.tsx extend context correctly 1`] =
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -1472,7 +1472,7 @@ exports[`renders components/steps/demo/inline.tsx extend context correctly 1`] =
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>

View File

@ -751,7 +751,7 @@ exports[`renders components/steps/demo/inline.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=0" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=0"
/> />
</span> </span>
</div> </div>
@ -901,7 +901,7 @@ exports[`renders components/steps/demo/inline.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=1" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=1"
/> />
</span> </span>
</div> </div>
@ -1051,7 +1051,7 @@ exports[`renders components/steps/demo/inline.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=2" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2"
/> />
</span> </span>
</div> </div>
@ -1201,7 +1201,7 @@ exports[`renders components/steps/demo/inline.tsx correctly 1`] = `
class="ant-avatar ant-avatar-circle ant-avatar-image" class="ant-avatar ant-avatar-circle ant-avatar-image"
> >
<img <img
src="https://joesch.moe/api/v1/random?key=3" src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=3"
/> />
</span> </span>
</div> </div>

View File

@ -45,7 +45,9 @@ const App: React.FC = () => (
renderItem={(item, index) => ( renderItem={(item, index) => (
<List.Item> <List.Item>
<List.Item.Meta <List.Item.Meta
avatar={<Avatar src={`https://joesch.moe/api/v1/random?key=${index}`} />} avatar={
<Avatar src={`https://xsgames.co/randomusers/avatar.php?g=pixel&key=${index}`} />
}
title={<a href="https://ant.design">{item.title}</a>} title={<a href="https://ant.design">{item.title}</a>}
description="Ant Design, a design language for background applications, is refined by Ant UED Team" description="Ant Design, a design language for background applications, is refined by Ant UED Team"
/> />

View File

@ -41,6 +41,9 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
getDefaultToken?: getDefaultToken?:
| OverrideTokenWithoutDerivative[ComponentName] | OverrideTokenWithoutDerivative[ComponentName]
| ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]), | ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]),
options?: {
resetStyle?: boolean;
},
) { ) {
return (prefixCls: string): UseComponentStyleResult => { return (prefixCls: string): UseComponentStyleResult => {
const [theme, token, hashId] = useToken(); const [theme, token, hashId] = useToken();
@ -93,7 +96,10 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
overrideComponentToken: token[component], overrideComponentToken: token[component],
}); });
flush(component, mergedComponentToken); flush(component, mergedComponentToken);
return [genCommonStyle(token, prefixCls), styleInterpolation]; return [
options?.resetStyle === false ? null : genCommonStyle(token, prefixCls),
styleInterpolation,
];
}), }),
hashId, hashId,
]; ];

View File

@ -185,4 +185,33 @@ describe('Tree', () => {
expect(nodeDraggable).toHaveBeenCalledWith(dragTreeData[0]); expect(nodeDraggable).toHaveBeenCalledWith(dragTreeData[0]);
}); });
}); });
describe('hidden switcherIcon', () => {
it('use `switcherIcon={() => null}`', () => {
const { container } = render(
<Tree defaultExpandAll switcherIcon={() => null}>
<TreeNode icon="icon">
<TreeNode title="node1" icon="icon" key="0-0-2" />
<TreeNode title="node2" key="0-0-3" />
</TreeNode>
</Tree>,
);
container.querySelectorAll('.ant-tree-switcher').forEach((el) => {
expect(el.children.length).toBe(0);
});
});
it('use `switcherIcon={null}`', () => {
const { container } = render(
<Tree defaultExpandAll switcherIcon={null}>
<TreeNode icon="icon">
<TreeNode title="node1" icon="icon" key="0-0-2" />
<TreeNode title="node2" key="0-0-3" />
</TreeNode>
</Tree>,
);
container.querySelectorAll('.ant-tree-switcher').forEach((el) => {
expect(el.children.length).toBe(0);
});
});
});
}); });

View File

@ -64,7 +64,7 @@ const SwitcherIconCom: React.FC<SwitcherIconProps> = (props) => {
}); });
} }
if (switcher) { if (switcher !== undefined) {
return switcher as unknown as React.ReactElement; return switcher as unknown as React.ReactElement;
} }

View File

@ -319,7 +319,7 @@ export default function Layout() {
} }
``` ```
这里先用 umi 的 `useAppData` 拿到全局客户端路由 `clientRoutes`,这是一份嵌套结构的路由表,我们把 `clientRoutes[0]` 传给 ProLayout再通过 `useLocation()` 拿到 location 信息,也传给 ProLayout 来决定哪个菜单应该高亮;同时我们希望点击菜单时做路由跳转,需要需要定制 ProLayout 的 menuItemRender 方法。 这里先用 umi 的 `useAppData` 拿到全局客户端路由 `clientRoutes`,这是一份嵌套结构的路由表,我们把 `clientRoutes[0]` 传给 ProLayout再通过 `useLocation()` 拿到 location 信息,也传给 ProLayout 来决定哪个菜单应该高亮;同时我们希望点击菜单时做路由跳转,需要定制 ProLayout 的 menuItemRender 方法。
聪明的你可能已经发现 `src/layouts/index.less` 已经没地方引用他了,为了保持项目文件的整洁,可以选择删掉他。 聪明的你可能已经发现 `src/layouts/index.less` 已经没地方引用他了,为了保持项目文件的整洁,可以选择删掉他。

View File

@ -140,7 +140,7 @@
"rc-rate": "~2.10.0", "rc-rate": "~2.10.0",
"rc-resize-observer": "^1.2.0", "rc-resize-observer": "^1.2.0",
"rc-segmented": "~2.1.2", "rc-segmented": "~2.1.2",
"rc-select": "~14.4.0", "rc-select": "~14.4.3",
"rc-slider": "~10.1.0", "rc-slider": "~10.1.0",
"rc-steps": "~6.0.0", "rc-steps": "~6.0.0",
"rc-switch": "~4.0.0", "rc-switch": "~4.0.0",

View File

@ -14,26 +14,26 @@ module.exports = {
const EmptyElement = React.createElement('div'); const EmptyElement = React.createElement('div');
styleFiles.forEach((file) => { styleFiles.forEach((file) => {
const pathArr = file.split('/');
const styleIndex = pathArr.lastIndexOf('style');
const componentName = pathArr[styleIndex - 1];
let useStyle = () => {}; let useStyle = () => {};
if (file.includes('grid')) { if (file.includes('grid')) {
// eslint-disable-next-line global-require,import/no-dynamic-require // eslint-disable-next-line global-require,import/no-dynamic-require
const { useColStyle, useRowStyle } = require(file); const { useColStyle, useRowStyle } = require(file);
useStyle = () => { useStyle = (prefixCls) => {
useRowStyle(); useRowStyle(prefixCls);
useColStyle(); useColStyle(prefixCls);
}; };
} else { } else {
// eslint-disable-next-line global-require,import/no-dynamic-require // eslint-disable-next-line global-require,import/no-dynamic-require
useStyle = require(file).default; useStyle = require(file).default;
} }
const Component = () => { const Component = () => {
useStyle(key); useStyle(`${key}-${componentName}`);
return EmptyElement; return EmptyElement;
}; };
const pathArr = file.split('/');
const styleIndex = pathArr.lastIndexOf('style');
const componentName = pathArr[styleIndex - 1];
beforeRender?.(componentName); beforeRender?.(componentName);
render(Component); render(Component);
}); });