import { ColumnConfig } from '@toolbox-web/grid'; /** * Slot context for #cell slot in TbwGridColumn. * * @example * ```vue * * * * ``` * @typeParam TRow - Row data shape. Defaults to `unknown` so users are * prompted to specify their row type explicitly for type safety. * @typeParam TValue - Cell value type. Defaults to `any` because the value * shape is per-column and awkward to narrow inside template expressions; * specify it (e.g. `CellSlotProps`) when known. * @since 0.1.0 */ export interface CellSlotProps { /** The cell value */ value: TValue; /** The entire row data */ row: TRow; /** The column configuration */ column: ColumnConfig; } /** * Slot context for #editor slot in TbwGridColumn. * * @example * ```vue * * * * ``` * @typeParam TRow - Row data shape. Defaults to `unknown` so users are * prompted to specify their row type explicitly for type safety. * @typeParam TValue - Cell value type. Defaults to `any` because the value * shape is per-column and awkward to narrow inside template expressions. * @since 0.1.0 */ export interface EditorSlotProps { /** The current cell value */ value: TValue; /** The entire row data */ row: TRow; /** The column configuration */ column: ColumnConfig; /** Field name being edited */ field: string; /** Stable row identifier (from `getRowId`). Empty string if no `getRowId` is configured. */ rowId: string; /** Commit the edit with new value */ commit: (newValue: TValue) => void; /** Cancel the edit */ 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). */ onValueChange?: (callback: (newValue: TValue) => void) => void; } /** * Context object passed to a cell renderer function. * * Re-export of {@link CellSlotProps} with the `` generic order * used by `@toolbox-web/grid-react`'s `GridCellContext`. Provided so that * users typing render-prop-style helpers can share a single signature across * adapters (e.g. when migrating from React to Vue or vice versa). Inside Vue * SFCs prefer `CellSlotProps` directly — Vue's `defineSlots` already infers * the right shape from it. * @since 1.5.0 */ export type GridCellContext = CellSlotProps; /** * Context object passed to a cell editor function. * * Re-export of {@link EditorSlotProps} with the `` generic order * used by `@toolbox-web/grid-react`'s `GridEditorContext`. Provided so that * users typing editor functions can share a single signature across adapters. * Inside Vue SFCs prefer `EditorSlotProps` directly — Vue's `defineSlots` * already infers the right shape from it. * @since 1.5.0 */ export type GridEditorContext = EditorSlotProps; /** * Slot context for `#headerLabel` slot in TbwGridColumn. Lets the consumer * customize the header label content; the grid keeps ownership of sort * icons, filter buttons, and resize handles. * * @example * ```vue * * * * ``` * @typeParam TRow - Row data shape. Defaults to `unknown`. * @since 1.9.0 */ export interface HeaderLabelSlotProps { /** Column configuration reference. */ column: ColumnConfig; /** The header text (from `column.header` or `column.field`). */ value: string; } /** * Slot context for `#header` slot in TbwGridColumn. Gives the consumer * full control over the header cell label — sort icons and filter * buttons are NOT added automatically; use the `renderSortIcon` and * `renderFilterButton` helpers to opt in. Resize handles are appended * automatically by the grid for resizable columns. * * @example * ```vue * * * * ``` * @typeParam TRow - Row data shape. Defaults to `unknown`. * @since 1.9.0 */ export interface HeaderSlotProps { /** Column configuration reference. */ column: ColumnConfig; /** The header text (from `column.header` or `column.field`). */ value: string; /** Current sort state for this column. */ sortState: 'asc' | 'desc' | null; /** Whether the column has an active filter. */ filterActive: boolean; /** The header cell DOM element being rendered into. */ cellEl: HTMLElement; /** Render the standard sort indicator icon. Returns null if not sortable. */ renderSortIcon: () => HTMLElement | null; /** Render the standard filter button. Returns null if filtering is not active for this column. */ renderFilterButton: () => HTMLElement | null; } //# sourceMappingURL=slot-types.d.ts.map