acud
Version:
acg react 组件库
75 lines (74 loc) • 2.88 kB
TypeScript
import * as React from 'react';
import { ColumnsType, TablePaginationConfig, TableProps } from '../table';
import { SearchProps } from '../search/Search';
export type TransferDirection = 'left' | 'right';
export type SelectAllLabel = React.ReactNode | ((info: {
selectedCount: number;
totalCount: number;
}) => React.ReactNode);
export type RenderResult = React.ReactNode | string | null;
export type TransferRender<RecordType> = (item: RecordType) => RenderResult;
export interface TransferLocale {
sourceTitle: React.ReactNode;
targetTitle: React.ReactNode;
searchPlaceholder: string;
sourceNoData: React.ReactNode;
sourceNoSearchData: React.ReactNode;
targetNoData: React.ReactNode;
targetNoSearchData: React.ReactNode;
clearAll: string;
workerLoadingTip: string;
}
export interface TransferItem {
key?: string;
title?: string;
description?: string;
disabled?: boolean;
children?: TransferItem[];
childrenKeys?: string[];
[name: string]: any;
}
export interface TransferProps<RecordType> {
prefixCls?: string;
className?: string;
displayType?: 'single' | 'table';
dataSource: RecordType[];
targetKeys?: string[];
render?: TransferRender<RecordType>;
onChange?: (targetKeys: string[]) => void;
onSourceExpandChange?: (key: string, isOpen: boolean) => void;
leftStyle?: React.CSSProperties;
rightStyle?: React.CSSProperties;
showSearch?: boolean | 'left' | 'right';
showSearchClear?: boolean;
searchMode?: 'fe' | 'api';
filterOption?: (inputValue: string, item: RecordType) => boolean;
locale?: Partial<TransferLocale>;
rowKey?: (record: RecordType) => string;
onSearch?: (searchPosition: 'left' | 'right', value: string) => void;
onScroll?: (direction: TransferDirection, e: React.SyntheticEvent<HTMLUListElement>) => void;
showSelectAll?: boolean;
showClearAll?: boolean;
selectAllLabels?: SelectAllLabel[];
defaultExpandGroupKey?: string[] | string | number[] | number | boolean;
virtual?: boolean;
useWorker?: boolean;
workerLimit?: number;
workerLoading?: boolean;
columns?: ColumnsType<RecordType>;
leftColumns?: ColumnsType<RecordType>;
rightColumns?: ColumnsType<RecordType>;
leftPagination?: TablePaginationConfig;
rightPagination?: TablePaginationConfig;
targetDataSelf?: boolean;
targetData?: any[];
onTargetDataChange?: (targetData: any[]) => void;
tableLeftProps?: TableProps<any>;
tableRightProps?: TableProps<any>;
searchLeftProps?: SearchProps;
searchRightProps?: SearchProps;
dataSourceCustom?: (dataSource: any[]) => any[];
labelRender?: React.ReactNode | ((selectedCount: number, totalCount: number) => React.ReactNode);
}
declare const Transfer: (props: TransferProps<TransferItem>) => React.JSX.Element;
export default Transfer;