import { CSSProperties, ReactNode } from 'react'; import { DragDropContextProps } from 'react-beautiful-dnd'; import { DraggableProvided, DropResult, ResponderProvided } from 'react-beautiful-dnd'; import { CommonProps, Layout } from 'react-window'; export interface IListData { /** 作为拖拽的id和key */ code: string; [propsName: string]: any; } interface DragEndOptions { reorder: (list: IListData[], startIndex: any, endIndex: any) => IListData[]; move: (sourceData: IListData[], destinationData: IListData[], result: any) => {}; } export interface DragDropProps extends Omit { onDragEnd: (result: DropResult, provided: ResponderProvided, options: DragEndOptions) => void; } export interface DragItemProps { /** 外部可不传 */ provided?: DraggableProvided; /** 样式 */ style?: CSSProperties; /** 自定义类名 */ className?: string; /** 拖拽icon */ icon?: boolean | ReactNode; } export interface VirtualProps extends CommonProps { /** 列表高度 */ height?: number | string; /** 宽度 */ width?: number | string; /** item高度 */ itemSize: number; /** 布局 */ layout?: Layout | undefined; } export interface DroppableProps { /** 数据 每一项都需要带code作为唯一标识 */ data: IListData[]; /** 虚拟列表 */ virtual?: VirtualProps; /** 拖动结束 */ /** 自定义渲染列表项 */ renderItem: (item: IListData, provided?: any) => ReactNode; /** 自定义类名 */ className?: string; /** 行内样式 */ style?: CSSProperties; /** 方向 */ direction?: 'horizontal' | 'vertical'; /** 每个拖拽的id,在多容器拖拽的时候需要传 */ droppableId?: string; } export {};