UNPKG

react-selectable-box

Version:

A React component used hooks that allows you to select elements in the drag area using the mouse

32 lines (31 loc) 971 B
import React from 'react'; export interface SelectableProps<T> { defaultValue?: T[]; value?: T[]; /** support virtual */ items?: T[]; disabled?: boolean; children?: React.ReactNode; mode?: 'add' | 'remove' | 'reverse'; selectStartRange?: 'all' | 'inside' | 'outside'; scrollSpeed?: number; scrollContainer?: () => HTMLElement; dragContainer?: () => HTMLElement; boxStyle?: React.CSSProperties; boxClassName?: string; compareFn?: (a: T, b: T) => boolean; onStart?: (event: MouseEvent | TouchEvent) => void; onEnd?: (selectingValue: T[], changed: { added: T[]; removed: T[]; }) => void; /** * @deprecated Use scrollContainer instead */ getContainer?: () => HTMLElement; } export interface SelectableRef { cancel: () => void; } declare const _default: <T>(props: SelectableProps<T> & React.RefAttributes<SelectableRef>) => React.ReactElement; export default _default;