|
|
|
import classNames from 'classnames';
|
|
|
|
import * as React from 'react';
|
|
|
|
import type { ConfigConsumerProps, RenderEmptyHandler } from '../config-provider';
|
|
|
|
import { ConfigConsumer } from '../config-provider';
|
|
|
|
import defaultRenderEmpty from '../config-provider/defaultRenderEmpty';
|
|
|
|
import { FormItemInputContext } from '../form/context';
|
|
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
|
|
|
import defaultLocale from '../locale/default';
|
|
|
|
import type { InputStatus } from '../_util/statusUtils';
|
|
|
|
import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';
|
|
|
|
import warning from '../_util/warning';
|
|
|
|
import type { PaginationType } from './interface';
|
|
|
|
import type { TransferListProps } from './list';
|
|
|
|
import List from './list';
|
|
|
|
import type { TransferListBodyProps } from './ListBody';
|
|
|
|
import Operation from './operation';
|
|
|
|
import Search from './search';
|
|
|
|
|
|
|
|
export { TransferListProps } from './list';
|
|
|
|
export { TransferOperationProps } from './operation';
|
|
|
|
export { TransferSearchProps } from './search';
|
|
|
|
|
|
|
|
export type TransferDirection = 'left' | 'right';
|
|
|
|
|
|
|
|
export interface RenderResultObject {
|
|
|
|
label: React.ReactElement;
|
|
|
|
value: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type RenderResult = React.ReactElement | RenderResultObject | string | null;
|
|
|
|
|
|
|
|
export interface TransferItem {
|
|
|
|
key?: string;
|
|
|
|
title?: string;
|
|
|
|
description?: string;
|
|
|
|
disabled?: boolean;
|
|
|
|
[name: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type KeyWise<T> = T & { key: string };
|
|
|
|
|
|
|
|
export type KeyWiseTransferItem = KeyWise<TransferItem>;
|
|
|
|
|
|
|
|
type TransferRender<RecordType> = (item: RecordType) => RenderResult;
|
|
|
|
|
|
|
|
export interface ListStyle {
|
|
|
|
direction: TransferDirection;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SelectAllLabel =
|
|
|
|
| React.ReactNode
|
|
|
|
| ((info: { selectedCount: number; totalCount: number }) => React.ReactNode);
|
|
|
|
|
|
|
|
export interface TransferLocale {
|
|
|
|
titles: React.ReactNode[];
|
|
|
|
notFoundContent?: React.ReactNode | React.ReactNode[];
|
|
|
|
searchPlaceholder: string;
|
|
|
|
itemUnit: string;
|
|
|
|
itemsUnit: string;
|
|
|
|
remove: string;
|
|
|
|
selectAll: string;
|
|
|
|
selectCurrent: string;
|
|
|
|
selectInvert: string;
|
|
|
|
removeAll: string;
|
|
|
|
removeCurrent: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TransferProps<RecordType> {
|
|
|
|
prefixCls?: string;
|
|
|
|
className?: string;
|
|
|
|
disabled?: boolean;
|
|
|
|
dataSource: RecordType[];
|
|
|
|
targetKeys?: string[];
|
|
|
|
selectedKeys?: string[];
|
|
|
|
render?: TransferRender<RecordType>;
|
|
|
|
onChange?: (targetKeys: string[], direction: TransferDirection, moveKeys: string[]) => void;
|
|
|
|
onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
listStyle?: ((style: ListStyle) => React.CSSProperties) | React.CSSProperties;
|
|
|
|
operationStyle?: React.CSSProperties;
|
|
|
|
titles?: React.ReactNode[];
|
|
|
|
operations?: string[];
|
|
|
|
showSearch?: boolean;
|
|
|
|
filterOption?: (inputValue: string, item: RecordType) => boolean;
|
|
|
|
locale?: Partial<TransferLocale>;
|
|
|
|
footer?: (
|
|