Interface useKeyboardEditorOverlayOptions

This enables custom editors to be injected in place of a renderer. Note sometimes is makes more sense to just allow the renderer to edit in place. Some examples are when a formula is being entered or if the cell is empty

TODO - should the editor extend the render interface?

interface useKeyboardEditorOverlayOptions {
    activeCoords: CellCoords;
    alignment?: HorizontalAlignment;
    borderStrokeFill?: string;
    borderStrokeWidth?: number;
    containerProps?: HTMLAttributes<HTMLDivElement>;
    getCellBoundsRange?: ((coord, view) => CellRangeCoords);
    getCellEditor: ((props, coords) => ReactElement<CellEditorProps<any, any> & CellEditorRefAttribute, string | JSXElementConstructor<any>>);
    gridRef: MutableRefObject<GridElement>;
    isEditorStartKeyEvent?: ((e) => boolean | StartEditEvent);
    isEditorStartPointerEvent?: ((e) => boolean | StartEditEvent);
    onBeforeStartEdit?: ((coords) => void);
    onCancelEdit?: ((coords) => void);
    onDoneEdit?: ((coords) => void);
    onNavigate?: ((direction) => void);
    onNavigateSelection?: ((direction) => void);
    onStartEdit?: ((coords) => void);
    onSubmitEdit?: ((coords) => void);
    canEdit?(coords): boolean;
}

Properties

activeCoords: CellCoords

Active selected cell. This is required to enable the editor to activate when a key is pressed

The editor alignment. Used for expanding on overflow

borderStrokeFill?: string
borderStrokeWidth?: number
containerProps?: HTMLAttributes<HTMLDivElement>
getCellBoundsRange?: ((coord, view) => CellRangeCoords)

If provided and it doesn't return null then the editor will be aligned to the range.

Type declaration

getCellEditor: ((props, coords) => ReactElement<CellEditorProps<any, any> & CellEditorRefAttribute, string | JSXElementConstructor<any>>)

Inject custom editors based on a cell. This should not return null but rather can canEdit. This is called during placement after scrolling and other bookkeeping has occurred

Type declaration

gridRef: MutableRefObject<GridElement>

Access grid methods

isEditorStartKeyEvent?: ((e) => boolean | StartEditEvent)

Test if the key event should start the editor

Type declaration

isEditorStartPointerEvent?: ((e) => boolean | StartEditEvent)

Test if the mouse event should start the editor. If this returns an event this will be dispatched to the editor.

Type declaration

Returns

Either true or an StartEditEvent

onBeforeStartEdit?: ((coords) => void)

Callback when a start has been initialed. This is called before the editor is mounted.

Type declaration

    • (coords): void
    • Parameters

      Returns void

onCancelEdit?: ((coords) => void)

Callback when user cancels editing

Type declaration

    • (coords): void
    • Parameters

      Returns void

onDoneEdit?: ((coords) => void)

Callback when user is done editing, either a submit or a cancel

Type declaration

    • (coords): void
    • Parameters

      Returns void

onNavigate?: ((direction) => void)

Type declaration

onNavigateSelection?: ((direction) => void)

Type declaration

onStartEdit?: ((coords) => void)

Callback when user start editing

Type declaration

    • (coords): void
    • Parameters

      Returns void

onSubmitEdit?: ((coords) => void)

Callback when user submits a value. Use this to update state

Type declaration

    • (coords): void
    • Parameters

      Returns void

Methods

  • Callback fired before editing. Can be used to prevent editing.

    Parameters

    Returns boolean