UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

107 lines (106 loc) 4.75 kB
import React, { ChangeEvent, Component, CSSProperties, ReactNode, SyntheticEvent } from 'react'; import noop from 'lodash/noop'; import List, { TransferListProps } from './list'; import Search from './search'; import { TransferDirection } from './enum'; import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext'; import { ButtonProps } from '../button/Button'; import { InputProps } from '../input/Input'; export { TransferListProps } from './list'; export { TransferOperationProps } from './operation'; export { TransferSearchProps } from './search'; export { TransferDirection }; export interface TransferItem { key: string; title: string; description?: string; disabled?: boolean; } export interface TransferProps { prefixCls?: string; checkboxPrefixCls?: string; className?: string; dataSource: TransferItem[]; targetKeys?: string[]; selectedKeys?: string[]; render?: (record: TransferItem) => ReactNode; onChange?: (targetKeys: string[], direction: string, moveKeys: any) => void; onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void; style?: CSSProperties; listStyle?: CSSProperties; operationStyle?: CSSProperties; titles?: string[]; operations?: string[] | ReactNode[]; sortable?: boolean; sortOperations?: string[] | ReactNode[]; showSearch?: boolean; filterOption?: (inputValue: any, item: any) => boolean; searchPlaceholder?: string; notFoundContent?: ReactNode; footer?: (props: TransferListProps) => ReactNode; body?: (props: TransferListProps) => ReactNode; rowKey?: (record: TransferItem) => string; onSearchChange?: (direction: TransferDirection, e: ChangeEvent<HTMLInputElement>) => void; lazy?: {} | boolean; onScroll?: (direction: TransferDirection, e: SyntheticEvent<HTMLDivElement>) => void; inputProps?: InputProps; buttonProps?: ButtonProps; } export interface TransferLocale { titles: string[]; notFoundContent: string; searchPlaceholder: string; itemUnit: string; itemsUnit: string; } export default class Transfer extends Component<TransferProps, any> { static get contextType(): typeof ConfigContext; static displayName: string; static List: typeof List; static Operation: React.FunctionComponent<import("./operation").TransferOperationProps>; static Search: typeof Search; static defaultProps: { dataSource: never[]; render: typeof noop; showSearch: boolean; }; context: ConfigContextValue; splitedDataSource: { leftDataSource: TransferItem[]; rightDataSource: TransferItem[]; } | null; transferRef: HTMLElement | null; constructor(props: TransferProps); componentWillReceiveProps(nextProps: TransferProps): void; splitDataSource(sortKeys?: Array<string>): { leftDataSource: TransferItem[]; rightDataSource: TransferItem[]; }; get computedRightDataSource(): TransferItem[]; moveTo: (direction: TransferDirection) => void; sortTo: (direction: TransferDirection) => void; moveToLeft: () => void; moveToRight: () => void; moveToUp: () => void; moveToDown: () => void; handleSelectChange(direction: TransferDirection, holder: string[]): void; handleSelectAll: (direction: TransferDirection, filteredDataSource: TransferItem[], checkAll: boolean) => void; handleLeftSelectAll: (filteredDataSource: TransferItem[], checkAll: boolean) => void; handleRightSelectAll: (filteredDataSource: TransferItem[], 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: string) => void; handleLeftClear: () => void; handleRightClear: () => void; handleSelect: (direction: TransferDirection, selectedItem: TransferItem, checked: boolean) => void; handleLeftSelect: (selectedItem: TransferItem, checked: boolean) => void; handleRightSelect: (selectedItem: TransferItem, checked: boolean) => void; handleScroll: (direction: TransferDirection, e: React.SyntheticEvent<HTMLDivElement, Event>) => void; handleLeftScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void; handleRightScroll: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void; getTitles(transferLocale: TransferLocale): string[]; getSelectedKeysName(direction: TransferDirection): "sourceSelectedKeys" | "targetSelectedKeys"; renderTransfer: (locale: TransferLocale) => JSX.Element; render(): JSX.Element; }