Niko Grid Types
CellState, CellPosition, GridRow, and related TypeScript types.
These types live in grid/types/. They have no domain logic, so they are safe to copy with the registry item.
CellStatus
Section titled “CellStatus”type CellStatus = "valid" | "invalid" | "empty"CellState
Section titled “CellState”Each editable cell keeps raw, the resolved value, and status apart. A pasted value that does not match stays visible, so the user can fix it.
interface CellState<T> { raw: string value: T | null status: CellStatus /** Tooltip when invalid. */ error?: string}CellPosition
Section titled “CellPosition”A cell is addressed by row id and column id, not display index. Focus and selection then survive filter, sort, and reorder.
interface CellPosition { rowId: string columnId: string}CopiedRange
Section titled “CopiedRange”The copy outline (marching ants). It is stored by id: Set membership plus the edge ids.
interface CopiedRange { rowIds: Set<string> firstRowId: string lastRowId: string columnIds: Set<string> firstColumnId: string lastColumnId: string}SelectionBounds
Section titled “SelectionBounds”The selection rectangle, edges included, in display space (indices after filter and sort).
interface SelectionBounds { minRow: number maxRow: number minColIndex: number maxColIndex: number}GridRow
Section titled “GridRow”interface GridRow { id: string [columnId: string]: CellState<string> | string}Helpers
Section titled “Helpers”| Helper | Role |
|---|---|
emptyCell<T>() |
Blank cell with status: "empty" |
isCellInBounds |
Inclusive membership in selection bounds |
Related types elsewhere
Section titled “Related types elsewhere”| Location | Types |
|---|---|
use-data-grid.ts |
UseDataGrid, UseDataGridConfig, GridCommit |
use-grid-columns.ts |
GridColumnSpec, GridColumnsApi |
use-grid-changes.ts |
GridChangeSet, GridChanges, GridReconcileResult |
data-grid-columns-context.tsx |
GridColumnTypeOption |
cell-props.ts |
CellEditorProps, GridComboboxOption |
For table-level types, see Niko Table Types.