1 | import * as React from 'react';
|
2 | import { TransferDirection, RenderResult, SelectAllLabel, TransferLocale, KeyWiseTransferItem } from './index';
|
3 | import DefaultListBody, { TransferListBodyProps } from './ListBody';
|
4 | import { PaginationType } from './interface';
|
5 | export interface RenderedItem<RecordType> {
|
6 | renderedText: string;
|
7 | renderedEl: React.ReactNode;
|
8 | item: RecordType;
|
9 | }
|
10 | declare type RenderListFunction<T> = (props: TransferListBodyProps<T>) => React.ReactNode;
|
11 | export interface TransferListProps<RecordType> extends TransferLocale {
|
12 | prefixCls: string;
|
13 | titleText: React.ReactNode;
|
14 | dataSource: RecordType[];
|
15 | filterOption?: (filterText: string, item: RecordType) => boolean;
|
16 | style?: React.CSSProperties;
|
17 | checkedKeys: string[];
|
18 | handleFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
19 | onItemSelect: (key: string, check: boolean) => void;
|
20 | onItemSelectAll: (dataSource: string[], checkAll: boolean) => void;
|
21 | onItemRemove?: (keys: string[]) => void;
|
22 | handleClear: () => void;
|
23 |
|
24 | render?: (item: RecordType) => RenderResult;
|
25 | showSearch?: boolean;
|
26 | searchPlaceholder: string;
|
27 | itemUnit: string;
|
28 | itemsUnit: string;
|
29 | renderList?: RenderListFunction<RecordType>;
|
30 | footer?: (props: TransferListProps<RecordType>) => React.ReactNode;
|
31 | onScroll: (e: React.UIEvent<HTMLUListElement>) => void;
|
32 | disabled?: boolean;
|
33 | direction: TransferDirection;
|
34 | showSelectAll?: boolean;
|
35 | selectAllLabel?: SelectAllLabel;
|
36 | showRemove?: boolean;
|
37 | pagination?: PaginationType;
|
38 | }
|
39 | interface TransferListState {
|
40 |
|
41 | filterValue: string;
|
42 | }
|
43 | export default class TransferList<RecordType extends KeyWiseTransferItem> extends React.PureComponent<TransferListProps<RecordType>, TransferListState> {
|
44 | static defaultProps: {
|
45 | dataSource: never[];
|
46 | titleText: string;
|
47 | showSearch: boolean;
|
48 | };
|
49 | timer: number;
|
50 | triggerScrollTimer: number;
|
51 | defaultListBodyRef: React.RefObject<DefaultListBody<RecordType>>;
|
52 | constructor(props: TransferListProps<RecordType>);
|
53 | componentWillUnmount(): void;
|
54 | getCheckStatus(filteredItems: RecordType[]): "none" | "all" | "part";
|
55 | getFilteredItems(dataSource: RecordType[], filterValue: string): {
|
56 | filteredItems: RecordType[];
|
57 | filteredRenderItems: RenderedItem<RecordType>[];
|
58 | };
|
59 | handleFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
60 | handleClear: () => void;
|
61 | matchFilter: (text: string, item: RecordType) => boolean;
|
62 | getCurrentPageItems: () => void;
|
63 | renderListBody: (renderList: RenderListFunction<RecordType> | undefined, props: TransferListBodyProps<RecordType>) => {
|
64 | customize: boolean;
|
65 | bodyContent: React.ReactNode;
|
66 | };
|
67 | getListBody(prefixCls: string, searchPlaceholder: string, filterValue: string, filteredItems: RecordType[], notFoundContent: React.ReactNode, filteredRenderItems: RenderedItem<RecordType>[], checkedKeys: string[], renderList?: RenderListFunction<RecordType>, showSearch?: boolean, disabled?: boolean): React.ReactNode;
|
68 | getCheckBox(filteredItems: RecordType[], onItemSelectAll: (dataSource: string[], checkAll: boolean) => void, showSelectAll?: boolean, disabled?: boolean, prefixCls?: string): false | JSX.Element;
|
69 | renderItem: (item: RecordType) => RenderedItem<RecordType>;
|
70 | getSelectAllLabel: (selectedCount: number, totalCount: number) => React.ReactNode;
|
71 | render(): JSX.Element;
|
72 | }
|
73 | export {};
|