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
|
||||
transfer={{
|
||||
className: 'test-class',
|
||||
selectionsIcon: <span className="cp-test-selectionsIcon">cp-test-selectionsIcon</span>,
|
||||
}}
|
||||
>
|
||||
<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<HTMLSpanElement>('.cp-test-selectionsIcon')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('Should Transfer style works', () => {
|
||||
|
@ -21,6 +21,7 @@ import type { TabsProps } from '../tabs';
|
||||
import type { TagProps } from '../tag';
|
||||
import type { AliasToken, MappingAlgorithm, OverrideToken } from '../theme/interface';
|
||||
import type { TourProps } from '../tour/interface';
|
||||
import type { TransferProps } from '../transfer';
|
||||
import type { RenderEmptyHandler } from './defaultRenderEmpty';
|
||||
|
||||
export const defaultIconPrefixCls = 'anticon';
|
||||
@ -109,6 +110,8 @@ export type DrawerConfig = ComponentStyleConfig &
|
||||
|
||||
export type FlexConfig = ComponentStyleConfig & Pick<FlexProps, 'vertical'>;
|
||||
|
||||
export type TransferConfig = ComponentStyleConfig & Pick<TransferProps, 'selectionsIcon'>;
|
||||
|
||||
export type PopupOverflow = 'viewport' | 'scroll';
|
||||
|
||||
export interface WaveConfig {
|
||||
@ -169,7 +172,7 @@ export interface ConfigConsumerProps {
|
||||
radio?: ComponentStyleConfig;
|
||||
rate?: ComponentStyleConfig;
|
||||
switch?: ComponentStyleConfig;
|
||||
transfer?: ComponentStyleConfig;
|
||||
transfer?: TransferConfig;
|
||||
avatar?: ComponentStyleConfig;
|
||||
message?: ComponentStyleConfig;
|
||||
tag?: TagConfig;
|
||||
|
@ -152,7 +152,7 @@ const {
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
@ -40,6 +40,7 @@ import type {
|
||||
Theme,
|
||||
ThemeConfig,
|
||||
TourConfig,
|
||||
TransferConfig,
|
||||
WaveConfig,
|
||||
} from './context';
|
||||
import { ConfigConsumer, ConfigContext, defaultIconPrefixCls } from './context';
|
||||
@ -167,7 +168,7 @@ export interface ConfigProviderProps {
|
||||
radio?: ComponentStyleConfig;
|
||||
rate?: ComponentStyleConfig;
|
||||
switch?: ComponentStyleConfig;
|
||||
transfer?: ComponentStyleConfig;
|
||||
transfer?: TransferConfig;
|
||||
avatar?: ComponentStyleConfig;
|
||||
message?: ComponentStyleConfig;
|
||||
tag?: TagConfig;
|
||||
|
@ -154,7 +154,7 @@ const {
|
||||
| timeline | 设置 Timeline 组件的通用属性 | { 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 |
|
||||
| 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 |
|
||||
| typography | 设置 Typography 组件的通用属性 | { 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 mergedSelectionsIcon = selectionsIcon ?? transfer?.selectionsIcon;
|
||||
|
||||
return wrapCSSVar(
|
||||
<div className={cls} style={{ ...transfer?.style, ...style }}>
|
||||
<List<KeyWise<RecordType>>
|
||||
@ -443,7 +445,7 @@ const Transfer = <RecordType extends TransferItem = TransferItem>(
|
||||
showSelectAll={showSelectAll}
|
||||
selectAllLabel={selectAllLabels[0]}
|
||||
pagination={mergedPagination}
|
||||
selectionsIcon={selectionsIcon}
|
||||
selectionsIcon={mergedSelectionsIcon}
|
||||
{...listLocale}
|
||||
/>
|
||||
<Operation
|
||||
@ -482,7 +484,7 @@ const Transfer = <RecordType extends TransferItem = TransferItem>(
|
||||
selectAllLabel={selectAllLabels[1]}
|
||||
showRemove={oneWay}
|
||||
pagination={mergedPagination}
|
||||
selectionsIcon={selectionsIcon}
|
||||
selectionsIcon={mergedSelectionsIcon}
|
||||
{...listLocale}
|
||||
/>
|
||||
</div>,
|
||||
|
Loading…
Reference in New Issue
Block a user