UNPKG

3.55 kBTypeScriptView Raw
1import type { CSSProperties } from 'react';
2import React from 'react';
3import type { InputStatus } from '../_util/statusUtils';
4import type { PaginationType, TransferKey } from './interface';
5import type { TransferCustomListBodyProps, TransferListProps } from './list';
6export type { TransferListProps } from './list';
7export type { TransferOperationProps } from './operation';
8export type { TransferSearchProps } from './search';
9export type TransferDirection = 'left' | 'right';
10export interface RenderResultObject {
11 label: React.ReactElement;
12 value: string;
13}
14export type RenderResult = React.ReactElement | RenderResultObject | string | null;
15export interface TransferItem {
16 key?: TransferKey;
17 title?: string;
18 description?: string;
19 disabled?: boolean;
20 [name: string]: any;
21}
22export type KeyWise<T> = T & {
23 key: TransferKey;
24};
25export type KeyWiseTransferItem = KeyWise<TransferItem>;
26type TransferRender<RecordType> = (item: RecordType) => RenderResult;
27export interface ListStyle {
28 direction: TransferDirection;
29}
30export type SelectAllLabel = React.ReactNode | ((info: {
31 selectedCount: number;
32 totalCount: number;
33}) => React.ReactNode);
34export interface TransferLocale {
35 titles?: React.ReactNode[];
36 notFoundContent?: React.ReactNode | React.ReactNode[];
37 searchPlaceholder: string;
38 itemUnit: string;
39 itemsUnit: string;
40 remove?: string;
41 selectAll?: string;
42 selectCurrent?: string;
43 selectInvert?: string;
44 removeAll?: string;
45 removeCurrent?: string;
46}
47export interface TransferProps<RecordType = any> {
48 prefixCls?: string;
49 className?: string;
50 rootClassName?: string;
51 disabled?: boolean;
52 dataSource?: RecordType[];
53 targetKeys?: TransferKey[];
54 selectedKeys?: TransferKey[];
55 render?: TransferRender<RecordType>;
56 onChange?: (targetKeys: TransferKey[], direction: TransferDirection, moveKeys: TransferKey[]) => void;
57 onSelectChange?: (sourceSelectedKeys: TransferKey[], targetSelectedKeys: TransferKey[]) => void;
58 style?: React.CSSProperties;
59 listStyle?: ((style: ListStyle) => CSSProperties) | CSSProperties;
60 operationStyle?: CSSProperties;
61 titles?: React.ReactNode[];
62 operations?: string[];
63 showSearch?: boolean;
64 filterOption?: (inputValue: string, item: RecordType, direction: TransferDirection) => boolean;
65 locale?: Partial<TransferLocale>;
66 footer?: (props: TransferListProps<RecordType>, info?: {
67 direction: TransferDirection;
68 }) => React.ReactNode;
69 rowKey?: (record: RecordType) => TransferKey;
70 onSearch?: (direction: TransferDirection, value: string) => void;
71 onScroll?: (direction: TransferDirection, e: React.SyntheticEvent<HTMLUListElement>) => void;
72 children?: (props: TransferCustomListBodyProps<RecordType>) => React.ReactNode;
73 showSelectAll?: boolean;
74 selectAllLabels?: SelectAllLabel[];
75 oneWay?: boolean;
76 pagination?: PaginationType;
77 status?: InputStatus;
78 selectionsIcon?: React.ReactNode;
79}
80declare const Transfer: {
81 <RecordType extends TransferItem = TransferItem>(props: TransferProps<RecordType>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
82 displayName: string;
83 List: {
84 <RecordType_1 extends KeyWiseTransferItem>(props: TransferListProps<RecordType_1>): React.JSX.Element;
85 displayName: string;
86 };
87 Search: React.FC<import("./search").TransferSearchProps>;
88 Operation: React.FC<import("./operation").TransferOperationProps>;
89};
90export default Transfer;