mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
feat: CP support Transfer selectionsIcon (#47301)
This commit is contained in:
parent
326ae986b9
commit
0e28360622
@ -1230,6 +1230,7 @@ describe('ConfigProvider support style and className props', () => {
|
|||||||
<ConfigProvider
|
<ConfigProvider
|
||||||
transfer={{
|
transfer={{
|
||||||
className: 'test-class',
|
className: 'test-class',
|
||||||
|
selectionsIcon: <span className="cp-test-selectionsIcon">cp-test-selectionsIcon</span>,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Transfer dataSource={mockData} />
|
<Transfer dataSource={mockData} />
|
||||||
@ -1237,6 +1238,7 @@ describe('ConfigProvider support style and className props', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(container.querySelector('.ant-transfer')).toHaveClass('test-class');
|
expect(container.querySelector('.ant-transfer')).toHaveClass('test-class');
|
||||||
|
expect(container.querySelector<HTMLSpanElement>('.cp-test-selectionsIcon')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should Transfer style works', () => {
|
it('Should Transfer style works', () => {
|
||||||
|
@ -21,6 +21,7 @@ import type { TabsProps } from '../tabs';
|
|||||||
import type { TagProps } from '../tag';
|
import type { TagProps } from '../tag';
|
||||||
import type { AliasToken, MappingAlgorithm, OverrideToken } from '../theme/interface';
|
import type { AliasToken, MappingAlgorithm, OverrideToken } from '../theme/interface';
|
||||||
import type { TourProps } from '../tour/interface';
|
import type { TourProps } from '../tour/interface';
|
||||||
|
import type { TransferProps } from '../transfer';
|
||||||
import type { RenderEmptyHandler } from './defaultRenderEmpty';
|
import type { RenderEmptyHandler } from './defaultRenderEmpty';
|
||||||
|
|
||||||
export const defaultIconPrefixCls = 'anticon';
|
export const defaultIconPrefixCls = 'anticon';
|
||||||
@ -109,6 +110,8 @@ export type DrawerConfig = ComponentStyleConfig &
|
|||||||
|
|
||||||
export type FlexConfig = ComponentStyleConfig & Pick<FlexProps, 'vertical'>;
|
export type FlexConfig = ComponentStyleConfig & Pick<FlexProps, 'vertical'>;
|
||||||
|
|
||||||
|
export type TransferConfig = ComponentStyleConfig & Pick<TransferProps, 'selectionsIcon'>;
|
||||||
|
|
||||||
export type PopupOverflow = 'viewport' | 'scroll';
|
export type PopupOverflow = 'viewport' | 'scroll';
|
||||||
|
|
||||||
export interface WaveConfig {
|
export interface WaveConfig {
|
||||||
@ -169,7 +172,7 @@ export interface ConfigConsumerProps {
|
|||||||
radio?: ComponentStyleConfig;
|
radio?: ComponentStyleConfig;
|
||||||
rate?: ComponentStyleConfig;
|
rate?: ComponentStyleConfig;
|
||||||
switch?: ComponentStyleConfig;
|
switch?: ComponentStyleConfig;
|
||||||
transfer?: ComponentStyleConfig;
|
transfer?: TransferConfig;
|
||||||
avatar?: ComponentStyleConfig;
|
avatar?: ComponentStyleConfig;
|
||||||
message?: ComponentStyleConfig;
|
message?: ComponentStyleConfig;
|
||||||
tag?: TagConfig;
|
tag?: TagConfig;
|
||||||
|
@ -152,7 +152,7 @@ const {
|
|||||||
| timeline | Set Timeline common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| timeline | Set Timeline common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| timePicker | Set TimePicker common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| timePicker | Set TimePicker common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| tour | Set Tour common props | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
| tour | Set Tour common props | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
||||||
| transfer | Set Transfer common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| transfer | Set Transfer common props | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
||||||
| tree | Set Tree common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| tree | Set Tree common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| typography | Set Typography common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| typography | Set Typography common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| upload | Set Upload common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| upload | Set Upload common props | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
|
@ -40,6 +40,7 @@ import type {
|
|||||||
Theme,
|
Theme,
|
||||||
ThemeConfig,
|
ThemeConfig,
|
||||||
TourConfig,
|
TourConfig,
|
||||||
|
TransferConfig,
|
||||||
WaveConfig,
|
WaveConfig,
|
||||||
} from './context';
|
} from './context';
|
||||||
import { ConfigConsumer, ConfigContext, defaultIconPrefixCls } from './context';
|
import { ConfigConsumer, ConfigContext, defaultIconPrefixCls } from './context';
|
||||||
@ -167,7 +168,7 @@ export interface ConfigProviderProps {
|
|||||||
radio?: ComponentStyleConfig;
|
radio?: ComponentStyleConfig;
|
||||||
rate?: ComponentStyleConfig;
|
rate?: ComponentStyleConfig;
|
||||||
switch?: ComponentStyleConfig;
|
switch?: ComponentStyleConfig;
|
||||||
transfer?: ComponentStyleConfig;
|
transfer?: TransferConfig;
|
||||||
avatar?: ComponentStyleConfig;
|
avatar?: ComponentStyleConfig;
|
||||||
message?: ComponentStyleConfig;
|
message?: ComponentStyleConfig;
|
||||||
tag?: TagConfig;
|
tag?: TagConfig;
|
||||||
|
@ -154,7 +154,7 @@ const {
|
|||||||
| timeline | 设置 Timeline 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| timeline | 设置 Timeline 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| timePicker | 设置 TimePicker 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| timePicker | 设置 TimePicker 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| tour | 设置 Tour 组件的通用属性 | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
| tour | 设置 Tour 组件的通用属性 | { closeIcon?: React.ReactNode } | - | 5.14.0 |
|
||||||
| transfer | 设置 Transfer 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| transfer | 设置 Transfer 组件的通用属性 | { className?: string, style?: React.CSSProperties, selectionsIcon?: React.ReactNode } | - | 5.7.0, selectionsIcon: 5.14.0 |
|
||||||
| tree | 设置 Tree 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| tree | 设置 Tree 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| typography | 设置 Typography 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| typography | 设置 Typography 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
| upload | 设置 Upload 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
| upload | 设置 Upload 组件的通用属性 | { className?: string, style?: React.CSSProperties } | - | 5.7.0 |
|
||||||
|
@ -420,6 +420,8 @@ const Transfer = <RecordType extends TransferItem = TransferItem>(
|
|||||||
|
|
||||||
const [leftTitle, rightTitle] = getTitles(listLocale);
|
const [leftTitle, rightTitle] = getTitles(listLocale);
|
||||||
|
|
||||||
|
const mergedSelectionsIcon = selectionsIcon ?? transfer?.selectionsIcon;
|
||||||
|
|
||||||
return wrapCSSVar(
|
return wrapCSSVar(
|
||||||
<div className={cls} style={{ ...transfer?.style, ...style }}>
|
<div className={cls} style={{ ...transfer?.style, ...style }}>
|
||||||
<List<KeyWise<RecordType>>
|
<List<KeyWise<RecordType>>
|
||||||
@ -443,7 +445,7 @@ const Transfer = <RecordType extends TransferItem = TransferItem>(
|
|||||||
showSelectAll={showSelectAll}
|
showSelectAll={showSelectAll}
|
||||||
selectAllLabel={selectAllLabels[0]}
|
selectAllLabel={selectAllLabels[0]}
|
||||||
pagination={mergedPagination}
|
pagination={mergedPagination}
|
||||||
selectionsIcon={selectionsIcon}
|
selectionsIcon={mergedSelectionsIcon}
|
||||||
{...listLocale}
|
{...listLocale}
|
||||||
/>
|
/>
|
||||||
<Operation
|
<Operation
|
||||||
@ -482,7 +484,7 @@ const Transfer = <RecordType extends TransferItem = TransferItem>(
|
|||||||
selectAllLabel={selectAllLabels[1]}
|
selectAllLabel={selectAllLabels[1]}
|
||||||
showRemove={oneWay}
|
showRemove={oneWay}
|
||||||
pagination={mergedPagination}
|
pagination={mergedPagination}
|
||||||
selectionsIcon={selectionsIcon}
|
selectionsIcon={mergedSelectionsIcon}
|
||||||
{...listLocale}
|
{...listLocale}
|
||||||
/>
|
/>
|
||||||
</div>,
|
</div>,
|
||||||
|
Loading…
Reference in New Issue
Block a user