@gridkitjs/core 0.17.0 → 0.18.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.
@@ -0,0 +1,3703 @@
1
+ /**
2
+ * A row or column selection change by id — see
3
+ * `GridControllerOptions.onSelectionDiff`.
4
+ */
5
+ interface SelectionDiffEvent extends SelectionDiff {
6
+ /** Which selection changed. */
7
+ readonly target: "rows" | "columns";
8
+ /** The whole selection after the change. */
9
+ readonly selection: SelectionState;
10
+ }
11
+ /**
12
+ * What `createGridController` is given: the grid's options and selection
13
+ * callbacks, plus what a renderer supplies that is not a setting — the column
14
+ * definitions, whose templates name the renderer's own node type, the width
15
+ * the viewport measured, and a hook for its own selection feedback.
16
+ */
17
+ interface GridControllerOptions<Row, Node = string> extends GridOptions<Row>, SelectionCallbacks<Row, Node> {
18
+ /**
19
+ * The columns to show. Omitted or empty, one column is inferred per field
20
+ * of `dataSource` — see `defineColumnsFromRows`.
21
+ */
22
+ columns?: readonly ColumnDefinition<Row, Node>[] | undefined;
23
+ /**
24
+ * The width, in px, `resizeMode: "fit"` fills. `null` or absent before it
25
+ * has been measured, or where there is no viewport at all (an export in
26
+ * Node), and then columns keep their resolved widths.
27
+ */
28
+ viewportWidth?: number | null | undefined;
29
+ /**
30
+ * Called once per row or column selection change, after the selection
31
+ * callbacks, with the change by id — every id it added or removed,
32
+ * including those with no row on screen (on another page, in a collapsed
33
+ * group, filtered out), which the callbacks' resolved rows leave out. For a
34
+ * renderer's own feedback, such as a live region announcing how many rows
35
+ * are selected; an application reads the selection callbacks instead.
36
+ */
37
+ onSelectionDiff?: ((event: SelectionDiffEvent) => void) | undefined;
38
+ }
39
+ /**
40
+ * A grid without a renderer: its state, the view derived from it, and every
41
+ * action that changes it. A renderer creates one per grid, hands it the
42
+ * current options on each update, draws `getView()` and calls the actions
43
+ * from its event handlers, so no renderer decides anything the user can see.
44
+ *
45
+ * Each slice of `GridState` is controlled or not on its own, the way a form
46
+ * input is: given as an option (`columnSort`), the grid shows that value and
47
+ * an action only asks for a change through the slice's callback
48
+ * (`onColumnSortChange`); left out, the controller keeps the slice itself,
49
+ * starting from its default (`defaultColumnSort`).
50
+ *
51
+ * Every action follows the same steps: work out the next value; stop if it
52
+ * is the very object the slice already holds; keep it, unless the slice is
53
+ * controlled; report it through the slice's callback; then, if the state
54
+ * changed, call every subscriber, synchronously. A controlled slice's state
55
+ * changes only when the next `setOptions` carries the value, so an action on
56
+ * it reports without calling subscribers. The setters (`setColumnSort` and the like) also
57
+ * stop for a value equal to the current one, so restoring what is already
58
+ * there reports nothing.
59
+ *
60
+ * Every member is a plain function bound to its grid, safe to hand around on
61
+ * its own — `onClick={controller.nextPage}`.
62
+ */
63
+ interface GridController<Row, Node = string> {
64
+ readonly getOptions: () => GridControllerOptions<Row, Node>;
65
+ /**
66
+ * Replaces the options, as a renderer does with its current props on every
67
+ * update; calling it again with equal options changes nothing. A controlled
68
+ * slice takes its new value from here.
69
+ *
70
+ * Does not call subscribers: a renderer calls this while it updates, and
71
+ * draws the result itself — a subscriber called mid-update would update
72
+ * mid-update too. A renderer that also tells other listeners about it does
73
+ * so once its update is done.
74
+ */
75
+ readonly setOptions: (options: GridControllerOptions<Row, Node>) => void;
76
+ /** Every slice as the grid now applies it. The same object until a slice changes. */
77
+ readonly getState: () => GridState<Row>;
78
+ /** What the user is looking at — see `resolveGridView`. The same object until something in it changes. */
79
+ readonly getView: () => GridView<Row, Node>;
80
+ /**
81
+ * Calls `listener` after each action that changed the state, so
82
+ * `getState()` returns a new object whenever it runs. Returns the function
83
+ * that unsubscribes it.
84
+ */
85
+ readonly subscribe: (listener: () => void) => () => void;
86
+ /**
87
+ * Puts back state saved earlier — from `getState()`, or from
88
+ * `serializeGridState` and back through JSON. Every slice given is set as
89
+ * its own `set*` action would set it, so each that changes fires its
90
+ * callback and a controlled one only asks; slices left out keep their value.
91
+ * Subscribers are called once, after every slice is in place, if any
92
+ * changed, and a
93
+ * restored pagination is kept even when the same call changed the sort,
94
+ * filter or grouping that would otherwise send it back to the first page.
95
+ * A slice that throws stops the restore there, after the slices before it
96
+ * are shown, reported and announced as above.
97
+ *
98
+ * Saved state is read by its `version`. One without a version, saved
99
+ * before the field existed, still restores: a `groupExpansion` saved as a
100
+ * bare list of group ids, as GridKit saved it before the slice carried a
101
+ * mode, restores as `allExpanded` with those ids as the exceptions. A
102
+ * version newer than this release reads throws before any slice is set.
103
+ */
104
+ readonly restoreState: (saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>) => void;
105
+ /**
106
+ * Replaces the column widths. Reported through `onColumnSizingChange` as the
107
+ * `"end"` of a resize of the first column whose width changed, at its new
108
+ * width — or, when its entry was removed, the width its definition gives
109
+ * it. Equal widths report nothing.
110
+ */
111
+ readonly setColumnSizing: (sizing: ColumnSizingState) => void;
112
+ /**
113
+ * Sets one column's width, as a resize gesture does: `"move"` while the
114
+ * gesture lasts, `"end"` once it is over. Never skipped for an unchanged
115
+ * width, so a drag held against a column's minimum still reports every
116
+ * move.
117
+ */
118
+ readonly resizeColumn: (columnId: string, width: number, phase: "move" | "end") => void;
119
+ /**
120
+ * Ends a resize gesture by putting its column back as it was when the
121
+ * gesture began — `startSizing` is the sizing state then, `startWidth` the
122
+ * width the column was drawn at — keeping any other column's change made in
123
+ * the meantime. Reported as the gesture's `"end"`, at `startWidth`.
124
+ */
125
+ readonly cancelColumnResize: (columnId: string, startSizing: ColumnSizingState, startWidth: number) => void;
126
+ /**
127
+ * Replaces the column order. Reported through `onColumnOrderChange` naming
128
+ * the first column whose position changed; an equal order reports nothing.
129
+ */
130
+ readonly setColumnOrder: (order: ColumnOrderState) => void;
131
+ /**
132
+ * Moves a column in front of `beforeId`, or to the end when that is
133
+ * `null`, among every column — hidden ones keep their place. A move that
134
+ * changes nothing reports nothing.
135
+ */
136
+ readonly moveColumn: (columnId: string, beforeId: string | null) => void;
137
+ /**
138
+ * Replaces the column visibility state. Reported through
139
+ * `onColumnVisibilityChange` with every column whose entry changed; an
140
+ * equal state reports nothing.
141
+ */
142
+ readonly setColumnVisibility: (visibility: ColumnVisibilityState) => void;
143
+ /** Shows the given columns, each in the place it held when hidden. One report for the whole call. */
144
+ readonly showColumns: (columnIds: readonly string[]) => void;
145
+ /** Hides the given columns. A hidden column still sorts, filters and groups. */
146
+ readonly hideColumns: (columnIds: readonly string[]) => void;
147
+ /**
148
+ * Replaces the filter. Reported through `onFilterChange`; a filter equal to
149
+ * the current one — the same entries in the same order, a `Date` value
150
+ * compared by time and a predicate by identity — reports nothing.
151
+ */
152
+ readonly setFilter: (filter: FilterState<Row>) => void;
153
+ /**
154
+ * Replaces the selected row ids as given, whatever `selectable` allows —
155
+ * the way a controlled or default value is applied. The same ids in the
156
+ * same order report nothing.
157
+ */
158
+ readonly setRowSelection: (selection: SelectionState) => void;
159
+ /**
160
+ * Selects rows as a user could, within what `selectable.rows` allows:
161
+ * `"replace"` (the default) selects exactly these — only the last of them
162
+ * under `"single"` — and `"toggle"` flips each one. An id need not name a
163
+ * row on screen. A call that leaves the selection as it was reports
164
+ * nothing.
165
+ */
166
+ readonly selectRows: (rowIds: readonly string[], intent?: "replace" | "toggle") => void;
167
+ /**
168
+ * Applies one click or key press to a row: `"replace"`, `"toggle"` or
169
+ * `"range"` from the last row selected by anything but a range, across
170
+ * the data rows on the current page. That anchor goes when the selection is
171
+ * cleared or replaced, or its row leaves the page; a range without one
172
+ * selects just this row and anchors there.
173
+ */
174
+ readonly selectRow: (rowId: string, intent: SelectIntent) => void;
175
+ /** Selects every data row on the current page, when `selectable.rows` is `"multiple"`. */
176
+ readonly selectAllRows: () => void;
177
+ /**
178
+ * Lets go of every row, column and cell selection at once, as Escape does:
179
+ * one change, so each selection that changes fires its callback and then
180
+ * subscribers are called once, if the state changed.
181
+ */
182
+ readonly clearSelection: () => void;
183
+ /** Replaces the selected column ids as given — see `setRowSelection`. */
184
+ readonly setColumnSelection: (selection: SelectionState) => void;
185
+ /** `selectRow`, for a column among the columns as rendered. */
186
+ readonly selectColumn: (columnId: string, intent: SelectIntent) => void;
187
+ /** Replaces the cell selection as given, `{ kind: "none" }` for none. */
188
+ readonly setCellSelection: (selection: CellSelectionState) => void;
189
+ /**
190
+ * Applies one click or key press to a cell: `"toggle"` lets go of it when
191
+ * it is the one selected; anything else selects it. A cell holds one value,
192
+ * so a range over cells reads as a plain click.
193
+ */
194
+ readonly selectCell: (cell: SelectedCellRef, intent: SelectIntent) => void;
195
+ /**
196
+ * Replaces the sort. Reported through `onColumnSortChange` naming the
197
+ * first column whose place or direction changed; a sort equal to the
198
+ * current one changes nothing and reports nothing.
199
+ */
200
+ readonly setColumnSort: (sort: ColumnSortState) => void;
201
+ /**
202
+ * Cycles a column's sort, as its header toggle does: ascending, descending,
203
+ * off. `stack` adds it to the sort rather than replacing the sort with it.
204
+ */
205
+ readonly toggleColumnSort: (columnId: string, options?: {
206
+ readonly stack?: boolean | undefined;
207
+ }) => void;
208
+ /**
209
+ * Takes one column out of the sort, keeping the rest in their order, and
210
+ * reports naming that column — which `setColumnSort` without it would not
211
+ * when it was the first key, naming instead the key that moved up. A
212
+ * column the sort leaves out already reports nothing.
213
+ */
214
+ readonly clearColumnSort: (columnId: string) => void;
215
+ /**
216
+ * Replaces the group-by stack. Reported through `onGroupByChange` naming
217
+ * the first level that changed; an equal stack reports nothing.
218
+ */
219
+ readonly setGroupBy: (groupBy: GroupByState) => void;
220
+ /** Adds a column to the end of the group-by stack, or removes it if it is already there. */
221
+ readonly toggleGroupBy: (columnId: string) => void;
222
+ /**
223
+ * Puts a column into the group-by stack in front of `beforeColumnId`, or at
224
+ * the end when that is `null` — adding it, or moving it if it is already
225
+ * there.
226
+ */
227
+ readonly moveGroupBy: (columnId: string, beforeColumnId: string | null) => void;
228
+ /**
229
+ * Replaces which groups are expanded. Reported with `groupId: null`, as a
230
+ * change to every group at once; the same mode with the same exceptions
231
+ * in the same order reports nothing.
232
+ */
233
+ readonly setGroupExpansion: (expansion: GroupExpansionState) => void;
234
+ /** Expands a collapsed group or collapses an expanded one — see `toggleGroupExpansion`. */
235
+ readonly toggleGroupExpansion: (groupId: string) => void;
236
+ /** Expands every group, including those that appear later — see `expandAllGroups`. */
237
+ readonly expandAllGroups: () => void;
238
+ /**
239
+ * Collapses every group, including one under a collapsed ancestor and
240
+ * those that appear later — see `collapseAllGroups`.
241
+ */
242
+ readonly collapseAllGroups: () => void;
243
+ /**
244
+ * Replaces the page and page size. A controlled pagination asks for them
245
+ * as given and the view clamps a page past the last one; an uncontrolled
246
+ * one stores and reports that page clamped. An equal pagination reports
247
+ * nothing.
248
+ */
249
+ readonly setPagination: (pagination: PaginationState) => void;
250
+ /**
251
+ * Moves to the given page, clamped into range. A page that clamps to the
252
+ * current one reports nothing.
253
+ */
254
+ readonly goToPage: (pageIndex: number) => void;
255
+ /** Moves one page on; on the last page it does nothing and reports nothing. */
256
+ readonly nextPage: () => void;
257
+ /** Moves one page back; on the first page it does nothing and reports nothing. */
258
+ readonly previousPage: () => void;
259
+ /**
260
+ * Changes the page size and goes back to the first page. The current size,
261
+ * already on the first page, reports nothing.
262
+ */
263
+ readonly setPageSize: (pageSize: number) => void;
264
+ }
265
+
266
+ /** How a column's values compare, which decides what an operand must be. */
267
+ type ValueKind = "number" | "boolean" | "date" | "text";
268
+
269
+ /**
270
+ * The kind of value a column filters as — what decides which conditions a
271
+ * filter menu offers on it, how their operators read, and what a typed
272
+ * operand must be.
273
+ */
274
+ type FilterOperatorFamily = ValueKind;
275
+ /**
276
+ * The family a column of `type` falls in: `"number"` for the numeric
277
+ * types, `"date"` for date, date-time and time, `"boolean"`, and `"text"`
278
+ * for everything else. It is the filter engine's own reading of `type`, so
279
+ * a menu never offers a condition the column would compare differently.
280
+ */
281
+ declare function filterOperatorFamily(type: ColumnType | undefined): FilterOperatorFamily;
282
+ /**
283
+ * The conditions a filter menu offers on a column of `type`, in the order it
284
+ * lists them, unless the column names its own. Never `in`: a list of values
285
+ * is the checklist's to pick, not a condition's to type.
286
+ */
287
+ declare function defaultFilterOperators(type: ColumnType | undefined): readonly FilterOperator[];
288
+ /**
289
+ * How many operands `operator` takes — how many inputs a condition row
290
+ * shows: none for the blanks, `between`'s two ends, one for the rest. `in`
291
+ * takes one list, which only a checklist writes.
292
+ */
293
+ declare function filterOperandArity(operator: FilterOperator): 0 | 1 | 2;
294
+ /**
295
+ * The operand a condition input's `text` stands for on a column of `type`,
296
+ * read as the column filters — or `undefined` when the text is empty or
297
+ * doesn't read as one, which an editor shows as a value still to fix.
298
+ *
299
+ * - Text is kept as typed, spaces and all.
300
+ * - A number reads with a point for decimals, as a number input gives it:
301
+ * `"12abc"` and `"1,5"` read as nothing rather than as a guess.
302
+ * - A date reads as a date input gives it, `yyyy-mm-dd`, at that day's
303
+ * local midnight; or as a date-time input does, `yyyy-mm-ddThh:mm`, at
304
+ * that local time.
305
+ * - A boolean reads `"true"` or `"false"`.
306
+ */
307
+ declare function parseFilterOperand(text: string, type: ColumnType | undefined): Exclude<FilterScalar, null> | undefined;
308
+ /**
309
+ * The text a condition input shows for `value` — `parseFilterOperand`'s
310
+ * inverse, for opening a condition already applied. A date reads back in
311
+ * the form its column's input takes: the day alone on a `"date"` column,
312
+ * the day and time on a `"dateTime"` or `"time"` one. A blank operand is
313
+ * empty, and one that isn't a date on a date column — a string set in code
314
+ * that names none — shows as it is, for the user to fix.
315
+ */
316
+ declare function formatFilterOperand(value: FilterScalar | undefined, type: ColumnType | undefined): string;
317
+
318
+ /** The locale(s) values are formatted for — `undefined` is the runtime's own. */
319
+ type FormatLocale = string | readonly string[] | undefined;
320
+ /**
321
+ * The text a value reads as in `column` — what a cell shows when the column
322
+ * has no `cellTemplate`, and what an export or a print writes, so the two
323
+ * cannot disagree.
324
+ *
325
+ * A `valueFormatter` decides outright. `null`/`undefined` read `""`, a
326
+ * boolean `"true"`/`"false"` — or `messages.booleanTrue`/`booleanFalse`
327
+ * when given, for a grid speaking another language — a string as it is, a
328
+ * plain object or array as JSON.
329
+ *
330
+ * Dates and numbers are formatted through `Intl` only once asked to — the
331
+ * column has a `format`, or a `locale` is given. Until then they print as a
332
+ * grid always printed them, so adopting this changes nothing on screen: a
333
+ * `Date` through `toLocaleString()`, a number as-is (`1234.5`, never
334
+ * `1,234.5`). Once asked:
335
+ *
336
+ * - A `Date` → `Intl.DateTimeFormat`: the date alone under `"date"`, the time
337
+ * alone under `"time"`, both otherwise.
338
+ * - A number under a numeric `type` → `Intl.NumberFormat`: `"currency"` with
339
+ * a currency symbol once `format.currency` names one (two fraction digits
340
+ * until then), `"percent"` reading `0.25` as 25 %. Under any other type it
341
+ * is still printed as-is, the way a number id should be.
342
+ *
343
+ * `format` and `locale` go to the `Intl` constructor unchanged, so any
344
+ * option it accepts is honoured.
345
+ */
346
+ declare function formatCellValue<Row>(value: unknown, column: ColumnDefinition<Row, unknown>, locale?: FormatLocale, row?: Row, messages?: Pick<GridMessages, "booleanTrue" | "booleanFalse">): string;
347
+ /**
348
+ * The text an aggregate result reads as — a footer cell, a group's subtotal
349
+ * — through `formatCellValue`, so once a `format` or `locale` asks for it a
350
+ * `sum` of a currency column reads as currency and a `max` of a date column
351
+ * as a date. `column` is `undefined` for a spec naming a column the grid
352
+ * does not have, which then formats by its value alone.
353
+ *
354
+ * Until then a numeric result reads through `toLocaleString()`, with digit
355
+ * grouping, where a cell prints its number as-is: that is how a grid has
356
+ * always shown its totals, and a sum easily runs into the thousands.
357
+ */
358
+ declare function formatAggregateValue<Row>(value: unknown, spec: AggregateSpec<Row>, column: ColumnDefinition<Row, unknown> | undefined, locale?: FormatLocale): string;
359
+ /**
360
+ * The text a group's own value reads as — a group header's name, and the
361
+ * label an export writes for it: as the grouped column's cells read it,
362
+ * except that a missing value reads `messages.blankGroupValue` ("(blank)"),
363
+ * since an empty label would leave the group looking unnamed rather than
364
+ * named "nothing".
365
+ */
366
+ declare function formatGroupValue<Row>(value: unknown, column: ColumnDefinition<Row, unknown>, locale: FormatLocale, messages: Pick<GridMessages, "booleanTrue" | "booleanFalse" | "blankGroupValue">): string;
367
+
368
+ /**
369
+ * Every string a grid shows or announces of its own — the pager, the group-by
370
+ * bar, the loading row, the text of a boolean or missing value, the labels of
371
+ * its built-in commands, the names of its menus, toolbar and column chooser,
372
+ * and the live-region
373
+ * announcements — so a grid can
374
+ * speak a language other than English. A message that names something takes
375
+ * a function, so a translation can put the name where its own grammar wants
376
+ * it.
377
+ *
378
+ * Text the data supplies (cells, headers, labels) is not here: it is already
379
+ * the app's to choose. Nor is formatting — dates and numbers follow
380
+ * `locale`, and so do the counts the defaults print: "1,204 of 10,000 rows"
381
+ * under `"en"`, "1.204 of 10.000 rows" under `"de-DE"`.
382
+ *
383
+ * A minor release may add keys. The `messages` option takes a partial set
384
+ * laid over the defaults, so a translation without a new key shows its
385
+ * English default until it gains one.
386
+ */
387
+ interface GridMessages {
388
+ /** The pager's accessible name. */
389
+ pagerLabel: string;
390
+ /** The pager button to the first page; drawn as an icon, so this is its accessible name. */
391
+ firstPage: string;
392
+ /** The pager button to the previous page; its accessible name. */
393
+ previousPage: string;
394
+ /** The pager button to the next page; its accessible name. */
395
+ nextPage: string;
396
+ /** The pager button to the last page; its accessible name. */
397
+ lastPage: string;
398
+ /** The page-size control's label. */
399
+ pageSizeLabel: string;
400
+ /** A numbered pager button's accessible name. */
401
+ pageButtonLabel: (page: number) => string;
402
+ /**
403
+ * The compact pager's status, and what a page change announces. `page`
404
+ * counts from one, and is `0` while there are no pages.
405
+ */
406
+ pageStatus: (page: number, pageCount: number) => string;
407
+ /** The row shown while `infiniteScroll` loads more. */
408
+ loadingMore: string;
409
+ /** A boolean cell's text. */
410
+ booleanTrue: string;
411
+ booleanFalse: string;
412
+ /** What a group header names a group of missing values. */
413
+ blankGroupValue: string;
414
+ /** The group-by bar's accessible name. */
415
+ groupByBarLabel: string;
416
+ /** Shown in an empty group-by bar a header can be dragged into. */
417
+ groupByBarPlaceholder: string;
418
+ /** A group-by chip's accessible name. `level` counts from one. */
419
+ groupByChipLabel: (columnName: string, level: number, levelCount: number) => string;
420
+ /** A group-by chip's remove button's accessible name. */
421
+ removeGroupBy: (columnName: string) => string;
422
+ /** Announced when a resize ends, `width` in whole pixels. */
423
+ columnResized: (columnName: string, width: number) => string;
424
+ /** Announced when a column is moved. `position` counts from one. */
425
+ columnMoved: (columnName: string, position: number, columnCount: number) => string;
426
+ /** Announced when a column is sorted. `key` is its place in the sort, from one. */
427
+ columnSorted: (columnName: string, direction: SortDirection, key: number, keyCount: number) => string;
428
+ /** Announced when a column leaves the sort. */
429
+ sortCleared: (columnName: string) => string;
430
+ /** Announced when a column is grouped by. `level` counts from one. */
431
+ groupedBy: (columnName: string, level: number, levelCount: number) => string;
432
+ /** Announced when a column leaves the grouping. */
433
+ groupingRemoved: (columnName: string) => string;
434
+ groupExpanded: string;
435
+ groupCollapsed: string;
436
+ allGroupsExpanded: string;
437
+ allGroupsCollapsed: string;
438
+ /** Announced when one change selects or deselects more than one row or column. */
439
+ selectedCount: (count: number, target: "rows" | "columns") => string;
440
+ /** Announced when a cell is selected. `rowNumber` counts from one. */
441
+ cellSelected: (columnName: string, rowNumber: number) => string;
442
+ /** Announced when one column is hidden. */
443
+ columnHidden: (columnName: string) => string;
444
+ /** Announced when one column is shown. */
445
+ columnShown: (columnName: string) => string;
446
+ /** Announced when one change hides more than one column. */
447
+ columnsHidden: (count: number) => string;
448
+ /** Announced when one change shows more than one column. */
449
+ columnsShown: (count: number) => string;
450
+ /**
451
+ * Announced when one action autofits more than one column, as
452
+ * `column.autoFitAll` does, in place of each column's `columnResized`.
453
+ */
454
+ columnsAutoFitted: (count: number) => string;
455
+ /** A column header's context menu's accessible name. */
456
+ headerMenuLabel: (columnName: string) => string;
457
+ /** A data cell's context menu's accessible name — a menu for its row. */
458
+ cellMenuLabel: string;
459
+ /** A group header row's context menu's accessible name. */
460
+ groupMenuLabel: string;
461
+ /** The accessible name of the menu in the body's empty space. */
462
+ bodyMenuLabel: string;
463
+ /** The built-in `sort.ascending` command's label. */
464
+ sortAscending: string;
465
+ sortDescending: string;
466
+ /** `sort.clear`: takes one column out of the sort. */
467
+ clearSort: string;
468
+ /** `sort.clearAll` */
469
+ clearAllSorting: string;
470
+ /** `group.add`, naming the column it groups by. */
471
+ groupByColumn: (columnName: string) => string;
472
+ /** `group.clearAll`. `group.remove` reads `removeGroupBy`, as the group-by chip's button does. */
473
+ ungroupAll: string;
474
+ expandAllGroups: string;
475
+ collapseAllGroups: string;
476
+ /** `column.hide` */
477
+ hideColumn: string;
478
+ /** `column.autoFit`: sizes the column to its content. */
479
+ autoFitColumn: string;
480
+ autoFitAllColumns: string;
481
+ /** `selection.selectAllRows` */
482
+ selectAllRows: string;
483
+ /** `selection.clear` */
484
+ clearSelection: string;
485
+ /** `filter.clearAll`, which clears the search too. */
486
+ clearFilters: string;
487
+ /** `column.choose`, which opens the column chooser. */
488
+ chooseColumns: string;
489
+ /** The toolbar's accessible name, unless its `label` gives one. */
490
+ toolbarLabel: string;
491
+ /** The toolbar's search box's accessible name. */
492
+ searchLabel: string;
493
+ /** Shown in the toolbar's empty search box. */
494
+ searchPlaceholder: string;
495
+ /** The toolbar's "More" button, holding the items that do not fit. */
496
+ moreToolbarItems: string;
497
+ /** Announced when a search settles: how many rows it found. */
498
+ searchResults: (count: number) => string;
499
+ /** The column chooser's accessible name. */
500
+ columnChooserLabel: string;
501
+ /** The column chooser's search box's accessible name. */
502
+ columnChooserSearchLabel: string;
503
+ /** The column chooser's checkbox showing or hiding every column its search lists. */
504
+ showAllColumns: string;
505
+ /** Shown in the column chooser when its search matches no column. */
506
+ noMatchingColumns: string;
507
+ /**
508
+ * A condition's operator, as a filter menu lists it. `family` is the
509
+ * column's (`filterOperatorFamily`), so a date can read `lt` as "Before"
510
+ * where a number reads "Less than".
511
+ */
512
+ filterOperatorLabel: (operator: FilterOperator, family: FilterOperatorFamily) => string;
513
+ /** A filter checklist's item for the column's blank cells. */
514
+ filterBlanks: string;
515
+ /**
516
+ * Shown in place of a filter checklist whose column holds more values
517
+ * than `filterMenu.valueLimit`, until something is searched.
518
+ */
519
+ filterSearchFirst: (total: number) => string;
520
+ /** Shown under a searched filter checklist `filterMenu.valueLimit` cut short: how many matches it left out. */
521
+ filterMoreValues: (count: number) => string;
522
+ /** `filter.open`, which opens a column's filter menu. */
523
+ openFilter: string;
524
+ /** `filter.clear`, and the filter menu's button doing the same: clears one column's filter. */
525
+ clearColumnFilter: string;
526
+ /** A column's filter menu's accessible name. */
527
+ filterMenuLabel: (columnName: string) => string;
528
+ /** What a column header is described as while its column is filtered. */
529
+ columnFiltered: string;
530
+ /** The filter menu's button applying what it holds. */
531
+ applyFilter: string;
532
+ /** The filter menu's button closing it without applying. */
533
+ cancelFilter: string;
534
+ /**
535
+ * Shown in a filter menu for a filter its editor cannot show — a
536
+ * predicate, a text query, a group across columns — which applying
537
+ * replaces.
538
+ */
539
+ customFilter: string;
540
+ /** Announced when a filter menu applies: how many rows the filter keeps, of how many. */
541
+ filterResults: (shown: number, total: number) => string;
542
+ /** The accessible name of one of a filter menu's conditions. `position` counts from one. */
543
+ filterConditionLabel: (position: number) => string;
544
+ /** The accessible name of a condition's operator picker. */
545
+ filterOperatorFieldLabel: string;
546
+ /** The accessible name of a condition's value box. */
547
+ filterValueLabel: string;
548
+ /** The accessible name of a `between` condition's first value box, its lower end. */
549
+ filterFromLabel: string;
550
+ /** The accessible name of a `between` condition's second value box, its upper end. */
551
+ filterToLabel: string;
552
+ /** The accessible name of the choice joining a filter menu's two conditions. */
553
+ filterCombinatorLabel: string;
554
+ /** Joins two conditions: a row has to meet both. */
555
+ filterAnd: string;
556
+ /** Joins two conditions: a row has to meet either. */
557
+ filterOr: string;
558
+ /**
559
+ * Shown under a filter menu's conditions when one's value is missing or
560
+ * doesn't read as its column's `family` (`filterOperatorFamily`) — "Enter
561
+ * a number" on a number column.
562
+ */
563
+ filterValueInvalid: (family: FilterOperatorFamily) => string;
564
+ /** The accessible name of a filter checklist's search box. */
565
+ filterSearchLabel: string;
566
+ /** The checkbox above a filter checklist checking every value its search shows. */
567
+ filterSelectAll: string;
568
+ /** The accessible name of a filter checklist's list of values. */
569
+ filterValuesLabel: string;
570
+ /**
571
+ * Shown above a filter checklist whose column is filtered by conditions,
572
+ * which checking values replaces.
573
+ */
574
+ filterByCondition: string;
575
+ /**
576
+ * The excel editor's button opening the conditions its column offers, and
577
+ * that menu's accessible name — "Number filters" on a number column, by
578
+ * its `family` (`filterOperatorFamily`).
579
+ */
580
+ filterOperatorMenu: (family: FilterOperatorFamily) => string;
581
+ /** The button taking the excel editor from a condition back to its checklist. */
582
+ filterBackToValues: string;
583
+ /** The toolbar's `"export"` dropdown, listing the export commands. */
584
+ exportMenu: string;
585
+ /** `export.csv` */
586
+ exportCsv: string;
587
+ /** `export.json` */
588
+ exportJson: string;
589
+ /** `export.xlsx`, shown once an xlsx writer is registered. */
590
+ exportXlsx: string;
591
+ /** `export.pdf`, shown once a PDF writer is registered. */
592
+ exportPdf: string;
593
+ /** `exportSelection.csv`: the selected rows only. */
594
+ exportSelectionCsv: string;
595
+ /** `exportSelection.json` */
596
+ exportSelectionJson: string;
597
+ /** `exportSelection.xlsx` */
598
+ exportSelectionXlsx: string;
599
+ /**
600
+ * Announced when an export's writer fails or the browser refuses its
601
+ * download, so no file is saved.
602
+ */
603
+ exportFailed: string;
604
+ /** `copy.cell` */
605
+ copyCell: string;
606
+ /** `copy.row` */
607
+ copyRow: string;
608
+ /** `copy.selection` */
609
+ copySelection: string;
610
+ /** Announced once a copy is on the clipboard. */
611
+ copied: (count: number, unit: "cells" | "rows" | "columns") => string;
612
+ /** Announced when the browser refuses the clipboard, so nothing was copied. */
613
+ copyFailed: string;
614
+ /** `print` */
615
+ print: string;
616
+ /** Announced when the browser fails to print, so nothing is printed. */
617
+ printFailed: string;
618
+ }
619
+ /**
620
+ * The grid's own English, its counts printed in `locale`'s digits —
621
+ * "1,204 of 10,000 rows" under `"en"`, "1.204 of 10.000 rows" under
622
+ * `"de-DE"`. Without a locale, the runtime's own; that one is
623
+ * `defaultMessages`.
624
+ */
625
+ declare function createDefaultMessages(locale?: FormatLocale): GridMessages;
626
+ /** The grid's own English, which `messages` replaces key by key. */
627
+ declare const defaultMessages: GridMessages;
628
+ /**
629
+ * `messages` over the defaults for `locale` — every key the grid needs,
630
+ * whichever the caller gave, the defaults counting in `locale`'s digits. The
631
+ * defaults themselves, same object for the same locale, when it gave none, so
632
+ * a renderer memoising on the result does not see a change that is not one.
633
+ */
634
+ declare function resolveMessages(messages: Partial<GridMessages> | undefined, locale?: FormatLocale): GridMessages;
635
+
636
+ /**
637
+ * A value an export stores as it is rather than as text — what a cell's
638
+ * `ExportCell.value` holds and a column's `exportValue` returns. Narrow on
639
+ * purpose: these are the kinds every format has a reading for (a spreadsheet
640
+ * number, date or boolean cell; a JSON scalar), so nothing a writer cannot
641
+ * represent reaches it.
642
+ */
643
+ type ExportScalar = string | number | boolean | Date | null;
644
+ /**
645
+ * One cell of an export, in both of its readings. `text` is what the grid
646
+ * shows — CSV, the clipboard and print write it, so a file reads as the
647
+ * screen does. `value` is the typed value a spreadsheet stores, so a number
648
+ * stays a number a formula can sum rather than text that looks like one.
649
+ */
650
+ interface ExportCell {
651
+ readonly value: ExportScalar;
652
+ readonly text: string;
653
+ }
654
+ /**
655
+ * A column of an export, settled once so that no writer reads a column
656
+ * definition for itself. `type` and `format` pass through for a writer that
657
+ * keeps typed values, which derives its own number or date format from them.
658
+ */
659
+ interface ExportColumn {
660
+ readonly id: string;
661
+ /** The column's name as text — `resolveColumnHeaderText`, never markup. */
662
+ readonly header: string;
663
+ /** The column's `type`, `"string"` when it has none. */
664
+ readonly type: ColumnType;
665
+ readonly format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | undefined;
666
+ /** How the column's cells align, after falling back to its type. */
667
+ readonly alignment: ColumnAlignment;
668
+ /** Width in px: as rendered for a visible column, as it would start for a hidden one. */
669
+ readonly width: number;
670
+ }
671
+ /** One row of data: a cell per `ExportTable.columns` entry, in that order. */
672
+ interface ExportDataRow {
673
+ readonly kind: "data";
674
+ readonly rowId: string;
675
+ readonly cells: readonly ExportCell[];
676
+ }
677
+ /**
678
+ * A group header. `label` is the header's text, `"Region: West"`; `cells`
679
+ * holds the group's aggregates under their own columns when the grid shows
680
+ * them inline in the header, and is empty text elsewhere — a cell per
681
+ * column either way, so a writer can lay it out like any other row.
682
+ */
683
+ interface ExportGroupRow {
684
+ readonly kind: "group";
685
+ /** Nesting depth, 0 for a top-level group. */
686
+ readonly level: number;
687
+ readonly groupId: string;
688
+ readonly label: string;
689
+ /** Data rows under this group, at every depth. */
690
+ readonly count: number;
691
+ readonly cells: readonly ExportCell[];
692
+ }
693
+ /**
694
+ * A group's aggregates as a row of their own, after everything in the group
695
+ * — present where the grid shows them that way (`groupAggregateDisplay:
696
+ * "row"`), and at the same `level` as its group.
697
+ */
698
+ interface ExportGroupSummaryRow {
699
+ readonly kind: "groupSummary";
700
+ readonly level: number;
701
+ readonly cells: readonly ExportCell[];
702
+ }
703
+ /**
704
+ * A body row of an export, in the order the grid shows them. Discriminate on
705
+ * `kind`; a minor release may add a kind, so a writer's `switch` over it
706
+ * needs a `default`.
707
+ */
708
+ type ExportRow = ExportDataRow | ExportGroupRow | ExportGroupSummaryRow;
709
+ /**
710
+ * The grand total — every aggregate over the exported rows. Its own kind
711
+ * rather than an `ExportRow`, since it only ever stands in
712
+ * `ExportTable.footer`, never among the body rows.
713
+ */
714
+ interface ExportTotalRow {
715
+ readonly kind: "total";
716
+ readonly cells: readonly ExportCell[];
717
+ }
718
+ /**
719
+ * What an export writes, whatever the format: the grid's view as data,
720
+ * built by `buildExportTable` from the controller's view and state and
721
+ * never from the page. Every serialiser and writer reads this one shape, so
722
+ * a file, the clipboard and a print cannot disagree.
723
+ */
724
+ interface ExportTable {
725
+ readonly columns: readonly ExportColumn[];
726
+ /** Whether a header row of column names leads the output. */
727
+ readonly header: boolean;
728
+ readonly rows: readonly ExportRow[];
729
+ /** The grand total, or `null` when there are no aggregates to total. */
730
+ readonly footer: ExportTotalRow | null;
731
+ }
732
+ /**
733
+ * Narrows what an export holds. Every field defaults to what the user sees,
734
+ * with nothing hidden by paging or a collapsed group.
735
+ */
736
+ interface ExportOptions {
737
+ /**
738
+ * Which rows: `"all"` (the default) every row the filter, search and sort
739
+ * leave, across every page; `"page"` the data rows on the current page;
740
+ * `"selection"` the selected rows among those `"all"` holds.
741
+ */
742
+ readonly scope?: "all" | "page" | "selection" | undefined;
743
+ /**
744
+ * Which columns: `"visible"` (the default) those shown, in their current
745
+ * order; `"all"` hidden ones too; or a list of column ids, in that order.
746
+ * A column with `exportable: false` is left out of every one.
747
+ */
748
+ readonly columns?: "visible" | "all" | readonly string[] | undefined;
749
+ /**
750
+ * Whether a grouped grid exports its group header rows, every group
751
+ * expanded whatever its state on screen. Defaults to `true`; `false`
752
+ * keeps the rows in grouped order without the headers.
753
+ */
754
+ readonly includeGroups?: boolean | undefined;
755
+ /** Whether group aggregates and the grand total are exported. Defaults to `true`. */
756
+ readonly includeAggregates?: boolean | undefined;
757
+ /** Whether a header row of column names leads the output. Defaults to `true`. */
758
+ readonly includeHeader?: boolean | undefined;
759
+ }
760
+
761
+ /**
762
+ * What an export is built from: the grid's view and state as a controller
763
+ * holds them, never the page — so rows virtualised, paged or scrolled out of
764
+ * sight still export. Typed as the few fields it reads, so a
765
+ * `GridCommandContext` is one as it stands.
766
+ */
767
+ interface ExportSource<Row> {
768
+ readonly view: GridView<Row, unknown>;
769
+ readonly state: Pick<GridState<Row>, "groupBy" | "rowSelection" | "columnSizing">;
770
+ readonly options: {
771
+ readonly locale?: FormatLocale;
772
+ readonly aggregates?: AggregateState<Row> | undefined;
773
+ readonly groupAggregateDisplay?: GroupAggregateDisplay | undefined;
774
+ readonly columnSizeDefaults?: Partial<ColumnSizeDefaults> | undefined;
775
+ };
776
+ readonly messages: Pick<GridMessages, "booleanTrue" | "booleanFalse" | "blankGroupValue">;
777
+ }
778
+ /**
779
+ * The grid's view as an `ExportTable` — the one model every export format,
780
+ * the clipboard and print are written from, so none of them reads the page
781
+ * and none can disagree with another.
782
+ *
783
+ * By default it holds what the user sees, minus what only hides it: every
784
+ * row the filter, search and sort leave, across every page; the visible
785
+ * columns in their current order, less any with `exportable: false`; and,
786
+ * in a grouped grid, every group expanded whatever its state on screen,
787
+ * with its aggregates where the grid shows them. `options` narrows it.
788
+ *
789
+ * Each cell carries the text `formatCellValue` makes of it, so the export
790
+ * reads as the screen does, and a typed value — the column's `exportValue`,
791
+ * else the raw value when it is a string, number, boolean or `Date`.
792
+ *
793
+ * The groups are rebuilt from the exported rows rather than read off
794
+ * `displayRows`, which omits a collapsed group's rows; so group counts,
795
+ * subtotals and the grand total describe exactly the rows exported — the
796
+ * selection, under `scope: "selection"`, not the whole grid.
797
+ */
798
+ declare function buildExportTable<Row>(source: ExportSource<Row>, options?: ExportOptions): ExportTable;
799
+
800
+ /**
801
+ * What a copy is built from: an export's source, with the column and cell
802
+ * selection a selection copy reads as well. A `GridCommandContext` is one
803
+ * as it stands.
804
+ */
805
+ interface CopySource<Row> extends ExportSource<Row> {
806
+ readonly state: Pick<GridState<Row>, "groupBy" | "rowSelection" | "columnSizing" | "columnSelection" | "cellSelection">;
807
+ }
808
+ /**
809
+ * What to copy: one cell, one row, or whatever the grid has selected — the
810
+ * selected rows, else the selected columns, else the selected cell.
811
+ */
812
+ type CopyRequest = {
813
+ readonly kind: "cell";
814
+ readonly rowId: string;
815
+ readonly columnId: string;
816
+ } | {
817
+ readonly kind: "row";
818
+ readonly rowId: string;
819
+ } | {
820
+ readonly kind: "selection";
821
+ };
822
+ /**
823
+ * A copy in the two forms the clipboard carries, with what it holds for the
824
+ * announcement: `count` cells, rows or columns.
825
+ */
826
+ interface CopyContent {
827
+ /** Tab-separated text, as `toTsv` writes it — what a spreadsheet splits into cells. */
828
+ readonly text: string;
829
+ /** The same as an HTML table, as `toHtmlTable` writes it — what a word processor keeps the columns of. */
830
+ readonly html: string;
831
+ readonly count: number;
832
+ readonly unit: "cells" | "rows" | "columns";
833
+ }
834
+ /**
835
+ * What `request` copies, as tab-separated text and an HTML table, or `null`
836
+ * when there is nothing to copy — a row the filter hides, a column hidden
837
+ * or marked `exportable: false`, or an empty selection.
838
+ *
839
+ * Built from the export model, never the page, so a copy holds exactly what
840
+ * an export would and reads as the grid shows it: each cell's formatted
841
+ * text, the shown columns in their order less any with `exportable: false`.
842
+ * The text has no byte order mark and no formula neutralising — what is
843
+ * copied is what is seen, and pasting it is the user's own act.
844
+ *
845
+ * A cell copies its text alone, and a row its cells without a header. A
846
+ * selection copies the selected rows, in the order the grid shows them and
847
+ * under a header row once there are two or more; else the selected columns
848
+ * over every row the filter leaves, under their header; else the selected
849
+ * cell.
850
+ */
851
+ declare function copyContent<Row>(source: CopySource<Row>, request: CopyRequest): CopyContent | null;
852
+
853
+ /** Which way the paper is turned. */
854
+ type PrintOrientation = "portrait" | "landscape";
855
+ /**
856
+ * How a grid prints: which rows and columns (every `ExportOptions` field),
857
+ * the text around the table, and the page it is laid out on. The grid's
858
+ * `print` option.
859
+ */
860
+ interface PrintOptions extends ExportOptions {
861
+ /** A heading above the table, and the printed document's title. */
862
+ readonly title?: string | undefined;
863
+ /** A line under the title. */
864
+ readonly subtitle?: string | undefined;
865
+ /** A line after the table. */
866
+ readonly footer?: string | undefined;
867
+ /**
868
+ * When the print was made, under the title: `true` for now, or a `Date`
869
+ * to print instead. Off by default.
870
+ */
871
+ readonly timestamp?: boolean | Date | undefined;
872
+ /** The language the timestamp is written in. Defaults to the grid's. */
873
+ readonly locale?: FormatLocale | undefined;
874
+ /**
875
+ * Which way the paper is turned. Defaults to `"landscape"` for a table of
876
+ * more than six columns, which rarely fits a portrait page, else
877
+ * `"portrait"`.
878
+ */
879
+ readonly orientation?: PrintOrientation | undefined;
880
+ /**
881
+ * A page size CSS names — `"A4"` (the default), `"Letter"`, `"A3"`,
882
+ * `"Legal"`.
883
+ */
884
+ readonly paperSize?: "A4" | "Letter" | (string & {}) | undefined;
885
+ /** Whether each page is numbered, "3 / 12", where the browser can. Defaults to `true`. */
886
+ readonly pageNumbers?: boolean | undefined;
887
+ /**
888
+ * Whether a wide table is squeezed onto the page — a smaller font and
889
+ * fixed column widths that wrap their text — rather than run off its
890
+ * edge. Defaults to `false`.
891
+ */
892
+ readonly fitToWidth?: boolean | undefined;
893
+ /** CSS added after the print stylesheet, to restyle the printed table. */
894
+ readonly styles?: string | undefined;
895
+ }
896
+ /**
897
+ * The page a print is laid out on, every choice settled — what
898
+ * `@gridkitjs/dom`'s `printStyles` turns into the page's CSS.
899
+ */
900
+ interface PrintPage {
901
+ readonly paperSize: string;
902
+ readonly orientation: PrintOrientation;
903
+ readonly pageNumbers: boolean;
904
+ readonly fitToWidth: boolean;
905
+ }
906
+ /** A print ready for a renderer to put on paper: what `buildPrintDocument` returns. */
907
+ interface PrintDocument {
908
+ /**
909
+ * The document's title as text, `""` when untitled — what the browser
910
+ * puts in a page's header and names a PDF saved from the print dialog.
911
+ */
912
+ readonly title: string;
913
+ /** The `<body>`'s markup: the heading, the table and the footer, every piece of text escaped. */
914
+ readonly bodyHtml: string;
915
+ readonly page: PrintPage;
916
+ }
917
+ /**
918
+ * The table as a printable document: its heading — the title, subtitle and
919
+ * timestamp `options` set — then the table as `toHtmlTable` writes it, then
920
+ * the footer line, with the page it is laid out on. Every piece of text is
921
+ * escaped. It holds no styles: putting it on paper, with a stylesheet for
922
+ * the page, is the renderer's — `@gridkitjs/dom`'s `printStyles` and
923
+ * `printDocument` in a browser.
924
+ *
925
+ * The heading and footer carry semantic class names for a stylesheet:
926
+ * `gridkit-print-header` around `gridkit-print-title`, `gridkit-print-subtitle` and
927
+ * `gridkit-print-timestamp`, and `gridkit-print-footer`.
928
+ */
929
+ declare function buildPrintDocument(table: ExportTable, options?: PrintOptions): PrintDocument;
930
+ /**
931
+ * What `exportPrintDocument` prints from: an `ExportSource` that may carry
932
+ * the grid's `label`. A `GridCommandContext` is one as it stands.
933
+ */
934
+ interface PrintSource<Row> extends ExportSource<Row> {
935
+ readonly options: ExportSource<Row>["options"] & {
936
+ readonly label?: string | undefined;
937
+ };
938
+ }
939
+ /**
940
+ * The grid's view as a print document: the table `options` narrow, laid out
941
+ * as `buildPrintDocument` lays it out, with the timestamp in the grid's
942
+ * locale unless `options` name another. Given no `title`, it takes the
943
+ * grid's `label` — the name a screen reader already reads for it; `""`
944
+ * leaves it untitled.
945
+ */
946
+ declare function exportPrintDocument<Row>(source: PrintSource<Row>, options?: PrintOptions): PrintDocument;
947
+
948
+ /** How `toCsv` writes a file. Every field is optional. */
949
+ interface CsvOptions {
950
+ /**
951
+ * The field separator: `","` by default, any string, or `"auto"` for the
952
+ * separator a spreadsheet expects in `locale` — `";"` where a decimal is
953
+ * written with a comma, as in most of Europe, since a comma there is part
954
+ * of a number; `","` elsewhere.
955
+ */
956
+ readonly delimiter?: string | undefined;
957
+ /** The locale `delimiter: "auto"` reads; the runtime's own when absent. */
958
+ readonly locale?: FormatLocale | undefined;
959
+ /** What ends each record. Defaults to `"\r\n"`, as RFC 4180 writes it. */
960
+ readonly eol?: string | undefined;
961
+ /**
962
+ * Whether the file starts with a UTF-8 byte order mark. Defaults to
963
+ * `true`: without one, Excel reads the file in the system's legacy code
964
+ * page and garbles every character outside ASCII.
965
+ */
966
+ readonly bom?: boolean | undefined;
967
+ /**
968
+ * Whether a field a spreadsheet would run as a formula is written as text
969
+ * instead. Defaults to `true`; see `toCsv`.
970
+ */
971
+ readonly neutralizeFormulas?: boolean | undefined;
972
+ /**
973
+ * Which reading of each cell is written: `"text"` (the default), as the
974
+ * grid shows it; or `"raw"`, the typed value — numbers plain, dates in ISO
975
+ * 8601, booleans as `true` and `false` — for a file a program reads.
976
+ */
977
+ readonly values?: "text" | "raw" | undefined;
978
+ }
979
+ /**
980
+ * The table as CSV, quoted per RFC 4180: a field is quoted when it holds the
981
+ * delimiter, a quote or a line break, and a quote inside one is doubled, so
982
+ * a line break inside a cell survives. A group row writes its label in the
983
+ * first column; summary rows and the footer write their aggregates under
984
+ * their columns.
985
+ *
986
+ * A CSV file opened in a spreadsheet runs any field that starts with `=`,
987
+ * `+`, `-` or `@` as a formula — and a tab or a carriage return can hide
988
+ * such a start — so a value a user typed into the data could make another
989
+ * user's spreadsheet fetch a URL or run a command. By default such a field
990
+ * gets a leading `'`, which the spreadsheet shows as text. A cell whose
991
+ * value is a number keeps its leading sign, since it is one.
992
+ *
993
+ * Returns a string, not a file: making a `Blob` of it, with the type
994
+ * `text/csv;charset=utf-8`, is the renderer's job.
995
+ */
996
+ declare function toCsv(table: ExportTable, options?: CsvOptions): string;
997
+
998
+ /** How `toJson` writes its text. Every field is optional. */
999
+ interface JsonOptions {
1000
+ /**
1001
+ * What each record is keyed by: `"id"` (the default), the column's id,
1002
+ * stable whatever the header says; or `"header"`, its header text, for a
1003
+ * reader who sees the keys. A header repeated across columns is suffixed
1004
+ * ` (2)`, ` (3)` and so on, so no column overwrites another.
1005
+ */
1006
+ readonly keys?: "id" | "header" | undefined;
1007
+ /** Indentation, as `JSON.stringify` takes it; none by default. */
1008
+ readonly space?: number | string | undefined;
1009
+ }
1010
+ /**
1011
+ * The table's data rows as a JSON array of objects, one property per
1012
+ * column holding the cell's typed value — a number stays a number, a `Date`
1013
+ * becomes its ISO 8601 string. Group headers, summary rows and the footer
1014
+ * are left out: JSON is read by programs, which group and total for
1015
+ * themselves, and a row that is not data would only have to be filtered
1016
+ * out again.
1017
+ *
1018
+ * Returns a string; making a `Blob` of it, with the type
1019
+ * `application/json`, is the renderer's job.
1020
+ */
1021
+ declare function toJson(table: ExportTable, options?: JsonOptions): string;
1022
+
1023
+ /**
1024
+ * How a grid exports unless a call says otherwise: which rows and columns
1025
+ * (every `ExportOptions` field), what the file is called, and each built-in
1026
+ * format's settings. The grid's `export` option.
1027
+ */
1028
+ interface GridExportOptions extends ExportOptions {
1029
+ /**
1030
+ * The file's name, without its extension — the writer's is added unless
1031
+ * the name already ends with it. A function is asked per export with the
1032
+ * format, `"csv"` or `"xlsx"`. Defaults to `"export"`.
1033
+ */
1034
+ readonly fileName?: string | ((format: string) => string) | undefined;
1035
+ /**
1036
+ * How the CSV writer writes. Its `locale`, which `delimiter: "auto"`
1037
+ * reads, defaults to the grid's.
1038
+ */
1039
+ readonly csv?: CsvOptions | undefined;
1040
+ /** How the JSON writer writes. */
1041
+ readonly json?: JsonOptions | undefined;
1042
+ }
1043
+ /** What a writer is given beside the table: the grid's language and the export's settings. */
1044
+ interface ExportWriteContext {
1045
+ /** The grid's `locale`. */
1046
+ readonly locale: FormatLocale;
1047
+ /** The grid's messages, over the defaults. */
1048
+ readonly messages: GridMessages;
1049
+ /**
1050
+ * The export's options, where a writer finds its own settings: the CSV
1051
+ * writer reads `csv`, the JSON writer `json`. A writer of the app's own
1052
+ * takes its settings when it is made instead, as a closure.
1053
+ */
1054
+ readonly options: GridExportOptions;
1055
+ }
1056
+ /**
1057
+ * One export format: how to write an `ExportTable` as a file of it, and what
1058
+ * the file is. CSV and JSON ship with the grid; any other — xlsx from
1059
+ * `@gridkitjs/export-xlsx`, or one of the app's own — is registered through
1060
+ * the grid's `exportWriters`.
1061
+ *
1062
+ * `write` returns the file's contents, not a file: text, bytes, or a promise
1063
+ * of either for a writer that loads a library first. Making a `Blob` of it
1064
+ * is the renderer's job.
1065
+ */
1066
+ interface ExportWriter {
1067
+ /** The id the grid knows it by — `"csv"`, `"xlsx"`; one per grid. */
1068
+ readonly format: string;
1069
+ /** Without the dot: `"csv"`. */
1070
+ readonly fileExtension: string;
1071
+ /** The file's media type, the `Blob`'s `type`. */
1072
+ readonly mimeType: string;
1073
+ readonly write: (table: ExportTable, context: ExportWriteContext) => string | Uint8Array | Promise<string | Uint8Array>;
1074
+ }
1075
+ /** An export ready to save: what `exportFile` hands a renderer to download. */
1076
+ interface ExportFile {
1077
+ /** With its extension: `"export.csv"`. */
1078
+ readonly fileName: string;
1079
+ readonly mimeType: string;
1080
+ readonly content: string | Uint8Array;
1081
+ }
1082
+ /** CSV through `toCsv`, its delimiter read for the grid's locale unless `csv.locale` says otherwise. */
1083
+ declare const csvWriter: ExportWriter;
1084
+ /** The data rows as JSON, through `toJson`. */
1085
+ declare const jsonWriter: ExportWriter;
1086
+ /**
1087
+ * Every writer a grid can export with, by format: CSV and JSON, then
1088
+ * `writers` — one with a built-in's format replacing it, as an app command
1089
+ * replaces a built-in of the same id.
1090
+ */
1091
+ declare function resolveExportWriters(writers: readonly ExportWriter[] | undefined): ReadonlyMap<string, ExportWriter>;
1092
+
1093
+ /**
1094
+ * Where a command was asked for: the part of the grid a menu was opened on,
1095
+ * the toolbar item pressed, or nowhere in particular for a call through a
1096
+ * renderer's API. A built-in reads the column, row or group it acts on from
1097
+ * here, and is hidden on a target that has none.
1098
+ */
1099
+ type GridCommandTarget = {
1100
+ readonly area: "header";
1101
+ readonly columnId: string;
1102
+ } | {
1103
+ readonly area: "cell";
1104
+ readonly rowId: string;
1105
+ readonly columnId: string;
1106
+ } | {
1107
+ readonly area: "group";
1108
+ readonly groupId: string;
1109
+ readonly columnId: string;
1110
+ }
1111
+ /** Empty body space, or a grid with no rows. */
1112
+ | {
1113
+ readonly area: "body";
1114
+ } | {
1115
+ readonly area: "toolbar";
1116
+ readonly itemId: string;
1117
+ }
1118
+ /** A renderer's API, with no particular place. */
1119
+ | {
1120
+ readonly area: "grid";
1121
+ };
1122
+ /**
1123
+ * Where a command was run from: a context menu, the toolbar, a renderer's
1124
+ * API, or a column's filter menu — its sort entries and its "Clear filter".
1125
+ * A minor release may add a source, so a `switch` over it needs a `default`.
1126
+ */
1127
+ type GridCommandSource = "contextMenu" | "toolbar" | "api" | "filterMenu";
1128
+ /** What `onCommand` is told of a command, or an inline menu item, that ran. */
1129
+ interface GridCommandEvent {
1130
+ /** The command's id, or the inline item's. */
1131
+ readonly commandId: string;
1132
+ /** Where it was asked for. */
1133
+ readonly target: GridCommandTarget;
1134
+ readonly source: GridCommandSource;
1135
+ }
1136
+ /**
1137
+ * The panels a command can ask a renderer to open: the column chooser, and
1138
+ * a column's filter menu, which opens on a header target only. A minor
1139
+ * release may add a panel, so a `switch` over it needs a `default`.
1140
+ */
1141
+ type GridPanelKind = "columnChooser" | "filter";
1142
+ /**
1143
+ * What a command needs that only a renderer has: a DOM to measure, panels to
1144
+ * open, a live region to speak through. A caller with none of these — a test,
1145
+ * a script in Node — passes members that do nothing. A member added in a
1146
+ * minor release is optional, so a host built by hand keeps compiling.
1147
+ */
1148
+ interface GridCommandHost {
1149
+ /** Sizes each column to fit its content, as double-clicking its resize handle does. */
1150
+ readonly autoFitColumns: (columnIds: readonly string[]) => void;
1151
+ /** Opens one of the grid's panels, anchored to where the command was asked for. */
1152
+ readonly openPanel: (kind: GridPanelKind, target: GridCommandTarget) => void;
1153
+ /** Reads `text` out through the grid's live region. */
1154
+ readonly announce: (text: string) => void;
1155
+ /**
1156
+ * Saves an export as a file — in a browser, a download. A promise is the
1157
+ * file of a writer still writing; the host waits for it, and reports a
1158
+ * rejected one rather than saving.
1159
+ *
1160
+ * Returns `false` for a file it drops without saving, as a host that saves
1161
+ * one file at a time does with one asked for while it waits on the last.
1162
+ * The export command that asked then did not run.
1163
+ */
1164
+ readonly saveFile: ((file: ExportFile | Promise<ExportFile>) => void) | ((file: ExportFile | Promise<ExportFile>) => boolean);
1165
+ /**
1166
+ * Whether `saveFile` would save a file asked for now. An export command
1167
+ * asks first, and while it is `false` builds no file and does not run, so
1168
+ * a writer is never run for a file the host would drop. Left out, every
1169
+ * file can be saved.
1170
+ */
1171
+ readonly canSave?: (() => boolean) | undefined;
1172
+ /**
1173
+ * Puts a copy on the clipboard, as text and as HTML, and announces it —
1174
+ * `count` and `unit` say what to announce — or that the browser refused.
1175
+ */
1176
+ readonly writeClipboard: (content: CopyContent) => void;
1177
+ /**
1178
+ * Puts a print document on paper — in a browser, through the print
1179
+ * dialog. `options` are those it was built under, for what the host adds
1180
+ * itself, such as `styles` over its print stylesheet.
1181
+ */
1182
+ readonly print: (document: PrintDocument, options: PrintOptions) => void;
1183
+ }
1184
+ /**
1185
+ * Every action of the controller — the only way a command changes state, so
1186
+ * each change reports through its slice's callback exactly as the user's own
1187
+ * gesture would. Leaves out `setOptions`, which is the renderer's alone,
1188
+ * `subscribe`, and the getters whose results the context already carries.
1189
+ *
1190
+ * Nothing left names the renderer's node type, so a controller of any `Node`
1191
+ * is one.
1192
+ */
1193
+ type GridCommandActions<Row> = Omit<GridController<Row, unknown>, "getOptions" | "setOptions" | "subscribe" | "getState" | "getView">;
1194
+ /**
1195
+ * Everything a command reads to decide whether it shows, whether it is
1196
+ * enabled and what it does — one snapshot of the grid, taken when a menu or
1197
+ * toolbar is resolved. Build one with `createCommandContext`.
1198
+ */
1199
+ interface GridCommandContext<Row> {
1200
+ readonly target: GridCommandTarget;
1201
+ readonly state: GridState<Row>;
1202
+ readonly view: GridView<Row, unknown>;
1203
+ readonly options: GridOptions<Row>;
1204
+ readonly messages: GridMessages;
1205
+ readonly actions: GridCommandActions<Row>;
1206
+ readonly host: GridCommandHost;
1207
+ /** The row a cell target is on; `null` for any other target, or a row the filter hides. */
1208
+ readonly row: ResolvedRow<Row> | null;
1209
+ /** The column a header, cell or group target names, hidden or not; `null` otherwise. */
1210
+ readonly column: DataColumn<Row, unknown> | null;
1211
+ /**
1212
+ * The selected rows that pass the filter, in the order they are shown,
1213
+ * across every page and collapsed group. A function, computed on first
1214
+ * call and remembered: resolving it walks every filtered row, and a toolbar
1215
+ * builds a context on every change without most commands ever asking.
1216
+ */
1217
+ readonly selectedRows: () => readonly ResolvedRow<Row>[];
1218
+ }
1219
+ /**
1220
+ * The one implementation behind a menu item, a toolbar button and a
1221
+ * renderer's `runCommand`. Whether it shows and whether it is enabled are
1222
+ * predicates over the context, asked each time a menu or toolbar is resolved,
1223
+ * so a command follows the grid's state without being told about it.
1224
+ */
1225
+ interface GridCommand<Row> {
1226
+ /** `"sort.ascending"` for a built-in, or any id of the app's own. Never `"separator"`, which a menu reads as one. */
1227
+ readonly id: string;
1228
+ readonly label: string | ((context: GridCommandContext<Row>) => string);
1229
+ /** A key the renderer maps to an icon of its own; a key it does not know draws nothing. */
1230
+ readonly icon?: string | undefined;
1231
+ /** A key-combination hint in `aria-keyshortcuts` syntax, such as `"Alt+ArrowUp"`. Shown, not bound. */
1232
+ readonly shortcut?: string | undefined;
1233
+ /** Whether the command shows here at all. Defaults to always. */
1234
+ readonly isVisible?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1235
+ /** Whether it can run. A disabled command still shows, so a user can see what is not possible. Defaults to always. */
1236
+ readonly isEnabled?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1237
+ /** Present for a checkable command — drawn as a checkbox item or a toggle button — and says whether it is checked. */
1238
+ readonly isChecked?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1239
+ /**
1240
+ * Does what the command does. Returns `false` when it turns out to do
1241
+ * nothing after all, such as an export the host dropped, so `runCommand`
1242
+ * says it did not run and a renderer does not report it.
1243
+ */
1244
+ readonly execute: ((context: GridCommandContext<Row>) => void) | ((context: GridCommandContext<Row>) => boolean);
1245
+ }
1246
+
1247
+ /**
1248
+ * The id of every command `builtInCommands` returns. A minor release may
1249
+ * add a command, so a `switch` over it needs a `default`.
1250
+ */
1251
+ type BuiltInCommandId = "sort.ascending" | "sort.descending" | "sort.clear" | "sort.clearAll" | "group.add" | "group.remove" | "group.clearAll" | "group.expandAll" | "group.collapseAll" | "column.hide" | "column.autoFit" | "column.autoFitAll" | "column.choose" | "filter.open" | "filter.clear" | "selection.selectAllRows" | "selection.clear" | "filter.clearAll" | "export.csv" | "export.json" | "export.xlsx" | "export.pdf" | "exportSelection.csv" | "exportSelection.json" | "exportSelection.xlsx" | "copy.cell" | "copy.row" | "copy.selection" | "print";
1252
+ /**
1253
+ * The icon keys the built-ins carry, which a renderer draws as icons of its
1254
+ * own. An app command may use them too, to look like the built-ins. A minor
1255
+ * release may add a key, so a renderer's map of them needs a fallback.
1256
+ */
1257
+ type BuiltInCommandIcon = "sortAscending" | "sortDescending" | "group" | "hide" | "autoFit" | "copy" | "print";
1258
+ /**
1259
+ * The grid's own commands, one per action its menus and toolbar offer —
1260
+ * sorting, grouping, hiding, fitting and choosing columns, selecting,
1261
+ * clearing, exporting, copying and printing.
1262
+ * Labels come from `messages`, so they follow the grid's language.
1263
+ *
1264
+ * A function rather than a constant so each comes typed for the caller's
1265
+ * `Row`; the commands hold no state, and two calls build equal ones.
1266
+ */
1267
+ declare function builtInCommands<Row>(): readonly GridCommand<Row>[];
1268
+
1269
+ /** A value given outright, or worked out from the context each time the menu is resolved. */
1270
+ type FromContext<Row, Value> = Value | ((context: GridCommandContext<Row>) => Value);
1271
+ /**
1272
+ * An item written into the menu itself rather than registered as a command —
1273
+ * for an action only one menu offers.
1274
+ */
1275
+ interface MenuItemEntry<Row> {
1276
+ readonly type: "item";
1277
+ readonly id: string;
1278
+ readonly label: FromContext<Row, string>;
1279
+ readonly icon?: string | undefined;
1280
+ readonly shortcut?: string | undefined;
1281
+ readonly hidden?: FromContext<Row, boolean> | undefined;
1282
+ readonly disabled?: FromContext<Row, boolean> | undefined;
1283
+ /** Present for a checkable item, and says whether it is checked. */
1284
+ readonly checked?: FromContext<Row, boolean> | undefined;
1285
+ readonly onSelect: (context: GridCommandContext<Row>) => void;
1286
+ }
1287
+ /** An item that opens a menu of its own. Left out when nothing in it shows. */
1288
+ interface MenuSubmenuEntry<Row> {
1289
+ readonly type: "submenu";
1290
+ readonly id: string;
1291
+ readonly label: FromContext<Row, string>;
1292
+ readonly icon?: string | undefined;
1293
+ readonly items: readonly MenuEntry<Row>[];
1294
+ }
1295
+ /**
1296
+ * One entry of a menu as an app writes it: a command id — a built-in's or
1297
+ * one of its own — `"separator"`, an inline item or a submenu. The same
1298
+ * vocabulary every menu and toolbar is listed in.
1299
+ */
1300
+ type MenuEntry<Row> = BuiltInCommandId | "separator" | (string & {}) | MenuItemEntry<Row> | MenuSubmenuEntry<Row>;
1301
+ /**
1302
+ * A menu item ready to draw: every label a string, every flag a boolean, and
1303
+ * `run` bound to the context the menu was resolved in.
1304
+ */
1305
+ interface ResolvedMenuItem {
1306
+ readonly type: "item";
1307
+ /** The command's id, or the inline item's. */
1308
+ readonly id: string;
1309
+ readonly label: string;
1310
+ readonly icon?: string | undefined;
1311
+ readonly shortcut?: string | undefined;
1312
+ /** Drawn, and focusable, but `run` does nothing. */
1313
+ readonly disabled: boolean;
1314
+ /** `undefined` for an item that is not checkable. */
1315
+ readonly checked: boolean | undefined;
1316
+ /**
1317
+ * Runs the item — a command only when it is still visible and enabled —
1318
+ * and says whether it ran, so a renderer reports only what did something.
1319
+ */
1320
+ readonly run: () => boolean;
1321
+ }
1322
+ interface ResolvedMenuSubmenu {
1323
+ readonly type: "submenu";
1324
+ readonly id: string;
1325
+ readonly label: string;
1326
+ readonly icon?: string | undefined;
1327
+ /** Never empty: a submenu with nothing to show is left out. */
1328
+ readonly items: readonly ResolvedMenuEntry[];
1329
+ }
1330
+ interface ResolvedMenuSeparator {
1331
+ readonly type: "separator";
1332
+ /**
1333
+ * The separator's place among the entries it was resolved from, which
1334
+ * stays put however the items around it come and go — a key for a
1335
+ * renderer that needs one, unique among its menu's separators.
1336
+ */
1337
+ readonly key: string;
1338
+ }
1339
+ /** One entry of a menu as `resolveMenu` hands it to a renderer to draw. */
1340
+ type ResolvedMenuEntry = ResolvedMenuItem | ResolvedMenuSubmenu | ResolvedMenuSeparator;
1341
+
1342
+ /**
1343
+ * The parts of a grid that open a context menu of their own. A minor
1344
+ * release may add an area, so a `switch` over it needs a `default`.
1345
+ */
1346
+ type GridContextMenuArea = "header" | "cell" | "group" | "body";
1347
+ /**
1348
+ * Where a context menu opens: a command target in one of the context menu
1349
+ * areas — a column header, a data cell, a group header row, or empty space
1350
+ * in the body — or in `Area` alone.
1351
+ */
1352
+ type GridContextMenuTarget<Area extends GridContextMenuArea = GridContextMenuArea> = Extract<GridCommandTarget, {
1353
+ readonly area: Area;
1354
+ }>;
1355
+ /** What `onContextMenuOpenChange` is told as a context menu opens or closes. */
1356
+ interface ContextMenuOpenChangeEvent {
1357
+ readonly open: boolean;
1358
+ /** Where the menu opened, or where the one closing had. */
1359
+ readonly target: GridContextMenuTarget;
1360
+ }
1361
+ /** What a function given for an area is asked, each time its menu opens. */
1362
+ interface GridContextMenuRequest<Row, Area extends GridContextMenuArea = GridContextMenuArea> {
1363
+ /** Where the menu opens. */
1364
+ readonly target: GridContextMenuTarget<Area>;
1365
+ /** The area's default entries, to keep, trim, reorder or add to. */
1366
+ readonly defaults: readonly MenuEntry<Row>[];
1367
+ /** The grid as the menu sees it — the context its items run in. */
1368
+ readonly context: GridCommandContext<Row>;
1369
+ }
1370
+ /**
1371
+ * An area's menu: its entries, or a function that works them out each time
1372
+ * the menu opens — from where it opens, the area's defaults and the grid's
1373
+ * state. A function giving `null` or `[]` shows no grid menu there, so the
1374
+ * browser's own menu shows.
1375
+ */
1376
+ type GridContextMenuEntries<Row, Area extends GridContextMenuArea = GridContextMenuArea> = readonly MenuEntry<Row>[] | ((request: GridContextMenuRequest<Row, Area>) => readonly MenuEntry<Row>[] | null);
1377
+ /**
1378
+ * A grid's context menus, by area, in the vocabulary every grid menu is
1379
+ * written in. An area left out shows its defaults; one given `[]` shows no
1380
+ * grid menu, so the browser's own menu shows there.
1381
+ */
1382
+ interface GridContextMenuOptions<Row> {
1383
+ /** A column header's menu. */
1384
+ readonly header?: GridContextMenuEntries<Row, "header"> | undefined;
1385
+ /** A data cell's menu, acting on its row and cell. */
1386
+ readonly cell?: GridContextMenuEntries<Row, "cell"> | undefined;
1387
+ /** A group header row's menu. */
1388
+ readonly group?: GridContextMenuEntries<Row, "group"> | undefined;
1389
+ /** The menu of the body's empty space, below the last row or in a grid with none. */
1390
+ readonly body?: GridContextMenuEntries<Row, "body"> | undefined;
1391
+ }
1392
+ /**
1393
+ * The menu each area shows unless the grid says otherwise — built-in
1394
+ * commands only, each hidden where it has nothing to act on, so the menu a
1395
+ * column header shows holds only what that column can do. The body has
1396
+ * none: empty space keeps the browser's menu until a grid gives it one.
1397
+ */
1398
+ declare const defaultContextMenu: {
1399
+ readonly [Area in GridContextMenuArea]: readonly (BuiltInCommandId | "separator")[];
1400
+ };
1401
+ /**
1402
+ * Whether the `contextMenu` option opens a grid menu on `area` at all: it is
1403
+ * on, and gives the area entries or a function rather than `[]`. A function
1404
+ * may still give no menu for one place or another; this answers for the
1405
+ * area, as a cell's `aria-keyshortcuts` needs to before anything is asked.
1406
+ */
1407
+ declare function hasContextMenu<Row>(contextMenu: boolean | GridContextMenuOptions<Row> | undefined, area: GridContextMenuArea): boolean;
1408
+ /**
1409
+ * The entries a grid's `contextMenu` option gives the place `context.target`
1410
+ * names, to resolve with `resolveMenu` in that same context: none while the
1411
+ * option is off — left out or `false` — or for a target no context menu
1412
+ * opens on; the area's defaults under `true` or when the option leaves the
1413
+ * area out; the entries it lists; or what its function gives this request.
1414
+ * No entries means no grid menu there.
1415
+ */
1416
+ declare function contextMenuEntries<Row>(contextMenu: boolean | GridContextMenuOptions<Row> | undefined, context: GridCommandContext<Row>): readonly MenuEntry<Row>[];
1417
+
1418
+ /** Where a toolbar item's command runs: the toolbar item it was asked from. */
1419
+ type GridToolbarTarget = Extract<GridCommandTarget, {
1420
+ readonly area: "toolbar";
1421
+ }>;
1422
+ /**
1423
+ * A place in the toolbar the renderer fills with content of the app's own —
1424
+ * React's `renderToolbarItem(id)` — for anything the entries cannot say.
1425
+ */
1426
+ interface ToolbarCustomEntry {
1427
+ readonly type: "custom";
1428
+ readonly id: string;
1429
+ }
1430
+ /**
1431
+ * One entry of a toolbar as an app writes it: anything a menu lists — a
1432
+ * command id, `"separator"`, an inline item, or a submenu, which the toolbar
1433
+ * draws as a dropdown button — plus the entries only a toolbar has:
1434
+ * `"search"`, the box searching every column; `"spacer"`, which takes up the
1435
+ * free space and so pushes what follows it to the far end; `"export"`, a
1436
+ * dropdown of the export commands that show; and a custom entry.
1437
+ */
1438
+ type ToolbarEntry<Row> = MenuEntry<Row> | "search" | "spacer" | "export" | ToolbarCustomEntry;
1439
+ /**
1440
+ * Attributes of the app's own for a toolbar entry's element, as hooks for
1441
+ * its tests, analytics or styles: an `id` and `data-*` attributes, nothing
1442
+ * that could change what the entry means or does.
1443
+ */
1444
+ interface ToolbarItemAttributes {
1445
+ readonly id?: string | undefined;
1446
+ readonly [name: `data-${string}`]: string;
1447
+ }
1448
+ /**
1449
+ * A toolbar button ready to draw — a command, or an inline item — with
1450
+ * every label a string, every flag a boolean, and `run` bound to the
1451
+ * context of its place in the toolbar.
1452
+ */
1453
+ interface ResolvedToolbarButton {
1454
+ readonly type: "button";
1455
+ /** The command's id, or the inline item's. */
1456
+ readonly id: string;
1457
+ /** The same as `id`. */
1458
+ readonly key: string;
1459
+ readonly label: string;
1460
+ readonly icon?: string | undefined;
1461
+ readonly shortcut?: string | undefined;
1462
+ /** Drawn, and focusable, but `run` does nothing. */
1463
+ readonly disabled: boolean;
1464
+ /**
1465
+ * Whether a toggle button is pressed — `undefined` for a button that is
1466
+ * not one: a checkable command or item draws as a toggle.
1467
+ */
1468
+ readonly pressed: boolean | undefined;
1469
+ /** Runs the button, and says whether it ran — see `ResolvedMenuItem.run`. */
1470
+ readonly run: () => boolean;
1471
+ /** The app's attributes for its element, from `itemAttributes`. */
1472
+ readonly attributes?: ToolbarItemAttributes | undefined;
1473
+ }
1474
+ /** A dropdown button, opening the menu its submenu entry lists. */
1475
+ interface ResolvedToolbarMenu {
1476
+ readonly type: "menu";
1477
+ readonly id: string;
1478
+ /** The same as `id`. */
1479
+ readonly key: string;
1480
+ readonly label: string;
1481
+ readonly icon?: string | undefined;
1482
+ /** Never empty: a dropdown with nothing to show is left out. */
1483
+ readonly items: readonly ResolvedMenuEntry[];
1484
+ /** The app's attributes for its element, from `itemAttributes`. */
1485
+ readonly attributes?: ToolbarItemAttributes | undefined;
1486
+ }
1487
+ /** The search box, over the grid's global text filter. */
1488
+ interface ResolvedToolbarSearch {
1489
+ readonly type: "search";
1490
+ /** Always `"search"`. */
1491
+ readonly key: string;
1492
+ /** The app's attributes for its element, from `itemAttributes`. */
1493
+ readonly attributes?: ToolbarItemAttributes | undefined;
1494
+ }
1495
+ /** The free space between the entries either side of it. */
1496
+ interface ResolvedToolbarSpacer {
1497
+ readonly type: "spacer";
1498
+ /** `spacer-<index>`, from its place among the entries it was resolved from. */
1499
+ readonly key: string;
1500
+ }
1501
+ /** A custom entry's place, for the renderer to fill. */
1502
+ interface ResolvedToolbarCustom {
1503
+ readonly type: "custom";
1504
+ readonly id: string;
1505
+ /** The same as `id`. */
1506
+ readonly key: string;
1507
+ /** The app's attributes for its element, from `itemAttributes`. */
1508
+ readonly attributes?: ToolbarItemAttributes | undefined;
1509
+ }
1510
+ /**
1511
+ * One entry of a toolbar as `resolveToolbar` hands it to a renderer to draw.
1512
+ * Each has a `key` — an item's id, `"search"`, or a separator's or spacer's
1513
+ * place among the entries — unique among the toolbar's entries, which the
1514
+ * renderer writes into the entry's `data-gridkit-toolbar-item`.
1515
+ */
1516
+ type ResolvedToolbarItem = ResolvedToolbarButton | ResolvedToolbarMenu | ResolvedToolbarSearch | ResolvedToolbarSpacer | ResolvedMenuSeparator | ResolvedToolbarCustom;
1517
+
1518
+ /**
1519
+ * A grid's toolbar: what it lists, what a screen reader calls it, and the
1520
+ * attributes of the app's own its entries' elements carry.
1521
+ */
1522
+ interface GridToolbarOptions<Row> {
1523
+ /** The toolbar's entries, in order. Left out, the defaults. */
1524
+ readonly items?: readonly ToolbarEntry<Row>[] | undefined;
1525
+ /** The toolbar's accessible name. Left out, `messages.toolbarLabel`. */
1526
+ readonly label?: string | undefined;
1527
+ /**
1528
+ * Attributes for entries' elements, by the entry's key: a command's,
1529
+ * inline item's, dropdown's or custom entry's id, `"search"` or
1530
+ * `"export"`. A key naming no entry, or a separator or spacer, is ignored.
1531
+ */
1532
+ readonly itemAttributes?: Readonly<Record<string, ToolbarItemAttributes>> | undefined;
1533
+ }
1534
+ /**
1535
+ * What a toolbar lists unless the grid says otherwise: the search box, then
1536
+ * the free space, then "Clear filters" and "Choose columns" at the far end.
1537
+ */
1538
+ declare const defaultToolbar: readonly (BuiltInCommandId | "search" | "spacer")[];
1539
+ /**
1540
+ * The entries a grid's `toolbar` option lists, to resolve with
1541
+ * `resolveToolbar`: none while it is off — left out or `false` — the
1542
+ * defaults under `true` or an object without `items`, else its `items`.
1543
+ * No entries means no toolbar.
1544
+ */
1545
+ declare function toolbarEntries<Row>(toolbar: boolean | GridToolbarOptions<Row> | undefined): readonly ToolbarEntry<Row>[];
1546
+
1547
+ /** Which cell borders a grid draws. */
1548
+ type Borders = "horizontal" | "vertical" | "all" | "none";
1549
+ /** Which hover highlighting a grid shows. Every member defaults to on. */
1550
+ interface HoverableConfig {
1551
+ rows?: boolean | undefined;
1552
+ columns?: boolean | undefined;
1553
+ cells?: boolean | undefined;
1554
+ }
1555
+ /**
1556
+ * How the group-by bar's visibility follows the active grouping. `"always"`
1557
+ * renders it even with an empty `groupBy` — a fixed drop target and a
1558
+ * constant reminder grouping exists. `"never"` never renders it, for a grid
1559
+ * driving `groupBy` entirely by its own UI (a header toggle, `Alt+ArrowDown`)
1560
+ * or programmatically. `"auto"` renders it once `groupBy` is non-empty, or
1561
+ * while a header drag eligible to drop into it is in progress — so there is
1562
+ * always somewhere to drop the very first column, even from a fully empty
1563
+ * grouping.
1564
+ */
1565
+ type GroupByBarVisibility = "always" | "auto" | "never";
1566
+ /**
1567
+ * What `getRowProps` adds to a data row: a class for the theme or the
1568
+ * app's own stylesheet to target, and `data-*` attributes for a test or a
1569
+ * script to find the row by. No inline style — styling belongs to the
1570
+ * stylesheet, which a class already reaches.
1571
+ */
1572
+ interface RowProps {
1573
+ className?: string | undefined;
1574
+ /**
1575
+ * Set on the row alongside the grid's own `data-gridkit-*` attributes,
1576
+ * which win over one of the same name — the grid finds its rows by them.
1577
+ */
1578
+ attributes?: Readonly<Record<`data-${string}`, string>> | undefined;
1579
+ }
1580
+ /**
1581
+ * Every setting of a grid that names no renderer's types: the data, what the
1582
+ * user may do with it, the state it starts in and the callbacks that report
1583
+ * changes. A renderer's own props are this plus what only it can express —
1584
+ * React's `columns` (whose templates return `ReactNode`), its pager and
1585
+ * infinite-scroll templates, its `ref` — so two renderers cannot drift apart
1586
+ * on what a setting is called or what it means.
1587
+ */
1588
+ interface GridOptions<Row> {
1589
+ dataSource?: readonly Row[] | undefined;
1590
+ /**
1591
+ * A row's stable identity, for state keyed by it. Defaults to the row's
1592
+ * position, which is enough for a static grid but ties that state to where a
1593
+ * row sits rather than to the row — so anything sorting, filtering or paging
1594
+ * its data should give one.
1595
+ *
1596
+ * Called for every row on every change to `dataSource`, so it should be
1597
+ * cheap and stable; an inline arrow is fine, one that re-reads the data is
1598
+ * not.
1599
+ */
1600
+ getRowId?: ((row: Row, index: number) => string) | undefined;
1601
+ /**
1602
+ * A class and `data-*` attributes for each data row, worked out from the
1603
+ * row — an `is-overdue` class, a `data-status` to style or find it by.
1604
+ * Group headers and summary rows are not passed to it.
1605
+ *
1606
+ * Called for each data row as it renders, so it should be cheap. A row
1607
+ * whose result reads the same as last time is not redrawn for it, so an
1608
+ * inline arrow returning a fresh object each time is fine.
1609
+ */
1610
+ getRowProps?: ((row: ResolvedRow<Row>) => RowProps) | undefined;
1611
+ /**
1612
+ * Called when a data row is clicked, after the click has changed the
1613
+ * selection — so a handler reading the selection sees the new one. Not
1614
+ * called for a group header, whose click expands or collapses it.
1615
+ */
1616
+ onRowClick?: ((event: RowPointerEvent<Row>) => void) | undefined;
1617
+ /**
1618
+ * Called once when a data row is double-clicked — the usual "open this
1619
+ * record" gesture. The two clicks before it still report through
1620
+ * `onRowClick` and select as clicks do.
1621
+ */
1622
+ onRowDoubleClick?: ((event: RowPointerEvent<Row>) => void) | undefined;
1623
+ borders?: Borders | undefined;
1624
+ hoverable?: HoverableConfig | undefined;
1625
+ /**
1626
+ * Which parts of the grid the user may select, and how many of each —
1627
+ * `{ rows: "multiple", cells: "single" }`. A cell addresses one value, so it
1628
+ * has no `"multiple"`.
1629
+ *
1630
+ * Off by default, unlike `hoverable`: selection claims the click, which a
1631
+ * grid that only displays data should not do. Give `getRowId` alongside it
1632
+ * for data that sorts, filters or pages, or a selection follows the position
1633
+ * rather than the row.
1634
+ */
1635
+ selectable?: SelectableConfig | undefined;
1636
+ /** Row ids selected to start with, keyed as `getRowId` resolves them. Uncontrolled. */
1637
+ defaultRowSelection?: SelectionState | undefined;
1638
+ /**
1639
+ * The selected row ids, controlled — applied as given, changed only through
1640
+ * the row selection callbacks (`onRowSelectionChange` carries the whole
1641
+ * next state). Leave it `undefined` for the grid to keep it itself,
1642
+ * starting from `defaultRowSelection`.
1643
+ */
1644
+ rowSelection?: SelectionState | undefined;
1645
+ /** Column ids selected to start with. Uncontrolled. */
1646
+ defaultColumnSelection?: SelectionState | undefined;
1647
+ /**
1648
+ * The selected column ids, controlled — changed only through the column
1649
+ * selection callbacks. Leave it `undefined` for the grid to keep it.
1650
+ */
1651
+ columnSelection?: SelectionState | undefined;
1652
+ /** The cell selected to start with. Uncontrolled. */
1653
+ defaultCellSelection?: CellSelectionState | undefined;
1654
+ /**
1655
+ * The selected cell, controlled — `{ kind: "none" }` for none, changed
1656
+ * only through the cell selection callbacks. Leave it `undefined` for the
1657
+ * grid to keep it.
1658
+ */
1659
+ cellSelection?: CellSelectionState | undefined;
1660
+ /** Whether columns can be dragged wider, unless a column says otherwise. */
1661
+ resizableColumns?: boolean | undefined;
1662
+ /**
1663
+ * Whether columns can be dragged into a new position, unless a column says
1664
+ * otherwise. Turning it off leaves an order the user already made in place.
1665
+ */
1666
+ reorderableColumns?: boolean | undefined;
1667
+ /**
1668
+ * Whether columns fill the grid's width or sit at their own. Defaults to
1669
+ * `"fit"`, under which columns the user has sized keep their width and the
1670
+ * rest share what is left.
1671
+ */
1672
+ resizeMode?: ResizeMode | undefined;
1673
+ /** Column widths to start from, keyed by column id. Uncontrolled. */
1674
+ defaultColumnSizing?: ColumnSizingState | undefined;
1675
+ /**
1676
+ * Column widths, controlled — applied as given, changed only through
1677
+ * `onColumnSizingChange`, whose `sizing` is the next state. Leave it
1678
+ * `undefined` for the grid to keep the widths itself, starting from
1679
+ * `defaultColumnSizing`.
1680
+ */
1681
+ columnSizing?: ColumnSizingState | undefined;
1682
+ /**
1683
+ * Column ids in the order to start in. Uncontrolled, and partial: ids it
1684
+ * omits keep their position among `columns` and follow those it lists.
1685
+ */
1686
+ defaultColumnOrder?: ColumnOrderState | undefined;
1687
+ /**
1688
+ * The column order, controlled — applied as given, changed only through
1689
+ * `onColumnOrderChange`. Leave it `undefined` for the grid to keep the
1690
+ * order itself, starting from `defaultColumnOrder`.
1691
+ */
1692
+ columnOrder?: ColumnOrderState | undefined;
1693
+ /**
1694
+ * Columns shown (`true`) or hidden (`false`) to start with, keyed by
1695
+ * column id, over each definition's own `hidden`. Uncontrolled.
1696
+ */
1697
+ defaultColumnVisibility?: ColumnVisibilityState | undefined;
1698
+ /**
1699
+ * Which columns are shown, controlled — applied as given, changed only
1700
+ * through `onColumnVisibilityChange`. Leave it `undefined` for the grid to
1701
+ * keep it itself, starting from `defaultColumnVisibility`.
1702
+ */
1703
+ columnVisibility?: ColumnVisibilityState | undefined;
1704
+ /**
1705
+ * Called once when columns are shown or hidden, with every column that one
1706
+ * change touched. A call that changes nothing does not call it.
1707
+ */
1708
+ onColumnVisibilityChange?: ((event: ColumnVisibilityEvent) => void) | undefined;
1709
+ /**
1710
+ * Sizes applied to columns that do not set their own — the width they start
1711
+ * at and the bounds they may be resized between. Distinct from
1712
+ * `defaultColumnSizing`, which sets specific columns' starting widths.
1713
+ */
1714
+ columnSizeDefaults?: Partial<ColumnSizeDefaults> | undefined;
1715
+ /**
1716
+ * Called as the user resizes a column. Fires continuously with
1717
+ * `phase: "move"` and once on release with `phase: "end"` — the latter being
1718
+ * the one to persist. Auto-fitting a column calls it once, with "end".
1719
+ */
1720
+ onColumnSizingChange?: ((event: ColumnResizeEvent) => void) | undefined;
1721
+ /**
1722
+ * Called once when the user drops a column somewhere new. A drop that leaves
1723
+ * the order as it was does not call it.
1724
+ */
1725
+ onColumnOrderChange?: ((event: ColumnOrderEvent) => void) | undefined;
1726
+ /**
1727
+ * Whether columns can be sorted by clicking their header toggle, unless a
1728
+ * column says otherwise. Shift-click stacks a column into the sort instead
1729
+ * of replacing it.
1730
+ */
1731
+ sortableColumns?: boolean | undefined;
1732
+ /** The sort to start with, in priority order. Uncontrolled. */
1733
+ defaultColumnSort?: ColumnSortState | undefined;
1734
+ /**
1735
+ * The sort, controlled: the grid shows exactly this, and a header click
1736
+ * only asks for a change through `onColumnSortChange`, which takes effect
1737
+ * once this prop follows it. Leave it `undefined` for the grid to keep the
1738
+ * sort itself, starting from `defaultColumnSort`.
1739
+ */
1740
+ columnSort?: ColumnSortState | undefined;
1741
+ /**
1742
+ * Called once when the user changes the sort — a toggle, a stack, or a
1743
+ * clear back to "none".
1744
+ */
1745
+ onColumnSortChange?: ((event: ColumnSortEvent) => void) | undefined;
1746
+ /**
1747
+ * Whether columns can be grouped by — a header's click/`Alt+ArrowDown`
1748
+ * toggle — unless a column says otherwise. The grouping itself still
1749
+ * applies when this is off, via `defaultGroupBy` or the imperative API;
1750
+ * this only gates that one interaction, the same way `sortableColumns`
1751
+ * gates the sort toggle without disabling `defaultColumnSort`. Independent
1752
+ * of `groupByBarVisibility` and `groupByDraggableColumns`, which gate the
1753
+ * bar and the drag-in gesture respectively.
1754
+ */
1755
+ groupableColumns?: boolean | undefined;
1756
+ /**
1757
+ * Whether a groupable header shows its group-toggle icon, unless a column
1758
+ * says otherwise. Purely a rendering choice: `Alt+ArrowDown` keeps working
1759
+ * on a groupable header with the icon hidden.
1760
+ */
1761
+ groupToggleIconColumns?: boolean | undefined;
1762
+ /**
1763
+ * Whether a column's header may be dragged into the group-by bar to add
1764
+ * it to the grouping, unless a column says otherwise. Independent of
1765
+ * `groupableColumns`: a column can be groupable via its header's
1766
+ * click/keyboard toggle, via this drag, both, or neither.
1767
+ */
1768
+ groupByDraggableColumns?: boolean | undefined;
1769
+ /** How the group-by bar's visibility follows the active grouping. */
1770
+ groupByBarVisibility?: GroupByBarVisibility | undefined;
1771
+ /** The group-by stack to start with, outer to inner. Uncontrolled. */
1772
+ defaultGroupBy?: GroupByState | undefined;
1773
+ /**
1774
+ * The group-by stack, controlled — applied as given, changed only through
1775
+ * `onGroupByChange`. Leave it `undefined` for the grid to keep it itself,
1776
+ * starting from `defaultGroupBy`.
1777
+ */
1778
+ groupBy?: GroupByState | undefined;
1779
+ /**
1780
+ * Called once when the user changes the group-by stack — adding, removing,
1781
+ * or reordering a level.
1782
+ */
1783
+ onGroupByChange?: ((event: GroupByEvent) => void) | undefined;
1784
+ /**
1785
+ * Which groups start expanded, as a mode with exceptions — `{ mode:
1786
+ * "allCollapsed", except: [] }` starts every group collapsed. Every group
1787
+ * starts expanded when it is left out. Uncontrolled.
1788
+ */
1789
+ defaultGroupExpansion?: GroupExpansionState | undefined;
1790
+ /**
1791
+ * Which groups are expanded, controlled — applied as given, changed only
1792
+ * through `onGroupExpansionChange`. Leave it `undefined` for the grid to
1793
+ * keep it itself, starting from `defaultGroupExpansion`.
1794
+ */
1795
+ groupExpansion?: GroupExpansionState | undefined;
1796
+ /** Called once when the user expands or collapses a group, or every group at once. */
1797
+ onGroupExpansionChange?: ((event: GroupExpansionEvent) => void) | undefined;
1798
+ /** The filter to start with — every applied entry, ANDed together. Uncontrolled. */
1799
+ defaultFilter?: FilterState<Row> | undefined;
1800
+ /**
1801
+ * The filter, controlled — applied as given, changed only through
1802
+ * `onFilterChange`. Leave it `undefined` for the grid to keep it itself,
1803
+ * starting from `defaultFilter`.
1804
+ */
1805
+ filter?: FilterState<Row> | undefined;
1806
+ /**
1807
+ * Called once when the filter changes — from the toolbar's search box, the
1808
+ * `filter.clearAll` command, `setFilter` or a restored state.
1809
+ */
1810
+ onFilterChange?: ((event: FilterChangeEvent<Row>) => void) | undefined;
1811
+ /**
1812
+ * Whether columns get a filter menu, opened from their header, unless a
1813
+ * column says otherwise. Off by default, like `sortableColumns`; the
1814
+ * filter itself applies either way, from `defaultFilter`, `setFilter` or a
1815
+ * search box. A renderer draws the menu from what
1816
+ * `resolveColumnFilterMenu` settles.
1817
+ */
1818
+ filterableColumns?: boolean | undefined;
1819
+ /**
1820
+ * How the filter menus look: which editor they open — `"simple"`
1821
+ * conditions or an `"excel"` checklist — and the checklist's counts and
1822
+ * value limit. A column's own `filterMenu` wins over it. Switching `ui`
1823
+ * keeps every filter, since both editors edit the one `filter`.
1824
+ */
1825
+ filterMenu?: GridFilterMenuOptions | undefined;
1826
+ /**
1827
+ * Whether the grid's rows are split into pages. Off by default, matching
1828
+ * `sortableColumns`. What a page's `pageSize` counts once the rows are
1829
+ * grouped is `paginationUnit`'s choice.
1830
+ */
1831
+ paginated?: boolean | undefined;
1832
+ /**
1833
+ * What `pageSize` counts in a grouped grid. `"group"` (the default) counts
1834
+ * top-level groups, each with everything beneath it, so a page never
1835
+ * splits a group but can grow as large as its groups. `"row"` counts data
1836
+ * rows, plus collapsed group headers, which stand in for their hidden
1837
+ * rows: every page holds `pageSize` of them, and a page continuing a group
1838
+ * starts with that group's headers again, with a group's summary row on
1839
+ * the page holding its last row. An ungrouped grid pages by data rows
1840
+ * under either. Selection, export and aggregates behave the same under
1841
+ * either unit.
1842
+ */
1843
+ paginationUnit?: PaginationUnit | undefined;
1844
+ /**
1845
+ * The page and page size to start on. Uncontrolled. Defaults to
1846
+ * `{ pageIndex: 0, pageSize: 25 }` when `paginated` is on and this is
1847
+ * omitted.
1848
+ */
1849
+ defaultPagination?: PaginationState | undefined;
1850
+ /**
1851
+ * The page and page size, controlled — applied as given, changed only
1852
+ * through `onPaginationChange`. Leave it `undefined` for the grid to keep
1853
+ * them itself, starting from `defaultPagination`.
1854
+ *
1855
+ * The grid sends an uncontrolled pagination back to the first page when
1856
+ * the filter, sort, grouping or `paginationUnit` changes; a controlled
1857
+ * one is the parent's to reset alongside that change. Until it does, the
1858
+ * grid shows the last page that exists rather than an empty one.
1859
+ */
1860
+ pagination?: PaginationState | undefined;
1861
+ /** Called once when the user changes the page or the page size. */
1862
+ onPaginationChange?: ((event: PaginationChangeEvent) => void) | undefined;
1863
+ /**
1864
+ * Aggregates to compute — a subtotal per group (rendered in that group's
1865
+ * header) plus a grand total over the whole filtered/grouped dataset
1866
+ * (rendered in a footer). Always computed over every row, never scoped to
1867
+ * the current page. A plain controlled prop, unlike `sort`/`filter`/
1868
+ * `groupBy`/`pagination`: there is no built-in UI for a user to add or
1869
+ * remove an aggregate interactively, so there is no `defaultAggregates`/
1870
+ * `onAggregatesChange` pair to go with it.
1871
+ */
1872
+ aggregates?: AggregateState<Row> | undefined;
1873
+ /**
1874
+ * Where a group's own aggregate results render. `"inline"` (the default)
1875
+ * keeps them as text in the group header, next to its leaf-row count.
1876
+ * `"row"` instead renders a dedicated row after that group's last visible
1877
+ * entry, with each aggregate's value in the `<td>` for its own column —
1878
+ * the same alignment the grand-total footer's own cells have. Has no
1879
+ * effect when `aggregates` is empty or omitted.
1880
+ */
1881
+ groupAggregateDisplay?: GroupAggregateDisplay | undefined;
1882
+ /**
1883
+ * Bounds the row area's height, independently scrollable — the grid's own
1884
+ * chrome (group-by bar, header, footer, pager) stays outside it and
1885
+ * always visible. A number is pixels; a string is passed through as a CSS
1886
+ * length (e.g. "60vh"). Omitted, the body's height stays content-driven,
1887
+ * same as today.
1888
+ */
1889
+ height?: number | string | undefined;
1890
+ /**
1891
+ * Renders only the rows near the current scroll position rather than every
1892
+ * row at once — for a dataset too large to mount in full. Requires
1893
+ * `height` to be set; a grid without a bounded body has no viewport to
1894
+ * window rows against (a dev-time console warning fires when it's
1895
+ * missing). Off by default, matching every other opt-in behavior here.
1896
+ */
1897
+ virtualized?: boolean | undefined;
1898
+ /**
1899
+ * Rows rendered outside the visible range on each side, to reduce
1900
+ * blank-frame flashes on fast scrolling. Only meaningful with `virtualized`
1901
+ * on.
1902
+ */
1903
+ overscan?: number | undefined;
1904
+ /**
1905
+ * Assumed height for a row never yet measured — only matters for the very
1906
+ * first paint and for `scrollToRow`'s initial jump before it corrects
1907
+ * itself against that row's real, measured height. Only meaningful with
1908
+ * `virtualized` on.
1909
+ */
1910
+ estimatedRowHeight?: number | undefined;
1911
+ /**
1912
+ * The grid's accessible name, announced when it takes focus. A grid without
1913
+ * one is read only as "grid", which says nothing about which grid.
1914
+ */
1915
+ label?: string | undefined;
1916
+ /**
1917
+ * The id of an element naming the grid, for a heading already on the page.
1918
+ * Takes precedence over `label`, as `aria-labelledby` does.
1919
+ */
1920
+ labelledBy?: string | undefined;
1921
+ /**
1922
+ * The locale values are formatted for — a BCP 47 tag such as `"de-DE"`, or
1923
+ * a list to fall back through. Setting it turns on `Intl` formatting of
1924
+ * dates and numbers in every cell and aggregate shown without a template;
1925
+ * without it, only a column with its own `format` is formatted, in the
1926
+ * runtime's locale, and the rest print as they always have.
1927
+ */
1928
+ locale?: FormatLocale | undefined;
1929
+ /**
1930
+ * The grid's own strings, replacing its English key by key — the pager's
1931
+ * buttons, the group-by bar, the loading row, boolean and blank values,
1932
+ * the built-in commands' labels, the menus' names, and every live-region
1933
+ * announcement. Keys
1934
+ * left out keep their default.
1935
+ * Formatting is `locale`'s, not this.
1936
+ */
1937
+ messages?: Partial<GridMessages> | undefined;
1938
+ /**
1939
+ * The grid's own context menu, opened on a column header, a data cell, a
1940
+ * group row or the body's empty space by a right-click, Shift+F10 or the
1941
+ * ContextMenu key. Off by default, like every other feature, leaving the
1942
+ * browser's menu. `true` shows each area's defaults — see
1943
+ * `defaultContextMenu`; an object lists an area's entries, an area left
1944
+ * out keeping its defaults and one given `[]` showing the browser's menu
1945
+ * there.
1946
+ */
1947
+ contextMenu?: boolean | GridContextMenuOptions<Row> | undefined;
1948
+ /**
1949
+ * Called when the grid's context menu opens or closes, with where. A menu
1950
+ * opened in place of another reports that one closing first. It also
1951
+ * reports closing when a panel opens in its place (before the command of
1952
+ * a menu item that opened it runs), when the grid unmounts and when
1953
+ * `contextMenu` is turned off while it is open. The open state is the renderer's to keep, so no
1954
+ * option holds it.
1955
+ */
1956
+ onContextMenuOpenChange?: ((event: ContextMenuOpenChangeEvent) => void) | undefined;
1957
+ /**
1958
+ * The app's own commands, for its menus to list by id. One with a
1959
+ * built-in's id replaces it wherever that id is listed — a translated,
1960
+ * privilege-gated or differently behaving "Hide column" — see
1961
+ * `resolveCommands`.
1962
+ */
1963
+ commands?: readonly GridCommand<Row>[] | undefined;
1964
+ /**
1965
+ * Called after a command or an inline menu item runs — chosen from a menu,
1966
+ * or run through a renderer's API — saying which, where it was asked for
1967
+ * and from where. One that did not run, being hidden or disabled, is not
1968
+ * reported.
1969
+ */
1970
+ onCommand?: ((event: GridCommandEvent) => void) | undefined;
1971
+ /**
1972
+ * A toolbar above the grid: its own commands, a search box over the
1973
+ * filter's global text entry, dropdowns and the app's own content, in the
1974
+ * menu vocabulary. Off by default. `true` lists `defaultToolbar`; an object
1975
+ * lists its `items` and may name it with `label` — see `ToolbarEntry`.
1976
+ */
1977
+ toolbar?: boolean | GridToolbarOptions<Row> | undefined;
1978
+ /**
1979
+ * How the grid exports unless a call says otherwise: which rows and
1980
+ * columns, the file's name, and the CSV and JSON settings. Left out, an
1981
+ * export holds what the user sees, across every page, in a file named
1982
+ * `export` with the format's extension.
1983
+ */
1984
+ export?: GridExportOptions | undefined;
1985
+ /**
1986
+ * Export formats beyond CSV and JSON — an xlsx writer, or one of the
1987
+ * app's own — each registered by its `format`, replacing a built-in
1988
+ * writer of the same format. `export.xlsx` and `export.pdf` show only
1989
+ * once a writer for their format is here — see `resolveExportWriters`.
1990
+ */
1991
+ exportWriters?: readonly ExportWriter[] | undefined;
1992
+ /**
1993
+ * How the grid prints unless a call says otherwise: the rows and columns,
1994
+ * the title and text around the table, and the page. Left out, a print
1995
+ * holds what an export does, titled with `label`, on an A4 page.
1996
+ */
1997
+ print?: PrintOptions | undefined;
1998
+ }
1999
+ /**
2000
+ * Reported as the user selects. Every one of these is fanned out from a single
2001
+ * diff of the transition it describes, so no two can disagree about what one
2002
+ * interaction did.
2003
+ *
2004
+ * Kept apart from `GridOptions` because the column payloads carry resolved
2005
+ * columns, whose labels are whatever a renderer's `headerTemplate` returns —
2006
+ * `Node` is that renderer's node type.
2007
+ */
2008
+ interface SelectionCallbacks<Row, Node = string> {
2009
+ /** Called once per row newly selected. The last call names the last row. */
2010
+ onRowSelect?: ((event: RowSelectEvent<Row>) => void) | undefined;
2011
+ /** Called once with every row one interaction selected. */
2012
+ onRowsSelect?: ((event: RowsSelectEvent<Row>) => void) | undefined;
2013
+ onRowDeselect?: ((event: RowSelectEvent<Row>) => void) | undefined;
2014
+ onRowsDeselect?: ((event: RowsSelectEvent<Row>) => void) | undefined;
2015
+ /**
2016
+ * Called once per change with what it added, what it removed and everything
2017
+ * selected after it — the one to persist from.
2018
+ */
2019
+ onRowSelectionChange?: ((event: RowSelectionChangeEvent<Row>) => void) | undefined;
2020
+ onColumnSelect?: ((event: ColumnSelectEvent<Row, Node>) => void) | undefined;
2021
+ onColumnsSelect?: ((event: ColumnsSelectEvent<Row, Node>) => void) | undefined;
2022
+ onColumnDeselect?: ((event: ColumnSelectEvent<Row, Node>) => void) | undefined;
2023
+ onColumnsDeselect?: ((event: ColumnsSelectEvent<Row, Node>) => void) | undefined;
2024
+ onColumnSelectionChange?: ((event: ColumnSelectionChangeEvent<Row, Node>) => void) | undefined;
2025
+ onCellSelect?: ((event: CellSelectEvent<Row, Node>) => void) | undefined;
2026
+ onCellDeselect?: ((event: CellSelectEvent<Row, Node>) => void) | undefined;
2027
+ onCellSelectionChange?: ((event: CellSelectionChangeEvent<Row, Node>) => void) | undefined;
2028
+ }
2029
+
2030
+ /**
2031
+ * Which editor a filter menu opens. Both edit the same `FilterState`, so
2032
+ * switching between them keeps every filter applied.
2033
+ *
2034
+ * - `"simple"`: one or two conditions — an operator and a value each —
2035
+ * joined by and/or.
2036
+ * - `"excel"`: a search box over a checklist of the column's values, with
2037
+ * the conditions a submenu away.
2038
+ */
2039
+ type FilterMenuUi = "simple" | "excel";
2040
+ /** How a grid's filter menus look, unless a column says otherwise. */
2041
+ interface GridFilterMenuOptions {
2042
+ /** Which editor a filter menu opens. Defaults to `"simple"`. */
2043
+ readonly ui?: FilterMenuUi | undefined;
2044
+ /** Whether the excel editor's checklist shows how many rows hold each value. Off by default. */
2045
+ readonly showCounts?: boolean | undefined;
2046
+ /**
2047
+ * How many distinct values the excel editor's checklist lists before it
2048
+ * asks for a search first. Defaults to `DEFAULT_FILTER_VALUE_LIMIT`.
2049
+ */
2050
+ readonly valueLimit?: number | undefined;
2051
+ }
2052
+ /** A column's own filter menu settings, over the grid's `filterMenu`. */
2053
+ interface ColumnFilterMenuOptions {
2054
+ /** Which editor this column's filter menu opens, over the grid's `filterMenu.ui`. */
2055
+ readonly ui?: FilterMenuUi | undefined;
2056
+ /**
2057
+ * The operators this column's conditions offer, in order, in place of its
2058
+ * type's `defaultFilterOperators`. `in` is dropped — the checklist is its
2059
+ * editor — and `[]` offers no condition, leaving the excel editor its
2060
+ * checklist alone.
2061
+ */
2062
+ readonly operators?: readonly FilterOperator[] | undefined;
2063
+ }
2064
+ /** One column's filter menu with every setting settled — what a renderer draws. */
2065
+ interface ResolvedColumnFilterMenu {
2066
+ readonly ui: FilterMenuUi;
2067
+ /** The operators its conditions offer, in order. Never `in`. */
2068
+ readonly operators: readonly FilterOperator[];
2069
+ /** The family the column's `type` falls in, which its operators are labelled by. */
2070
+ readonly family: FilterOperatorFamily;
2071
+ readonly showCounts: boolean;
2072
+ readonly valueLimit: number;
2073
+ }
2074
+ /**
2075
+ * How many distinct values a checklist lists before asking for a search —
2076
+ * Excel's own cap. The list is virtualized, so what this bounds is counting
2077
+ * the values, not drawing them.
2078
+ */
2079
+ declare const DEFAULT_FILTER_VALUE_LIMIT = 10000;
2080
+ /**
2081
+ * The filter menu `column` opens, or `null` when it has none: a column is
2082
+ * filterable when its own `filterable` says so, else when the grid's
2083
+ * `filterableColumns` does — off unless one of them turns it on, as
2084
+ * `sortable` is. The column's `filterMenu` settings win over the grid's
2085
+ * one by one; what neither sets takes its default.
2086
+ */
2087
+ declare function resolveColumnFilterMenu(options: Pick<GridOptions<unknown>, "filterableColumns" | "filterMenu">, column: Pick<ColumnDefinition<unknown, unknown>, "type" | "filterable" | "filterMenu">): ResolvedColumnFilterMenu | null;
2088
+
2089
+ /**
2090
+ * Values a cell shows as-is instead of being drilled into. Arrays and `Date`s
2091
+ * are cell values rather than groups of columns, and `null` cannot be
2092
+ * introspected, so all three end a path.
2093
+ */
2094
+ type LeafValue = bigint | boolean | number | string | symbol | null | undefined | Date | readonly unknown[] | ((...args: never[]) => unknown);
2095
+ /** Keys of `T` holding a leaf value — the only ones a path may end on. */
2096
+ type LeafKey<T> = {
2097
+ [K in keyof T & string]: NonNullable<T[K]> extends LeafValue ? K : never;
2098
+ }[keyof T & string];
2099
+ /**
2100
+ * Every addressable field of `Row`, one level deep: `"Id"` for a flat field,
2101
+ * `"Application.Id"` for a leaf inside a nested object. A nested object
2102
+ * contributes only its leaf children, never itself and never anything deeper.
2103
+ */
2104
+ type FieldPath<Row> = {
2105
+ [K in keyof Row & string]: NonNullable<Row[K]> extends LeafValue ? K : `${K}.${LeafKey<NonNullable<Row[K]>>}`;
2106
+ }[keyof Row & string];
2107
+ /**
2108
+ * The value type of a column's cells. This package is framework-agnostic so it
2109
+ * defaults to `string`;
2110
+ */
2111
+ type ColumnType = "dateTime" | "date" | "time" | "number" | "string" | "boolean" | "decimal" | "currency" | "percent";
2112
+ type ColumnAlignment = "left" | "center" | "right";
2113
+ /**
2114
+ * What `cellTemplate` receives. An object rather than positional arguments so
2115
+ * that a later addition — a sort state, whether the row is selected — is not a
2116
+ * breaking change to every template already written.
2117
+ */
2118
+ interface CellTemplateContext<Row> {
2119
+ /**
2120
+ * This cell's value, read off the column's field path. `unknown` because a
2121
+ * dotted path's type cannot be recovered here; a template narrows it.
2122
+ */
2123
+ value: unknown;
2124
+ /** The whole row, for a template that needs a sibling field. */
2125
+ row: Row;
2126
+ /** Position among the rows as rendered — the index within the current page once paging is on. */
2127
+ rowIndex: number;
2128
+ /** This row's absolute position in the whole filtered/sorted/grouped dataset, unaffected by which page is showing. */
2129
+ datasetIndex: number;
2130
+ /** This row's id, as `resolveRowId` settled it. */
2131
+ rowId: string;
2132
+ /** Whether this row is selected, so a template can style itself to match. */
2133
+ selected: boolean;
2134
+ }
2135
+ /**
2136
+ * What a column's `footerTemplate` receives. Mirrors `CellTemplateContext`'s
2137
+ * shape where it applies — `value`, `rows` — minus everything scoped to one
2138
+ * rendered row (`rowIndex`, `rowId`, `selected`), since a footer addresses
2139
+ * every row an aggregate was computed over at once, not a single one.
2140
+ */
2141
+ interface FooterTemplateContext<Row> {
2142
+ /** This column's aggregate result, as `computeAggregates` produced it. */
2143
+ value: unknown;
2144
+ /** Every row the aggregate was computed over — the grand total's full dataset, or one group's full leaf descendants. */
2145
+ rows: readonly Row[];
2146
+ }
2147
+ /**
2148
+ * @typeParam Node - What a header or cell renders to. This package is
2149
+ * framework-agnostic so it defaults to `string`; `@gridkitjs/react` binds it to
2150
+ * `ReactNode` so a template can return JSX.
2151
+ */
2152
+ interface ColumnDefinition<Row, Node = string> {
2153
+ /**
2154
+ * Path to this cell's value: a key of `Row`, or `"Parent.Child"` for a leaf
2155
+ * one level inside a nested object. Any string still compiles — the union
2156
+ * exists to drive autocomplete, not to lock the grid down.
2157
+ */
2158
+ field: FieldPath<Row> | (string & {});
2159
+ /**
2160
+ * Stable identity for state keyed by this column. Defaults to `field`, which
2161
+ * is unique in the common case but need not be — two columns may render the
2162
+ * same field differently.
2163
+ */
2164
+ id?: string | undefined;
2165
+ /**
2166
+ * The column's name as plain text. The header shows it when there is no
2167
+ * `headerTemplate`, and anything that needs the name as text rather than
2168
+ * markup — a screen-reader announcement, an export — reads it even when
2169
+ * there is one, since a template's output need not be text at all.
2170
+ */
2171
+ header?: string | undefined;
2172
+ /** Header content, or a function returning it at render time. */
2173
+ headerTemplate?: Node | (() => Node) | undefined;
2174
+ /**
2175
+ * Renders this column's cells in place of the text `formatCellValue` makes
2176
+ * of the value at `field`. The raw value is still resolved and handed over,
2177
+ * so a template never repeats the field path.
2178
+ */
2179
+ cellTemplate?: ((context: CellTemplateContext<Row>) => Node) | undefined;
2180
+ /**
2181
+ * Renders this column's own aggregate result in a group footer or the
2182
+ * grand-total footer, in place of the raw computed value. Absent for a
2183
+ * column with no aggregate: nothing is shown, the same way a column
2184
+ * missing from `AggregateState` contributes no cell to either footer.
2185
+ */
2186
+ footerTemplate?: ((context: FooterTemplateContext<Row>) => Node) | undefined;
2187
+ /**
2188
+ * The value type of this column's cells. Absent, the column has none: it
2189
+ * sorts as `compareValues` does without a type, two numbers or two `Date`s
2190
+ * by value and any other pair as text.
2191
+ */
2192
+ type?: ColumnType | undefined;
2193
+ /**
2194
+ * `Intl` options for how this column's values read as text: number options
2195
+ * for a numeric `type`, date options for a date or time one. Passed to
2196
+ * `Intl.NumberFormat`/`Intl.DateTimeFormat` with the grid's `locale` — see
2197
+ * `formatCellValue` for the defaults each `type` starts from. Setting it,
2198
+ * or the grid's `locale`, is what turns that formatting on: without either,
2199
+ * numbers print as-is and dates through `toLocaleString()`.
2200
+ */
2201
+ format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | undefined;
2202
+ /**
2203
+ * Turns a value into the text shown for it, in place of `format` and
2204
+ * `type`. Applies wherever this column's values are shown as text — its
2205
+ * cells and its aggregates. `row` is the cell's row, and `undefined` for a
2206
+ * value no single row owns: an aggregate result, or a group header's value.
2207
+ */
2208
+ valueFormatter?: ((value: unknown, row: Row | undefined) => string) | undefined;
2209
+ /**
2210
+ * Alignment of this column's cells. This package is framework-agnostic so it
2211
+ * defaults to `left` (`right` for numbers);
2212
+ */
2213
+ alignment?: ColumnAlignment | undefined;
2214
+ /**
2215
+ * Width in px this column starts at. A user resize overrides it for as long
2216
+ * as that resize lives in the sizing state.
2217
+ */
2218
+ width?: number | undefined;
2219
+ /** Lower bound a resize may not drag below. */
2220
+ minWidth?: number | undefined;
2221
+ /** Upper bound a resize may not drag above. */
2222
+ maxWidth?: number | undefined;
2223
+ /** Whether this column can be resized, overriding the grid-level default. */
2224
+ resizable?: boolean | undefined;
2225
+ /**
2226
+ * Whether this column can be dragged to a new position, overriding the
2227
+ * grid-level default. A column that cannot move can still be moved past.
2228
+ */
2229
+ reorderable?: boolean | undefined;
2230
+ /** Whether this column can be sorted, overriding the grid-level default. */
2231
+ sortable?: boolean | undefined;
2232
+ /**
2233
+ * Whether this column has a filter menu, overriding the grid-level
2234
+ * `filterableColumns`. Like `sortable`, it gates the user's way in and
2235
+ * nothing else: a filter on the column set in code still applies.
2236
+ */
2237
+ filterable?: boolean | undefined;
2238
+ /**
2239
+ * This column's own filter menu settings — its editor and the operators
2240
+ * its conditions offer — over the grid's `filterMenu`.
2241
+ */
2242
+ filterMenu?: ColumnFilterMenuOptions | undefined;
2243
+ /** Whether this column can be grouped by, overriding the grid-level default. */
2244
+ groupable?: boolean | undefined;
2245
+ /**
2246
+ * Whether this column's header shows its group-toggle icon, overriding
2247
+ * the grid-level default. Purely a rendering choice — it does not affect
2248
+ * whether the column can be grouped by (`groupable`) or the
2249
+ * `Alt+ArrowDown` shortcut, which keeps working with the icon hidden, the
2250
+ * same way the resize handle stays `aria-hidden` while `Alt+ArrowLeft`/
2251
+ * `ArrowRight` still resize.
2252
+ */
2253
+ groupToggleIcon?: boolean | undefined;
2254
+ /**
2255
+ * Whether this column's header may be dragged into the group-by bar to
2256
+ * add it to the active grouping, overriding the grid-level default.
2257
+ * Distinct from `groupable`: a column can be groupable via its header's
2258
+ * click/`Alt+ArrowDown` toggle, via this drag, both, or neither.
2259
+ */
2260
+ groupByDraggable?: boolean | undefined;
2261
+ /**
2262
+ * Lets this column's header and/or cell text wrap onto multiple lines
2263
+ * instead of the grid's default single line with an ellipsis. Off by
2264
+ * default: wrapping changes row height, so it stays a column's own choice
2265
+ * rather than something a minor release could turn on under an existing
2266
+ * grid.
2267
+ */
2268
+ wrap?: ColumnWrapConfig | undefined;
2269
+ /**
2270
+ * Extra class names appended to this column's `th`. An escape hatch for a
2271
+ * consumer's own CSS — nothing in this package reads them — for anything
2272
+ * `wrap` and the rest of this type don't cover.
2273
+ */
2274
+ headerClassName?: string | undefined;
2275
+ /**
2276
+ * Extra class names appended to this column's `td`, on every row. Static
2277
+ * per column: a per-row condition is already `cellTemplate`'s job (a
2278
+ * template returning its own markup with a conditional class), so this
2279
+ * stays a plain string rather than taking the row.
2280
+ */
2281
+ cellClassName?: string | undefined;
2282
+ /**
2283
+ * Whether this column starts out hidden. A hidden column is not rendered
2284
+ * but is still a column of the grid: a sort, filter or grouping on it
2285
+ * still applies, and it keeps its place in the column order. The user
2286
+ * showing or hiding it lives in `ColumnVisibilityState`, which wins over
2287
+ * this for as long as it holds an entry for the column.
2288
+ */
2289
+ hidden?: boolean | undefined;
2290
+ /**
2291
+ * Whether the user may hide this column — from its header's menu, or the
2292
+ * column chooser. Defaults to `true`. Like `sortable`, it gates the user's
2293
+ * ways to do it and nothing else: `hideColumns` still hides the column.
2294
+ */
2295
+ hideable?: boolean | undefined;
2296
+ /**
2297
+ * Whether this column is written to an export, a clipboard copy or a
2298
+ * print. Defaults to `true`. `false` keeps it out of every one of them —
2299
+ * even when an export names it by id — for a column whose cells mean
2300
+ * nothing off screen, such as one of action buttons.
2301
+ */
2302
+ exportable?: boolean | undefined;
2303
+ /**
2304
+ * The typed value an export stores for this column's cells, where the raw
2305
+ * value at `field` is not the one to keep — an id to resolve into a name,
2306
+ * a string date to turn into a `Date`. Only a format that keeps typed
2307
+ * values (a spreadsheet, JSON) reads it; the text every format writes
2308
+ * still comes from `formatCellValue`, so what is exported reads as what
2309
+ * is shown.
2310
+ */
2311
+ exportValue?: ((value: unknown, row: Row) => ExportScalar) | undefined;
2312
+ }
2313
+ /** Which parts of a column opt out of the grid's default single-line text. */
2314
+ interface ColumnWrapConfig {
2315
+ header?: boolean | undefined;
2316
+ cells?: boolean | undefined;
2317
+ }
2318
+ /**
2319
+ * Widths the user has changed, keyed by column id. Holding only what changed —
2320
+ * rather than every width — means a `width` edited in the column definition
2321
+ * still takes effect, and resetting is discarding the state.
2322
+ */
2323
+ type ColumnSizingState = Readonly<Record<string, number>>;
2324
+ /** The active page, and how many rows/units make one up. */
2325
+ interface PaginationState {
2326
+ readonly pageIndex: number;
2327
+ readonly pageSize: number;
2328
+ }
2329
+ /**
2330
+ * What a grouped grid's `pageSize` counts. `"group"` counts top-level groups,
2331
+ * each with everything beneath it, so a page never splits a group. `"row"`
2332
+ * counts data rows and collapsed group headers, so every page holds
2333
+ * `pageSize` of them however large the groups are; a page continuing a group
2334
+ * starts with that group's headers again. An ungrouped grid pages by data
2335
+ * rows under either.
2336
+ */
2337
+ type PaginationUnit = "group" | "row";
2338
+ /** Reports a user page/page-size change whole — the one to persist from, mirroring ColumnSortEvent. */
2339
+ interface PaginationChangeEvent {
2340
+ readonly pagination: PaginationState;
2341
+ readonly pageCount: number;
2342
+ }
2343
+ /** Sizes used for a column that does not specify its own. */
2344
+ interface ColumnSizeDefaults {
2345
+ width: number;
2346
+ minWidth: number;
2347
+ maxWidth: number;
2348
+ }
2349
+ /** The bounds a column's width is held between, resolved once from both. */
2350
+ interface ColumnConstraints {
2351
+ minWidth: number;
2352
+ maxWidth: number;
2353
+ }
2354
+ /**
2355
+ * Grid-level defaults a column falls back to when it does not set its own.
2356
+ * Sizes are grouped so the rest of the grid's defaults have somewhere to go.
2357
+ */
2358
+ interface ColumnResolveOptions {
2359
+ sizes?: Partial<ColumnSizeDefaults> | undefined;
2360
+ /** Whether columns are resizable, unless a column says otherwise. */
2361
+ resizable?: boolean | undefined;
2362
+ /** Whether columns are reorderable, unless a column says otherwise. */
2363
+ reorderable?: boolean | undefined;
2364
+ /** Whether columns may be dragged into the group-by bar, unless a column says otherwise. */
2365
+ groupByDraggable?: boolean | undefined;
2366
+ }
2367
+ /**
2368
+ * How a column's width relates to the grid's.
2369
+ *
2370
+ * `"fit"` keeps the columns filling the grid: the space a column gives up is
2371
+ * handed to the others, and the space it takes comes out of them. `"fixed"`
2372
+ * lets every column keep its own width, so a resize moves one column and
2373
+ * nothing else, and the grid scrolls or leaves a gap accordingly.
2374
+ */
2375
+ type ResizeMode = "fit" | "fixed";
2376
+ /**
2377
+ * A column as the data stages read it — filtering, sorting, grouping and
2378
+ * aggregating need its id and its definition's `field` and `type`, never its
2379
+ * width. Kept apart from `ResolvedColumn` so that a resize or a viewport
2380
+ * change, which re-resolves every width, leaves these stages' input — and so
2381
+ * their output — untouched. `ResolvedColumn` satisfies it structurally.
2382
+ */
2383
+ interface DataColumn<Row, Node = string> {
2384
+ readonly id: string;
2385
+ readonly column: ColumnDefinition<Row, Node>;
2386
+ }
2387
+ /**
2388
+ * A column paired with everything it takes to render it. Each field is a
2389
+ * decision made once here rather than in each adapter, so a second framework
2390
+ * binding renders identically without repeating the logic.
2391
+ */
2392
+ interface ResolvedColumn<Row, Node = string> {
2393
+ column: ColumnDefinition<Row, Node>;
2394
+ id: string;
2395
+ width: number;
2396
+ /**
2397
+ * Whether `width` came from the sizing state rather than the column
2398
+ * definition — that is, whether the user set it. Auto-fit leaves these
2399
+ * columns alone so that resizing one does not undo itself.
2400
+ */
2401
+ sized: boolean;
2402
+ /**
2403
+ * What the header shows: the column's own `headerTemplate`, else its
2404
+ * `header`, else a label read off the field path. `string` is in the
2405
+ * union because both fallbacks are text whatever `Node` is bound to.
2406
+ */
2407
+ label: Node | string;
2408
+ /** Whether this column can be resized, after the grid-level default. */
2409
+ resizable: boolean;
2410
+ /** Whether this column can be dragged, after the grid-level default. */
2411
+ reorderable: boolean;
2412
+ /** Whether this column's header may be dragged into the group-by bar, after the grid-level default. */
2413
+ groupByDraggable: boolean;
2414
+ /** How this column's cells align, after falling back to its type. */
2415
+ alignment: ColumnAlignment;
2416
+ }
2417
+ /**
2418
+ * A resize in progress. It captures its constraints up front so that applying
2419
+ * a pointer position is arithmetic on numbers alone — no column, no DOM.
2420
+ */
2421
+ interface ColumnResizeSession {
2422
+ readonly columnId: string;
2423
+ readonly startWidth: number;
2424
+ readonly startPosition: number;
2425
+ readonly constraints: ColumnConstraints;
2426
+ }
2427
+ /**
2428
+ * Reports a user resize. `phase` separates the two audiences: `"move"` fires
2429
+ * continuously for live feedback, `"end"` once on release — the one to persist.
2430
+ */
2431
+ interface ColumnResizeEvent {
2432
+ readonly columnId: string;
2433
+ readonly width: number;
2434
+ readonly sizing: ColumnSizingState;
2435
+ readonly phase: "move" | "end";
2436
+ }
2437
+ /**
2438
+ * Columns shown (`true`) or hidden (`false`) since the grid started, keyed by
2439
+ * column id. Holding only what changed, the way `ColumnSizingState` does: a
2440
+ * column absent from it follows its definition's `hidden`, so a definition
2441
+ * edited later still takes effect for every column the user never touched.
2442
+ */
2443
+ type ColumnVisibilityState = Readonly<Record<string, boolean>>;
2444
+ /**
2445
+ * Reports columns shown or hidden. `columnIds` lists every column the one
2446
+ * change touched — showing three columns at once is one event, not three —
2447
+ * and `visibility` is the whole state to persist from.
2448
+ */
2449
+ interface ColumnVisibilityEvent {
2450
+ readonly columnIds: readonly string[];
2451
+ readonly visibility: ColumnVisibilityState;
2452
+ }
2453
+ /**
2454
+ * Column ids in the order they render. It need not list every column: one
2455
+ * absent from it keeps its position among the definitions and follows those
2456
+ * that are listed.
2457
+ */
2458
+ type ColumnOrderState = readonly string[];
2459
+ /**
2460
+ * Which side of a column a drop lands on, normalised away by
2461
+ * `resolveDropBefore` so it reaches no state.
2462
+ */
2463
+ type DropSide = "before" | "after";
2464
+ /**
2465
+ * Reports a user reorder. Unlike a resize there is no `"move"` phase — the
2466
+ * order does not change until the drop.
2467
+ */
2468
+ interface ColumnOrderEvent {
2469
+ readonly columnId: string;
2470
+ readonly order: ColumnOrderState;
2471
+ }
2472
+ /** Which way a column sorts. */
2473
+ type SortDirection = "asc" | "desc";
2474
+ /** One column's place in a stacked sort, and which way it sorts. */
2475
+ interface ColumnSortEntry {
2476
+ readonly columnId: string;
2477
+ readonly direction: SortDirection;
2478
+ }
2479
+ /**
2480
+ * The active sort, in priority order: index 0 sorts first, ties broken by
2481
+ * index 1, and so on down the stack. Empty for an unsorted grid, mirroring
2482
+ * `SelectionState`'s empty array for "nothing selected".
2483
+ */
2484
+ type ColumnSortState = readonly ColumnSortEntry[];
2485
+ /**
2486
+ * Reports a user sort change whole — the stack to persist from. No `phase`:
2487
+ * unlike a resize, a sort has no in-progress state, only before and after.
2488
+ */
2489
+ interface ColumnSortEvent {
2490
+ readonly columnId: string;
2491
+ readonly sort: ColumnSortState;
2492
+ }
2493
+ /** One level of a stacked group-by, outer to inner. Mirrors ColumnSortEntry. */
2494
+ interface GroupByEntry {
2495
+ readonly columnId: string;
2496
+ /** Order of this level's own group values (not row order within a group). Defaults to "asc". */
2497
+ readonly direction?: SortDirection;
2498
+ }
2499
+ /**
2500
+ * The active grouping, outer to inner: index 0 groups first, each
2501
+ * subsequent index nests inside it. Empty for an ungrouped grid, mirroring
2502
+ * ColumnSortState's empty array for "no sort".
2503
+ */
2504
+ type GroupByState = readonly GroupByEntry[];
2505
+ /**
2506
+ * Reports a user group-by change whole — the stack to persist from. Mirrors
2507
+ * ColumnSortEvent's `{columnId, sort}` shape.
2508
+ */
2509
+ interface GroupByEvent {
2510
+ readonly columnId: string;
2511
+ readonly groupBy: GroupByState;
2512
+ }
2513
+ /**
2514
+ * Which groups are expanded, as a policy with exceptions: under
2515
+ * `allExpanded` every group is expanded but those whose `groupId` is in
2516
+ * `except`; under `allCollapsed` every group is collapsed but those. The
2517
+ * mode covers every group, including one hidden under a collapsed ancestor
2518
+ * and one that appears only after the state was set, so `except` holds just
2519
+ * the groups toggled against it.
2520
+ */
2521
+ type GroupExpansionState = {
2522
+ readonly mode: "allExpanded";
2523
+ readonly except: readonly string[];
2524
+ } | {
2525
+ readonly mode: "allCollapsed";
2526
+ readonly except: readonly string[];
2527
+ };
2528
+ /**
2529
+ * Reports a user expansion change. `groupId` is the group toggled, or `null`
2530
+ * for expandAllGroups/collapseAllGroups and setGroupExpansion, which touch
2531
+ * every group in one call rather than one at a time.
2532
+ */
2533
+ interface GroupExpansionEvent {
2534
+ readonly groupId: string | null;
2535
+ readonly expansion: GroupExpansionState;
2536
+ }
2537
+ /**
2538
+ * One group header in a grouped result. `path` is every ancestor value
2539
+ * down to and including this group's own, outermost first — what a header
2540
+ * template needs to render "West / Enterprise", not just "Enterprise".
2541
+ *
2542
+ * Not parameterized by `Row`: nothing here holds a `Row`-typed value today —
2543
+ * `aggregates` holds computed `unknown` results, not rows themselves.
2544
+ */
2545
+ interface ResolvedGroupRow {
2546
+ readonly kind: "group";
2547
+ /** Stable id for this node: this plan's join of `path`, used as the React key and in GroupExpansionState's `except`. Opaque — build it with `groupRowId`, never construct one by hand. */
2548
+ readonly groupId: string;
2549
+ /** Nesting depth, 0 for a top-level group. */
2550
+ readonly level: number;
2551
+ readonly columnId: string;
2552
+ /** This level's own value — the last entry of `path`. */
2553
+ readonly value: unknown;
2554
+ readonly path: readonly unknown[];
2555
+ readonly expanded: boolean;
2556
+ /** Leaf row count under this group, regardless of collapse state. */
2557
+ readonly count: number;
2558
+ /** Position among the display rows as rendered — same invariant ResolvedRow.rowIndex keeps. */
2559
+ readonly rowIndex: number;
2560
+ /** This header's absolute position in the whole filtered/sorted/grouped dataset, matching ResolvedRow.datasetIndex. */
2561
+ readonly datasetIndex: number;
2562
+ /**
2563
+ * This group's own aggregate results, computed over its full leaf-row
2564
+ * descendants regardless of collapse state — see `withGroupAggregates`.
2565
+ * Empty when no `AggregateState` is active.
2566
+ */
2567
+ readonly aggregates: AggregateResults;
2568
+ }
2569
+ /**
2570
+ * A group's own aggregate results, rendered as a row of its own rather than
2571
+ * inline in its header — see `groupAggregateDisplay: "row"`. Emitted by
2572
+ * `withGroupAggregates` immediately after a group's last visible
2573
+ * descendant (its last nested group or data row, or immediately after its
2574
+ * own header when collapsed), at that same group's `level`, one per group
2575
+ * with `AggregateState` active — mirroring `ResolvedGroupRow` closely
2576
+ * enough that the two are meant to be read side by side.
2577
+ */
2578
+ interface ResolvedGroupSummaryRow {
2579
+ readonly kind: "group-summary";
2580
+ /** The group this summary belongs to — shared with that group's own `ResolvedGroupRow.groupId`, not a new id of its own. */
2581
+ readonly groupId: string;
2582
+ /** Nesting depth, matching the group's own `level`. */
2583
+ readonly level: number;
2584
+ /** Position among the display rows as rendered — same invariant every other DisplayRow's `rowIndex` keeps. */
2585
+ readonly rowIndex: number;
2586
+ /** This row's absolute position in the whole filtered/sorted/grouped dataset, matching ResolvedRow.datasetIndex. */
2587
+ readonly datasetIndex: number;
2588
+ /** This group's own aggregate results — identical to its `ResolvedGroupRow.aggregates`, computed once and shared rather than recomputed. */
2589
+ readonly aggregates: AggregateResults;
2590
+ }
2591
+ /**
2592
+ * One entry of a grouped result: a data row (`kind: "data"`), a group header
2593
+ * (`kind: "group"`), or — only when `groupAggregateDisplay: "row"` is
2594
+ * active — that group's own summary row (`kind: "group-summary"`).
2595
+ * Discriminate with `entry.kind`.
2596
+ */
2597
+ type DisplayRow<Row> = ResolvedRow<Row> | ResolvedGroupRow | ResolvedGroupSummaryRow;
2598
+ /** A reducer this package computes without a custom `AggregateFn`. */
2599
+ type BuiltInAggregate = "sum" | "avg" | "min" | "max" | "count" | "countDistinct";
2600
+ /**
2601
+ * Called with every raw row in scope — always the full leaf set, never a
2602
+ * partial reduction combined from child groups, so a non-associative
2603
+ * aggregate (median, distinct count) is never computed from
2604
+ * already-aggregated values. Mirrors `FilterPredicate`'s shape, minus the
2605
+ * per-row `value` since an aggregate reduces across rows rather than
2606
+ * testing one.
2607
+ */
2608
+ type AggregateFn<Row> = (rows: readonly Row[]) => unknown;
2609
+ /** One aggregate to compute against a column — a built-in reducer, or custom logic via `fn`. */
2610
+ interface AggregateSpec<Row> {
2611
+ readonly columnId: string;
2612
+ readonly fn: BuiltInAggregate | AggregateFn<Row>;
2613
+ /** Distinguishes two aggregates on the same column (e.g. both sum and avg of Amount). Defaults to columnId, mirroring ColumnDefinition.id defaulting to field. */
2614
+ readonly id?: string;
2615
+ /**
2616
+ * Overrides this aggregate's own cell alignment, in the grand-total
2617
+ * footer and a group's own summary row (`groupAggregateDisplay: "row"`)
2618
+ * — inline rendering (`"inline"`) is text, not a cell, so this has no
2619
+ * effect there. Falls back to the column's own `alignment` when omitted.
2620
+ * When two specs share a column and disagree, the first one in
2621
+ * `AggregateState` wins for that shared cell, since one `<td>` can only
2622
+ * take one `text-align`.
2623
+ */
2624
+ readonly alignment?: ColumnAlignment;
2625
+ }
2626
+ /**
2627
+ * The active aggregates to compute. Empty for a grid with none, mirroring
2628
+ * `FilterState`'s empty array for "no filter". A fully controlled prop —
2629
+ * unlike `sort`/`filter`/`groupBy`/`pagination`, there is no built-in UI
2630
+ * affordance for a user to add or remove an aggregate interactively.
2631
+ */
2632
+ type AggregateState<Row> = readonly AggregateSpec<Row>[];
2633
+ /** One computed aggregate result, keyed by `spec.id ?? spec.columnId`. */
2634
+ type AggregateResults = ReadonlyMap<string, unknown>;
2635
+ /**
2636
+ * Where a group's own aggregate results render. `"inline"` (the default)
2637
+ * keeps them as text in the group header itself, next to its leaf-row
2638
+ * count. `"row"` instead emits a `ResolvedGroupSummaryRow` immediately
2639
+ * after that group's last visible descendant, with each aggregate's value
2640
+ * in the `<td>` for its own column — the same alignment a grand-total
2641
+ * footer cell has to its column, just scoped to one group instead of the
2642
+ * whole dataset.
2643
+ */
2644
+ type GroupAggregateDisplay = "inline" | "row";
2645
+ interface FilterEntryBase<Row> {
2646
+ readonly columnId?: FieldPath<Row> | (string & {});
2647
+ }
2648
+ /** Matches a column's stringified value against an SQL LIKE-style query. */
2649
+ interface TextFilterEntry<Row> extends FilterEntryBase<Row> {
2650
+ readonly kind: "text";
2651
+ /**
2652
+ * A bare query is an exact match; `%text%` is contains; `text%` is
2653
+ * starts-with; `%text` is ends-with. Always case-insensitive. Only the
2654
+ * first and last characters are read as anchors — a `%` anywhere else is
2655
+ * a literal character, not a wildcard.
2656
+ */
2657
+ readonly query: string;
2658
+ }
2659
+ /**
2660
+ * Matches a column's actual (non-stringified) value by strict equality —
2661
+ * only when the column's resolved `type` agrees: `number`/`decimal`/
2662
+ * `currency`/`percent` for a `number` value, `boolean` for a `boolean`
2663
+ * value, `date`/`dateTime`/`time` for a `Date` value (compared via
2664
+ * `getTime()`). A `value` against a column of the wrong type never matches,
2665
+ * rather than silently stringifying and falling through to a text
2666
+ * comparison — the whole point of this variant existing separately from
2667
+ * `TextFilterEntry` is that it doesn't do that.
2668
+ */
2669
+ interface ValueFilterEntry<Row> extends FilterEntryBase<Row> {
2670
+ readonly kind: "value";
2671
+ readonly value: number | boolean | Date;
2672
+ }
2673
+ type FilterPredicate<Row> = (value: unknown, row: Row) => boolean;
2674
+ /**
2675
+ * Matches via caller-supplied logic — a numeric range, a cross-field
2676
+ * combination, anything `query`/`value` can't express. Called once per row,
2677
+ * not per column: when `columnId` is given, `value` is that column's value,
2678
+ * resolved for convenience; when it's omitted, `value` is `undefined` and
2679
+ * the predicate is expected to read whatever it needs off `row` itself.
2680
+ */
2681
+ interface PredicateFilterEntry<Row> extends FilterEntryBase<Row> {
2682
+ readonly kind: "predicate";
2683
+ readonly predicate: FilterPredicate<Row>;
2684
+ }
2685
+ /**
2686
+ * A nested group of entries, combined with `combinator` instead of the
2687
+ * implicit AND every top-level `FilterState` uses. `entries` is itself a
2688
+ * `FilterState<Row>`, so groups nest to any depth — the only entry variant
2689
+ * with no `columnId` of its own, since it isn't scoped to one column, only
2690
+ * to the entries it composes.
2691
+ */
2692
+ interface GroupFilterEntry<Row> {
2693
+ readonly kind: "group";
2694
+ readonly combinator: "and" | "or";
2695
+ readonly entries: FilterState<Row>;
2696
+ }
2697
+ /**
2698
+ * What an `OperatorFilterEntry` asks of a cell. `contains`, `notContains`,
2699
+ * `startsWith` and `endsWith` read the value as text; the rest compare it as
2700
+ * the column's `type` says.
2701
+ */
2702
+ type FilterOperator = "eq" | "ne" | "contains" | "notContains" | "startsWith" | "endsWith" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "isEmpty" | "isNotEmpty";
2703
+ /** A value an `OperatorFilterEntry` compares a cell against. */
2704
+ type FilterScalar = string | number | boolean | Date | null;
2705
+ /**
2706
+ * Matches one column's value by a named operator — plain data, unlike a
2707
+ * predicate, so a filter built from these can be saved and restored.
2708
+ *
2709
+ * `value` is one `FilterScalar` for most operators, a list of them for
2710
+ * `in`, a `[low, high]` pair for `between` (both ends inclusive), and
2711
+ * absent for `isEmpty`/`isNotEmpty`.
2712
+ *
2713
+ * - An empty cell is `null`, `undefined` or `""`. `isEmpty` matches it,
2714
+ * `isNotEmpty` does not, and so does no other operator — except `ne` and
2715
+ * `notContains`, which match it: a "not" filter must not quietly drop the
2716
+ * blanks. Each of those two is the exact opposite of `eq`/`contains`.
2717
+ * - The text operators compare the stringified value, case-insensitively.
2718
+ * - `eq`, `ne`, `gt`, `gte`, `lt`, `lte` and `between` compare as
2719
+ * `compareValues` does under the column's `type`: numerically,
2720
+ * chronologically, or as text (case-insensitively, like a query). A cell
2721
+ * of another kind — a string in a number column — is never equal, greater
2722
+ * or less.
2723
+ * - `in` matches the values grouping would put in the same group.
2724
+ * - A date column reads a string `value` as `new Date(value)`.
2725
+ * - A `value` of the wrong kind for the column — a string against a number
2726
+ * column, a missing pair for `between` — matches no row at all, as a
2727
+ * `ValueFilterEntry` of the wrong type doesn't.
2728
+ */
2729
+ interface OperatorFilterEntry<Row> {
2730
+ readonly kind: "operator";
2731
+ readonly columnId: FieldPath<Row> | (string & {});
2732
+ readonly operator: FilterOperator;
2733
+ readonly value?: FilterScalar | readonly FilterScalar[];
2734
+ }
2735
+ /** One condition of a `FilterState`, its `kind` naming which of the five. */
2736
+ type FilterEntry<Row> = TextFilterEntry<Row> | ValueFilterEntry<Row> | PredicateFilterEntry<Row> | OperatorFilterEntry<Row> | GroupFilterEntry<Row>;
2737
+ /**
2738
+ * The active filter, every entry ANDed together at the top level — nest a
2739
+ * `GroupFilterEntry` for anything that needs OR. Empty for an unfiltered
2740
+ * grid, mirroring `ColumnSortState`'s empty array for "no sort".
2741
+ */
2742
+ type FilterState<Row> = readonly FilterEntry<Row>[];
2743
+ /**
2744
+ * A `ValueFilterEntry` as JSON holds it: a `Date` value becomes its ISO
2745
+ * string, which restoring turns back into a `Date`.
2746
+ */
2747
+ interface SerializedValueFilterEntry<Row> extends FilterEntryBase<Row> {
2748
+ readonly kind: "value";
2749
+ readonly value: number | boolean | string;
2750
+ }
2751
+ /** A `FilterScalar` as JSON holds it: a `Date` becomes its ISO string. */
2752
+ type SerializedFilterScalar = string | number | boolean | null;
2753
+ /**
2754
+ * An `OperatorFilterEntry` as JSON holds it: each `Date` becomes its ISO
2755
+ * string, which restoring turns back into a `Date` when the column is a
2756
+ * date, date-time or time column.
2757
+ */
2758
+ interface SerializedOperatorFilterEntry<Row> {
2759
+ readonly kind: "operator";
2760
+ readonly columnId: FieldPath<Row> | (string & {});
2761
+ readonly operator: FilterOperator;
2762
+ readonly value?: SerializedFilterScalar | readonly SerializedFilterScalar[];
2763
+ }
2764
+ /** A `GroupFilterEntry` whose entries are serialised too. */
2765
+ interface SerializedGroupFilterEntry<Row> {
2766
+ readonly kind: "group";
2767
+ readonly combinator: "and" | "or";
2768
+ readonly entries: SerializedFilterState<Row>;
2769
+ }
2770
+ /**
2771
+ * A filter entry that survives `JSON.stringify`: every kind but a predicate,
2772
+ * which is a function and cannot be written down.
2773
+ */
2774
+ type SerializedFilterEntry<Row> = TextFilterEntry<Row> | SerializedValueFilterEntry<Row> | SerializedOperatorFilterEntry<Row> | SerializedGroupFilterEntry<Row>;
2775
+ type SerializedFilterState<Row> = readonly SerializedFilterEntry<Row>[];
2776
+ /** Reports a filter change whole — the filter to persist from. */
2777
+ interface FilterChangeEvent<Row> {
2778
+ readonly filter: FilterState<Row>;
2779
+ }
2780
+ /**
2781
+ * Ids selected, in the order they were selected — so the most recent is last,
2782
+ * and a consumer wanting only that reads `at(-1)` rather than tracking it
2783
+ * alongside.
2784
+ *
2785
+ * Ordered rather than a keyed record for that reason alone; a render layer
2786
+ * that needs lookups builds a `Set` from it. Rows and columns share the type:
2787
+ * they are both a list of ids, and the state they live in already names which.
2788
+ */
2789
+ type SelectionState = readonly string[];
2790
+ /**
2791
+ * How much of a member may be selected at once. `false` rather than an absent
2792
+ * key so that turning selection off for one member reads the same as never
2793
+ * having enabled it.
2794
+ */
2795
+ type SelectionMode = false | "single" | "multiple";
2796
+ /**
2797
+ * The modes a cell may take. A cell addresses one value, so it has no
2798
+ * `"multiple"` — a range of cells is a different feature, with a rectangle
2799
+ * rather than a list behind it.
2800
+ */
2801
+ type CellSelectionMode = false | "single";
2802
+ /**
2803
+ * Which parts of the grid the user may select, and how many of each.
2804
+ *
2805
+ * Off by default, unlike `HoverableConfig`: selection claims the click, which
2806
+ * a grid that only displays data should not do.
2807
+ */
2808
+ interface SelectableConfig {
2809
+ rows?: SelectionMode | undefined;
2810
+ columns?: SelectionMode | undefined;
2811
+ cells?: CellSelectionMode | undefined;
2812
+ /**
2813
+ * Whether a plain click on a row toggles it rather than selecting it
2814
+ * alone — a checklist, where picking rows one after another should not
2815
+ * need Ctrl held down. Shift still selects a range and Ctrl/Cmd still
2816
+ * toggles. Rows only: a column or cell click is unchanged.
2817
+ */
2818
+ toggleOnClick?: boolean | undefined;
2819
+ }
2820
+ /**
2821
+ * What an interaction means for the selection, read off its modifiers once at
2822
+ * the boundary so that nothing downstream handles a raw event.
2823
+ */
2824
+ type SelectIntent = "replace" | "toggle" | "range";
2825
+ /** The address of one cell: which row, and which column within it. */
2826
+ interface SelectedCellRef {
2827
+ readonly rowId: string;
2828
+ readonly columnId: string;
2829
+ }
2830
+ /**
2831
+ * Which cells are selected: none, or one cell by its address. A minor
2832
+ * release may add a member, such as a range of cells, so a `switch` over
2833
+ * `kind` needs a `default`.
2834
+ */
2835
+ type CellSelectionState = {
2836
+ readonly kind: "none";
2837
+ } | {
2838
+ readonly kind: "cell";
2839
+ readonly rowId: string;
2840
+ readonly columnId: string;
2841
+ };
2842
+ /**
2843
+ * What changed between two selections. Ids rather than resolved members, so
2844
+ * that the transform producing it stays free of the data it selects from.
2845
+ */
2846
+ interface SelectionDiff {
2847
+ readonly added: readonly string[];
2848
+ readonly removed: readonly string[];
2849
+ }
2850
+ /**
2851
+ * A row paired with the identity and position it renders under — the row
2852
+ * counterpart to `ResolvedColumn`, and resolved once for the same reason: so
2853
+ * no part of the grid works out a row's id for itself.
2854
+ *
2855
+ * It is also what the selection callbacks report, so a handler reads the row
2856
+ * itself rather than an id it has to look up.
2857
+ */
2858
+ interface ResolvedRow<Row> {
2859
+ readonly kind: "data";
2860
+ readonly rowId: string;
2861
+ readonly row: Row;
2862
+ /** Position among the rows as rendered, matching `CellTemplateContext`. */
2863
+ readonly rowIndex: number;
2864
+ /** This row's absolute position in the whole filtered/sorted/grouped dataset, matching `CellTemplateContext`. */
2865
+ readonly datasetIndex: number;
2866
+ }
2867
+ /**
2868
+ * A selected column. Carries the resolved column rather than the bare
2869
+ * definition, so a handler reads the width and label the user actually
2870
+ * clicked rather than what the definition asked for.
2871
+ */
2872
+ interface SelectedColumn<Row, Node = string> {
2873
+ readonly columnId: string;
2874
+ readonly column: ResolvedColumn<Row, Node>;
2875
+ /** Position among the columns as displayed, so after any reorder. */
2876
+ readonly columnIndex: number;
2877
+ }
2878
+ /** A selected cell, resolved down to the value it shows. */
2879
+ interface SelectedCell<Row, Node = string> {
2880
+ readonly rowId: string;
2881
+ readonly columnId: string;
2882
+ readonly row: Row;
2883
+ readonly column: ResolvedColumn<Row, Node>;
2884
+ readonly rowIndex: number;
2885
+ readonly columnIndex: number;
2886
+ /** Read off the column's field path — the value a `cellTemplate` receives. */
2887
+ readonly value: unknown;
2888
+ }
2889
+ /**
2890
+ * Reports a click or double-click on a data row. Carries the modifiers and
2891
+ * button rather than the browser's own event, so a handler reads the same
2892
+ * payload whichever renderer drew the row.
2893
+ */
2894
+ interface RowPointerEvent<Row> {
2895
+ readonly row: ResolvedRow<Row>;
2896
+ /** The column of the cell the pointer was on, or `null` when it was on no cell. */
2897
+ readonly columnId: string | null;
2898
+ readonly native: {
2899
+ readonly ctrlKey: boolean;
2900
+ readonly metaKey: boolean;
2901
+ readonly shiftKey: boolean;
2902
+ readonly altKey: boolean;
2903
+ /** Which button was pressed, numbered as `MouseEvent.button` numbers them — `0` for the main one. */
2904
+ readonly button: number;
2905
+ };
2906
+ }
2907
+ /** Reports one row selected or deselected. */
2908
+ interface RowSelectEvent<Row> {
2909
+ readonly row: ResolvedRow<Row>;
2910
+ readonly selection: SelectionState;
2911
+ }
2912
+ /**
2913
+ * Reports every row one interaction selected or deselected. Fires once for a
2914
+ * range that `RowSelectEvent` reports one row at a time.
2915
+ */
2916
+ interface RowsSelectEvent<Row> {
2917
+ readonly rows: readonly ResolvedRow<Row>[];
2918
+ readonly selection: SelectionState;
2919
+ }
2920
+ /**
2921
+ * Reports a row selection change whole: what it gained, what it lost, and
2922
+ * everything it now holds. The one to persist from.
2923
+ */
2924
+ interface RowSelectionChangeEvent<Row> {
2925
+ readonly added: readonly ResolvedRow<Row>[];
2926
+ readonly removed: readonly ResolvedRow<Row>[];
2927
+ /** Every selected row, not only what this interaction changed. */
2928
+ readonly selected: readonly ResolvedRow<Row>[];
2929
+ readonly selection: SelectionState;
2930
+ }
2931
+ /** Reports one column selected or deselected. */
2932
+ interface ColumnSelectEvent<Row, Node = string> {
2933
+ readonly column: SelectedColumn<Row, Node>;
2934
+ readonly selection: SelectionState;
2935
+ }
2936
+ /** Reports every column one interaction selected or deselected. */
2937
+ interface ColumnsSelectEvent<Row, Node = string> {
2938
+ readonly columns: readonly SelectedColumn<Row, Node>[];
2939
+ readonly selection: SelectionState;
2940
+ }
2941
+ /** Reports a column selection change whole. The one to persist from. */
2942
+ interface ColumnSelectionChangeEvent<Row, Node = string> {
2943
+ readonly added: readonly SelectedColumn<Row, Node>[];
2944
+ readonly removed: readonly SelectedColumn<Row, Node>[];
2945
+ /** Every selected column, not only what this interaction changed. */
2946
+ readonly selected: readonly SelectedColumn<Row, Node>[];
2947
+ readonly selection: SelectionState;
2948
+ }
2949
+ /** Reports the cell selected or deselected. */
2950
+ interface CellSelectEvent<Row, Node = string> {
2951
+ readonly cell: SelectedCell<Row, Node>;
2952
+ readonly selection: CellSelectionState;
2953
+ }
2954
+ /**
2955
+ * Reports a cell selection change whole. `selected` and `deselected` are
2956
+ * nullable and one interaction can fill both — moving between cells
2957
+ * deselects and selects at once.
2958
+ */
2959
+ interface CellSelectionChangeEvent<Row, Node = string> {
2960
+ readonly selected: SelectedCell<Row, Node> | null;
2961
+ readonly deselected: SelectedCell<Row, Node> | null;
2962
+ readonly selection: CellSelectionState;
2963
+ }
2964
+ /**
2965
+ * Everything about a grid the user can change, one slice per feature. Each
2966
+ * slice is the same `*State` type its own `default*` prop and change event
2967
+ * already use, so state read from here can be fed straight back as a default.
2968
+ */
2969
+ interface GridState<Row> {
2970
+ readonly columnSizing: ColumnSizingState;
2971
+ readonly columnOrder: ColumnOrderState;
2972
+ readonly columnVisibility: ColumnVisibilityState;
2973
+ readonly columnSort: ColumnSortState;
2974
+ readonly filter: FilterState<Row>;
2975
+ readonly groupBy: GroupByState;
2976
+ readonly groupExpansion: GroupExpansionState;
2977
+ readonly pagination: PaginationState;
2978
+ readonly rowSelection: SelectionState;
2979
+ readonly columnSelection: SelectionState;
2980
+ readonly cellSelection: CellSelectionState;
2981
+ }
2982
+ /**
2983
+ * `GridState` as `serializeGridState` writes it: safe to pass through
2984
+ * `JSON.stringify` and back, and to hand straight to `restoreState`.
2985
+ */
2986
+ interface SerializedGridState<Row> extends Omit<GridState<Row>, "filter"> {
2987
+ /**
2988
+ * The shape the state was saved in, so `restoreState` can read a layout
2989
+ * saved by an earlier release. A saved state without one predates it.
2990
+ */
2991
+ readonly version: 1;
2992
+ readonly filter: SerializedFilterState<Row>;
2993
+ }
2994
+ /**
2995
+ * The slices the view is derived from: every one but the selections, which
2996
+ * change what is highlighted and never what is shown. A whole `GridState`
2997
+ * is one.
2998
+ */
2999
+ type GridViewState<Row> = Omit<GridState<Row>, "rowSelection" | "columnSelection" | "cellSelection">;
3000
+ /**
3001
+ * The settings that shape the view but are not user state: what the grid is
3002
+ * configured to do, plus the one measurement — `viewportWidth` — that fitting
3003
+ * columns needs from the page. Every field falls back to the same default
3004
+ * the React grid's matching prop does.
3005
+ */
3006
+ interface GridViewOptions<Row> {
3007
+ /** Whether `pageRows` is one page of `displayRows` rather than all of it. Defaults to `false`. */
3008
+ readonly paginated?: boolean | undefined;
3009
+ /** What a page's `pageSize` counts once grouped. Defaults to `"group"`. */
3010
+ readonly paginationUnit?: PaginationUnit | undefined;
3011
+ readonly aggregates?: AggregateState<Row> | undefined;
3012
+ /** Defaults to `"inline"`. */
3013
+ readonly groupAggregateDisplay?: GroupAggregateDisplay | undefined;
3014
+ readonly columnSizeDefaults?: Partial<ColumnSizeDefaults> | undefined;
3015
+ readonly resizableColumns?: boolean | undefined;
3016
+ readonly reorderableColumns?: boolean | undefined;
3017
+ readonly groupByDraggableColumns?: boolean | undefined;
3018
+ /** Defaults to `"fit"`, which only takes effect once `viewportWidth` is known. */
3019
+ readonly resizeMode?: ResizeMode | undefined;
3020
+ /**
3021
+ * The width, in px, `"fit"` fills. `null` or absent before it has been
3022
+ * measured, or where there is no viewport at all (an export in Node), and
3023
+ * then columns keep their resolved widths.
3024
+ */
3025
+ readonly viewportWidth?: number | null | undefined;
3026
+ }
3027
+ /** What `resolveGridView` derives the view from. */
3028
+ interface GridViewInput<Row, Node = string> {
3029
+ readonly rows: readonly Row[];
3030
+ readonly getRowId?: ((row: Row, index: number) => string) | undefined;
3031
+ readonly columns: readonly ColumnDefinition<Row, Node>[];
3032
+ /**
3033
+ * The slices to show, any of them: one left out reads as the grid's
3034
+ * starting default — no sizes, order, hidden columns, sort, filter or
3035
+ * grouping, every group expanded, and the first page of 25.
3036
+ */
3037
+ readonly state: {
3038
+ readonly [K in keyof GridViewState<Row>]?: GridViewState<Row>[K] | undefined;
3039
+ };
3040
+ readonly options: GridViewOptions<Row>;
3041
+ }
3042
+ /**
3043
+ * What the user is looking at, derived once from `GridViewInput` — every
3044
+ * list a renderer draws, and the ones an export, a toolbar or a status line
3045
+ * reads, so none of them composes the pipeline for itself.
3046
+ */
3047
+ interface GridView<Row, Node = string> {
3048
+ /** Every column, hidden ones included, ordered but not sized — what the data stages read. */
3049
+ readonly dataColumns: readonly DataColumn<Row, Node>[];
3050
+ /** The columns as rendered: visible, ordered and sized. */
3051
+ readonly columns: readonly ResolvedColumn<Row, Node>[];
3052
+ /** The rows, filtered then sorted. */
3053
+ readonly rows: readonly ResolvedRow<Row>[];
3054
+ /** `rows` grouped, with each group's aggregates attached — every page of it. */
3055
+ readonly displayRows: readonly DisplayRow<Row>[];
3056
+ /** The current page of `displayRows`; all of it when not paginated. */
3057
+ readonly pageRows: readonly DisplayRow<Row>[];
3058
+ /** `pageRows` narrowed to its data rows, in display order — what a range selection spans. */
3059
+ readonly displayDataRows: readonly ResolvedRow<Row>[];
3060
+ /** `1` when not paginated. */
3061
+ readonly pageCount: number;
3062
+ /** `state.pagination.pageIndex` clamped into range; `0` when not paginated. */
3063
+ readonly pageIndex: number;
3064
+ /** Every aggregate over all of `rows`, ungrouped and unpaginated. */
3065
+ readonly grandTotal: AggregateResults;
3066
+ }
3067
+
3068
+ /**
3069
+ * How a column of `type` aligns by default. Numeric types align right so that
3070
+ * their digits line up by place value; everything else reads from the left.
3071
+ */
3072
+ declare function alignmentForType(type: ColumnType): ColumnAlignment;
3073
+ /**
3074
+ * Derives one column per field across `rows`, in the order each field is first
3075
+ * seen — so a key that only appears in a later row still gets a column,
3076
+ * appended at the end. Nested objects contribute their non-object properties
3077
+ * as `"Parent.Child"`; anything deeper is skipped, as is the nested object
3078
+ * itself.
3079
+ *
3080
+ * Order follows `Object.entries`, which lists integer-like keys first
3081
+ * regardless of the order they were written in.
3082
+ *
3083
+ * `Node` is whatever the caller's renderer draws: an inferred column sets no
3084
+ * template, so it suits any.
3085
+ */
3086
+ declare function defineColumnsFromRows<Row, Node = string>(rows: readonly Row[]): readonly ColumnDefinition<Row, Node>[];
3087
+ /**
3088
+ * The key state about a column is stored under, and the key it renders with.
3089
+ * Every such lookup goes through here so the two can never disagree.
3090
+ */
3091
+ declare function getColumnId<Row>(column: ColumnDefinition<Row, unknown>): string;
3092
+ /**
3093
+ * The key state about a row is stored under, and the key it renders with — the
3094
+ * row's counterpart to `getColumnId`, and for the same reason: every such
3095
+ * lookup goes through here so no two can disagree.
3096
+ *
3097
+ * Falls back to the position so a grid given no `getRowId` still works. That
3098
+ * fallback ties a selection to where a row sits rather than to the row, so
3099
+ * anything that sorts, filters or pages its data has to supply one — otherwise
3100
+ * a re-sort leaves the same positions selected under different rows.
3101
+ */
3102
+ declare function resolveRowId<Row>(row: Row, index: number, getRowId?: (row: Row, index: number) => string): string;
3103
+ /**
3104
+ * What a column's header shows: its own `headerTemplate`, called first if it is
3105
+ * a function, or else its plain-text `header`, or else a label read off the
3106
+ * field path.
3107
+ */
3108
+ declare function resolveColumnLabel<Row, Node>(column: ColumnDefinition<Row, Node>): Node | string;
3109
+ /**
3110
+ * A column's name as text, for wherever markup will not do — an
3111
+ * announcement, an export. Its `header` first, even beside a
3112
+ * `headerTemplate`, since a template's output need not be text; then the
3113
+ * label `resolveColumnLabel` gives, when that is a string; then the label
3114
+ * read off the field path.
3115
+ */
3116
+ declare function resolveColumnHeaderText<Row>(column: ColumnDefinition<Row, unknown>): string;
3117
+ /** Which of a column header's keyboard interactions to announce. */
3118
+ interface KeyShortcutCapabilities {
3119
+ reorderable: boolean;
3120
+ resizable: boolean;
3121
+ sortable: boolean;
3122
+ groupable: boolean;
3123
+ /** Whether the column has a filter menu the header opens. Defaults to `false`. */
3124
+ filterable?: boolean | undefined;
3125
+ /** Whether the header opens the grid's context menu. Defaults to `false`. */
3126
+ contextMenu?: boolean | undefined;
3127
+ }
3128
+ /**
3129
+ * The `aria-keyshortcuts` string for a column header, naming only the keys
3130
+ * that column actually responds to — so the keys are discoverable, since
3131
+ * none of them is a convention a user would try unprompted.
3132
+ */
3133
+ declare function buildKeyShortcuts(capabilities: KeyShortcutCapabilities): string;
3134
+ /**
3135
+ * Accesses a value at a dotted path, e.g. `foo.bar.baz`.
3136
+ *
3137
+ * @param obj The object to access
3138
+ * @param path Path to the value, e.g. `"foo.bar"`
3139
+ * @returns The value at `path`, or `undefined` if it doesn't exist
3140
+ */
3141
+ declare function accessDotted(obj: unknown, path: string): unknown;
3142
+
3143
+ /**
3144
+ * The cell the grid's single tab stop sits on: a header cell, or a cell of
3145
+ * body row `rowIndex`. A body focus's `rowIndex` counts from `0`.
3146
+ */
3147
+ type GridFocus = {
3148
+ readonly area: "header";
3149
+ readonly columnIndex: number;
3150
+ } | {
3151
+ readonly area: "body";
3152
+ readonly rowIndex: number;
3153
+ readonly columnIndex: number;
3154
+ };
3155
+ /** The modifier keys held with a navigation key press. */
3156
+ interface NavigationModifiers {
3157
+ readonly ctrlKey: boolean;
3158
+ readonly metaKey: boolean;
3159
+ readonly altKey: boolean;
3160
+ readonly shiftKey: boolean;
3161
+ }
3162
+ /** The header's cell at `columnIndex`. */
3163
+ declare function headerFocus(columnIndex: number): GridFocus;
3164
+ /** Body row `rowIndex`'s cell at `columnIndex`. */
3165
+ declare function bodyFocus(rowIndex: number, columnIndex: number): GridFocus;
3166
+ /**
3167
+ * Holds a coordinate inside the grid, so that a focus surviving a column
3168
+ * removal or a shorter page never leaves the grid with no tab stop at all —
3169
+ * which is a grid a keyboard cannot reach. A body focus below the last row
3170
+ * moves up to it; one above the first row, or in a grid with no rows, moves
3171
+ * to the header.
3172
+ */
3173
+ declare function clampFocus(focus: GridFocus, rowCount: number, columnCount: number): GridFocus;
3174
+ /**
3175
+ * The focus a navigation key press moves to, or `null` when the key isn't
3176
+ * this grid's to handle — left for the browser or another handler.
3177
+ *
3178
+ * `pageSize` is a pre-measured row count rather than a callback: this
3179
+ * function takes plain data only, so a caller measures the viewport once and
3180
+ * hands over the number.
3181
+ *
3182
+ * `isSkippableRow` names rows the vertical moves (`ArrowUp`/`ArrowDown`/
3183
+ * `PageUp`/`PageDown`/`Ctrl+End`) never land a tab stop on — a group's own
3184
+ * summary row (`groupAggregateDisplay: "row"`), which still occupies a real
3185
+ * row slot for `rowCount`/`aria-rowindex` purposes but is presentational,
3186
+ * not a stop of its own. Left/right and plain `Home`/`End` stay row-scoped
3187
+ * and so never consult it. Defaults to skipping nothing, so every existing
3188
+ * caller (and every horizontal move) is unaffected.
3189
+ */
3190
+ declare function nextFocusForKey(key: string, modifiers: NavigationModifiers, focus: GridFocus, rowCount: number, columnCount: number, pageSize: number, isSkippableRow?: (rowIndex: number) => boolean): GridFocus | null;
3191
+
3192
+ /**
3193
+ * Puts `columns` in the order `order` gives. Ids it lists come first, in that
3194
+ * order; columns it omits keep their position among the definitions and
3195
+ * follow. Ids naming no column are ignored.
3196
+ *
3197
+ * Tolerating both gaps is what lets a stored order outlive the column list it
3198
+ * was made against.
3199
+ */
3200
+ declare function applyColumnOrder<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], order: ColumnOrderState): readonly ColumnDefinition<Row, Node>[];
3201
+ /**
3202
+ * `columns` in the order `order` gives, each paired with its id — the
3203
+ * width-free column list the data stages (filter, sort, group, aggregate)
3204
+ * read. Ordered here, ahead of sizing, so every later stage sees the one
3205
+ * already-ordered list and no part of the grid has to know a reorder
3206
+ * happened.
3207
+ */
3208
+ declare function resolveDataColumns<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], order: ColumnOrderState): readonly DataColumn<Row, Node>[];
3209
+ /**
3210
+ * The order with `movedId` lifted out and put back in front of `beforeId`, or
3211
+ * at the end when that is `null`.
3212
+ *
3213
+ * Returns `orderedIds` itself when the move changes nothing, so callers can
3214
+ * treat an unchanged reference as "no move happened".
3215
+ */
3216
+ declare function moveColumnBefore(orderedIds: ColumnOrderState, movedId: string, beforeId: string | null): ColumnOrderState;
3217
+ /**
3218
+ * Whether moving `movedId` in front of `beforeId` would rearrange anything, so
3219
+ * that a drop indicator promises exactly the moves that happen.
3220
+ *
3221
+ * Defined against `moveColumnBefore` rather than restating its conditions, so
3222
+ * the two cannot disagree about what a no-op is.
3223
+ */
3224
+ declare function movesColumn(orderedIds: ColumnOrderState, movedId: string, beforeId: string | null): boolean;
3225
+ /**
3226
+ * The id a drop on `side` of `targetId` lands in front of, which is `null`
3227
+ * past the last column.
3228
+ *
3229
+ * "After C" and "before D" name the same gap, so collapsing both to one id
3230
+ * keeps a drop target a single nullable string.
3231
+ */
3232
+ declare function resolveDropBefore(orderedIds: ColumnOrderState, targetId: string, side: DropSide): string | null;
3233
+ /**
3234
+ * The `beforeId` a keyboard nudge on `columnId` produces, for `onDrop` to
3235
+ * apply the same way a pointer drop does — or `undefined` when the nudge is a
3236
+ * no-op: `columnId` is not in `orderedIds`, or the nudge would move it left
3237
+ * of the start.
3238
+ *
3239
+ * `null` is a real answer here, not "no-op": it means append to the end, the
3240
+ * same convention `moveColumnBefore` uses.
3241
+ */
3242
+ declare function resolveKeyboardDropTarget(orderedIds: ColumnOrderState, columnId: string, direction: -1 | 1): string | null | undefined;
3243
+
3244
+ /**
3245
+ * The selection with `id` added if absent and removed if present — a
3246
+ * Ctrl-click, or Space on the focused member.
3247
+ *
3248
+ * The mode is enforced here rather than by each caller, so `"single"` cannot
3249
+ * accumulate no matter which interaction reaches it. Returns `selection`
3250
+ * itself when `mode` is `false`, keeping the unchanged-reference contract
3251
+ * `moveColumnBefore` set: a caller treats an unchanged reference as "nothing
3252
+ * happened" and neither renders nor reports.
3253
+ */
3254
+ declare function toggleSelection(selection: SelectionState, id: string, mode: SelectionMode): SelectionState;
3255
+ /**
3256
+ * The selection reduced to `id` alone — a plain click, which discards what
3257
+ * came before rather than adding to it.
3258
+ *
3259
+ * Never deselects, so clicking the one selected row leaves it selected.
3260
+ * Letting go of it is Ctrl-click's job, and `toggleSelection`'s.
3261
+ */
3262
+ declare function selectOnly(selection: SelectionState, id: string, mode: SelectionMode): SelectionState;
3263
+ /**
3264
+ * The selection replaced by every id from `anchorId` to `focusId` inclusive — a
3265
+ * Shift-click. The two may be given in either order.
3266
+ *
3267
+ * Spans `orderedIds`, the order as displayed, rather than the selection's own:
3268
+ * the range a user drew across the screen is the range they mean, whatever
3269
+ * order they clicked its ends in. Degrades to `selectOnly` under `"single"`,
3270
+ * where a range has nowhere to go.
3271
+ */
3272
+ declare function selectRange(selection: SelectionState, orderedIds: readonly string[], anchorId: string, focusId: string, mode: SelectionMode): SelectionState;
3273
+ /**
3274
+ * Every id in `orderedIds`, or `selection` untouched under any mode but
3275
+ * `"multiple"` — there is no selecting all of one thing.
3276
+ */
3277
+ declare function selectAll(selection: SelectionState, orderedIds: readonly string[], mode: SelectionMode): SelectionState;
3278
+ declare function clearSelection(selection: SelectionState): SelectionState;
3279
+ /**
3280
+ * What one transition added and what it removed.
3281
+ *
3282
+ * Defined here rather than in an adapter so that every callback reporting a
3283
+ * selection change reads one answer, and a select and a deselect fired for the
3284
+ * same interaction cannot disagree about which it was.
3285
+ */
3286
+ declare function diffSelection(previous: SelectionState, next: SelectionState): SelectionDiff;
3287
+ /** Whether two cell selections hold the same cells. */
3288
+ declare function isSameCell(a: CellSelectionState, b: CellSelectionState): boolean;
3289
+ /**
3290
+ * The cell selection moved to `cell` — a plain click. Idempotent: clicking the
3291
+ * selected cell again leaves it selected, matching `selectOnly`.
3292
+ */
3293
+ declare function selectCell(selection: CellSelectionState, cell: SelectedCellRef, mode: CellSelectionMode): CellSelectionState;
3294
+ /**
3295
+ * The cell selection moved to `cell`, or cleared when it is already there — a
3296
+ * Ctrl-click, matching `toggleSelection`.
3297
+ */
3298
+ declare function toggleCellSelection(selection: CellSelectionState, cell: SelectedCellRef, mode: CellSelectionMode): CellSelectionState;
3299
+ /**
3300
+ * The intent a click or key press carries, by the modifiers held with it.
3301
+ *
3302
+ * `toggleOnClick` makes the unmodified press a toggle — the
3303
+ * `selectable.toggleOnClick` checklist behaviour — leaving Shift and Ctrl
3304
+ * to mean what they always do.
3305
+ */
3306
+ declare function intentOf(event: {
3307
+ ctrlKey: boolean;
3308
+ metaKey: boolean;
3309
+ shiftKey: boolean;
3310
+ }, options?: {
3311
+ toggleOnClick?: boolean | undefined;
3312
+ }): SelectIntent;
3313
+ /**
3314
+ * The transform an intent asks for. A function rather than a branch inside
3315
+ * each caller, so a row and a column cannot come to mean different things by
3316
+ * the same click.
3317
+ */
3318
+ declare function applySelectionIntent(selection: SelectionState, orderedIds: readonly string[], anchorId: string | null, id: string, intent: SelectIntent, mode: SelectionMode): SelectionState;
3319
+
3320
+ /**
3321
+ * Applied to any column that does not size itself. The minimum is a width a
3322
+ * header stays legible at rather than a measured value — a column dragged
3323
+ * narrower than this reads as a rendering fault.
3324
+ */
3325
+ declare const DEFAULT_COLUMN_SIZES: ColumnSizeDefaults;
3326
+ /** How far one arrow key press moves a column edge. */
3327
+ declare const KEYBOARD_STEP = 10;
3328
+ /**
3329
+ * The bounds `column` may be sized between. Resolved in one place so that a
3330
+ * drag, a clamp and an auto-fit cannot disagree about a column's limits.
3331
+ */
3332
+ declare function resolveColumnConstraints<Row>(column: ColumnDefinition<Row, unknown>, defaults?: Partial<ColumnSizeDefaults>): ColumnConstraints;
3333
+ /** Holds `width` within `constraints`. */
3334
+ declare function clampColumnWidth(width: number, constraints: ColumnConstraints): number;
3335
+ /**
3336
+ * Pairs each column with everything needed to render it — the width it sits
3337
+ * at, the label its header shows, whether it may be resized and how its cells
3338
+ * align. Widths take the first of the sizing state, the column's own `width`,
3339
+ * and the default, then clamp.
3340
+ *
3341
+ * The sizing state winning means a user's drag outlives a re-render; a column
3342
+ * absent from it still tracks a `width` edited in the definition.
3343
+ */
3344
+ declare function resolveColumnWidths<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], sizing: ColumnSizingState, options?: ColumnResolveOptions): readonly ResolvedColumn<Row, Node>[];
3345
+ declare function totalColumnWidth<Row, Node>(resolved: readonly ResolvedColumn<Row, Node>[]): number;
3346
+ /**
3347
+ * Opens a resize. The session captures its constraints and starting point up
3348
+ * front, so applying a pointer position later is arithmetic on numbers alone —
3349
+ * which is what keeps the drag testable without a DOM.
3350
+ *
3351
+ * @param startPosition Where the pointer went down, on the axis being dragged.
3352
+ */
3353
+ declare function beginColumnResize<Row>(column: ColumnDefinition<Row, unknown>, startWidth: number, startPosition: number, defaults?: Partial<ColumnSizeDefaults>): ColumnResizeSession;
3354
+ /**
3355
+ * The width the dragged column takes with the pointer at `position`. The delta
3356
+ * is signed, so a right-to-left adapter negates it and nothing else changes.
3357
+ */
3358
+ declare function applyColumnResize(session: ColumnResizeSession, position: number): number;
3359
+ /**
3360
+ * Fits columns to `availableWidth`: grows them to fill leftover space, or
3361
+ * shrinks them to relieve an overflow, in both cases proportionally to each
3362
+ * column's current width. Columns the user has sized are left alone in
3363
+ * either direction, so dragging one column neither rubber-bands it back nor
3364
+ * has it absorb a squeeze meant for the rest.
3365
+ *
3366
+ * Growing stops at each column's `maxWidth`; shrinking stops at its
3367
+ * `minWidth`. If shrinking every adjustable column to its floor still does
3368
+ * not reach `availableWidth`, the columns are returned untouched and the
3369
+ * container scrolls rather than crushing them further.
3370
+ */
3371
+ declare function fitColumnsToWidth<Row, Node>(resolved: readonly ResolvedColumn<Row, Node>[], availableWidth: number, defaults?: Partial<ColumnSizeDefaults>): readonly ResolvedColumn<Row, Node>[];
3372
+ /**
3373
+ * The width a column needs to show `measuredWidth` of content.
3374
+ *
3375
+ * `padding` is an allowance on top of the measurement, since a column sized to
3376
+ * exactly its content can still round down into an ellipsis.
3377
+ */
3378
+ declare function sizeColumnToContent(measuredWidth: number, constraints: ColumnConstraints, padding?: number): number;
3379
+ /**
3380
+ * `current` with `columnId` reverted to its width in `base` — or omitted
3381
+ * entirely if `base` had none — for Escape to restore a resize in progress.
3382
+ *
3383
+ * A column with no stored width in `base` is correctly omitted by deleting
3384
+ * the key rather than merging its `base` width back in, which would
3385
+ * otherwise leave it pinned and hidden from auto-fit.
3386
+ */
3387
+ declare function revertColumnSize(current: ColumnSizingState, base: ColumnSizingState, columnId: string): ColumnSizingState;
3388
+
3389
+ /**
3390
+ * This group's id, from its path. Every group-id producer/consumer in this
3391
+ * package goes through this — never join `path` by hand elsewhere.
3392
+ *
3393
+ * `JSON.stringify` rather than a delimiter join: a delimiter would have to be
3394
+ * escaped in every segment to stay collision-free against a value that
3395
+ * legitimately contains it, and `JSON.stringify` already draws that
3396
+ * boundary between array entries for free.
3397
+ */
3398
+ declare function groupRowId(path: readonly unknown[]): string;
3399
+ /**
3400
+ * `rows`, regrouped into `groupBy`'s stacked levels — a group header per
3401
+ * distinct value at each level, ordered by `compareValues` per that level's
3402
+ * own `direction`, followed depth-first by its nested groups and/or data
3403
+ * rows. A group `expansion` collapses contributes only its own header,
3404
+ * nothing beneath it — but its `count` still reports the group's full
3405
+ * leaf-row count either way.
3406
+ *
3407
+ * Filter and sort are expected to have already run (see `resolveShownRows`):
3408
+ * this only reshapes their output, and never changes which rows appear or
3409
+ * their relative order within a group.
3410
+ *
3411
+ * `rowIndex` and `datasetIndex` are renumbered across the whole flattened
3412
+ * output, header rows included — the same invariant `sortRows`/`filterRows`
3413
+ * keep for a `ResolvedRow`, extended to `ResolvedGroupRow` since `GridBody`
3414
+ * addresses both kinds by the same flat position, and `aria-rowindex`
3415
+ * counts both.
3416
+ *
3417
+ * Returns `rows` itself, untouched, when `groupBy` is empty or names only
3418
+ * columns absent from `columns` — a stored grouping tolerates a column
3419
+ * removed from the definition the same way a stored `ColumnSortState` does.
3420
+ */
3421
+ declare function groupRows<Row>(rows: readonly ResolvedRow<Row>[], groupBy: GroupByState, expansion: GroupExpansionState, columns: readonly DataColumn<Row, unknown>[]): readonly DisplayRow<Row>[];
3422
+ /** Every group expanded, with no exceptions: where an uncontrolled grid starts. */
3423
+ declare const ALL_EXPANDED: GroupExpansionState;
3424
+ /** Every group collapsed, with no exceptions. */
3425
+ declare const ALL_COLLAPSED: GroupExpansionState;
3426
+ /** Whether `expansion` shows the group `groupId` names expanded. */
3427
+ declare function isGroupExpanded(expansion: GroupExpansionState, groupId: string): boolean;
3428
+ /**
3429
+ * The expansion with `groupId` collapsed if it was expanded, or expanded if
3430
+ * it was collapsed: it joins `except`, or leaves it, whatever the mode.
3431
+ */
3432
+ declare function toggleGroupExpansion(expansion: GroupExpansionState, groupId: string): GroupExpansionState;
3433
+ /**
3434
+ * Every group expanded, now and as groups appear. Returns `expansion` itself
3435
+ * when it already says so, so expanding twice is no change.
3436
+ */
3437
+ declare function expandAllGroups(expansion: GroupExpansionState): GroupExpansionState;
3438
+ /**
3439
+ * Every group collapsed, now and as groups appear: one hidden under a
3440
+ * collapsed ancestor too, so expanding that ancestor shows its children
3441
+ * collapsed. Returns `expansion` itself when it already says so.
3442
+ */
3443
+ declare function collapseAllGroups(expansion: GroupExpansionState): GroupExpansionState;
3444
+ /**
3445
+ * `groupBy` with `columnId` positioned in front of `beforeColumnId` — or at
3446
+ * the end when that is `null` — inserting a fresh entry if `columnId` isn't
3447
+ * already part of the stack, or lifting its existing entry out and back in
3448
+ * if it is. The one function both a header dropped on the group-by bar and
3449
+ * a chip dragged within it need: the former's `columnId` is usually new to
3450
+ * the stack, the latter's never is, and this doesn't need to be told which.
3451
+ *
3452
+ * An existing entry keeps its own object (and so its own `direction`)
3453
+ * rather than being rebuilt, so a level merely repositioned stays
3454
+ * reference-equal at its new index — the same reason `moveColumnBefore`
3455
+ * moves ids rather than rebuilding them.
3456
+ *
3457
+ * Returns `groupBy` itself, untouched, when the move changes nothing: a
3458
+ * drop on the entry's own id, or back into the gap it already occupies, or
3459
+ * naming a `beforeColumnId` absent from the stack. Inserting a column not
3460
+ * yet in the stack is never a no-op.
3461
+ */
3462
+ declare function moveGroupByBefore(groupBy: GroupByState, columnId: string, beforeColumnId: string | null): GroupByState;
3463
+ /**
3464
+ * Whether moving `columnId` in front of `beforeColumnId` would change
3465
+ * `groupBy` at all, so that a drop indicator promises exactly the move that
3466
+ * happens. Defined against `moveGroupByBefore` rather than restating its
3467
+ * conditions, the same relationship `movesColumn` keeps with
3468
+ * `moveColumnBefore`.
3469
+ */
3470
+ declare function movesGroupBy(groupBy: GroupByState, columnId: string, beforeColumnId: string | null): boolean;
3471
+
3472
+ /**
3473
+ * What one column's filter looks like to an editor — which of its forms can
3474
+ * show it, or that none can.
3475
+ *
3476
+ * - `"none"`: no entry touches the column.
3477
+ * - `"values"`: a checklist — one `in` entry, optionally OR-grouped with an
3478
+ * `isEmpty` on the same column (`includeBlanks`).
3479
+ * - `"conditions"`: one or two operator entries on the column (any but
3480
+ * `in`), at the top level (ANDed) or alone in one group with its
3481
+ * combinator.
3482
+ * - `"custom"`: anything else that touches the column — a text query, a
3483
+ * predicate, a group spanning several columns. An editor shows it as
3484
+ * such, and applying an editor's draft replaces it.
3485
+ */
3486
+ type ColumnFilterShape<Row> = {
3487
+ readonly kind: "none";
3488
+ } | {
3489
+ readonly kind: "values";
3490
+ readonly values: readonly FilterScalar[];
3491
+ readonly includeBlanks: boolean;
3492
+ } | {
3493
+ readonly kind: "conditions";
3494
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
3495
+ readonly combinator: "and" | "or";
3496
+ } | {
3497
+ readonly kind: "custom";
3498
+ };
3499
+ /** One distinct value a column holds, as a checklist offers it. */
3500
+ interface ColumnValueOption {
3501
+ readonly value: Exclude<FilterScalar, null>;
3502
+ /** The value as the column prints it — what a search matches against. */
3503
+ readonly label: string;
3504
+ /** How many rows hold it, among the rows the other columns' filters keep. */
3505
+ readonly count: number;
3506
+ }
3507
+ /** What `columnValueOptions` narrows its list by. */
3508
+ interface ColumnValueQuery {
3509
+ /** Keeps the values whose label contains this, ignoring case. */
3510
+ readonly search?: string;
3511
+ /** Keeps at most this many values, first in sorted order. */
3512
+ readonly limit?: number;
3513
+ /** The locale labels are formatted for — the grid's own `locale`. */
3514
+ readonly locale?: FormatLocale;
3515
+ /**
3516
+ * The grid's own `messages`, over the defaults: a boolean is labelled
3517
+ * `booleanTrue`/`booleanFalse`, as its cells print it.
3518
+ */
3519
+ readonly messages?: Partial<GridMessages>;
3520
+ }
3521
+ interface ColumnValueOptions {
3522
+ /** The distinct values, sorted as the column sorts, searched and cut to `limit`. */
3523
+ readonly options: readonly ColumnValueOption[];
3524
+ /** How many values matched the search, before `limit` cut them. */
3525
+ readonly total: number;
3526
+ /** Whether `limit` left values out. */
3527
+ readonly truncated: boolean;
3528
+ /** How many of the same rows hold a blank — `null`, `undefined` or `""`. */
3529
+ readonly blanks: number;
3530
+ /**
3531
+ * The column's `type`, which tells values apart the way an `in` filter
3532
+ * does — on a date column, a date string and the `Date` it names are one
3533
+ * value. `initialFilterEditorDraft` carries it into the draft.
3534
+ */
3535
+ readonly columnType?: ColumnType | undefined;
3536
+ }
3537
+ /** What a `FilterEditorDraft` holds on either arm. */
3538
+ interface FilterEditorDraftBase<Row> {
3539
+ /** Every value the editor offers, from `columnValueOptions`. */
3540
+ readonly options: readonly ColumnValueOption[];
3541
+ /** How many rows hold a blank; the blanks entry only matters when some do. */
3542
+ readonly blanks: number;
3543
+ readonly search: string;
3544
+ /**
3545
+ * The column's filter as the editor opened on it. An action for the other
3546
+ * arm builds that arm from it, as reopening the editor would show it.
3547
+ */
3548
+ readonly openedShape: ColumnFilterShape<Row>;
3549
+ /** The column's `type`, from `ColumnValueOptions` — what values are keyed by. */
3550
+ readonly columnType?: ColumnType | undefined;
3551
+ }
3552
+ /** A draft on its checklist: the values `draftToFilter` writes as an `in` entry. */
3553
+ interface ValuesDraft<Row> extends FilterEditorDraftBase<Row> {
3554
+ readonly kind: "values";
3555
+ /** The checked values, keyed as an `in` filter on the column keys them. */
3556
+ readonly checked: ReadonlyMap<string, FilterScalar>;
3557
+ readonly includeBlanks: boolean;
3558
+ }
3559
+ /** A draft on its conditions: the operator entries `draftToFilter` writes. */
3560
+ interface ConditionsDraft<Row> extends FilterEditorDraftBase<Row> {
3561
+ readonly kind: "conditions";
3562
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
3563
+ readonly combinator: "and" | "or";
3564
+ }
3565
+ /**
3566
+ * A checklist or condition editor's working copy of one column's filter,
3567
+ * changed by `filterEditorReducer` and turned into a filter by
3568
+ * `draftToFilter` only when the user applies it — so cancelling is just
3569
+ * dropping the draft. It is on one arm at a time, the one `draftToFilter`
3570
+ * applies: the last one changed.
3571
+ */
3572
+ type FilterEditorDraft<Row> = ValuesDraft<Row> | ConditionsDraft<Row>;
3573
+ type FilterEditorAction<Row> = {
3574
+ readonly type: "search";
3575
+ readonly search: string;
3576
+ } | {
3577
+ readonly type: "toggleValue";
3578
+ readonly value: FilterScalar;
3579
+ }
3580
+ /** Checks every value the search shows, or unchecks them once all are. */
3581
+ | {
3582
+ readonly type: "toggleAll";
3583
+ } | {
3584
+ readonly type: "setIncludeBlanks";
3585
+ readonly includeBlanks: boolean;
3586
+ } | {
3587
+ readonly type: "setConditions";
3588
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
3589
+ /**
3590
+ * Keeps the draft's own when omitted; a checklist draft's is the opened
3591
+ * filter's, or `"and"`.
3592
+ */
3593
+ readonly combinator?: "and" | "or";
3594
+ }
3595
+ /**
3596
+ * Back to "no filter" on the draft's own arm — every value checked, or no
3597
+ * conditions — and no search.
3598
+ */
3599
+ | {
3600
+ readonly type: "clear";
3601
+ };
3602
+ /** A select-all checkbox's state over the values the search shows. */
3603
+ type SelectAllState = "checked" | "unchecked" | "mixed";
3604
+ /**
3605
+ * How `filter` filters `columnId`, as one of the forms an editor can show —
3606
+ * see `ColumnFilterShape`. Entries about other columns don't count, nor do
3607
+ * entries across every column (a global search).
3608
+ */
3609
+ declare function describeColumnFilter<Row>(filter: FilterState<Row>, columnId: string): ColumnFilterShape<Row>;
3610
+ /**
3611
+ * Whether `filter` filters `columnId` — whether `describeColumnFilter` reads
3612
+ * it as anything but `"none"` — for a header to show its column as
3613
+ * filtered. A global search filters every column alike, so it marks none.
3614
+ */
3615
+ declare function isColumnFiltered<Row>(filter: FilterState<Row>, columnId: string): boolean;
3616
+ /**
3617
+ * The distinct values `columnId` holds, for a checklist editor: each with
3618
+ * its label and how many rows hold it.
3619
+ *
3620
+ * Counted over the rows every *other* column's filter keeps — every entry
3621
+ * except those `describeColumnFilter` would count for this column — so a
3622
+ * column's list cascades from the other filters without its own pick
3623
+ * hiding the values the user unchecked. Values are told apart as an `in`
3624
+ * filter tells them apart — as grouping does, except that a date column's
3625
+ * date strings are the dates they name — ordered as the column sorts, and
3626
+ * labelled as its cells print, a boolean in `query.messages`' words; blanks
3627
+ * are counted apart, in `blanks`.
3628
+ *
3629
+ * Costs one pass over `rows` (tens of milliseconds at 100k rows), so compute
3630
+ * it when an editor opens rather than on every render, and hand the whole
3631
+ * list to `initialFilterEditorDraft`, whose search needs no recount.
3632
+ */
3633
+ declare function columnValueOptions<Row>(rows: readonly Row[], dataColumns: readonly DataColumn<Row, unknown>[], filter: FilterState<Row>, columnId: string, query?: ColumnValueQuery): ColumnValueOptions;
3634
+ /**
3635
+ * A draft showing `shape` over `values` — what an editor opens with. A
3636
+ * column filtered by conditions opens on them as they are. Anything else
3637
+ * opens on the checklist: with no filter, or one only a custom editor could
3638
+ * show, every value checked; a checklist with its own values checked, kept
3639
+ * even when the other filters now hide them.
3640
+ */
3641
+ declare function initialFilterEditorDraft<Row>(shape: ColumnFilterShape<Row>, values: ColumnValueOptions): FilterEditorDraft<Row>;
3642
+ /**
3643
+ * `draft` on its checklist: itself when it is there, otherwise the checklist
3644
+ * the filter it opened on shows, its conditions dropped. What a value action
3645
+ * starts from, and what a checklist draws over a draft on its conditions.
3646
+ */
3647
+ declare function toValuesDraft<Row>(draft: FilterEditorDraft<Row>): ValuesDraft<Row>;
3648
+ /**
3649
+ * `draft` on its conditions: itself when it is there, otherwise the
3650
+ * conditions the filter it opened on holds (none unless it was conditions),
3651
+ * its checklist dropped. What `setConditions` starts from.
3652
+ */
3653
+ declare function toConditionsDraft<Row>(draft: FilterEditorDraft<Row>): ConditionsDraft<Row>;
3654
+ /** The options the draft's search shows — those a select-all acts on. */
3655
+ declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): readonly ColumnValueOption[];
3656
+ /**
3657
+ * The select-all checkbox's state: whether every value the search shows is
3658
+ * checked, none is, or some are — blanks included while nothing is
3659
+ * searched.
3660
+ */
3661
+ declare function selectAllState<Row>(draft: ValuesDraft<Row>): SelectAllState;
3662
+ /**
3663
+ * The next draft after `action` — a plain reducer, so a renderer can hold
3664
+ * the draft in whatever state it has (`useReducer`, a signal, a store).
3665
+ * Changing a value or the blanks puts the draft on its checklist; setting
3666
+ * conditions puts it on its conditions. An action for the arm the draft
3667
+ * is not on starts that arm as the filter the editor opened on shows it
3668
+ * (`toValuesDraft`, `toConditionsDraft`), dropping what the other arm held.
3669
+ */
3670
+ declare function filterEditorReducer<Row>(draft: FilterEditorDraft<Row>, action: FilterEditorAction<Row>): FilterEditorDraft<Row>;
3671
+ /**
3672
+ * `current` with `columnId`'s filter replaced by what `draft` holds — what
3673
+ * applying an editor sets. Every entry about the column goes (custom ones
3674
+ * included); the draft's entries take the place of the first, so the rest
3675
+ * keep their order.
3676
+ *
3677
+ * A checklist with everything checked is no filter at all, and a partial
3678
+ * pick is one `in` entry, OR-grouped with an `isEmpty` when blanks are
3679
+ * kept. One condition is stored as itself, two as a group with the
3680
+ * draft's combinator. Returns `current` itself when nothing changes.
3681
+ */
3682
+ declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: string, current: FilterState<Row>): FilterState<Row>;
3683
+ /**
3684
+ * Whether `draft` changes anything since the editor opened at `opened` — for
3685
+ * an Apply that changes nothing to leave the column's filter as it is,
3686
+ * rather than writing the draft over it. Compared by value, not identity, so
3687
+ * a value unchecked and checked again, or the same conditions typed again,
3688
+ * is no change; the search never is one.
3689
+ *
3690
+ * Only the arm `draft` is on counts. A checklist changes when its checked
3691
+ * values or blanks differ from those `opened` shows (`toValuesDraft`), so
3692
+ * one left as it opened over conditions or a custom filter leaves that
3693
+ * filter be. Conditions change when they differ from those `opened` holds,
3694
+ * and always when `opened` is on its checklist (it opened on a checklist,
3695
+ * no filter or a custom one): setting conditions there replaces it, none
3696
+ * removing it.
3697
+ *
3698
+ * `clear` over a custom filter leaves a draft equal to the one it opened
3699
+ * with, so this reads it as no change.
3700
+ */
3701
+ declare function filterDraftChanged<Row>(opened: FilterEditorDraft<Row>, draft: FilterEditorDraft<Row>): boolean;
3702
+
3703
+ export { type CellSelectionState as $, type AggregateState as A, type SerializedGridState as B, type ColumnType as C, type DataColumn as D, type ExportTable as E, type FilterState as F, type GridControllerOptions as G, type ExportSource as H, type ExportWriter as I, type GridExportOptions as J, type ExportFile as K, ALL_COLLAPSED as L, type MenuEntry as M, ALL_EXPANDED as N, type AggregateFn as O, type PaginationUnit as P, type AggregateSpec as Q, type ResolvedMenuEntry as R, type SortDirection as S, type ToolbarItemAttributes as T, type Borders as U, type BuiltInAggregate as V, type BuiltInCommandIcon as W, type BuiltInCommandId as X, type CellSelectEvent as Y, type CellSelectionChangeEvent as Z, type CellSelectionMode as _, type GridController as a, type JsonOptions as a$, type CellTemplateContext as a0, type ColumnAlignment as a1, type ColumnConstraints as a2, type ColumnFilterMenuOptions as a3, type ColumnOrderEvent as a4, type ColumnOrderState as a5, type ColumnResizeEvent as a6, type ColumnResolveOptions as a7, type ColumnSelectEvent as a8, type ColumnSelectionChangeEvent as a9, type FilterOperatorFamily as aA, type FilterPredicate as aB, type FilterScalar as aC, type FooterTemplateContext as aD, type FormatLocale as aE, type GridCommandActions as aF, type GridCommandEvent as aG, type GridCommandSource as aH, type GridContextMenuArea as aI, type GridContextMenuEntries as aJ, type GridContextMenuOptions as aK, type GridContextMenuRequest as aL, type GridContextMenuTarget as aM, type GridFilterMenuOptions as aN, type GridFocus as aO, type GridOptions as aP, type GridPanelKind as aQ, type GridToolbarOptions as aR, type GridViewOptions as aS, type GridViewState as aT, type GroupByBarVisibility as aU, type GroupByEntry as aV, type GroupByEvent as aW, type GroupExpansionEvent as aX, type GroupExpansionState as aY, type GroupFilterEntry as aZ, type HoverableConfig as a_, type ColumnSizeDefaults as aa, type ColumnSizingState as ab, type ColumnSortEntry as ac, type ColumnSortEvent as ad, type ColumnVisibilityEvent as ae, type ColumnWrapConfig as af, type ColumnsSelectEvent as ag, type ContextMenuOpenChangeEvent as ah, type CopyContent as ai, type CsvOptions as aj, DEFAULT_COLUMN_SIZES as ak, DEFAULT_FILTER_VALUE_LIMIT as al, type ExportCell as am, type ExportColumn as an, type ExportDataRow as ao, type ExportGroupRow as ap, type ExportGroupSummaryRow as aq, type ExportOptions as ar, type ExportRow as as, type ExportScalar as at, type ExportTotalRow as au, type ExportWriteContext as av, type FilterChangeEvent as aw, type FilterEntry as ax, type FilterMenuUi as ay, type FilterOperator as az, type GridCommandTarget as b, formatGroupValue as b$, type MenuItemEntry as b0, type MenuSubmenuEntry as b1, type OperatorFilterEntry as b2, type PaginationChangeEvent as b3, type PredicateFilterEntry as b4, type PrintDocument as b5, type PrintOptions as b6, type PrintOrientation as b7, type PrintPage as b8, type PrintSource as b9, type SerializedGroupFilterEntry as bA, type SerializedOperatorFilterEntry as bB, type SerializedValueFilterEntry as bC, type TextFilterEntry as bD, type ToolbarCustomEntry as bE, type ValueFilterEntry as bF, accessDotted as bG, alignmentForType as bH, applyColumnOrder as bI, applySelectionIntent as bJ, bodyFocus as bK, buildExportTable as bL, builtInCommands as bM, clearSelection as bN, collapseAllGroups as bO, contextMenuEntries as bP, createDefaultMessages as bQ, csvWriter as bR, defaultContextMenu as bS, defaultFilterOperators as bT, defaultMessages as bU, defaultToolbar as bV, defineColumnsFromRows as bW, expandAllGroups as bX, exportPrintDocument as bY, formatAggregateValue as bZ, formatCellValue as b_, type ResizeMode as ba, type ResolvedGroupRow as bb, type ResolvedGroupSummaryRow as bc, type ResolvedMenuItem as bd, type ResolvedMenuSeparator as be, type ResolvedMenuSubmenu as bf, type ResolvedToolbarButton as bg, type ResolvedToolbarCustom as bh, type ResolvedToolbarMenu as bi, type ResolvedToolbarSearch as bj, type ResolvedToolbarSpacer as bk, type RowPointerEvent as bl, type RowProps as bm, type RowSelectEvent as bn, type RowSelectionChangeEvent as bo, type RowsSelectEvent as bp, type SelectIntent as bq, type SelectableConfig as br, type SelectionCallbacks as bs, type SelectionDiff as bt, type SelectionDiffEvent as bu, type SelectionMode as bv, type SelectionState as bw, type SerializedFilterEntry as bx, type SerializedFilterScalar as by, type SerializedFilterState as bz, type GridMessages as c, initialFilterEditorDraft as c$, getColumnId as c0, groupRowId as c1, groupRows as c2, headerFocus as c3, isColumnFiltered as c4, isGroupExpanded as c5, isSameCell as c6, jsonWriter as c7, moveColumnBefore as c8, moveGroupByBefore as c9, type CopySource as cA, type DropSide as cB, type FilterEditorAction as cC, type FilterEditorDraft as cD, type FilterEditorDraftBase as cE, KEYBOARD_STEP as cF, type KeyShortcutCapabilities as cG, type NavigationModifiers as cH, type ResolvedColumnFilterMenu as cI, applyColumnResize as cJ, beginColumnResize as cK, buildKeyShortcuts as cL, buildPrintDocument as cM, clampColumnWidth as cN, clampFocus as cO, columnValueOptions as cP, copyContent as cQ, describeColumnFilter as cR, diffSelection as cS, draftToFilter as cT, filterDraftChanged as cU, filterEditorReducer as cV, filterOperandArity as cW, filterOperatorFamily as cX, fitColumnsToWidth as cY, formatFilterOperand as cZ, hasContextMenu as c_, resolveColumnHeaderText as ca, resolveColumnLabel as cb, resolveColumnWidths as cc, resolveDataColumns as cd, resolveExportWriters as ce, resolveMessages as cf, resolveRowId as cg, selectAll as ch, selectCell as ci, selectOnly as cj, selectRange as ck, toCsv as cl, toJson as cm, toggleCellSelection as cn, toggleGroupExpansion as co, toggleSelection as cp, toolbarEntries as cq, type SelectAllState as cr, type ColumnFilterShape as cs, type ColumnValueQuery as ct, type ColumnValueOptions as cu, type ValuesDraft as cv, type ColumnResizeSession as cw, type ColumnValueOption as cx, type ConditionsDraft as cy, type CopyRequest as cz, type GridCommandHost as d, intentOf as d0, movesColumn as d1, movesGroupBy as d2, nextFocusForKey as d3, parseFilterOperand as d4, resolveColumnConstraints as d5, resolveColumnFilterMenu as d6, resolveDropBefore as d7, resolveKeyboardDropTarget as d8, revertColumnSize as d9, selectAllState as da, sizeColumnToContent as db, toConditionsDraft as dc, toValuesDraft as dd, totalColumnWidth as de, visibleFilterOptions as df, type GridCommandContext as e, type GridCommand as f, type GridToolbarTarget as g, type ToolbarEntry as h, type ResolvedToolbarItem as i, type ColumnSortState as j, type ResolvedRow as k, type FieldPath as l, type ResolvedColumn as m, type SelectedCellRef as n, type SelectedCell as o, type SelectedColumn as p, type DisplayRow as q, type PaginationState as r, type AggregateResults as s, type GroupByState as t, type GroupAggregateDisplay as u, type ColumnVisibilityState as v, type ColumnDefinition as w, type GridViewInput as x, type GridView as y, type GridState as z };