index.d.ts
6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import * as React from 'react';
import List, { TransferListProps } from './list';
import Search from './search';
import { RenderEmptyHandler } from '../config-provider';
import { TransferListBodyProps } from './ListBody';
import { PaginationType } from './interface';
export { TransferListProps } from './list';
export { TransferOperationProps } from './operation';
export { TransferSearchProps } from './search';
export declare type TransferDirection = 'left' | 'right';
export interface RenderResultObject {
label: React.ReactElement;
value: string;
}
export declare type RenderResult = React.ReactElement | RenderResultObject | string | null;
export interface TransferItem {
key?: string;
title?: string;
description?: string;
disabled?: boolean;
[name: string]: any;
}
export declare type KeyWise<T> = T & {
key: string;
};
export declare type KeyWiseTransferItem = KeyWise<TransferItem>;
declare type TransferRender<RecordType> = (item: RecordType) => RenderResult;
export interface ListStyle {
direction: TransferDirection;
}
export declare type SelectAllLabel = React.ReactNode | ((info: {
selectedCount: number;
totalCount: number;
}) => React.ReactNode);
export interface TransferLocale {
titles: string[];
notFoundContent?: 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?: string[];
operations?: string[];
showSearch?: boolean;
filterOption?: (inputValue: string, item: RecordType) => boolean;
locale?: Partial<TransferLocale>;
footer?: (props: TransferListProps<RecordType>) => React.ReactNode;
rowKey?: (record: RecordType) => string;
onSearch?: (direction: TransferDirection, value: string) => void;
onScroll?: (direction: TransferDirection, e: React.SyntheticEvent<HTMLUListElement>) => void;
children?: (props: TransferListBodyProps<RecordType>) => React.ReactNode;
showSelectAll?: boolean;
selectAllLabels?: SelectAllLabel[];
oneWay?: boolean;
pagination?: PaginationType;
}
interface TransferState {
sourceSelectedKeys: string[];
targetSelectedKeys: string[];
}
declare class Transfer<RecordType extends TransferItem = TransferItem> extends React.Component<TransferProps<RecordType>, TransferState> {
static List: typeof List;
static Operation: ({ disabled, moveToLeft, moveToRight, leftArrowText, rightArrowText, leftActive, rightActive, className, style, direction, oneWay, }: import("./operation").TransferOperationProps) => JSX.Element;
static Search: typeof Search;
static defaultProps: {
dataSource: never[];
locale: {};
showSearch: boolean;
listStyle: () => void;
};
static getDerivedStateFromProps<T>({ selectedKeys, targetKeys, pagination, children, }: TransferProps<T>): {
sourceSelectedKeys: string[];
targetSelectedKeys: string[];
} | null;
separatedDataSource: {
leftDataSource: RecordType[];
rightDataSource: RecordType[];
} | null;
constructor(props: TransferProps<RecordType>);
setStateKeys: (direction: TransferDirection, keys: string[] | ((prevKeys: string[]) => string[])) => void;
getTitles(transferLocale: TransferLocale): string[];
getLocale: (transferLocale: TransferLocale, renderEmpty: RenderEmptyHandler) => {
titles: string[];
notFoundContent: React.ReactNode;
searchPlaceholder: string;
itemUnit: string;
itemsUnit: string;
remove: string;
selectAll: string;
selectCurrent: string;
selectInvert: string;
removeAll: string;
removeCurrent: string;
};
moveTo: (direction: TransferDirection) => void;
moveToLeft: () => void;
moveToRight: () => void;
onItemSelectAll: (direction: TransferDirection, selectedKeys: string[], checkAll: boolean) => void;
onLeftItemSelectAll: (selectedKeys: string[], checkAll: boolean) => void;
onRightItemSelectAll: (selectedKeys: string[], checkAll: boolean) => void;
handleFilter: (direction: TransferDirection, e: React.ChangeEvent<HTMLInputElement>) => void;
handleLeftFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
handleRightFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
handleClear: (direction: TransferDirection) => void;
handleLeftClear: () => void;
handleRightClear: () => void;
onItemSelect: (direction: TransferDirection, selectedKey: string, checked: boolean) => void;
onLeftItemSelect: (selectedKey: string, checked: boolean) => void;
onRightItemSelect: (selectedKey: string, checked: boolean) => void;
onRightItemRemove: (selectedKeys: string[]) => void;
handleScroll: (direction: TransferDirection, e: React.SyntheticEvent<HTMLUListElement>) => void;
handleLeftScroll: (e: React.SyntheticEvent<HTMLUListElement>) => void;
handleRightScroll: (e: React.SyntheticEvent<HTMLUListElement>) => void;
handleSelectChange(direction: TransferDirection, holder: string[]): void;
handleListStyle: (listStyle: React.CSSProperties | ((style: ListStyle) => React.CSSProperties), direction: TransferDirection) => React.CSSProperties;
separateDataSource(): {
leftDataSource: KeyWise<RecordType>[];
rightDataSource: KeyWise<RecordType>[];
};
renderTransfer: (transferLocale: TransferLocale) => JSX.Element;
render(): JSX.Element;
}
export default Transfer;