1 | import React, { ChangeEvent, Component, CSSProperties, ReactNode, SyntheticEvent } from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import noop from 'lodash/noop';
|
4 | import List, { TransferListProps } from './list';
|
5 | import Search from './search';
|
6 | import { TransferDirection } from './enum';
|
7 | export { TransferListProps } from './list';
|
8 | export { TransferOperationProps } from './operation';
|
9 | export { TransferSearchProps } from './search';
|
10 | export interface TransferItem {
|
11 | key: string;
|
12 | title: string;
|
13 | description?: string;
|
14 | disabled?: boolean;
|
15 | }
|
16 | export interface TransferProps {
|
17 | prefixCls?: string;
|
18 | className?: string;
|
19 | dataSource: TransferItem[];
|
20 | targetKeys?: string[];
|
21 | selectedKeys?: string[];
|
22 | render?: (record: TransferItem) => ReactNode;
|
23 | onChange?: (targetKeys: string[], direction: string, moveKeys: any) => void;
|
24 | onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
25 | style?: CSSProperties;
|
26 | listStyle?: CSSProperties;
|
27 | titles?: string[];
|
28 | operations?: string[];
|
29 | showSearch?: boolean;
|
30 | filterOption?: (inputValue: any, item: any) => boolean;
|
31 | searchPlaceholder?: string;
|
32 | notFoundContent?: ReactNode;
|
33 | footer?: (props: TransferListProps) => ReactNode;
|
34 | body?: (props: TransferListProps) => ReactNode;
|
35 | rowKey?: (record: TransferItem) => string;
|
36 | onSearchChange?: (direction: TransferDirection, e: ChangeEvent<HTMLInputElement>) => void;
|
37 | lazy?: {} | boolean;
|
38 | onScroll?: (direction: TransferDirection, e: SyntheticEvent<HTMLDivElement>) => void;
|
39 | }
|
40 | export interface TransferLocale {
|
41 | titles: string[];
|
42 | notFoundContent: string;
|
43 | searchPlaceholder: string;
|
44 | itemUnit: string;
|
45 | itemsUnit: string;
|
46 | }
|
47 | export default class Transfer extends Component<TransferProps, any> {
|
48 | static displayName: string;
|
49 | static List: typeof List;
|
50 | static Operation: React.FunctionComponent<import("./operation").TransferOperationProps>;
|
51 | static Search: typeof Search;
|
52 | static defaultProps: {
|
53 | dataSource: never[];
|
54 | render: typeof noop;
|
55 | showSearch: boolean;
|
56 | };
|
57 | static propTypes: {
|
58 | prefixCls: PropTypes.Requireable<string>;
|
59 | dataSource: PropTypes.Requireable<any[]>;
|
60 | render: PropTypes.Requireable<(...args: any[]) => any>;
|
61 | targetKeys: PropTypes.Requireable<any[]>;
|
62 | onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
63 | listStyle: PropTypes.Requireable<object>;
|
64 | className: PropTypes.Requireable<string>;
|
65 | titles: PropTypes.Requireable<any[]>;
|
66 | operations: PropTypes.Requireable<any[]>;
|
67 | showSearch: PropTypes.Requireable<boolean>;
|
68 | filterOption: PropTypes.Requireable<(...args: any[]) => any>;
|
69 | searchPlaceholder: PropTypes.Requireable<string>;
|
70 | notFoundContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
71 | body: PropTypes.Requireable<(...args: any[]) => any>;
|
72 | footer: PropTypes.Requireable<(...args: any[]) => any>;
|
73 | rowKey: PropTypes.Requireable<(...args: any[]) => any>;
|
74 | lazy: PropTypes.Requireable<boolean | object>;
|
75 | };
|
76 | splitedDataSource: {
|
77 | leftDataSource: TransferItem[];
|
78 | rightDataSource: TransferItem[];
|
79 | } | null;
|
80 | constructor(props: TransferProps);
|
81 | componentWillReceiveProps(nextProps: TransferProps): void;
|
82 | splitDataSource(): {
|
83 | leftDataSource: TransferItem[];
|
84 | rightDataSource: TransferItem[];
|
85 | };
|
86 | moveTo: (direction: TransferDirection) => void;
|
87 | moveToLeft: () => void;
|
88 | moveToRight: () => void;
|
89 | handleSelectChange(direction: TransferDirection, holder: string[]): void;
|
90 | handleSelectAll: (direction: TransferDirection, filteredDataSource: TransferItem[], checkAll: boolean) => void;
|
91 | handleLeftSelectAll: (filteredDataSource: TransferItem[], checkAll: boolean) => void;
|
92 | handleRightSelectAll: (filteredDataSource: TransferItem[], checkAll: boolean) => void;
|
93 | handleFilter: (direction: TransferDirection, e: React.ChangeEvent<HTMLInputElement>) => void;
|
94 | handleLeftFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
95 | handleRightFilter: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
96 | handleClear: (direction: string) => void;
|
97 | handleLeftClear: () => void;
|
98 | handleRightClear: () => void;
|
99 | handleSelect: (direction: TransferDirection, selectedItem: TransferItem, checked: boolean) => void;
|
100 | handleLeftSelect: (selectedItem: TransferItem, checked: boolean) => void;
|
101 | handleRightSelect: (selectedItem: TransferItem, checked: boolean) => void;
|
102 | handleScroll: (direction: TransferDirection, e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
103 | handleLeftScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
104 | handleRightScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
105 | getTitles(transferLocale: TransferLocale): string[];
|
106 | getSelectedKeysName(direction: TransferDirection): "sourceSelectedKeys" | "targetSelectedKeys";
|
107 | renderTransfer: (locale: TransferLocale) => JSX.Element;
|
108 | render(): JSX.Element;
|
109 | }
|