@svgrid/grid 1.0.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.
Files changed (213) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +39 -0
  3. package/dist/FlexRender.svelte +96 -0
  4. package/dist/FlexRender.svelte.d.ts +49 -0
  5. package/dist/SvGrid.svelte +8742 -0
  6. package/dist/SvGrid.svelte.d.ts +381 -0
  7. package/dist/SvGridChart.svelte +653 -0
  8. package/dist/SvGridChart.svelte.d.ts +25 -0
  9. package/dist/SvGridChart.test.d.ts +1 -0
  10. package/dist/SvGridChart.test.js +62 -0
  11. package/dist/SvGridDropdown.svelte +675 -0
  12. package/dist/SvGridDropdown.svelte.d.ts +40 -0
  13. package/dist/a11y.contract.test.d.ts +1 -0
  14. package/dist/a11y.contract.test.js +39 -0
  15. package/dist/a11y.d.ts +38 -0
  16. package/dist/a11y.js +37 -0
  17. package/dist/a11y.test.d.ts +1 -0
  18. package/dist/a11y.test.js +44 -0
  19. package/dist/cell-formatting.d.ts +17 -0
  20. package/dist/cell-formatting.js +141 -0
  21. package/dist/cell-formatting.test.d.ts +1 -0
  22. package/dist/cell-formatting.test.js +234 -0
  23. package/dist/chart-export.d.ts +14 -0
  24. package/dist/chart-export.js +112 -0
  25. package/dist/chart.d.ts +226 -0
  26. package/dist/chart.js +732 -0
  27. package/dist/chart.test.d.ts +1 -0
  28. package/dist/chart.test.js +289 -0
  29. package/dist/collaboration.d.ts +74 -0
  30. package/dist/collaboration.js +98 -0
  31. package/dist/collaboration.test.d.ts +1 -0
  32. package/dist/collaboration.test.js +65 -0
  33. package/dist/conditional-formatting.d.ts +91 -0
  34. package/dist/conditional-formatting.js +170 -0
  35. package/dist/conditional-formatting.test.d.ts +1 -0
  36. package/dist/conditional-formatting.test.js +87 -0
  37. package/dist/core.coverage.test.d.ts +1 -0
  38. package/dist/core.coverage.test.js +186 -0
  39. package/dist/core.d.ts +370 -0
  40. package/dist/core.js +568 -0
  41. package/dist/core.performance.test.d.ts +1 -0
  42. package/dist/core.performance.test.js +29 -0
  43. package/dist/createGrid.svelte.d.ts +6 -0
  44. package/dist/createGrid.svelte.js +17 -0
  45. package/dist/createGrid.test.d.ts +1 -0
  46. package/dist/createGrid.test.js +9 -0
  47. package/dist/createGridState.svelte.d.ts +3 -0
  48. package/dist/createGridState.svelte.js +13 -0
  49. package/dist/editors/cell-editors.d.ts +23 -0
  50. package/dist/editors/cell-editors.js +97 -0
  51. package/dist/editors/cell-editors.test.d.ts +1 -0
  52. package/dist/editors/cell-editors.test.js +75 -0
  53. package/dist/fill-patterns.d.ts +30 -0
  54. package/dist/fill-patterns.js +207 -0
  55. package/dist/fill-patterns.test.d.ts +1 -0
  56. package/dist/fill-patterns.test.js +81 -0
  57. package/dist/filtering/excel-filters.d.ts +26 -0
  58. package/dist/filtering/excel-filters.js +64 -0
  59. package/dist/filtering/excel-filters.test.d.ts +1 -0
  60. package/dist/filtering/excel-filters.test.js +116 -0
  61. package/dist/filtering/locale-filter.test.d.ts +13 -0
  62. package/dist/filtering/locale-filter.test.js +189 -0
  63. package/dist/flex-render.d.ts +1 -0
  64. package/dist/flex-render.js +2 -0
  65. package/dist/flex-render.test.d.ts +1 -0
  66. package/dist/flex-render.test.js +142 -0
  67. package/dist/group-aggregate.test.d.ts +1 -0
  68. package/dist/group-aggregate.test.js +32 -0
  69. package/dist/index.d.ts +29 -0
  70. package/dist/index.js +27 -0
  71. package/dist/keyboard.d.ts +8 -0
  72. package/dist/keyboard.js +91 -0
  73. package/dist/keyboard.test.d.ts +1 -0
  74. package/dist/keyboard.test.js +27 -0
  75. package/dist/merge-objects.d.ts +9 -0
  76. package/dist/merge-objects.js +28 -0
  77. package/dist/named-views.d.ts +42 -0
  78. package/dist/named-views.js +80 -0
  79. package/dist/named-views.test.d.ts +1 -0
  80. package/dist/named-views.test.js +57 -0
  81. package/dist/new-features.test.d.ts +1 -0
  82. package/dist/new-features.test.js +183 -0
  83. package/dist/render-component.d.ts +13 -0
  84. package/dist/render-component.js +14 -0
  85. package/dist/render-component.test.d.ts +1 -0
  86. package/dist/render-component.test.js +41 -0
  87. package/dist/server-data-source.d.ts +76 -0
  88. package/dist/server-data-source.js +83 -0
  89. package/dist/server-data-source.test.d.ts +1 -0
  90. package/dist/server-data-source.test.js +81 -0
  91. package/dist/sparkline.d.ts +56 -0
  92. package/dist/sparkline.js +97 -0
  93. package/dist/sparkline.test.d.ts +1 -0
  94. package/dist/sparkline.test.js +52 -0
  95. package/dist/static-functions.d.ts +1 -0
  96. package/dist/static-functions.js +1 -0
  97. package/dist/subscribe.d.ts +9 -0
  98. package/dist/subscribe.js +31 -0
  99. package/dist/subscribe.test.d.ts +1 -0
  100. package/dist/subscribe.test.js +93 -0
  101. package/dist/sv-grid-scrollbar.d.ts +1 -0
  102. package/dist/sv-grid-scrollbar.js +310 -0
  103. package/dist/svgrid-wrapper.types.d.ts +341 -0
  104. package/dist/svgrid-wrapper.types.js +1 -0
  105. package/dist/svgrid.api-extensions.test.d.ts +14 -0
  106. package/dist/svgrid.api-extensions.test.js +334 -0
  107. package/dist/svgrid.api.test.d.ts +15 -0
  108. package/dist/svgrid.api.test.js +169 -0
  109. package/dist/svgrid.behavior.test.d.ts +15 -0
  110. package/dist/svgrid.behavior.test.js +605 -0
  111. package/dist/svgrid.column-reorder.test.d.ts +15 -0
  112. package/dist/svgrid.column-reorder.test.js +224 -0
  113. package/dist/svgrid.features.test.d.ts +1 -0
  114. package/dist/svgrid.features.test.js +129 -0
  115. package/dist/svgrid.interaction.test.d.ts +9 -0
  116. package/dist/svgrid.interaction.test.js +318 -0
  117. package/dist/svgrid.locale-filtering.test.d.ts +15 -0
  118. package/dist/svgrid.locale-filtering.test.js +261 -0
  119. package/dist/svgrid.new-features.wrapper.test.d.ts +1 -0
  120. package/dist/svgrid.new-features.wrapper.test.js +136 -0
  121. package/dist/svgrid.row-pinning.test.d.ts +14 -0
  122. package/dist/svgrid.row-pinning.test.js +250 -0
  123. package/dist/svgrid.set-filter.test.d.ts +17 -0
  124. package/dist/svgrid.set-filter.test.js +268 -0
  125. package/dist/svgrid.wrapper.test.d.ts +1 -0
  126. package/dist/svgrid.wrapper.test.js +33 -0
  127. package/dist/test-setup.d.ts +1 -0
  128. package/dist/test-setup.js +29 -0
  129. package/dist/transaction.test.d.ts +1 -0
  130. package/dist/transaction.test.js +89 -0
  131. package/dist/virtualization/column-virtualizer.d.ts +20 -0
  132. package/dist/virtualization/column-virtualizer.js +19 -0
  133. package/dist/virtualization/column-virtualizer.test.d.ts +1 -0
  134. package/dist/virtualization/column-virtualizer.test.js +25 -0
  135. package/dist/virtualization/svelte-virtualizer.svelte.d.ts +11 -0
  136. package/dist/virtualization/svelte-virtualizer.svelte.js +20 -0
  137. package/dist/virtualization/types.d.ts +28 -0
  138. package/dist/virtualization/types.js +1 -0
  139. package/dist/virtualization/virtualizer.d.ts +13 -0
  140. package/dist/virtualization/virtualizer.js +232 -0
  141. package/dist/virtualization/virtualizer.test.d.ts +1 -0
  142. package/dist/virtualization/virtualizer.test.js +41 -0
  143. package/package.json +69 -0
  144. package/src/FlexRender.svelte +96 -0
  145. package/src/SvGrid.svelte +8742 -0
  146. package/src/SvGridChart.svelte +653 -0
  147. package/src/SvGridChart.test.ts +69 -0
  148. package/src/SvGridDropdown.svelte +675 -0
  149. package/src/a11y.contract.test.ts +49 -0
  150. package/src/a11y.test.ts +59 -0
  151. package/src/a11y.ts +59 -0
  152. package/src/cell-formatting.test.ts +273 -0
  153. package/src/cell-formatting.ts +169 -0
  154. package/src/chart-export.ts +144 -0
  155. package/src/chart.test.ts +311 -0
  156. package/src/chart.ts +934 -0
  157. package/src/collaboration.test.ts +74 -0
  158. package/src/collaboration.ts +161 -0
  159. package/src/conditional-formatting.test.ts +107 -0
  160. package/src/conditional-formatting.ts +239 -0
  161. package/src/core.coverage.test.ts +230 -0
  162. package/src/core.performance.test.ts +30 -0
  163. package/src/core.ts +991 -0
  164. package/src/createGrid.svelte.ts +42 -0
  165. package/src/createGrid.test.ts +10 -0
  166. package/src/createGridState.svelte.ts +17 -0
  167. package/src/editors/cell-editors.test.ts +80 -0
  168. package/src/editors/cell-editors.ts +127 -0
  169. package/src/fill-patterns.test.ts +93 -0
  170. package/src/fill-patterns.ts +229 -0
  171. package/src/filtering/excel-filters.test.ts +131 -0
  172. package/src/filtering/excel-filters.ts +101 -0
  173. package/src/filtering/locale-filter.test.ts +220 -0
  174. package/src/flex-render.test.ts +143 -0
  175. package/src/flex-render.ts +3 -0
  176. package/src/group-aggregate.test.ts +48 -0
  177. package/src/index.ts +159 -0
  178. package/src/keyboard.test.ts +59 -0
  179. package/src/keyboard.ts +97 -0
  180. package/src/merge-objects.ts +48 -0
  181. package/src/named-views.test.ts +66 -0
  182. package/src/named-views.ts +120 -0
  183. package/src/new-features.test.ts +217 -0
  184. package/src/render-component.test.ts +51 -0
  185. package/src/render-component.ts +28 -0
  186. package/src/server-data-source.test.ts +88 -0
  187. package/src/server-data-source.ts +163 -0
  188. package/src/sparkline.test.ts +59 -0
  189. package/src/sparkline.ts +164 -0
  190. package/src/static-functions.ts +11 -0
  191. package/src/subscribe.test.ts +103 -0
  192. package/src/subscribe.ts +38 -0
  193. package/src/sv-grid-scrollbar.ts +347 -0
  194. package/src/svgrid-wrapper.types.ts +382 -0
  195. package/src/svgrid.api-extensions.test.ts +362 -0
  196. package/src/svgrid.api.test.ts +192 -0
  197. package/src/svgrid.behavior.test.ts +657 -0
  198. package/src/svgrid.column-reorder.test.ts +234 -0
  199. package/src/svgrid.features.test.ts +157 -0
  200. package/src/svgrid.interaction.test.ts +355 -0
  201. package/src/svgrid.locale-filtering.test.ts +259 -0
  202. package/src/svgrid.new-features.wrapper.test.ts +164 -0
  203. package/src/svgrid.row-pinning.test.ts +266 -0
  204. package/src/svgrid.set-filter.test.ts +270 -0
  205. package/src/svgrid.wrapper.test.ts +35 -0
  206. package/src/test-setup.ts +37 -0
  207. package/src/transaction.test.ts +100 -0
  208. package/src/virtualization/column-virtualizer.test.ts +27 -0
  209. package/src/virtualization/column-virtualizer.ts +30 -0
  210. package/src/virtualization/svelte-virtualizer.svelte.ts +24 -0
  211. package/src/virtualization/types.ts +30 -0
  212. package/src/virtualization/virtualizer.test.ts +47 -0
  213. package/src/virtualization/virtualizer.ts +270 -0
@@ -0,0 +1,382 @@
1
+ import type { ColumnDef, RowData, SvGridOptions, TableFeatures } from './core'
2
+
3
+ export type SvGridFilterOperator =
4
+ | 'contains'
5
+ | 'equals'
6
+ | 'startsWith'
7
+ | 'greaterThan'
8
+ | 'lessThan'
9
+ | 'between'
10
+ | 'isBlank'
11
+
12
+ /**
13
+ * A serializable snapshot of everything that makes up the current "view":
14
+ * sort, grouping, pagination, column layout (width / pinning / order /
15
+ * visibility), and all filter surfaces. Round-trippable through
16
+ * `api.getState()` / `api.setState()` - persist it to a URL, localStorage, or
17
+ * a server to implement "save view" / "named views".
18
+ */
19
+ export type SvGridViewState = {
20
+ sorting: Array<{ id: string; desc: boolean }>
21
+ grouping: string[]
22
+ pagination: { pageIndex: number; pageSize: number }
23
+ columnWidths: Record<string, number>
24
+ columnPinning: { left: string[]; right: string[] }
25
+ columnOrder: string[]
26
+ /** Ids of columns currently hidden via setColumnVisible. */
27
+ hiddenColumns: string[]
28
+ globalFilter: string
29
+ columnFilters: Record<
30
+ string,
31
+ { operator: SvGridFilterOperator; value: string; valueTo?: string }
32
+ >
33
+ /** Facet (Excel-style value checklist) selections, keyed by column id. */
34
+ facetFilters: Record<string, string[]>
35
+ }
36
+
37
+ /**
38
+ * A batch of row mutations for `api.applyTransaction`. `update` / `remove`
39
+ * (by id) match on `getRowId`; `remove` also accepts row object references.
40
+ */
41
+ export type SvGridTransaction<TData> = {
42
+ add?: ReadonlyArray<TData>
43
+ update?: ReadonlyArray<TData>
44
+ remove?: ReadonlyArray<TData | string>
45
+ }
46
+
47
+ export type SvGridTransactionResult = {
48
+ added: number
49
+ updated: number
50
+ removed: number
51
+ }
52
+
53
+ /**
54
+ * Imperative API exposed via the `<SvGrid onApiReady>` callback. Use it for
55
+ * data, column, filter, sort, group, and visibility operations from outside
56
+ * the component.
57
+ */
58
+ export type SvGridApi<
59
+ TFeatures extends TableFeatures,
60
+ TData extends RowData,
61
+ > = {
62
+ // ----- Cells -----
63
+ /** Read a cell value from the underlying data at `rowIndex`. */
64
+ getCellValue(rowIndex: number, columnId: string): unknown
65
+ /** Write a cell value through the column's field. */
66
+ setCellValue(rowIndex: number, columnId: string, value: unknown): void
67
+
68
+ // ----- Cell selection -----
69
+ /**
70
+ * Programmatically select one or more rectangular cell ranges. Each
71
+ * range is `[rowStart, colStart, rowEnd, colEnd]` in 0-indexed grid
72
+ * coordinates. Pass an empty array to clear the selection.
73
+ *
74
+ * The grid currently honours the FIRST range only (single-range
75
+ * engine); subsequent ranges are accepted for API forward compat
76
+ * but ignored. The grid's active cell jumps to the range's start
77
+ * corner.
78
+ */
79
+ selectCells(ranges: ReadonlyArray<readonly [number, number, number, number]>): void
80
+ /**
81
+ * Returns the current cell-selection rectangles in the same shape
82
+ * `selectCells` accepts. Empty array when no range is active.
83
+ */
84
+ getSelected(): Array<[number, number, number, number]>
85
+
86
+ // ----- Rows -----
87
+ /** Add one row. `position` defaults to `'bottom'`. */
88
+ addRow(row: TData, position?: 'top' | 'bottom' | number): void
89
+ addRows(rows: ReadonlyArray<TData>, position?: 'top' | 'bottom' | number): void
90
+ /** Remove a row at the given data-array index. */
91
+ removeRow(rowIndex: number): void
92
+ removeRows(rowIndices: ReadonlyArray<number>): void
93
+ /**
94
+ * Apply a batch of add / update / remove mutations in a SINGLE data update
95
+ * (one re-render, not one per row) - the high-frequency / streaming path.
96
+ * `update` and `remove`-by-id match rows via `getRowId`, so set that prop
97
+ * for those to work; `remove` also accepts row object references. Returns
98
+ * the counts actually applied.
99
+ */
100
+ applyTransaction(tx: SvGridTransaction<TData>): SvGridTransactionResult
101
+
102
+ // ----- Columns -----
103
+ /** Add one column. `position` defaults to `'right'`. */
104
+ addColumn(
105
+ column: ColumnDef<TFeatures, TData>,
106
+ position?: 'left' | 'right' | number,
107
+ ): void
108
+ addColumns(
109
+ columns: ReadonlyArray<ColumnDef<TFeatures, TData>>,
110
+ position?: 'left' | 'right' | number,
111
+ ): void
112
+ /** Remove a column by id (or field when no id was provided). */
113
+ removeColumn(columnId: string): void
114
+
115
+ // ----- Visibility -----
116
+ setColumnVisible(columnId: string, visible: boolean): void
117
+ isColumnVisible(columnId: string): boolean
118
+
119
+ // ----- Sort / group / filter -----
120
+ /** Sort by one column (replaces any existing sort). Pass `null` to clear. */
121
+ setSort(columnId: string, direction: 'asc' | 'desc' | null): void
122
+ clearSort(): void
123
+ setGroupBy(columnIds: ReadonlyArray<string>): void
124
+ /** Set the operator filter for a column. Pass `null` to clear. */
125
+ setFilter(
126
+ columnId: string,
127
+ filter:
128
+ | {
129
+ operator: SvGridFilterOperator
130
+ value?: string
131
+ /** Upper bound for the `between` operator. Required when `operator === 'between'`. */
132
+ valueTo?: string
133
+ }
134
+ | null,
135
+ ): void
136
+ /**
137
+ * Set the facet (set-list, Excel-style multi-select) filter for a column.
138
+ * Pass an empty array or `null` to clear it. The values restore the
139
+ * checked state of the column-menu's value list - the engine then filters
140
+ * the data to rows whose cell value is in the set. Used to restore
141
+ * snapshots captured via `onFiltersChange`'s `selectedValues`.
142
+ */
143
+ setFacetFilter(columnId: string, values: ReadonlyArray<string> | null): void
144
+ clearFilter(columnId: string): void
145
+ /**
146
+ * Clear every active column filter (menu, filter-row, set-list, and global).
147
+ * Resets the grid to "no filtering" in a single call.
148
+ */
149
+ clearAllFilters(): void
150
+ /**
151
+ * Read the active column-menu filters as a snapshot. Keyed by column id.
152
+ * Returns an empty object when nothing is filtered. `valueTo` is only
153
+ * present when `operator === 'between'`.
154
+ */
155
+ getFilters(): Record<
156
+ string,
157
+ { operator: SvGridFilterOperator; value: string; valueTo?: string }
158
+ >
159
+
160
+ /**
161
+ * Snapshot of the rows the grid is actually displaying right now -
162
+ * after filtering, sorting, grouping, and pagination have been applied.
163
+ * Use this when you need to export the visible result set (e.g. CSV).
164
+ */
165
+ getDisplayedRows(): ReadonlyArray<TData>
166
+
167
+ /** Snapshot of the current data array (pre-pipeline). */
168
+ getData(): ReadonlyArray<TData>
169
+
170
+ /**
171
+ * Snapshot of every column the grid currently knows about, in visual
172
+ * order, with the human-readable header label. Use this when exporting
173
+ * or building a column-picker UI - the data is read once, no
174
+ * subscription. Hidden columns are included; check `visible` to filter.
175
+ */
176
+ getColumns(): ReadonlyArray<{
177
+ id: string
178
+ field?: string
179
+ header: string
180
+ visible: boolean
181
+ }>
182
+
183
+ /** Clear every checked row. Emits `onRowSelectionChange({}, [])`. */
184
+ clearRowSelection(): void
185
+
186
+ // ----- Column layout (width + pinning) -----
187
+ /**
188
+ * Set the width of one column in pixels. Identical to dragging the
189
+ * column's resize handle. Width is clamped to `MIN_COLUMN_WIDTH`.
190
+ */
191
+ setColumnWidth(columnId: string, width: number): void
192
+ /**
193
+ * Snapshot of every column's current width (in pixels), keyed by
194
+ * column id. Columns the user has never resized AND that have no
195
+ * explicit `width` on their ColumnDef are reported at the grid-wide
196
+ * default. Useful for "save view" + URL persistence.
197
+ */
198
+ getColumnWidths(): Record<string, number>
199
+ /**
200
+ * Replace the column-pinning state in one call. Each entry is a
201
+ * column id; the order in the array becomes the visible order along
202
+ * the pinned edge.
203
+ */
204
+ setColumnPinning(pinning: {
205
+ left?: ReadonlyArray<string>
206
+ right?: ReadonlyArray<string>
207
+ }): void
208
+ /** Snapshot of the current column-pinning state. */
209
+ getColumnPinning(): { left: string[]; right: string[] }
210
+
211
+ // ----- Column reorder -----
212
+ /**
213
+ * Replace the column order. Pass an array of column ids in the
214
+ * desired visual order. Unknown ids are skipped; columns not in the
215
+ * array keep their existing relative position after the listed ones.
216
+ * Fires `onColumnOrderChange` once the new order is applied. Pin
217
+ * groups (`columnPinning.left` / `right`) are still applied on top.
218
+ */
219
+ setColumnOrder(order: ReadonlyArray<string>): void
220
+ /**
221
+ * Snapshot of the current visual column order - the same shape the
222
+ * `onColumnOrderChange` callback receives. Useful for saving and
223
+ * restoring a view layout.
224
+ */
225
+ getColumnOrder(): string[]
226
+
227
+ // ----- Row expansion -----
228
+ /**
229
+ * Set whether a row (group node or expandable leaf) is expanded.
230
+ * The `id` is the engine's row id - for grouped rows that's the
231
+ * synthetic group key (e.g. `"department:Engineering"`).
232
+ */
233
+ setRowExpanded(id: string, expanded: boolean): void
234
+ /** Expand every group node in the current grouped row model. */
235
+ expandAllGroups(): void
236
+ /** Collapse every expansion - resets expanded state to {}. */
237
+ collapseAllGroups(): void
238
+
239
+ // ----- Undo / redo -----
240
+ /** Undo the most recent inline-edit. Returns false when the history is empty. */
241
+ undo(): boolean
242
+ /** Redo the most recently undone edit. Returns false when the redo stack is empty. */
243
+ redo(): boolean
244
+ /** True when there's at least one step on the undo stack. */
245
+ canUndo(): boolean
246
+ /** True when there's at least one step on the redo stack. */
247
+ canRedo(): boolean
248
+ /** Wipe both stacks (e.g. after a server save commits the buffer). */
249
+ clearHistory(): void
250
+
251
+ // ----- Find in grid -----
252
+ /** Open the built-in find overlay (Ctrl+F also opens it). */
253
+ openFind(): void
254
+ /** Close the find overlay and clear the query. */
255
+ closeFind(): void
256
+ /** Update the find query programmatically (useful for app-wide command palettes). */
257
+ setFindQuery(q: string): void
258
+ /** Snapshot of the current find hits (rowIndex / colIndex / columnId). */
259
+ getFindHits(): Array<{ rowIndex: number; colIndex: number; columnId: string }>
260
+
261
+ // ----- Row selection (read + write) -----
262
+ /**
263
+ * The currently selected data rows (group-header rows excluded), in row-model
264
+ * order. Read once - no subscription. The push-based equivalent is
265
+ * `onRowSelectionChange`.
266
+ */
267
+ getSelectedRows(): TData[]
268
+ /** The engine row ids of the selected rows. Keys into the selection record. */
269
+ getSelectedRowIds(): string[]
270
+ /**
271
+ * Select rows by engine row id. By default this REPLACES the selection;
272
+ * pass `additive: true` to add to the existing selection instead.
273
+ */
274
+ selectRows(ids: ReadonlyArray<string>, additive?: boolean): void
275
+ /** Select every selectable (non-group) row in the current row model. */
276
+ selectAllRows(): void
277
+ /** Flip one row's selected state by id. */
278
+ toggleRowSelected(id: string): void
279
+
280
+ // ----- Pagination -----
281
+ /**
282
+ * Current pagination snapshot. `total` is the post-filter row count;
283
+ * `pageCount` is derived from it and `pageSize` (always >= 1).
284
+ */
285
+ getPageInfo(): {
286
+ pageIndex: number
287
+ pageSize: number
288
+ pageCount: number
289
+ total: number
290
+ }
291
+ /** Jump to a 0-based page. Clamped to [0, pageCount - 1]. */
292
+ setPage(pageIndex: number): void
293
+ /** Advance one page (no-op past the last page). */
294
+ nextPage(): void
295
+ /** Go back one page (no-op before the first page). */
296
+ prevPage(): void
297
+ /** Jump to the first page. */
298
+ firstPage(): void
299
+ /** Jump to the last page. */
300
+ lastPage(): void
301
+ /** Change the page size, keeping the first visible row in view. */
302
+ setPageSize(pageSize: number): void
303
+
304
+ // ----- Navigation / scrolling -----
305
+ /**
306
+ * Scroll the body so the given row index is at the top of the viewport.
307
+ * Works with virtualization on. Index is clamped to the row count.
308
+ */
309
+ scrollToRow(rowIndex: number): void
310
+ /** The active (focused) cell, or null when nothing is focused. */
311
+ getActiveCell(): { rowIndex: number; colIndex: number; columnId: string } | null
312
+ /** Move the active cell. Both coordinates are clamped to the grid bounds. */
313
+ setActiveCell(rowIndex: number, colIndex: number): void
314
+
315
+ // ----- View state (save / restore) -----
316
+ /**
317
+ * Serializable snapshot of the whole view - sort, grouping, pagination,
318
+ * column layout, and every filter surface. Pair with `setState` for
319
+ * "save view" / URL persistence / named views.
320
+ */
321
+ getState(): SvGridViewState
322
+ /**
323
+ * Restore a view from a (partial) snapshot produced by `getState`. Only the
324
+ * keys present are applied, so you can restore just the columns, just the
325
+ * filters, etc.
326
+ */
327
+ setState(state: Partial<SvGridViewState>): void
328
+ /** Force a recompute of the row pipeline + a re-render. */
329
+ refresh(): void
330
+ }
331
+
332
+ export type SvGridWrapperProps<
333
+ TFeatures extends TableFeatures,
334
+ TData extends RowData,
335
+ > = {
336
+ data: ReadonlyArray<TData>
337
+ columns: Array<ColumnDef<TFeatures, TData>>
338
+ /**
339
+ * Feature set from `tableFeatures({ ... })`. Optional - the `sortable` /
340
+ * `filterable` / `groupable` shortcuts inject the matching feature, so a
341
+ * grid can be configured from the boolean shortcuts alone.
342
+ */
343
+ features?: TFeatures
344
+ /**
345
+ * Capability shortcuts. Every capability is OFF by default (a bare grid is
346
+ * a plain read-only table); set a shortcut `true` to opt in.
347
+ *
348
+ * `sortable` - column sorting (injects `rowSortingFeature`)
349
+ * `filterable` - column filtering (injects `columnFilteringFeature`)
350
+ * `editable` - inline editing (alias of `enableInlineEditing`)
351
+ * `groupable` - grouping controls (alias of `showGroupingControls`)
352
+ * `pageable` - pagination footer (alias of `showPagination`)
353
+ */
354
+ sortable?: boolean
355
+ filterable?: boolean
356
+ editable?: boolean
357
+ groupable?: boolean
358
+ pageable?: boolean
359
+ options?: Partial<SvGridOptions<TFeatures, TData>>
360
+ loading?: boolean
361
+ error?: string | null
362
+ emptyMessage?: string
363
+ showGlobalFilter?: boolean
364
+ showColumnFilters?: boolean
365
+ showGroupingControls?: boolean
366
+ showRowSelection?: boolean
367
+ showPagination?: boolean
368
+ virtualization?: boolean
369
+ rowHeight?: number
370
+ overscan?: number
371
+ containerHeight?: number
372
+ columnVirtualization?: boolean
373
+ columnOverscan?: number
374
+ columnWidth?: number
375
+ showFilterMenu?: boolean
376
+ showFilterRow?: boolean
377
+ enableCellSelection?: boolean
378
+ enableInlineEditing?: boolean
379
+ enableRowSummaries?: boolean
380
+ /** Receives the imperative grid API when the component is ready. */
381
+ onApiReady?: (api: SvGridApi<TFeatures, TData>) => void
382
+ }