mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-17 23:50:52 +08:00
Merge branch 'master' into feature-merge-master
This commit is contained in:
commit
18af5374e8
@ -7,7 +7,9 @@ version: 2.1
|
|||||||
jobs:
|
jobs:
|
||||||
test-argos-ci:
|
test-argos-ci:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/node:16.20-browsers
|
- image: cimg/node:18.17-browsers
|
||||||
|
environment:
|
||||||
|
NODE_OPTIONS: --openssl-legacy-provider
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import ConfigProvider from '..';
|
import ConfigProvider from '..';
|
||||||
import { fireEvent, render } from '../../../tests/utils';
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import Alert from '../../alert';
|
import Alert from '../../alert';
|
||||||
@ -942,11 +943,16 @@ describe('ConfigProvider support style and className props', () => {
|
|||||||
const { container } = render(
|
const { container } = render(
|
||||||
<ConfigProvider tag={{ className: 'cp-tag', style: { backgroundColor: 'blue' } }}>
|
<ConfigProvider tag={{ className: 'cp-tag', style: { backgroundColor: 'blue' } }}>
|
||||||
<Tag>Test</Tag>
|
<Tag>Test</Tag>
|
||||||
|
<Tag.CheckableTag checked>CheckableTag</Tag.CheckableTag>
|
||||||
</ConfigProvider>,
|
</ConfigProvider>,
|
||||||
);
|
);
|
||||||
const element = container.querySelector<HTMLSpanElement>('.ant-tag');
|
const element = container.querySelector<HTMLSpanElement>('.ant-tag');
|
||||||
expect(element).toHaveClass('cp-tag');
|
expect(element).toHaveClass('cp-tag');
|
||||||
expect(element).toHaveStyle({ backgroundColor: 'blue' });
|
expect(element).toHaveStyle({ backgroundColor: 'blue' });
|
||||||
|
|
||||||
|
const checkableElement = container.querySelector<HTMLSpanElement>('.ant-tag-checkable');
|
||||||
|
expect(checkableElement).toHaveClass('cp-tag');
|
||||||
|
expect(checkableElement).toHaveStyle({ backgroundColor: 'blue' });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should Table className & style works', () => {
|
it('Should Table className & style works', () => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
|
|
||||||
@ -21,13 +22,14 @@ export interface CheckableTagProps {
|
|||||||
const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
||||||
const {
|
const {
|
||||||
prefixCls: customizePrefixCls,
|
prefixCls: customizePrefixCls,
|
||||||
|
style,
|
||||||
className,
|
className,
|
||||||
checked,
|
checked,
|
||||||
onChange,
|
onChange,
|
||||||
onClick,
|
onClick,
|
||||||
...restProps
|
...restProps
|
||||||
} = props;
|
} = props;
|
||||||
const { getPrefixCls } = React.useContext(ConfigContext);
|
const { getPrefixCls, tag } = React.useContext(ConfigContext);
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {
|
const handleClick = (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {
|
||||||
onChange?.(!checked);
|
onChange?.(!checked);
|
||||||
@ -44,11 +46,22 @@ const CheckableTag: React.FC<CheckableTagProps> = (props) => {
|
|||||||
{
|
{
|
||||||
[`${prefixCls}-checkable-checked`]: checked,
|
[`${prefixCls}-checkable-checked`]: checked,
|
||||||
},
|
},
|
||||||
|
tag?.className,
|
||||||
className,
|
className,
|
||||||
hashId,
|
hashId,
|
||||||
);
|
);
|
||||||
|
|
||||||
return wrapSSR(<span {...restProps} className={cls} onClick={handleClick} />);
|
return wrapSSR(
|
||||||
|
<span
|
||||||
|
{...restProps}
|
||||||
|
style={{
|
||||||
|
...style,
|
||||||
|
...tag?.style,
|
||||||
|
}}
|
||||||
|
className={cls}
|
||||||
|
onClick={handleClick}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CheckableTag;
|
export default CheckableTag;
|
||||||
|
@ -75,6 +75,7 @@ The following languages are currently supported:
|
|||||||
| Malayalam (India) | ml_IN |
|
| Malayalam (India) | ml_IN |
|
||||||
| Mongolian | mn_MN |
|
| Mongolian | mn_MN |
|
||||||
| Malay (Malaysia) | ms_MY |
|
| Malay (Malaysia) | ms_MY |
|
||||||
|
| Burmese | my_MM |
|
||||||
| Norwegian | nb_NO |
|
| Norwegian | nb_NO |
|
||||||
| Nepal | ne_NP |
|
| Nepal | ne_NP |
|
||||||
| Dutch (Belgium) | nl_BE |
|
| Dutch (Belgium) | nl_BE |
|
||||||
@ -99,7 +100,6 @@ The following languages are currently supported:
|
|||||||
| Chinese (Simplified) | zh_CN |
|
| Chinese (Simplified) | zh_CN |
|
||||||
| Chinese (Traditional) | zh_HK |
|
| Chinese (Traditional) | zh_HK |
|
||||||
| Chinese (Traditional) | zh_TW |
|
| Chinese (Traditional) | zh_TW |
|
||||||
| Burmese | my_MM |
|
|
||||||
|
|
||||||
See more usage at [ConfigProvider](/components/config-provider).
|
See more usage at [ConfigProvider](/components/config-provider).
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ return (
|
|||||||
| 马拉雅拉姆语 | ml_IN |
|
| 马拉雅拉姆语 | ml_IN |
|
||||||
| 蒙古语 | mn_MN |
|
| 蒙古语 | mn_MN |
|
||||||
| 马来语 (马来西亚) | ms_MY |
|
| 马来语 (马来西亚) | ms_MY |
|
||||||
|
| 缅甸语 | my_MM |
|
||||||
| 挪威语 | nb_NO |
|
| 挪威语 | nb_NO |
|
||||||
| 尼泊尔语 | ne_NP |
|
| 尼泊尔语 | ne_NP |
|
||||||
| 荷兰语(比利时) | nl_BE |
|
| 荷兰语(比利时) | nl_BE |
|
||||||
@ -96,7 +97,6 @@ return (
|
|||||||
| 简体中文 | zh_CN |
|
| 简体中文 | zh_CN |
|
||||||
| 繁体中文(中国香港) | zh_HK |
|
| 繁体中文(中国香港) | zh_HK |
|
||||||
| 繁体中文(中国台湾) | zh_TW |
|
| 繁体中文(中国台湾) | zh_TW |
|
||||||
| 缅甸语 | my_MM |
|
|
||||||
|
|
||||||
具体的使用方法请参考 [ConfigProvider 文档](/components/config-provider-cn)。
|
具体的使用方法请参考 [ConfigProvider 文档](/components/config-provider-cn)。
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user