@rozie-ui/data-table-solid 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -57,6 +57,12 @@ interface DataTableHistoryChangePayload {
57
57
  canUndo: boolean;
58
58
  canRedo: boolean;
59
59
  }
60
+ /** The held-view state (`holdView`): whether the view is held right now, and how many rows the held view disagrees with. */
61
+ interface DataTableViewState {
62
+ held: boolean;
63
+ filterMismatches: number;
64
+ sortMismatches: number;
65
+ }
60
66
  /** The `range-change` payload: the new range corners (both `null` when the range cleared). */
61
67
  type DataTableRangeChangePayload = DataTableRange;
62
68
  /** The `row-activate` payload. `row` is the original data object and `index` its position in the rendered model. */
@@ -132,7 +138,7 @@ interface DataTableProps {
132
138
  defaultData?: any[];
133
139
  onDataChange?: (data: any[]) => void;
134
140
  /**
135
- * Config-array column fallback (lower precedence than `<Column>` children). Each entry: `{ id?, field, header?, sortable?, filterable?, pinned?, width? }`. Columns may come from this array, from `<Column>` children, or both (id-keyed last-write-wins union). A `pinned` value of `'left'` or `'right'` is applied once as the table's initial `columnPinning` state — identical to `<Column pinned>` — which also REORDERS that column, since table-core orders visible cells `[left-pinned, center, right-pinned]`. A consumer who has already expressed a pin (an initial two-way `columnPinning` model value or an interactive pin) owns the slice and this declaration is ignored.
141
+ * Config-array column fallback (lower precedence than `<Column>` children). Each entry: `{ id?, field, header?, sortable?, filterable?, filterFn?, sortingFn?, pinned?, width? }` (`filterFn`/`sortingFn` take a table-core built-in name or a custom function). Columns may come from this array, from `<Column>` children, or both (id-keyed last-write-wins union). A `pinned` value of `'left'` or `'right'` is applied once as the table's initial `columnPinning` state — identical to `<Column pinned>` — which also REORDERS that column, since table-core orders visible cells `[left-pinned, center, right-pinned]`. A consumer who has already expressed a pin (an initial two-way `columnPinning` model value or an interactive pin) owns the slice and this declaration is ignored.
136
142
  */
137
143
  columns?: any[];
138
144
  /**
@@ -253,6 +259,10 @@ interface DataTableProps {
253
259
  * The maximum number of undo steps retained (oldest evicted past this depth). Only consulted when `undoable` is `true`.
254
260
  */
255
261
  undoLimit?: number;
262
+ /**
263
+ * When `true`, the table holds its current view through its own writes (edit, paste, fill, cut, clear, the boolean toggle, undo and redo): rows keep the membership and order they had before the write and new values render in place, so an edited row does not jump or vanish under an active sort or filter. The view is re-derived (and both mismatch counts reset to 0) when `sorting`, `columnFilters` or `globalFilter` change, when `refreshView()` is called, when the dataset is swapped externally, or when `holdView` is toggled. Paging, page size, column visibility/order/pinning/sizing and expanding rows move through the held rows; a table write or `refreshView()` never changes the page (a sort, filter or grouping change returns to the first page). Falls back to live behaviour (with one console warning) while grouping is active, in `manual` mode, or with tree data (`getSubRows`). Passing a fresh `data` array that did not come from the table (for example reloading from the server after a save) is an external swap: it re-derives the view and clears undo history. Track mismatches with `view-state-change` / `getViewState()`.
264
+ */
265
+ holdView?: boolean;
256
266
  /**
257
267
  * Opt-in windowing grammar: `false` (default, off — byte-identical to a non-virtual table) | `true` or `'rows'` (vertical row windowing; `true` is byte-behavior-identical to every existing consumer, zero churn) | `'columns'` (horizontal column windowing) | `'both'` (both axes windowed). Row windowing renders only the visible slice of rows inside a bounded `rdt-scroll` container (with leading/trailing spacer rows preserving total scroll height), windowing over the full filtered + sorted (pre-pagination) model and suppressing the client pagination chrome. Column windowing renders only the visible slice of leaf columns inside the same `rdt-scroll` container. An unrecognised string behaves as `false`.
258
268
  */
@@ -285,6 +295,7 @@ interface DataTableProps {
285
295
  onSelectionChange?: (payload: RowSelectionState) => void;
286
296
  onSortChange?: (payload: SortingState) => void;
287
297
  onVisibilityChange?: (payload: VisibilityState) => void;
298
+ onViewStateChange?: (payload: DataTableViewState) => void;
288
299
  onVisibleRangeChange?: (payload: DataTableVisibleRangeChangePayload) => void;
289
300
  children?: JSX.Element;
290
301
  groupBarSlot?: (ctx: GroupBarSlotCtx) => JSX.Element;
@@ -370,6 +381,8 @@ interface DataTableHandle {
370
381
  canUndo: () => boolean;
371
382
  canRedo: () => boolean;
372
383
  clearHistory: () => void;
384
+ refreshView: () => void;
385
+ getViewState: () => DataTableViewState;
373
386
  }
374
387
  declare function DataTable(_props: DataTableProps): JSX.Element;
375
388
  //#endregion
@@ -417,6 +430,14 @@ interface ColumnProps {
417
430
  * The table-core aggregation for this column inside a group-header cell. Either a built-in name string — `'sum'` | `'min'` | `'max'` | `'extent'` | `'mean'` | `'median'` | `'unique'` | `'uniqueCount'` | `'count'` — or a custom function `(columnId, leafRows, childRows) => any` (defensively wrapped by the parent so a throw cannot crash grouping). Null → no aggregation (the group-header cell renders as a placeholder).
418
431
  */
419
432
  aggregationFn?: (string | ((...args: any[]) => any)) | null;
433
+ /**
434
+ * The table-core filter rule for this column. Either a built-in name string (e.g. `'arrIncludesSome'`, `'equalsString'`) or a custom function `(value, filterValue, row) => boolean`, where `row` is the original data object. Null → table-core's auto rule for the column's value type.
435
+ */
436
+ filterFn?: (string | ((...args: any[]) => any)) | null;
437
+ /**
438
+ * The table-core sort rule for this column. Either a built-in name string (e.g. `'alphanumeric'`, `'basic'`) or a custom ascending comparator `(a, b, rowA, rowB) => number` over the cell values, with the original data objects as `rowA` / `rowB`. Null → table-core's auto rule for the column's value type.
439
+ */
440
+ sortingFn?: (string | ((...args: any[]) => any)) | null;
420
441
  /**
421
442
  * Whether this column's cells are editable (opt-in). Default `false` → the column is read-only and the display↔editor branch never mounts an editor. Bind `:editable="true"` (a bare attr only coerces on Vue+Lit).
422
443
  */
@@ -738,4 +759,4 @@ interface DetailPanelProps {
738
759
  }
739
760
  declare function DetailPanel(_props: DetailPanelProps): JSX.Element;
740
761
  //#endregion
741
- export { Column, DataTable, DataTable as default, DataTableActiveCell, DataTableActiveCellChangePayload, DataTableCellChange, DataTableCellEditCommitPayload, DataTableCellPosition, DataTableFilterChangePayload, DataTableGroupableColumn, type DataTableHandle, DataTableHistoryChangePayload, DataTableRange, DataTableRangeChangePayload, DataTableRowActivatePayload, DataTableRowEditCommitPayload, DataTableVisibleRangeChangePayload, DetailPanel, EditorCheckbox, EditorDate, EditorNumber, EditorSelect, EditorText, FilterNumberRange, FilterSelect, FilterText, GroupBar };
762
+ export { Column, DataTable, DataTable as default, DataTableActiveCell, DataTableActiveCellChangePayload, DataTableCellChange, DataTableCellEditCommitPayload, DataTableCellPosition, DataTableFilterChangePayload, DataTableGroupableColumn, type DataTableHandle, DataTableHistoryChangePayload, DataTableRange, DataTableRangeChangePayload, DataTableRowActivatePayload, DataTableRowEditCommitPayload, DataTableViewState, DataTableVisibleRangeChangePayload, DetailPanel, EditorCheckbox, EditorDate, EditorNumber, EditorSelect, EditorText, FilterNumberRange, FilterSelect, FilterText, GroupBar };
package/dist/index.d.mts CHANGED
@@ -57,6 +57,12 @@ interface DataTableHistoryChangePayload {
57
57
  canUndo: boolean;
58
58
  canRedo: boolean;
59
59
  }
60
+ /** The held-view state (`holdView`): whether the view is held right now, and how many rows the held view disagrees with. */
61
+ interface DataTableViewState {
62
+ held: boolean;
63
+ filterMismatches: number;
64
+ sortMismatches: number;
65
+ }
60
66
  /** The `range-change` payload: the new range corners (both `null` when the range cleared). */
61
67
  type DataTableRangeChangePayload = DataTableRange;
62
68
  /** The `row-activate` payload. `row` is the original data object and `index` its position in the rendered model. */
@@ -132,7 +138,7 @@ interface DataTableProps {
132
138
  defaultData?: any[];
133
139
  onDataChange?: (data: any[]) => void;
134
140
  /**
135
- * Config-array column fallback (lower precedence than `<Column>` children). Each entry: `{ id?, field, header?, sortable?, filterable?, pinned?, width? }`. Columns may come from this array, from `<Column>` children, or both (id-keyed last-write-wins union). A `pinned` value of `'left'` or `'right'` is applied once as the table's initial `columnPinning` state — identical to `<Column pinned>` — which also REORDERS that column, since table-core orders visible cells `[left-pinned, center, right-pinned]`. A consumer who has already expressed a pin (an initial two-way `columnPinning` model value or an interactive pin) owns the slice and this declaration is ignored.
141
+ * Config-array column fallback (lower precedence than `<Column>` children). Each entry: `{ id?, field, header?, sortable?, filterable?, filterFn?, sortingFn?, pinned?, width? }` (`filterFn`/`sortingFn` take a table-core built-in name or a custom function). Columns may come from this array, from `<Column>` children, or both (id-keyed last-write-wins union). A `pinned` value of `'left'` or `'right'` is applied once as the table's initial `columnPinning` state — identical to `<Column pinned>` — which also REORDERS that column, since table-core orders visible cells `[left-pinned, center, right-pinned]`. A consumer who has already expressed a pin (an initial two-way `columnPinning` model value or an interactive pin) owns the slice and this declaration is ignored.
136
142
  */
137
143
  columns?: any[];
138
144
  /**
@@ -253,6 +259,10 @@ interface DataTableProps {
253
259
  * The maximum number of undo steps retained (oldest evicted past this depth). Only consulted when `undoable` is `true`.
254
260
  */
255
261
  undoLimit?: number;
262
+ /**
263
+ * When `true`, the table holds its current view through its own writes (edit, paste, fill, cut, clear, the boolean toggle, undo and redo): rows keep the membership and order they had before the write and new values render in place, so an edited row does not jump or vanish under an active sort or filter. The view is re-derived (and both mismatch counts reset to 0) when `sorting`, `columnFilters` or `globalFilter` change, when `refreshView()` is called, when the dataset is swapped externally, or when `holdView` is toggled. Paging, page size, column visibility/order/pinning/sizing and expanding rows move through the held rows; a table write or `refreshView()` never changes the page (a sort, filter or grouping change returns to the first page). Falls back to live behaviour (with one console warning) while grouping is active, in `manual` mode, or with tree data (`getSubRows`). Passing a fresh `data` array that did not come from the table (for example reloading from the server after a save) is an external swap: it re-derives the view and clears undo history. Track mismatches with `view-state-change` / `getViewState()`.
264
+ */
265
+ holdView?: boolean;
256
266
  /**
257
267
  * Opt-in windowing grammar: `false` (default, off — byte-identical to a non-virtual table) | `true` or `'rows'` (vertical row windowing; `true` is byte-behavior-identical to every existing consumer, zero churn) | `'columns'` (horizontal column windowing) | `'both'` (both axes windowed). Row windowing renders only the visible slice of rows inside a bounded `rdt-scroll` container (with leading/trailing spacer rows preserving total scroll height), windowing over the full filtered + sorted (pre-pagination) model and suppressing the client pagination chrome. Column windowing renders only the visible slice of leaf columns inside the same `rdt-scroll` container. An unrecognised string behaves as `false`.
258
268
  */
@@ -285,6 +295,7 @@ interface DataTableProps {
285
295
  onSelectionChange?: (payload: RowSelectionState) => void;
286
296
  onSortChange?: (payload: SortingState) => void;
287
297
  onVisibilityChange?: (payload: VisibilityState) => void;
298
+ onViewStateChange?: (payload: DataTableViewState) => void;
288
299
  onVisibleRangeChange?: (payload: DataTableVisibleRangeChangePayload) => void;
289
300
  children?: JSX.Element;
290
301
  groupBarSlot?: (ctx: GroupBarSlotCtx) => JSX.Element;
@@ -370,6 +381,8 @@ interface DataTableHandle {
370
381
  canUndo: () => boolean;
371
382
  canRedo: () => boolean;
372
383
  clearHistory: () => void;
384
+ refreshView: () => void;
385
+ getViewState: () => DataTableViewState;
373
386
  }
374
387
  declare function DataTable(_props: DataTableProps): JSX.Element;
375
388
  //#endregion
@@ -417,6 +430,14 @@ interface ColumnProps {
417
430
  * The table-core aggregation for this column inside a group-header cell. Either a built-in name string — `'sum'` | `'min'` | `'max'` | `'extent'` | `'mean'` | `'median'` | `'unique'` | `'uniqueCount'` | `'count'` — or a custom function `(columnId, leafRows, childRows) => any` (defensively wrapped by the parent so a throw cannot crash grouping). Null → no aggregation (the group-header cell renders as a placeholder).
418
431
  */
419
432
  aggregationFn?: (string | ((...args: any[]) => any)) | null;
433
+ /**
434
+ * The table-core filter rule for this column. Either a built-in name string (e.g. `'arrIncludesSome'`, `'equalsString'`) or a custom function `(value, filterValue, row) => boolean`, where `row` is the original data object. Null → table-core's auto rule for the column's value type.
435
+ */
436
+ filterFn?: (string | ((...args: any[]) => any)) | null;
437
+ /**
438
+ * The table-core sort rule for this column. Either a built-in name string (e.g. `'alphanumeric'`, `'basic'`) or a custom ascending comparator `(a, b, rowA, rowB) => number` over the cell values, with the original data objects as `rowA` / `rowB`. Null → table-core's auto rule for the column's value type.
439
+ */
440
+ sortingFn?: (string | ((...args: any[]) => any)) | null;
420
441
  /**
421
442
  * Whether this column's cells are editable (opt-in). Default `false` → the column is read-only and the display↔editor branch never mounts an editor. Bind `:editable="true"` (a bare attr only coerces on Vue+Lit).
422
443
  */
@@ -738,4 +759,4 @@ interface DetailPanelProps {
738
759
  }
739
760
  declare function DetailPanel(_props: DetailPanelProps): JSX.Element;
740
761
  //#endregion
741
- export { Column, DataTable, DataTable as default, DataTableActiveCell, DataTableActiveCellChangePayload, DataTableCellChange, DataTableCellEditCommitPayload, DataTableCellPosition, DataTableFilterChangePayload, DataTableGroupableColumn, type DataTableHandle, DataTableHistoryChangePayload, DataTableRange, DataTableRangeChangePayload, DataTableRowActivatePayload, DataTableRowEditCommitPayload, DataTableVisibleRangeChangePayload, DetailPanel, EditorCheckbox, EditorDate, EditorNumber, EditorSelect, EditorText, FilterNumberRange, FilterSelect, FilterText, GroupBar };
762
+ export { Column, DataTable, DataTable as default, DataTableActiveCell, DataTableActiveCellChangePayload, DataTableCellChange, DataTableCellEditCommitPayload, DataTableCellPosition, DataTableFilterChangePayload, DataTableGroupableColumn, type DataTableHandle, DataTableHistoryChangePayload, DataTableRange, DataTableRangeChangePayload, DataTableRowActivatePayload, DataTableRowEditCommitPayload, DataTableViewState, DataTableVisibleRangeChangePayload, DetailPanel, EditorCheckbox, EditorDate, EditorNumber, EditorSelect, EditorText, FilterNumberRange, FilterSelect, FilterText, GroupBar };