UNPKG

zent

Version:

一套前端设计语言和基于React的实现

97 lines (96 loc) 3.03 kB
/// <reference types="react" /> import { IGridColumn, IGridProps } from '../grid'; import { ListPropsType } from './constants'; export declare type TransferDirection = 'left' | 'right'; export interface ITransferData { disabled?: boolean; [key: string]: any; } export declare type TransferColumnType = Array<{ title?: React.ReactNode; name: string; } & Omit<IGridColumn<ITransferData>, 'title' | 'name'>>; export interface ITransferDirectionChangeProps { targetKeys: string[]; transferredKeys: string[]; direction: TransferDirection; selectedKeys: string[]; } interface ITransferChildrenProps { direction: TransferDirection; selectedKeys: string[]; handleSelectChange: (keys: string[]) => void; } declare type ListType = { columns: TransferColumnType; selection?: { getCheckboxProps: (data: ITransferData) => { disabled?: boolean; reason?: React.ReactNode; }; }; } & Pick<IGridProps<ITransferData>, ListPropsType>; declare type OneRequired = { children?: (props: ITransferChildrenProps) => React.ReactNode; list: ListType | [ListType, ListType]; } | { children: (props: ITransferChildrenProps) => React.ReactNode; list?: ListType | [ListType, ListType]; }; export interface ITransferItem { title?: React.ReactNode; direction: TransferDirection; keyName: string; dataSets: ITransferData[]; selectedKeys: string[]; handleSelectChange: (keys: string[]) => void; showSearch?: boolean; searchPlaceholder?: string; filterOption?: (inputValue: string, option: ITransferData) => boolean; list: Omit<ListType, 'columns'> & { columns: TransferColumnType; }; prefix: string; pagination: boolean | { pageSize: number; }; disabled: boolean; } interface ITransfer { keyName: string; dataSource: ITransferData[]; onChange: (params: ITransferDirectionChangeProps) => void; targetKeys?: string[]; selectedKeys?: string[]; onSelectChange?: (selectedKeys: string[]) => void; titles?: [React.ReactNode, React.ReactNode]; showSearch?: boolean; searchPlaceholder?: string; filterOption?: (inputValue: string, option: ITransferData) => boolean; pagination?: boolean | { pageSize: number; }; disabled?: boolean; className?: string; } export declare type TransferType = OneRequired & ITransfer; export interface ITransferArrowButton { direction: TransferDirection; disabled: boolean; prefix: string; onChange: () => void; } export interface ITransferHookParams { selectedKeys?: string[]; targetKeys?: string[]; disabledKeys?: string[]; } export interface ITransferHookResult { targetKeys: string[]; selectedKeys: string[]; transferKeys: (direction: TransferDirection) => void; changeSelectedKeys: (direction: TransferDirection, keys: string[]) => void; resetSelectedKeys: (keys: string[]) => void; resetTargetKeys: (keys: string[]) => void; } export {};