UNPKG

react-konva-grid

Version:

Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets

27 lines (26 loc) 1.06 kB
import React from "react"; import { SelectionArea, CellInterface, GridRef } from "./../Grid"; export interface UseSelectionOptions { gridRef?: React.MutableRefObject<GridRef>; initialSelections?: SelectionArea[]; initialActiveCell?: CellInterface | null; columnCount?: number; rowCount?: number; } export interface SelectionResults { activeCell: CellInterface | null; newSelection: (coords: CellInterface) => void; setSelections: (selection: SelectionArea[]) => void; setActiveCell: (coords: CellInterface | null) => void; selections: SelectionArea[]; onMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void; onMouseMove: (e: React.MouseEvent<HTMLDivElement>) => void; onMouseUp: (e: React.MouseEvent<HTMLDivElement>) => void; onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void; } /** * useSelection hook to enable selection in datagrid * @param initialSelection */ declare const useSelection: (options?: UseSelectionOptions | undefined) => SelectionResults; export default useSelection;