Skip to main content

@topgrid/grid-core-headless

Framework-agnostic grid core (table-core based). Shared consumption by React/Vue adapters. W1 Phase 0. · Free (MIT)

Auto-generated

This page is auto-generated from TSDoc comments in the source code (internal markers scrubbed). For a curated getting-started summary, see the API Reference.

36 public exports — 14 functions · 0 hooks · 0 components · 20 types · 2 constants.

Functions

buildPaginationOptions

buildPaginationOptions(pagination: undefined | HeadlessPaginationOptions): BuildPaginationResult<TData>

buildTableOptions

enable* inputs → TableOptions mapping.

buildTableOptions(props: TableOptionsInput<TData>, state: GridStateBag, createSelectionColumn: CreateSelectionColumn<TData>): BuildOptionsResult<TData>
ParameterTypeDescription
propsTableOptionsInput<TData>The structural subset of GridProps (TableOptionsInput).
stateGridStateBaginternal state + setters (framework-agnostic bag).
createSelectionColumnCreateSelectionColumn<TData>Per-framework checkbox column factory (injected).

cellValueToClipboardText

Cell value → clipboard text (pure, W1 Phase 0, ported from grid-pro-master).

A value→text mapping decoupled from the browser navigator.clipboard wiring. framework-agnostic — shared by the React copy (makeCopyCellItem) and Vue copy adapters.

Mapping: null/undefined→'' (empty string, not "null"/"undefined") · object (including arrays)→JSON.stringify · otherwise (string/number/boolean)→String.

cellValueToClipboardText(cell: {}): string

dateRangeFilterFn

dateRangeFilterFn(row: Row<unknown>, columnId: string, filterValue: any, addMeta: () =>): boolean

detectSeriesStep

detectSeriesStep(values: number[]): null | number

fillRange

fillRange(sourceRange: CellRange, direction: FillDirection, fillCount: number, getCellValue: () =>): CellUpdate<TCell>[]

isInRange

isInRange(row: number, col: number, range: null | CellRange): boolean

normalizeRange

normalizeRange(range: CellRange): CellRange

numberFilterFn

numberFilterFn(row: Row<unknown>, columnId: string, filterValue: any, addMeta: () =>): boolean

parseTsv

parseTsv(tsv: string): string[][]

resolveResetValues

Computes the restore values for the reset target keys (pure).

  • Value = initialState[key] ?? DEFAULT_GRID_STATE_VALUES[key] (the initial captured at mount takes precedence).
  • Deduplicates keys with a Set (idempotent).
  • Unknown keys are ignored (no-op).

Shared by both resetState (full) / resetSection (partial). Setter dispatch is per-framework (React/Vue).

resolveResetValues(keys: readonly GridStateKey[], initialState: Partial<GridStateValues<TData>>): Partial<GridStateValues<TData>>
ParameterTypeDescription
keysreadonly GridStateKey[]The list of keys to restore.
initialStatePartial<GridStateValues<TData>>The initialState captured at mount (falls back to DEFAULT if absent).

Returns — A (partial) map of the restore values for the requested valid keys.

selectFilterFn

selectFilterFn(row: Row<any>, columnId: string, filterValue: any, addMeta: () =>): boolean

stringifyTsv

stringifyTsv(matrix: readonly readonly unknown[][]): string

textFilterFn

textFilterFn(row: Row<unknown>, columnId: string, filterValue: any, addMeta: () =>): boolean

Types & Interfaces

BuildOptionsResult

The result of buildTableOptions — spreadable into useReactTable/useVueTable.

PropertyTypeDescription
effectiveColumnsColumnDef<TData, unknown>[]
optionsOmit<TableOptions<TData>, "columns" | "data">
selectionModeRowSelectionMode
selectionOptionsHeadlessRowSelectionOptions<TData>

BuildPaginationResult

PropertyTypeDescription
impliedEnablePaginationboolean
tanstackOptionsPartial<TableOptions<TData>>

CellCoord

Pure cell range utilities — normalization · containment check · drag-fill · TSV (W1 Phase 0, ported from grid-pro-range).

All are framework-agnostic pure functions + pure data types (coordinate/rectangle/direction/update). The React (grid-pro-range) and Vue range adapters share the same math/serialization. Render/event-agnostic.

PropertyTypeDescription
colnumber
rownumber

CellRange

PropertyTypeDescription
endCellCoord
startCellCoord

CellUpdate

PropertyTypeDescription
colnumber
rownumber
valueTCell

DateFilterValue

PropertyTypeDescription
from?Date
to?Date

GridStateBag

The internal state values + setters held by the Grid (or adapter).

PropertyTypeDescription
columnFiltersColumnFiltersState
columnOrderColumnOrderState
columnPinningColumnPinningState
columnSizingColumnSizingState
columnVisibilityVisibilityState
expandedExpandedState
paginationPaginationState
rowSelectionRowSelectionState
setColumnFilters(…) => …
setColumnOrder(…) => …
setColumnPinning(…) => …
setColumnSizing(…) => …
setColumnVisibility(…) => …
setExpanded(…) => …
setPagination(…) => …
setRowSelection(…) => …
setSorting(…) => …
sortingSortingState

GridStateValues

The 8 standard grid state values.

PropertyTypeDescription
columnFiltersColumnFiltersState
columnOrderColumnOrderState
columnPinningColumnPinningState
columnSizingColumnSizingState
columnVisibilityVisibilityState
paginationPaginationState
rowSelectionRowSelectionState
sortingSortingState

HeadlessPaginationOptions

Pagination options — the subset read by buildPaginationOptions.

PropertyTypeDescription
manual?boolean
mode?PaginationMode
onPaginationChange?OnChangeFn<PaginationState>
pageCount?number
pageSize?number
totalCount?number

HeadlessRowSelectionOptions

Row selection options — the framework-agnostic part (render callbacks excluded).

PropertyTypeDescription
mode?RowSelectionMode
onSelectionChange?(…) => …
onStateChange?OnChangeFn<RowSelectionState>
selectAllPages?boolean
state?RowSelectionState

NumberFilterValue

PropertyTypeDescription
max?number
min?number
operatorNumberFilterOperator
value?number

TableOptionsInput

The structural subset of GridProps read by buildTableOptions. grid-core's React GridProps<TData> structurally satisfies (is assignable to) this interface.

PropertyTypeDescription
alwaysMultiSort?boolean
columnResizeMode?ColumnResizeMode
columnsColumnDef<TData, unknown>[]
dataTData[]
debug?boolean
enableColumnPinning?boolean
enableColumnResizing?boolean
enableExpanding?boolean
enableFilter?boolean
enableMultiSort?boolean
enablePagination?boolean
enableRowPinning?boolean
enableSort?boolean
getRowId?(…) => …
getSubRows?(…) => …
manualFiltering?boolean
manualSorting?boolean
maxMultiSortColCount?number
onColumnFiltersChange?OnChangeFn<ColumnFiltersState>
onColumnPinningChange?OnChangeFn<ColumnPinningState>
onColumnSizingChange?OnChangeFn<ColumnSizingState>
onSortingChange?OnChangeFn<SortingState>
pagination?HeadlessPaginationOptions
rowSelection?RowSelectionMode | HeadlessRowSelectionOptions<TData>
sortDescFirst?boolean

TextFilterValue

PropertyTypeDescription
operatorTextFilterOperator
valuestring

CreateSelectionColumn

Per-framework selection (checkbox) column factory — injected. grid-core passes the React createCheckboxColumn; the Vue adapter passes the Vue version. headless purely handles only selection normalization + the 'prepend when mode≠none' policy.

type CreateSelectionColumn = () =>

FillDirection

type FillDirection = "up" | "down" | "left" | "right"

GridStateKey

Union of the 8 state keys.

type GridStateKey = "sorting" | "columnFilters" | "rowSelection" | "pagination" | "columnPinning" | "columnOrder" | "columnSizing" | "columnVisibility"

NumberFilterOperator

type NumberFilterOperator = "=" | "!=" | ">" | "<" | ">=" | "<=" | "between"

PaginationMode

Pagination behavior mode (convenience shorthand).

type PaginationMode = "client" | "server" | "none"

RowSelectionMode

Row selection mode.

type RowSelectionMode = "single" | "multi" | "none"

TextFilterOperator

type TextFilterOperator = "contains" | "equals" | "startsWith" | "endsWith"

Constants

DEFAULT_GRID_STATE_VALUES

The default value of each state key — the single source of truth. Both the initial values (when initialState is not provided) and reset use this constant (deduplication).

const DEFAULT_GRID_STATE_VALUES: GridStateValues<unknown>

GRID_STATE_KEYS

All state keys (stable order).

const GRID_STATE_KEYS: readonly GridStateKey[]