react-konva-grid
Version:
Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets
44 lines (43 loc) • 1.04 kB
TypeScript
import React from "react";
import { CellInterface, GridRef, SelectionArea } from "../Grid";
export interface CopyProps {
/**
* Selection bounds
*/
selections: SelectionArea[];
/**
* Active cell
*/
activeCell?: CellInterface | null;
/**
* Value getter of a cell
*/
getValue: (cell: CellInterface) => any;
/**
* Grid reference to access grid methods
*/
gridRef: React.MutableRefObject<GridRef>;
/**
* Callback when a paste is executed
*/
onPaste?: (rows: (string | null)[][], activeCell: CellInterface | null) => void;
/**
* When user tries to cut a selection
*/
onCut: (selection: SelectionArea) => void;
}
export interface CopyResults {
copy: () => void;
paste: () => void;
}
/**
* Copy paste hook
* Usage
*
* useCopyPaste ({
* onPaste: (text) => {
* }
* })
*/
declare const useCopyPaste: ({ selections, activeCell, getValue, gridRef, onPaste, onCut, }: CopyProps) => CopyResults;
export default useCopyPaste;