import { ColumnConfig } from '@toolbox-web/grid'; /** * Context object passed to cell renderer components. * * @typeParam TValue - Cell value type. Defaults to `any` because the value * shape is per-column and awkward to narrow inside JSX expressions; * specify it (e.g. `GridCellContext`) when known. * @typeParam TRow - Row data shape. Defaults to `unknown` so users are * prompted to specify their row type explicitly for type safety. * @since 0.0.1 */ export interface GridCellContext { /** The cell value for this column */ value: TValue; /** The full row data object */ row: TRow; /** The column configuration */ column: ColumnConfig; /** Field key (may be a nested dotted path, e.g. `a.b.c`) */ field: string; } /** * Context object passed to cell editor components. * * @typeParam TValue - Cell value type. Defaults to `any` because the value * shape is per-column and awkward to narrow inside JSX expressions. * @typeParam TRow - Row data shape. Defaults to `unknown` so users are * prompted to specify their row type explicitly for type safety. * @since 0.0.1 */ export interface GridEditorContext { /** The cell value for this column */ value: TValue; /** The full row data object */ row: TRow; /** The column configuration */ column: ColumnConfig; /** Field key (may be a nested dotted path, e.g. `a.b.c`) */ field: string; /** Stable row identifier (from `getRowId`). Empty string if no `getRowId` is configured. */ rowId: string; /** Commit the new value and close editor */ commit: (newValue: TValue) => void; /** Cancel editing without saving */ cancel: () => void; /** * Update other fields in this row while the editor is open. * Changes trigger `cell-change` events with source `'cascade'`. */ updateRow: (changes: Partial) => void; /** * Register a callback to receive value updates when the cell is modified * externally (e.g., via `updateRow()` from another cell's commit). * * React editors receive the full context at render time; use this to * update local state when another cell cascades a change. */ onValueChange?: (callback: (newValue: TValue) => void) => void; } /** * Context object passed to detail panel components. * @since 0.0.1 */ export interface GridDetailContext { /** The row data object */ row: TRow; /** Row index */ rowIndex: number; } /** * Context object passed to tool panel components. * @since 0.0.1 */ export interface GridToolPanelContext { /** Reference to the grid element */ grid: HTMLElement; } //# sourceMappingURL=context-types.d.ts.map