react-konva-grid
Version:
Canvas grid to render large set of tabular data with virtualization.
27 lines (26 loc) • 954 B
TypeScript
import React from "react";
import { CellInterface, ScrollCoords, CellPosition, GridRef } from "../Grid";
export interface UseEditableOptions {
getEditor?: (cell: CellInterface | null) => React.ElementType;
gridRef: React.MutableRefObject<GridRef>;
getValue: (cell: CellInterface) => any;
onChange?: (value: string, coords: CellInterface) => void;
}
export interface EditableResults {
editorComponent: React.ReactNode;
onDoubleClick: (e: React.MouseEvent<HTMLInputElement>) => void;
onScroll: (props: ScrollCoords) => void;
}
export interface EditorProps extends CellInterface {
onChange: (value: string) => void;
onSubmit: () => void;
onHide: () => void;
scrollPosition: ScrollCoords;
position: CellPosition;
}
/**
* Hook to make grid editable
* @param param
*/
declare const useEditable: ({ getEditor, gridRef, getValue, onChange, }: UseEditableOptions) => EditableResults;
export default useEditable;