Interface UseSelectionOptions

interface UseSelectionOptions {
    allowDeselectSelection?: boolean;
    alwaysScrollToActiveCoords?: boolean;
    canSelectionSpanMergedCells?: ((range) => boolean);
    cellLayout?: CellLayout;
    contentfulCellFinder?: CellFinder;
    disableFillDrag?: boolean;
    disableMoveDrag?: boolean;
    disableTouchSelection?: boolean;
    fillHandleBorderColor?: string;
    getCellBounds?: ((includeHeaders) => CellRangeCoords);
    gridRef: MutableRefObject<GridElement>;
    hiddenColumnsAt?: HiddenHeadersAt;
    hiddenRowsAt?: HiddenHeadersAt;
    isContentfulCell?: ((coords) => boolean);
    mergedRanges?: CellRangeLookup | CellRangeCoords[];
    moveDragHitSize?: number;
    moveDragOutlineSize?: number;
    newSelectionMode?: NewSelectionMode;
    onFill?: ((template, fillBounds, direction, amount) => void);
    onFillCancel?: (() => void);
    onFillDone?: (() => void);
    onFillPreview?: ((template, fillBounds, direction, amount) => void);
    onMoveDragDone?: ((from, to, event, modifiers) => Promise<void>);
    onMoveDragEnd?: ((from, e, modifiers) => void);
    onMoveDragStart?: ((from, e, modifiers) => void);
    onMoveDragUpdate?: ((from, e, modifiers) => void);
    onSelectionChange?: ((selection) => void);
    onSelectionDragEnd?: ((selection, e) => void);
    onSelectionDragStart?: ((selection, e) => void);
    pointerDownInterceptor?: ((e, coords, selection) => boolean);
    pointerMoveInterceptor?: ((e, coords, selection) => boolean);
    selection?: GridSelection;
    selectionBackgroundColor?: string;
    selectionBorderColor?: string;
    selectionBounds?: Rectangle;
    selectionPolicy?: SelectionPolicy;
    selectionRemoveBackgroundColor?: string;
    selectionRemoveBorderColor?: string;
    selectionRenderer?: ((props) => ReactNode);
    touchSelectHandleProps?: TouchSelectHandleProps;
}

Properties

allowDeselectSelection?: boolean

Allow deselect a selected area

alwaysScrollToActiveCoords?: boolean

Always scroll to active cell

canSelectionSpanMergedCells?: ((range) => boolean)

Is the current selection able to intersect merged cells.

Type declaration

cellLayout?: CellLayout

This is used for pageUp/pageDown and getHiddenAuto.

contentfulCellFinder?: CellFinder

Allows for selection to navigate intelligently between cells based on if they have data. If this is note specified a default implementation will be used that uses hiddenRowsAt/hiddenColumnsAt/hiddenCellAt. If no intelligently navigation is desired then this can be set explicitly to null.

disableFillDrag?: boolean

Disable fill drag

Default Value

to a value based on if onFill is provided
disableMoveDrag?: boolean

Disable move drag

Default Value

if the onMoveDragDone is provided
disableTouchSelection?: boolean

Disable touch selection If false then the touch selection handles are not set

Default Value

true
fillHandleBorderColor?: string

Border color of fill handle

getCellBounds?: ((includeHeaders) => CellRangeCoords)

Performance - important performance consideration. This allows functions (like copy and scan to not operate on the entire sheet.) If this is not set or returns undefined then a scan of all the rows/columns will be done when needed to determine. (For example select all in a large sheet and copy to clipboard)

Type declaration

gridRef: MutableRefObject<GridElement>

Access grid functions. We can't use this eventing

hiddenColumnsAt?: HiddenHeadersAt

Hidden columns

hiddenRowsAt?: HiddenHeadersAt

Hidden rows

isContentfulCell?: ((coords) => boolean)

If there is no value. Note - This is slightly different than isEmpty because it may still have logical render (like fill, border, etc)

Type declaration

    • (coords): boolean
    • Parameters

      Returns boolean

mergedRanges?: CellRangeLookup | CellRangeCoords[]

Is either an array of merged cells or a CellRangeLookup

moveDragHitSize?: number

The size of the move hit stroke.

Default Value

5
moveDragOutlineSize?: number

The size of the move outline.

Default Value

3
newSelectionMode?: NewSelectionMode

New selection mode

onFill?: ((template, fillBounds, direction, amount) => void)

Called to actually perform the fill.

Type declaration

Remarks

onFillCancel?: (() => void)

Called when a cancel is started but not completed by dragging to original rect.

Type declaration

    • (): void
    • Returns void

onFillDone?: (() => void)

Called when fill gesture is complete; either onFill or onFillCancel'

Type declaration

    • (): void
    • Returns void

onFillPreview?: ((template, fillBounds, direction, amount) => void)

Called when dragging to fill

Type declaration

onMoveDragDone?: ((from, to, event, modifiers) => Promise<void>)

When selection is moved

Type declaration

onMoveDragEnd?: ((from, e, modifiers) => void)

Callback at the end of selection change driven by the pointer.

Type declaration

onMoveDragStart?: ((from, e, modifiers) => void)

Callback at the start of selection change driven by the pointer.

Type declaration

onMoveDragUpdate?: ((from, e, modifiers) => void)

Callback at the start of selection change driven by the pointer.

Type declaration

onSelectionChange?: ((selection) => void)

Callback when a value has changed.

Type declaration

onSelectionDragEnd?: ((selection, e) => void)

Callback at the end of selection change driven by the pointer.

Type declaration

    • (selection, e): void
    • Parameters

      Returns void

onSelectionDragStart?: ((selection, e) => void)

Callback at the start of selection change driven by the pointer.

Type declaration

    • (selection, e): void
    • Parameters

      Returns void

pointerDownInterceptor?: ((e, coords, selection) => boolean)

pointerDownInterceptor

Type declaration

    • (e, coords, selection): boolean
    • Parameters

      Returns boolean

pointerMoveInterceptor?: ((e, coords, selection) => boolean)

Type declaration

selection?: GridSelection

selections

selectionBackgroundColor?: string

Background of selection

selectionBorderColor?: string

Border color of selected area

selectionBounds?: Rectangle

bound of selection

selectionPolicy?: SelectionPolicy

Selection policy

selectionRemoveBackgroundColor?: string

Background of selection for removal

selectionRemoveBorderColor?: string
selectionRenderer?: ((props) => ReactNode)

Allow users to customize selected cells design

Type declaration

touchSelectHandleProps?: TouchSelectHandleProps

If touch is enabled