@gridkitjs/core 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -74,12 +74,19 @@ interface ColumnDefinition<Row, Node = string> {
74
74
  * same field differently.
75
75
  */
76
76
  id?: string;
77
+ /**
78
+ * The column's name as plain text. The header shows it when there is no
79
+ * `headerTemplate`, and anything that needs the name as text rather than
80
+ * markup — a screen-reader announcement, an export — reads it even when
81
+ * there is one, since a template's output need not be text at all.
82
+ */
83
+ header?: string | undefined;
77
84
  /** Header content, or a function returning it at render time. */
78
85
  headerTemplate?: Node | (() => Node) | undefined;
79
86
  /**
80
- * Renders this column's cells in place of the raw value at `field`. The
81
- * value is still resolved and handed over, so a template that only formats
82
- * it never repeats the field path.
87
+ * Renders this column's cells in place of the text `formatCellValue` makes
88
+ * of the value at `field`. The raw value is still resolved and handed over,
89
+ * so a template never repeats the field path.
83
90
  */
84
91
  cellTemplate?: ((context: CellTemplateContext<Row>) => Node) | undefined;
85
92
  /**
@@ -94,6 +101,22 @@ interface ColumnDefinition<Row, Node = string> {
94
101
  * defaults to `string`;
95
102
  */
96
103
  type?: ColumnType;
104
+ /**
105
+ * `Intl` options for how this column's values read as text: number options
106
+ * for a numeric `type`, date options for a date or time one. Passed to
107
+ * `Intl.NumberFormat`/`Intl.DateTimeFormat` with the grid's `locale` — see
108
+ * `formatCellValue` for the defaults each `type` starts from. Setting it,
109
+ * or the grid's `locale`, is what turns that formatting on: without either,
110
+ * numbers print as-is and dates through `toLocaleString()`.
111
+ */
112
+ format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | undefined;
113
+ /**
114
+ * Turns a value into the text shown for it, in place of `format` and
115
+ * `type`. Applies wherever this column's values are shown as text — its
116
+ * cells and its aggregates. `row` is the cell's row, and `undefined` for a
117
+ * value no single row owns: an aggregate result, or a group header's value.
118
+ */
119
+ valueFormatter?: ((value: unknown, row: Row | undefined) => string) | undefined;
97
120
  /**
98
121
  * Alignment of this column's cells. This package is framework-agnostic so it
99
122
  * defaults to `left` (`right` for numbers);
@@ -156,6 +179,20 @@ interface ColumnDefinition<Row, Node = string> {
156
179
  * stays a plain string rather than taking the row.
157
180
  */
158
181
  cellClassName?: string;
182
+ /**
183
+ * Whether this column starts out hidden. A hidden column is not rendered
184
+ * but is still a column of the grid: a sort, filter or grouping on it
185
+ * still applies, and it keeps its place in the column order. The user
186
+ * showing or hiding it lives in `ColumnVisibilityState`, which wins over
187
+ * this for as long as it holds an entry for the column.
188
+ */
189
+ hidden?: boolean | undefined;
190
+ /**
191
+ * Whether the user may hide this column — from its header's menu, or the
192
+ * column chooser. Defaults to `true`. Like `sortable`, it gates the user's
193
+ * ways to do it and nothing else: `hideColumns` still hides the column.
194
+ */
195
+ hideable?: boolean | undefined;
159
196
  }
160
197
  /** Which parts of a column opt out of the grid's default single-line text. */
161
198
  interface ColumnWrapConfig {
@@ -202,6 +239,26 @@ interface ColumnResolveOptions {
202
239
  /** Whether columns may be dragged into the group-by bar, unless a column says otherwise. */
203
240
  groupByDraggable?: boolean | undefined;
204
241
  }
242
+ /**
243
+ * How a column's width relates to the grid's.
244
+ *
245
+ * `"fit"` keeps the columns filling the grid: the space a column gives up is
246
+ * handed to the others, and the space it takes comes out of them. `"fixed"`
247
+ * lets every column keep its own width, so a resize moves one column and
248
+ * nothing else, and the grid scrolls or leaves a gap accordingly.
249
+ */
250
+ type ResizeMode = "fit" | "fixed";
251
+ /**
252
+ * A column as the data stages read it — filtering, sorting, grouping and
253
+ * aggregating need its id and its definition's `field` and `type`, never its
254
+ * width. Kept apart from `ResolvedColumn` so that a resize or a viewport
255
+ * change, which re-resolves every width, leaves these stages' input — and so
256
+ * their output — untouched. `ResolvedColumn` satisfies it structurally.
257
+ */
258
+ interface DataColumn<Row, Node = string> {
259
+ readonly id: string;
260
+ readonly column: ColumnDefinition<Row, Node>;
261
+ }
205
262
  /**
206
263
  * A column paired with everything it takes to render it. Each field is a
207
264
  * decision made once here rather than in each adapter, so a second framework
@@ -218,9 +275,9 @@ interface ResolvedColumn<Row, Node = string> {
218
275
  */
219
276
  sized: boolean;
220
277
  /**
221
- * What the header shows: the column's own `headerTemplate`, or a label read
222
- * off the field path. `string` is in the union because that fallback is text
223
- * whatever `Node` is bound to.
278
+ * What the header shows: the column's own `headerTemplate`, else its
279
+ * `header`, else a label read off the field path. `string` is in the
280
+ * union because both fallbacks are text whatever `Node` is bound to.
224
281
  */
225
282
  label: Node | string;
226
283
  /** Whether this column can be resized, after the grid-level default. */
@@ -252,6 +309,22 @@ interface ColumnResizeEvent {
252
309
  readonly sizing: ColumnSizingState;
253
310
  readonly phase: "move" | "end";
254
311
  }
312
+ /**
313
+ * Columns shown (`true`) or hidden (`false`) since the grid started, keyed by
314
+ * column id. Holding only what changed, the way `ColumnSizingState` does: a
315
+ * column absent from it follows its definition's `hidden`, so a definition
316
+ * edited later still takes effect for every column the user never touched.
317
+ */
318
+ type ColumnVisibilityState = Readonly<Record<string, boolean>>;
319
+ /**
320
+ * Reports columns shown or hidden. `columnIds` lists every column the one
321
+ * change touched — showing three columns at once is one event, not three —
322
+ * and `visibility` is the whole state to persist from.
323
+ */
324
+ interface ColumnVisibilityEvent {
325
+ readonly columnIds: readonly string[];
326
+ readonly visibility: ColumnVisibilityState;
327
+ }
255
328
  /**
256
329
  * Column ids in the order they render. It need not list every column: one
257
330
  * absent from it keeps its position among the definitions and follows those
@@ -484,13 +557,84 @@ interface GroupFilterEntry<Row> {
484
557
  readonly combinator: "and" | "or";
485
558
  readonly entries: FilterState<Row>;
486
559
  }
487
- type FilterEntry<Row> = TextFilterEntry<Row> | ValueFilterEntry<Row> | PredicateFilterEntry<Row> | GroupFilterEntry<Row>;
560
+ /**
561
+ * What an `OperatorFilterEntry` asks of a cell. `contains`, `notContains`,
562
+ * `startsWith` and `endsWith` read the value as text; the rest compare it as
563
+ * the column's `type` says.
564
+ */
565
+ type FilterOperator = "eq" | "ne" | "contains" | "notContains" | "startsWith" | "endsWith" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "isEmpty" | "isNotEmpty";
566
+ /** A value an `OperatorFilterEntry` compares a cell against. */
567
+ type FilterScalar = string | number | boolean | Date | null;
568
+ /**
569
+ * Matches one column's value by a named operator — plain data, unlike a
570
+ * predicate, so a filter built from these can be saved and restored.
571
+ *
572
+ * `value` is one `FilterScalar` for most operators, a list of them for
573
+ * `in`, a `[low, high]` pair for `between` (both ends inclusive), and
574
+ * absent for `isEmpty`/`isNotEmpty`.
575
+ *
576
+ * - An empty cell is `null`, `undefined` or `""`. `isEmpty` matches it,
577
+ * `isNotEmpty` does not, and so does no other operator — except `ne` and
578
+ * `notContains`, which match it: a "not" filter must not quietly drop the
579
+ * blanks. Each of those two is the exact opposite of `eq`/`contains`.
580
+ * - The text operators compare the stringified value, case-insensitively.
581
+ * - `eq`, `ne`, `gt`, `gte`, `lt`, `lte` and `between` compare as
582
+ * `compareValues` does under the column's `type`: numerically,
583
+ * chronologically, or as text (case-insensitively, like a query). A cell
584
+ * of another kind — a string in a number column — is never equal, greater
585
+ * or less.
586
+ * - `in` matches the values grouping would put in the same group.
587
+ * - A date column reads a string `value` as `new Date(value)`.
588
+ * - A `value` of the wrong kind for the column — a string against a number
589
+ * column, a missing pair for `between` — matches no row at all, as a
590
+ * `ValueFilterEntry` of the wrong type doesn't.
591
+ */
592
+ interface OperatorFilterEntry<Row> {
593
+ readonly columnId: FieldPath<Row> | (string & {});
594
+ readonly operator: FilterOperator;
595
+ readonly value?: FilterScalar | readonly FilterScalar[];
596
+ }
597
+ type FilterEntry<Row> = TextFilterEntry<Row> | ValueFilterEntry<Row> | PredicateFilterEntry<Row> | OperatorFilterEntry<Row> | GroupFilterEntry<Row>;
488
598
  /**
489
599
  * The active filter, every entry ANDed together at the top level — nest a
490
600
  * `GroupFilterEntry` for anything that needs OR. Empty for an unfiltered
491
601
  * grid, mirroring `ColumnSortState`'s empty array for "no sort".
492
602
  */
493
603
  type FilterState<Row> = readonly FilterEntry<Row>[];
604
+ /**
605
+ * A `ValueFilterEntry` as JSON holds it: a `Date` value becomes its ISO
606
+ * string, which restoring turns back into a `Date`.
607
+ */
608
+ interface SerializedValueFilterEntry<Row> extends FilterEntryBase<Row> {
609
+ readonly value: number | boolean | string;
610
+ }
611
+ /** A `FilterScalar` as JSON holds it: a `Date` becomes its ISO string. */
612
+ type SerializedFilterScalar = string | number | boolean | null;
613
+ /**
614
+ * An `OperatorFilterEntry` as JSON holds it: each `Date` becomes its ISO
615
+ * string, which restoring turns back into a `Date` when the column is a
616
+ * date, date-time or time column.
617
+ */
618
+ interface SerializedOperatorFilterEntry<Row> {
619
+ readonly columnId: FieldPath<Row> | (string & {});
620
+ readonly operator: FilterOperator;
621
+ readonly value?: SerializedFilterScalar | readonly SerializedFilterScalar[];
622
+ }
623
+ /** A `GroupFilterEntry` whose entries are serialised too. */
624
+ interface SerializedGroupFilterEntry<Row> {
625
+ readonly combinator: "and" | "or";
626
+ readonly entries: SerializedFilterState<Row>;
627
+ }
628
+ /**
629
+ * A filter entry that survives `JSON.stringify`: every kind but a predicate,
630
+ * which is a function and cannot be written down.
631
+ */
632
+ type SerializedFilterEntry<Row> = TextFilterEntry<Row> | SerializedValueFilterEntry<Row> | SerializedOperatorFilterEntry<Row> | SerializedGroupFilterEntry<Row>;
633
+ type SerializedFilterState<Row> = readonly SerializedFilterEntry<Row>[];
634
+ /** Reports a filter change whole — the filter to persist from. */
635
+ interface FilterChangeEvent<Row> {
636
+ readonly filter: FilterState<Row>;
637
+ }
494
638
  /**
495
639
  * Ids selected, in the order they were selected — so the most recent is last,
496
640
  * and a consumer wanting only that reads `at(-1)` rather than tracking it
@@ -523,6 +667,13 @@ interface SelectableConfig {
523
667
  rows?: SelectionMode | undefined;
524
668
  columns?: SelectionMode | undefined;
525
669
  cells?: CellSelectionMode | undefined;
670
+ /**
671
+ * Whether a plain click on a row toggles it rather than selecting it
672
+ * alone — a checklist, where picking rows one after another should not
673
+ * need Ctrl held down. Shift still selects a range and Ctrl/Cmd still
674
+ * toggles. Rows only: a column or cell click is unchanged.
675
+ */
676
+ toggleOnClick?: boolean | undefined;
526
677
  }
527
678
  /**
528
679
  * What an interaction means for the selection, read off its modifiers once at
@@ -582,6 +733,24 @@ interface SelectedCell<Row, Node = string> {
582
733
  /** Read off the column's field path — the value a `cellTemplate` receives. */
583
734
  readonly value: unknown;
584
735
  }
736
+ /**
737
+ * Reports a click or double-click on a data row. Carries the modifiers and
738
+ * button rather than the browser's own event, so a handler reads the same
739
+ * payload whichever renderer drew the row.
740
+ */
741
+ interface RowPointerEvent<Row> {
742
+ readonly row: ResolvedRow<Row>;
743
+ /** The column of the cell the pointer was on, or `null` when it was on no cell. */
744
+ readonly columnId: string | null;
745
+ readonly native: {
746
+ readonly ctrlKey: boolean;
747
+ readonly metaKey: boolean;
748
+ readonly shiftKey: boolean;
749
+ readonly altKey: boolean;
750
+ /** Which button was pressed, numbered as `MouseEvent.button` numbers them — `0` for the main one. */
751
+ readonly button: number;
752
+ };
753
+ }
585
754
  /** Reports one row selected or deselected. */
586
755
  interface RowSelectEvent<Row> {
587
756
  readonly row: ResolvedRow<Row>;
@@ -639,6 +808,1513 @@ interface CellSelectionChangeEvent<Row, Node = string> {
639
808
  readonly deselected: SelectedCell<Row, Node> | null;
640
809
  readonly selection: CellSelectionState;
641
810
  }
811
+ /**
812
+ * Everything about a grid the user can change, one slice per feature. Each
813
+ * slice is the same `*State` type its own `default*` prop and change event
814
+ * already use, so state read from here can be fed straight back as a default.
815
+ */
816
+ interface GridState<Row> {
817
+ readonly columnSizing: ColumnSizingState;
818
+ readonly columnOrder: ColumnOrderState;
819
+ readonly columnVisibility: ColumnVisibilityState;
820
+ readonly columnSort: ColumnSortState;
821
+ readonly filter: FilterState<Row>;
822
+ readonly groupBy: GroupByState;
823
+ readonly groupExpansion: GroupExpansionState;
824
+ readonly pagination: PaginationState;
825
+ readonly rowSelection: SelectionState;
826
+ readonly columnSelection: SelectionState;
827
+ readonly cellSelection: CellSelectionState;
828
+ }
829
+ /**
830
+ * `GridState` as `serializeGridState` writes it: safe to pass through
831
+ * `JSON.stringify` and back, and to hand straight to `restoreState`.
832
+ */
833
+ interface SerializedGridState<Row> extends Omit<GridState<Row>, "filter"> {
834
+ readonly filter: SerializedFilterState<Row>;
835
+ }
836
+ /**
837
+ * The slices the view is derived from: every one but the selections, which
838
+ * change what is highlighted and never what is shown. A whole `GridState`
839
+ * is one.
840
+ */
841
+ type GridViewState<Row> = Omit<GridState<Row>, "rowSelection" | "columnSelection" | "cellSelection">;
842
+ /**
843
+ * The settings that shape the view but are not user state: what the grid is
844
+ * configured to do, plus the one measurement — `viewportWidth` — that fitting
845
+ * columns needs from the page. Every field falls back to the same default
846
+ * the React grid's matching prop does.
847
+ */
848
+ interface GridViewOptions<Row> {
849
+ /** Whether `pageRows` is one page of `displayRows` rather than all of it. Defaults to `false`. */
850
+ readonly paginated?: boolean | undefined;
851
+ readonly aggregates?: AggregateState<Row> | undefined;
852
+ /** Defaults to `"inline"`. */
853
+ readonly groupAggregateDisplay?: GroupAggregateDisplay | undefined;
854
+ readonly columnSizeDefaults?: Partial<ColumnSizeDefaults> | undefined;
855
+ readonly resizableColumns?: boolean | undefined;
856
+ readonly reorderableColumns?: boolean | undefined;
857
+ readonly groupByDraggableColumns?: boolean | undefined;
858
+ /** Defaults to `"fit"`, which only takes effect once `viewportWidth` is known. */
859
+ readonly resizeMode?: ResizeMode | undefined;
860
+ /**
861
+ * The width, in px, `"fit"` fills. `null` or absent before it has been
862
+ * measured, or where there is no viewport at all (an export in Node), and
863
+ * then columns keep their resolved widths.
864
+ */
865
+ readonly viewportWidth?: number | null | undefined;
866
+ }
867
+ /** What `resolveGridView` derives the view from. */
868
+ interface GridViewInput<Row, Node = string> {
869
+ readonly rows: readonly Row[];
870
+ readonly getRowId?: ((row: Row, index: number) => string) | undefined;
871
+ readonly columns: readonly ColumnDefinition<Row, Node>[];
872
+ readonly state: GridViewState<Row>;
873
+ readonly options: GridViewOptions<Row>;
874
+ }
875
+ /**
876
+ * What the user is looking at, derived once from `GridViewInput` — every
877
+ * list a renderer draws, and the ones an export, a toolbar or a status line
878
+ * reads, so none of them composes the pipeline for itself.
879
+ */
880
+ interface GridView<Row, Node = string> {
881
+ /** Every column, hidden ones included, ordered but not sized — what the data stages read. */
882
+ readonly dataColumns: readonly DataColumn<Row, Node>[];
883
+ /** The columns as rendered: visible, ordered and sized. */
884
+ readonly columns: readonly ResolvedColumn<Row, Node>[];
885
+ /** The rows, filtered then sorted. */
886
+ readonly rows: readonly ResolvedRow<Row>[];
887
+ /** `rows` grouped, with each group's aggregates attached — every page of it. */
888
+ readonly displayRows: readonly DisplayRow<Row>[];
889
+ /** The current page of `displayRows`; all of it when not paginated. */
890
+ readonly pageRows: readonly DisplayRow<Row>[];
891
+ /** `pageRows` narrowed to its data rows, in display order — what a range selection spans. */
892
+ readonly displayDataRows: readonly ResolvedRow<Row>[];
893
+ /** `1` when not paginated. */
894
+ readonly pageCount: number;
895
+ /** `state.pagination.pageIndex` clamped into range; `0` when not paginated. */
896
+ readonly pageIndex: number;
897
+ /** Every aggregate over all of `rows`, ungrouped and unpaginated. */
898
+ readonly grandTotal: AggregateResults;
899
+ }
900
+
901
+ /**
902
+ * A row or column selection change by id — see
903
+ * `GridControllerOptions.onSelectionDiff`.
904
+ */
905
+ interface SelectionDiffEvent extends SelectionDiff {
906
+ /** Which selection changed. */
907
+ readonly target: "rows" | "columns";
908
+ /** The whole selection after the change. */
909
+ readonly selection: SelectionState;
910
+ }
911
+ /**
912
+ * What `createGridController` is given: the grid's options and selection
913
+ * callbacks, plus what a renderer supplies that is not a setting — the column
914
+ * definitions, whose templates name the renderer's own node type, the width
915
+ * the viewport measured, and a hook for its own selection feedback.
916
+ */
917
+ interface GridControllerOptions<Row, Node = string> extends GridOptions<Row>, SelectionCallbacks<Row, Node> {
918
+ /**
919
+ * The columns to show. Omitted or empty, one column is inferred per field
920
+ * of `dataSource` — see `defineColumnsFromRows`.
921
+ */
922
+ columns?: readonly ColumnDefinition<Row, Node>[] | undefined;
923
+ /**
924
+ * The width, in px, `resizeMode: "fit"` fills. `null` or absent before it
925
+ * has been measured, or where there is no viewport at all (an export in
926
+ * Node), and then columns keep their resolved widths.
927
+ */
928
+ viewportWidth?: number | null | undefined;
929
+ /**
930
+ * Called once per row or column selection change, after the selection
931
+ * callbacks, with the change by id — every id it added or removed,
932
+ * including those with no row on screen (on another page, in a collapsed
933
+ * group, filtered out), which the callbacks' resolved rows leave out. For a
934
+ * renderer's own feedback, such as a live region announcing how many rows
935
+ * are selected; an application reads the selection callbacks instead.
936
+ */
937
+ onSelectionDiff?: ((event: SelectionDiffEvent) => void) | undefined;
938
+ }
939
+ /**
940
+ * A grid without a renderer: its state, the view derived from it, and every
941
+ * action that changes it. A renderer creates one per grid, hands it the
942
+ * current options on each update, draws `getView()` and calls the actions
943
+ * from its event handlers, so no renderer decides anything the user can see.
944
+ *
945
+ * Each slice of `GridState` is controlled or not on its own, the way a form
946
+ * input is: given as an option (`columnSort`), the grid shows that value and
947
+ * an action only asks for a change through the slice's callback
948
+ * (`onColumnSortChange`); left out, the controller keeps the slice itself,
949
+ * starting from its default (`defaultColumnSort`).
950
+ *
951
+ * Every action follows the same steps: work out the next value; stop if it
952
+ * is the very object the slice already holds; keep it, unless the slice is
953
+ * controlled; report it through the slice's callback; then call every
954
+ * subscriber, synchronously. The setters (`setColumnSort` and the like) also
955
+ * stop for a value equal to the current one, so restoring what is already
956
+ * there reports nothing.
957
+ *
958
+ * Every member is a plain function bound to its grid, safe to hand around on
959
+ * its own — `onClick={controller.nextPage}`.
960
+ */
961
+ interface GridController<Row, Node = string> {
962
+ readonly getOptions: () => GridControllerOptions<Row, Node>;
963
+ /**
964
+ * Replaces the options, as a renderer does with its current props on every
965
+ * update; calling it again with equal options changes nothing. A controlled
966
+ * slice takes its new value from here.
967
+ *
968
+ * Does not call subscribers: a renderer calls this while it updates, and
969
+ * draws the result itself — a subscriber called mid-update would update
970
+ * mid-update too. A renderer that also tells other listeners about it does
971
+ * so once its update is done.
972
+ */
973
+ readonly setOptions: (options: GridControllerOptions<Row, Node>) => void;
974
+ /** Every slice as the grid now applies it. The same object until a slice changes. */
975
+ readonly getState: () => GridState<Row>;
976
+ /** What the user is looking at — see `resolveGridView`. The same object until something in it changes. */
977
+ readonly getView: () => GridView<Row, Node>;
978
+ /**
979
+ * Calls `listener` after each action that got as far as reporting a
980
+ * change. Returns the function that unsubscribes it.
981
+ */
982
+ readonly subscribe: (listener: () => void) => () => void;
983
+ /**
984
+ * Puts back state saved earlier — from `getState()`, or from
985
+ * `serializeGridState` and back through JSON. Every slice given is set as
986
+ * its own `set*` action would set it, so each that changes fires its
987
+ * callback and a controlled one only asks; slices left out keep their value.
988
+ * Subscribers are called once, after every slice is in place, and a
989
+ * restored pagination is kept even when the same call changed the sort,
990
+ * filter or grouping that would otherwise send it back to the first page.
991
+ */
992
+ readonly restoreState: (saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>) => void;
993
+ /**
994
+ * Replaces the column widths. Reported through `onColumnResize` as the
995
+ * `"end"` of a resize of the first column whose width changed, at its new
996
+ * width — or, when its entry was removed, the width its definition gives
997
+ * it. Equal widths report nothing.
998
+ */
999
+ readonly setColumnSizing: (sizing: ColumnSizingState) => void;
1000
+ /**
1001
+ * Sets one column's width, as a resize gesture does: `"move"` while the
1002
+ * gesture lasts, `"end"` once it is over. Never skipped for an unchanged
1003
+ * width, so a drag held against a column's minimum still reports every
1004
+ * move.
1005
+ */
1006
+ readonly resizeColumn: (columnId: string, width: number, phase: "move" | "end") => void;
1007
+ /**
1008
+ * Ends a resize gesture by putting its column back as it was when the
1009
+ * gesture began — `startSizing` is the sizing state then, `startWidth` the
1010
+ * width the column was drawn at — keeping any other column's change made in
1011
+ * the meantime. Reported as the gesture's `"end"`, at `startWidth`.
1012
+ */
1013
+ readonly cancelColumnResize: (columnId: string, startSizing: ColumnSizingState, startWidth: number) => void;
1014
+ /**
1015
+ * Replaces the column order. Reported through `onColumnOrderChange` naming
1016
+ * the first column whose position changed; an equal order reports nothing.
1017
+ */
1018
+ readonly setColumnOrder: (order: ColumnOrderState) => void;
1019
+ /**
1020
+ * Moves a column in front of `beforeId`, or to the end when that is
1021
+ * `null`, among every column — hidden ones keep their place. A move that
1022
+ * changes nothing reports nothing.
1023
+ */
1024
+ readonly moveColumn: (columnId: string, beforeId: string | null) => void;
1025
+ /**
1026
+ * Replaces the column visibility state. Reported through
1027
+ * `onColumnVisibilityChange` with every column whose entry changed; an
1028
+ * equal state reports nothing.
1029
+ */
1030
+ readonly setColumnVisibility: (visibility: ColumnVisibilityState) => void;
1031
+ /** Shows the given columns, each in the place it held when hidden. One report for the whole call. */
1032
+ readonly showColumns: (columnIds: readonly string[]) => void;
1033
+ /** Hides the given columns. A hidden column still sorts, filters and groups. */
1034
+ readonly hideColumns: (columnIds: readonly string[]) => void;
1035
+ /**
1036
+ * Replaces the filter. Reported through `onFilterChange`; a filter equal to
1037
+ * the current one — the same entries in the same order, a `Date` value
1038
+ * compared by time and a predicate by identity — reports nothing.
1039
+ */
1040
+ readonly setFilter: (filter: FilterState<Row>) => void;
1041
+ /**
1042
+ * Replaces the selected row ids as given, whatever `selectable` allows —
1043
+ * the way a controlled or default value is applied. The same ids in the
1044
+ * same order report nothing.
1045
+ */
1046
+ readonly setRowSelection: (selection: SelectionState) => void;
1047
+ /**
1048
+ * Selects rows as a user could, within what `selectable.rows` allows:
1049
+ * `"replace"` (the default) selects exactly these — only the last of them
1050
+ * under `"single"` — and `"toggle"` flips each one. An id need not name a
1051
+ * row on screen. A call that leaves the selection as it was reports
1052
+ * nothing.
1053
+ */
1054
+ readonly selectRows: (rowIds: readonly string[], intent?: "replace" | "toggle") => void;
1055
+ /**
1056
+ * Applies one click or key press to a row: `"replace"`, `"toggle"` or
1057
+ * `"range"` from the last row selected by anything but a range, across
1058
+ * the data rows on the current page.
1059
+ */
1060
+ readonly selectRow: (rowId: string, intent: SelectIntent) => void;
1061
+ /** Selects every data row on the current page, when `selectable.rows` is `"multiple"`. */
1062
+ readonly selectAllRows: () => void;
1063
+ /** Lets go of every row, column and cell selection at once, as Escape does. */
1064
+ readonly clearSelection: () => void;
1065
+ /** Replaces the selected column ids as given — see `setRowSelection`. */
1066
+ readonly setColumnSelection: (selection: SelectionState) => void;
1067
+ /** `selectRow`, for a column among the columns as rendered. */
1068
+ readonly selectColumn: (columnId: string, intent: SelectIntent) => void;
1069
+ /** Replaces the selected cell as given, `null` for none. */
1070
+ readonly setCellSelection: (selection: CellSelectionState) => void;
1071
+ /**
1072
+ * Applies one click or key press to a cell: `"toggle"` lets go of it when
1073
+ * it is the one selected; anything else selects it. A cell holds one value,
1074
+ * so a range over cells reads as a plain click.
1075
+ */
1076
+ readonly selectCell: (cell: SelectedCellRef, intent: SelectIntent) => void;
1077
+ /**
1078
+ * Replaces the sort. Reported through `onColumnSortChange` naming the
1079
+ * first column whose place or direction changed; a sort equal to the
1080
+ * current one changes nothing and reports nothing.
1081
+ */
1082
+ readonly setColumnSort: (sort: ColumnSortState) => void;
1083
+ /**
1084
+ * Cycles a column's sort, as its header toggle does: ascending, descending,
1085
+ * off. `stack` adds it to the sort rather than replacing the sort with it.
1086
+ */
1087
+ readonly toggleColumnSort: (columnId: string, options?: {
1088
+ readonly stack?: boolean | undefined;
1089
+ }) => void;
1090
+ /**
1091
+ * Takes one column out of the sort, keeping the rest in their order, and
1092
+ * reports naming that column — which `setColumnSort` without it would not
1093
+ * when it was the first key, naming instead the key that moved up. A
1094
+ * column the sort leaves out already reports nothing.
1095
+ */
1096
+ readonly clearColumnSort: (columnId: string) => void;
1097
+ /**
1098
+ * Replaces the group-by stack. Reported through `onGroupByChange` naming
1099
+ * the first level that changed; an equal stack reports nothing.
1100
+ */
1101
+ readonly setGroupBy: (groupBy: GroupByState) => void;
1102
+ /** Adds a column to the end of the group-by stack, or removes it if it is already there. */
1103
+ readonly toggleGroupBy: (columnId: string) => void;
1104
+ /**
1105
+ * Puts a column into the group-by stack in front of `beforeColumnId`, or at
1106
+ * the end when that is `null` — adding it, or moving it if it is already
1107
+ * there.
1108
+ */
1109
+ readonly moveGroupBy: (columnId: string, beforeColumnId: string | null) => void;
1110
+ /**
1111
+ * Replaces the collapsed groups. Reported with `groupId: null`, as a change
1112
+ * to every group at once; the same ids in the same order report nothing.
1113
+ */
1114
+ readonly setGroupExpansion: (expansion: GroupExpansionState) => void;
1115
+ readonly toggleGroupExpansion: (groupId: string) => void;
1116
+ readonly expandAllGroups: () => void;
1117
+ /** Collapses every group currently shown — see `collapseAllGroups`. */
1118
+ readonly collapseAllGroups: () => void;
1119
+ /**
1120
+ * Replaces the page and page size as given; the view clamps a page past
1121
+ * the last one. An equal pagination reports nothing.
1122
+ */
1123
+ readonly setPagination: (pagination: PaginationState) => void;
1124
+ /**
1125
+ * Moves to the given page, clamped into range. A page that clamps to the
1126
+ * current one reports nothing.
1127
+ */
1128
+ readonly goToPage: (pageIndex: number) => void;
1129
+ /** Moves one page on; on the last page it does nothing and reports nothing. */
1130
+ readonly nextPage: () => void;
1131
+ /** Moves one page back; on the first page it does nothing and reports nothing. */
1132
+ readonly previousPage: () => void;
1133
+ /**
1134
+ * Changes the page size and goes back to the first page. The current size,
1135
+ * already on the first page, reports nothing.
1136
+ */
1137
+ readonly setPageSize: (pageSize: number) => void;
1138
+ }
1139
+
1140
+ /**
1141
+ * Every string a grid shows or announces of its own — the pager, the group-by
1142
+ * bar, the loading row, the text of a boolean or missing value, the labels of
1143
+ * its built-in commands, the names of its menus, toolbar and column chooser,
1144
+ * and the live-region
1145
+ * announcements — so a grid can
1146
+ * speak a language other than English. A message that names something takes
1147
+ * a function, so a translation can put the name where its own grammar wants
1148
+ * it.
1149
+ *
1150
+ * Text the data supplies (cells, headers, labels) is not here: it is already
1151
+ * the app's to choose. Nor is formatting — dates and numbers follow
1152
+ * `locale`.
1153
+ */
1154
+ interface GridMessages {
1155
+ /** The pager's accessible name. */
1156
+ pagerLabel: string;
1157
+ previousPage: string;
1158
+ nextPage: string;
1159
+ /** The page-size control's label. */
1160
+ pageSizeLabel: string;
1161
+ /** A numbered pager button's accessible name. */
1162
+ pageButtonLabel: (page: number) => string;
1163
+ /**
1164
+ * The compact pager's status, and what a page change announces. `page`
1165
+ * counts from one, and is `0` while there are no pages.
1166
+ */
1167
+ pageStatus: (page: number, pageCount: number) => string;
1168
+ /** The row shown while `infiniteScroll` loads more. */
1169
+ loadingMore: string;
1170
+ /** A boolean cell's text. */
1171
+ booleanTrue: string;
1172
+ booleanFalse: string;
1173
+ /** What a group header names a group of missing values. */
1174
+ blankGroupValue: string;
1175
+ /** The group-by bar's accessible name. */
1176
+ groupByBarLabel: string;
1177
+ /** Shown in an empty group-by bar a header can be dragged into. */
1178
+ groupByBarPlaceholder: string;
1179
+ /** A group-by chip's accessible name. `level` counts from one. */
1180
+ groupByChipLabel: (columnName: string, level: number, levelCount: number) => string;
1181
+ /** A group-by chip's remove button's accessible name. */
1182
+ removeGroupBy: (columnName: string) => string;
1183
+ /** Announced when a resize ends, `width` in whole pixels. */
1184
+ columnResized: (columnName: string, width: number) => string;
1185
+ /** Announced when a column is moved. `position` counts from one. */
1186
+ columnMoved: (columnName: string, position: number, columnCount: number) => string;
1187
+ /** Announced when a column is sorted. `key` is its place in the sort, from one. */
1188
+ columnSorted: (columnName: string, direction: SortDirection, key: number, keyCount: number) => string;
1189
+ /** Announced when a column leaves the sort. */
1190
+ sortCleared: (columnName: string) => string;
1191
+ /** Announced when a column is grouped by. `level` counts from one. */
1192
+ groupedBy: (columnName: string, level: number, levelCount: number) => string;
1193
+ /** Announced when a column leaves the grouping. */
1194
+ groupingRemoved: (columnName: string) => string;
1195
+ groupExpanded: string;
1196
+ groupCollapsed: string;
1197
+ allGroupsExpanded: string;
1198
+ allGroupsCollapsed: string;
1199
+ /** Announced when one change selects or deselects more than one row or column. */
1200
+ selectedCount: (count: number, target: "rows" | "columns") => string;
1201
+ /** Announced when a cell is selected. `rowNumber` counts from one. */
1202
+ cellSelected: (columnName: string, rowNumber: number) => string;
1203
+ /** Announced when one column is hidden. */
1204
+ columnHidden: (columnName: string) => string;
1205
+ /** Announced when one column is shown. */
1206
+ columnShown: (columnName: string) => string;
1207
+ /** Announced when one change hides more than one column. */
1208
+ columnsHidden: (count: number) => string;
1209
+ /** Announced when one change shows more than one column. */
1210
+ columnsShown: (count: number) => string;
1211
+ /**
1212
+ * Announced when one action autofits more than one column, as
1213
+ * `column.autoFitAll` does, in place of each column's `columnResized`.
1214
+ */
1215
+ columnsAutoFitted: (count: number) => string;
1216
+ /** A column header's context menu's accessible name. */
1217
+ headerMenuLabel: (columnName: string) => string;
1218
+ /** A data cell's context menu's accessible name — a menu for its row. */
1219
+ cellMenuLabel: string;
1220
+ /** A group header row's context menu's accessible name. */
1221
+ groupMenuLabel: string;
1222
+ /** The accessible name of the menu in the body's empty space. */
1223
+ bodyMenuLabel: string;
1224
+ /** The built-in `sort.ascending` command's label. */
1225
+ sortAscending: string;
1226
+ sortDescending: string;
1227
+ /** `sort.clear`: takes one column out of the sort. */
1228
+ clearSort: string;
1229
+ /** `sort.clearAll` */
1230
+ clearAllSorting: string;
1231
+ /** `group.add`, naming the column it groups by. */
1232
+ groupByColumn: (columnName: string) => string;
1233
+ /** `group.clearAll`. `group.remove` reads `removeGroupBy`, as the group-by chip's button does. */
1234
+ ungroupAll: string;
1235
+ expandAllGroups: string;
1236
+ collapseAllGroups: string;
1237
+ /** `column.hide` */
1238
+ hideColumn: string;
1239
+ /** `column.autoFit`: sizes the column to its content. */
1240
+ autoFitColumn: string;
1241
+ autoFitAllColumns: string;
1242
+ /** `selection.selectAllRows` */
1243
+ selectAllRows: string;
1244
+ /** `selection.clear` */
1245
+ clearSelection: string;
1246
+ /** `filter.clearAll`, which clears the search too. */
1247
+ clearFilters: string;
1248
+ /** `column.choose`, which opens the column chooser. */
1249
+ chooseColumns: string;
1250
+ /** The toolbar's accessible name, unless its `label` gives one. */
1251
+ toolbarLabel: string;
1252
+ /** The toolbar's search box's accessible name. */
1253
+ searchLabel: string;
1254
+ /** Shown in the toolbar's empty search box. */
1255
+ searchPlaceholder: string;
1256
+ /** The toolbar's "More" button, holding the items that do not fit. */
1257
+ moreToolbarItems: string;
1258
+ /** Announced when a search settles: how many rows it found. */
1259
+ searchResults: (count: number) => string;
1260
+ /** The column chooser's accessible name. */
1261
+ columnChooserLabel: string;
1262
+ /** The column chooser's search box's accessible name. */
1263
+ columnChooserSearchLabel: string;
1264
+ /** The column chooser's checkbox showing or hiding every column its search lists. */
1265
+ showAllColumns: string;
1266
+ /** Shown in the column chooser when its search matches no column. */
1267
+ noMatchingColumns: string;
1268
+ }
1269
+ /** The grid's own English, which `messages` replaces key by key. */
1270
+ declare const defaultMessages: GridMessages;
1271
+ /**
1272
+ * `messages` over the defaults — every key the grid needs, whichever the
1273
+ * caller gave. The defaults themselves, same object, when it gave none, so a
1274
+ * renderer memoising on the result does not see a change that is not one.
1275
+ */
1276
+ declare function resolveMessages(messages: Partial<GridMessages> | undefined): GridMessages;
1277
+
1278
+ /**
1279
+ * Where a command was asked for: the part of the grid a menu was opened on,
1280
+ * the toolbar item pressed, or nowhere in particular for a call through a
1281
+ * renderer's API. A built-in reads the column, row or group it acts on from
1282
+ * here, and is hidden on a target that has none.
1283
+ */
1284
+ type GridCommandTarget = {
1285
+ readonly area: "header";
1286
+ readonly columnId: string;
1287
+ } | {
1288
+ readonly area: "cell";
1289
+ readonly rowId: string;
1290
+ readonly columnId: string;
1291
+ } | {
1292
+ readonly area: "group";
1293
+ readonly groupId: string;
1294
+ readonly columnId: string;
1295
+ }
1296
+ /** Empty body space, or a grid with no rows. */
1297
+ | {
1298
+ readonly area: "body";
1299
+ } | {
1300
+ readonly area: "toolbar";
1301
+ readonly itemId: string;
1302
+ }
1303
+ /** A renderer's API, with no particular place. */
1304
+ | {
1305
+ readonly area: "grid";
1306
+ };
1307
+ /** Where a command was run from: a context menu, the toolbar, or a renderer's API. */
1308
+ type GridCommandSource = "contextMenu" | "toolbar" | "api";
1309
+ /** What `onCommand` is told of a command, or an inline menu item, that ran. */
1310
+ interface GridCommandEvent {
1311
+ /** The command's id, or the inline item's. */
1312
+ readonly commandId: string;
1313
+ /** Where it was asked for. */
1314
+ readonly target: GridCommandTarget;
1315
+ readonly source: GridCommandSource;
1316
+ }
1317
+ /**
1318
+ * The panels a command can ask a renderer to open. A union so the filter UI
1319
+ * can add its own kind through the same door.
1320
+ */
1321
+ type GridPanelKind = "columnChooser";
1322
+ /**
1323
+ * What a command needs that only a renderer has: a DOM to measure, panels to
1324
+ * open, a live region to speak through. A caller with none of these — a test,
1325
+ * a script in Node — passes members that do nothing.
1326
+ */
1327
+ interface GridCommandHost {
1328
+ /** Sizes each column to fit its content, as double-clicking its resize handle does. */
1329
+ readonly autoFitColumns: (columnIds: readonly string[]) => void;
1330
+ /** Opens one of the grid's panels, anchored to where the command was asked for. */
1331
+ readonly openPanel: (kind: GridPanelKind, target: GridCommandTarget) => void;
1332
+ /** Reads `text` out through the grid's live region. */
1333
+ readonly announce: (text: string) => void;
1334
+ }
1335
+ /**
1336
+ * Every action of the controller — the only way a command changes state, so
1337
+ * each change reports through its slice's callback exactly as the user's own
1338
+ * gesture would. Leaves out `setOptions`, which is the renderer's alone,
1339
+ * `subscribe`, and the getters whose results the context already carries.
1340
+ *
1341
+ * Nothing left names the renderer's node type, so a controller of any `Node`
1342
+ * is one.
1343
+ */
1344
+ type GridCommandActions<Row> = Omit<GridController<Row, unknown>, "getOptions" | "setOptions" | "subscribe" | "getState" | "getView">;
1345
+ /**
1346
+ * Everything a command reads to decide whether it shows, whether it is
1347
+ * enabled and what it does — one snapshot of the grid, taken when a menu or
1348
+ * toolbar is resolved. Build one with `createCommandContext`.
1349
+ */
1350
+ interface GridCommandContext<Row> {
1351
+ readonly target: GridCommandTarget;
1352
+ readonly state: GridState<Row>;
1353
+ readonly view: GridView<Row, unknown>;
1354
+ readonly options: GridOptions<Row>;
1355
+ readonly messages: GridMessages;
1356
+ readonly actions: GridCommandActions<Row>;
1357
+ readonly host: GridCommandHost;
1358
+ /** The row a cell target is on; `null` for any other target, or a row the filter hides. */
1359
+ readonly row: ResolvedRow<Row> | null;
1360
+ /** The column a header, cell or group target names, hidden or not; `null` otherwise. */
1361
+ readonly column: DataColumn<Row, unknown> | null;
1362
+ /**
1363
+ * The selected rows that pass the filter, in the order they are shown,
1364
+ * across every page and collapsed group. A function, computed on first
1365
+ * call and remembered: resolving it walks every filtered row, and a toolbar
1366
+ * builds a context on every change without most commands ever asking.
1367
+ */
1368
+ readonly selectedRows: () => readonly ResolvedRow<Row>[];
1369
+ }
1370
+ /**
1371
+ * The one implementation behind a menu item, a toolbar button and a
1372
+ * renderer's `runCommand`. Whether it shows and whether it is enabled are
1373
+ * predicates over the context, asked each time a menu or toolbar is resolved,
1374
+ * so a command follows the grid's state without being told about it.
1375
+ */
1376
+ interface GridCommand<Row> {
1377
+ /** `"sort.ascending"` for a built-in, or any id of the app's own. Never `"separator"`, which a menu reads as one. */
1378
+ readonly id: string;
1379
+ readonly label: string | ((context: GridCommandContext<Row>) => string);
1380
+ /** A key the renderer maps to an icon of its own; a key it does not know draws nothing. */
1381
+ readonly icon?: string | undefined;
1382
+ /** A key-combination hint in `aria-keyshortcuts` syntax, such as `"Alt+ArrowUp"`. Shown, not bound. */
1383
+ readonly shortcut?: string | undefined;
1384
+ /** Whether the command shows here at all. Defaults to always. */
1385
+ readonly isVisible?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1386
+ /** Whether it can run. A disabled command still shows, so a user can see what is not possible. Defaults to always. */
1387
+ readonly isEnabled?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1388
+ /** Present for a checkable command — drawn as a checkbox item or a toggle button — and says whether it is checked. */
1389
+ readonly isChecked?: ((context: GridCommandContext<Row>) => boolean) | undefined;
1390
+ readonly execute: (context: GridCommandContext<Row>) => void;
1391
+ }
1392
+
1393
+ /** The id of every command `builtInCommands` returns. */
1394
+ 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" | "selection.selectAllRows" | "selection.clear" | "filter.clearAll";
1395
+ /**
1396
+ * The icon keys the built-ins carry, which a renderer draws as icons of its
1397
+ * own. An app command may use them too, to look like the built-ins.
1398
+ */
1399
+ type BuiltInCommandIcon = "sortAscending" | "sortDescending" | "group" | "hide" | "autoFit";
1400
+ /**
1401
+ * The grid's own commands, one per action its menus and toolbar offer —
1402
+ * sorting, grouping, hiding, fitting and choosing columns, selecting and
1403
+ * clearing.
1404
+ * Labels come from `messages`, so they follow the grid's language.
1405
+ *
1406
+ * A function rather than a constant so each comes typed for the caller's
1407
+ * `Row`; the commands hold no state, and two calls build equal ones.
1408
+ */
1409
+ declare function builtInCommands<Row>(): readonly GridCommand<Row>[];
1410
+
1411
+ /** A value given outright, or worked out from the context each time the menu is resolved. */
1412
+ type FromContext<Row, Value> = Value | ((context: GridCommandContext<Row>) => Value);
1413
+ /**
1414
+ * An item written into the menu itself rather than registered as a command —
1415
+ * for an action only one menu offers.
1416
+ */
1417
+ interface MenuItemEntry<Row> {
1418
+ readonly type: "item";
1419
+ readonly id: string;
1420
+ readonly label: FromContext<Row, string>;
1421
+ readonly icon?: string | undefined;
1422
+ readonly shortcut?: string | undefined;
1423
+ readonly hidden?: FromContext<Row, boolean> | undefined;
1424
+ readonly disabled?: FromContext<Row, boolean> | undefined;
1425
+ /** Present for a checkable item, and says whether it is checked. */
1426
+ readonly checked?: FromContext<Row, boolean> | undefined;
1427
+ readonly onSelect: (context: GridCommandContext<Row>) => void;
1428
+ }
1429
+ /** An item that opens a menu of its own. Left out when nothing in it shows. */
1430
+ interface MenuSubmenuEntry<Row> {
1431
+ readonly type: "submenu";
1432
+ readonly id: string;
1433
+ readonly label: FromContext<Row, string>;
1434
+ readonly icon?: string | undefined;
1435
+ readonly items: readonly MenuEntry<Row>[];
1436
+ }
1437
+ /**
1438
+ * One entry of a menu as an app writes it: a command id — a built-in's or
1439
+ * one of its own — `"separator"`, an inline item or a submenu. The same
1440
+ * vocabulary every menu and toolbar is listed in.
1441
+ */
1442
+ type MenuEntry<Row> = BuiltInCommandId | "separator" | (string & {}) | MenuItemEntry<Row> | MenuSubmenuEntry<Row>;
1443
+ /**
1444
+ * A menu item ready to draw: every label a string, every flag a boolean, and
1445
+ * `run` bound to the context the menu was resolved in.
1446
+ */
1447
+ interface ResolvedMenuItem {
1448
+ readonly type: "item";
1449
+ /** The command's id, or the inline item's. */
1450
+ readonly id: string;
1451
+ readonly label: string;
1452
+ readonly icon?: string | undefined;
1453
+ readonly shortcut?: string | undefined;
1454
+ /** Drawn, and focusable, but `run` does nothing. */
1455
+ readonly disabled: boolean;
1456
+ /** `undefined` for an item that is not checkable. */
1457
+ readonly checked: boolean | undefined;
1458
+ /**
1459
+ * Runs the item — a command only when it is still visible and enabled —
1460
+ * and says whether it ran, so a renderer reports only what did something.
1461
+ */
1462
+ readonly run: () => boolean;
1463
+ }
1464
+ interface ResolvedMenuSubmenu {
1465
+ readonly type: "submenu";
1466
+ readonly id: string;
1467
+ readonly label: string;
1468
+ readonly icon?: string | undefined;
1469
+ /** Never empty: a submenu with nothing to show is left out. */
1470
+ readonly items: readonly ResolvedMenuEntry[];
1471
+ }
1472
+ interface ResolvedMenuSeparator {
1473
+ readonly type: "separator";
1474
+ /**
1475
+ * The separator's place among the entries it was resolved from, which
1476
+ * stays put however the items around it come and go — a key for a
1477
+ * renderer that needs one, unique among its menu's separators.
1478
+ */
1479
+ readonly key: string;
1480
+ }
1481
+ /** One entry of a menu as `resolveMenu` hands it to a renderer to draw. */
1482
+ type ResolvedMenuEntry = ResolvedMenuItem | ResolvedMenuSubmenu | ResolvedMenuSeparator;
1483
+
1484
+ /** The parts of a grid that open a context menu of their own. */
1485
+ type GridContextMenuArea = "header" | "cell" | "group" | "body";
1486
+ /**
1487
+ * Where a context menu opens: a command target in one of the context menu
1488
+ * areas — a column header, a data cell, a group header row, or empty space
1489
+ * in the body — or in `Area` alone.
1490
+ */
1491
+ type GridContextMenuTarget<Area extends GridContextMenuArea = GridContextMenuArea> = Extract<GridCommandTarget, {
1492
+ readonly area: Area;
1493
+ }>;
1494
+ /** What `onContextMenuOpenChange` is told as a context menu opens or closes. */
1495
+ interface ContextMenuOpenChangeEvent {
1496
+ readonly open: boolean;
1497
+ /** Where the menu opened, or where the one closing had. */
1498
+ readonly target: GridContextMenuTarget;
1499
+ }
1500
+ /** What a function given for an area is asked, each time its menu opens. */
1501
+ interface GridContextMenuRequest<Row, Area extends GridContextMenuArea = GridContextMenuArea> {
1502
+ /** Where the menu opens. */
1503
+ readonly target: GridContextMenuTarget<Area>;
1504
+ /** The area's default entries, to keep, trim, reorder or add to. */
1505
+ readonly defaults: readonly MenuEntry<Row>[];
1506
+ /** The grid as the menu sees it — the context its items run in. */
1507
+ readonly context: GridCommandContext<Row>;
1508
+ }
1509
+ /**
1510
+ * An area's menu: its entries, or a function that works them out each time
1511
+ * the menu opens — from where it opens, the area's defaults and the grid's
1512
+ * state. A function giving `null` or `[]` shows no grid menu there, so the
1513
+ * browser's own menu shows.
1514
+ */
1515
+ type GridContextMenuEntries<Row, Area extends GridContextMenuArea = GridContextMenuArea> = readonly MenuEntry<Row>[] | ((request: GridContextMenuRequest<Row, Area>) => readonly MenuEntry<Row>[] | null);
1516
+ /**
1517
+ * A grid's context menus, by area, in the vocabulary every grid menu is
1518
+ * written in. An area left out shows its defaults; one given `[]` shows no
1519
+ * grid menu, so the browser's own menu shows there.
1520
+ */
1521
+ interface GridContextMenuOptions<Row> {
1522
+ /** A column header's menu. */
1523
+ readonly header?: GridContextMenuEntries<Row, "header"> | undefined;
1524
+ /** A data cell's menu, acting on its row and cell. */
1525
+ readonly cell?: GridContextMenuEntries<Row, "cell"> | undefined;
1526
+ /** A group header row's menu. */
1527
+ readonly group?: GridContextMenuEntries<Row, "group"> | undefined;
1528
+ /** The menu of the body's empty space, below the last row or in a grid with none. */
1529
+ readonly body?: GridContextMenuEntries<Row, "body"> | undefined;
1530
+ }
1531
+ /**
1532
+ * The menu each area shows unless the grid says otherwise — built-in
1533
+ * commands only, each hidden where it has nothing to act on, so the menu a
1534
+ * column header shows holds only what that column can do. The body has
1535
+ * none: empty space keeps the browser's menu until a grid gives it one.
1536
+ */
1537
+ declare const defaultContextMenu: {
1538
+ readonly [Area in GridContextMenuArea]: readonly (BuiltInCommandId | "separator")[];
1539
+ };
1540
+ /**
1541
+ * Whether the `contextMenu` option opens a grid menu on `area` at all: it is
1542
+ * on, and gives the area entries or a function rather than `[]`. A function
1543
+ * may still give no menu for one place or another; this answers for the
1544
+ * area, as a cell's `aria-keyshortcuts` needs to before anything is asked.
1545
+ */
1546
+ declare function hasContextMenu<Row>(contextMenu: boolean | GridContextMenuOptions<Row> | undefined, area: GridContextMenuArea): boolean;
1547
+ /**
1548
+ * The entries a grid's `contextMenu` option gives the place `context.target`
1549
+ * names, to resolve with `resolveMenu` in that same context: none while the
1550
+ * option is off — left out or `false` — or for a target no context menu
1551
+ * opens on; the area's defaults under `true` or when the option leaves the
1552
+ * area out; the entries it lists; or what its function gives this request.
1553
+ * No entries means no grid menu there.
1554
+ */
1555
+ declare function contextMenuEntries<Row>(contextMenu: boolean | GridContextMenuOptions<Row> | undefined, context: GridCommandContext<Row>): readonly MenuEntry<Row>[];
1556
+
1557
+ /** Where a toolbar item's command runs: the toolbar item it was asked from. */
1558
+ type GridToolbarTarget = Extract<GridCommandTarget, {
1559
+ readonly area: "toolbar";
1560
+ }>;
1561
+ /**
1562
+ * A place in the toolbar the renderer fills with content of the app's own —
1563
+ * React's `renderToolbarItem(id)` — for anything the entries cannot say.
1564
+ */
1565
+ interface ToolbarCustomEntry {
1566
+ readonly type: "custom";
1567
+ readonly id: string;
1568
+ }
1569
+ /**
1570
+ * One entry of a toolbar as an app writes it: anything a menu lists — a
1571
+ * command id, `"separator"`, an inline item, or a submenu, which the toolbar
1572
+ * draws as a dropdown button — plus the entries only a toolbar has:
1573
+ * `"search"`, the box searching every column; `"spacer"`, which takes up the
1574
+ * free space and so pushes what follows it to the far end; and a custom
1575
+ * entry.
1576
+ */
1577
+ type ToolbarEntry<Row> = MenuEntry<Row> | "search" | "spacer" | ToolbarCustomEntry;
1578
+ /**
1579
+ * A toolbar button ready to draw — a command, or an inline item — with
1580
+ * every label a string, every flag a boolean, and `run` bound to the
1581
+ * context of its place in the toolbar.
1582
+ */
1583
+ interface ResolvedToolbarButton {
1584
+ readonly type: "button";
1585
+ /** The command's id, or the inline item's. */
1586
+ readonly id: string;
1587
+ /** The same as `id`. */
1588
+ readonly key: string;
1589
+ readonly label: string;
1590
+ readonly icon?: string | undefined;
1591
+ readonly shortcut?: string | undefined;
1592
+ /** Drawn, and focusable, but `run` does nothing. */
1593
+ readonly disabled: boolean;
1594
+ /**
1595
+ * Whether a toggle button is pressed — `undefined` for a button that is
1596
+ * not one: a checkable command or item draws as a toggle.
1597
+ */
1598
+ readonly pressed: boolean | undefined;
1599
+ /** Runs the button, and says whether it ran — see `ResolvedMenuItem.run`. */
1600
+ readonly run: () => boolean;
1601
+ }
1602
+ /** A dropdown button, opening the menu its submenu entry lists. */
1603
+ interface ResolvedToolbarMenu {
1604
+ readonly type: "menu";
1605
+ readonly id: string;
1606
+ /** The same as `id`. */
1607
+ readonly key: string;
1608
+ readonly label: string;
1609
+ readonly icon?: string | undefined;
1610
+ /** Never empty: a dropdown with nothing to show is left out. */
1611
+ readonly items: readonly ResolvedMenuEntry[];
1612
+ }
1613
+ /** The search box, over the grid's global text filter. */
1614
+ interface ResolvedToolbarSearch {
1615
+ readonly type: "search";
1616
+ /** Always `"search"`. */
1617
+ readonly key: string;
1618
+ }
1619
+ /** The free space between the entries either side of it. */
1620
+ interface ResolvedToolbarSpacer {
1621
+ readonly type: "spacer";
1622
+ /** `spacer-<index>`, from its place among the entries it was resolved from. */
1623
+ readonly key: string;
1624
+ }
1625
+ /** A custom entry's place, for the renderer to fill. */
1626
+ interface ResolvedToolbarCustom {
1627
+ readonly type: "custom";
1628
+ readonly id: string;
1629
+ /** The same as `id`. */
1630
+ readonly key: string;
1631
+ }
1632
+ /**
1633
+ * One entry of a toolbar as `resolveToolbar` hands it to a renderer to draw.
1634
+ * Each has a `key` — an item's id, `"search"`, or a separator's or spacer's
1635
+ * place among the entries — unique among the toolbar's entries, which the
1636
+ * renderer writes into the entry's `data-gridkit-toolbar-item`.
1637
+ */
1638
+ type ResolvedToolbarItem = ResolvedToolbarButton | ResolvedToolbarMenu | ResolvedToolbarSearch | ResolvedToolbarSpacer | ResolvedMenuSeparator | ResolvedToolbarCustom;
1639
+
1640
+ /** A grid's toolbar: what it lists, and what a screen reader calls it. */
1641
+ interface GridToolbarOptions<Row> {
1642
+ /** The toolbar's entries, in order. Left out, the defaults. */
1643
+ readonly items?: readonly ToolbarEntry<Row>[] | undefined;
1644
+ /** The toolbar's accessible name. Left out, `messages.toolbarLabel`. */
1645
+ readonly label?: string | undefined;
1646
+ }
1647
+ /**
1648
+ * What a toolbar lists unless the grid says otherwise: the search box, then
1649
+ * the free space, then "Clear filters" and "Choose columns" at the far end.
1650
+ */
1651
+ declare const defaultToolbar: readonly (BuiltInCommandId | "search" | "spacer")[];
1652
+ /**
1653
+ * The entries a grid's `toolbar` option lists, to resolve with
1654
+ * `resolveToolbar`: none while it is off — left out or `false` — the
1655
+ * defaults under `true` or an object without `items`, else its `items`.
1656
+ * No entries means no toolbar.
1657
+ */
1658
+ declare function toolbarEntries<Row>(toolbar: boolean | GridToolbarOptions<Row> | undefined): readonly ToolbarEntry<Row>[];
1659
+
1660
+ /** The locale(s) values are formatted for — `undefined` is the runtime's own. */
1661
+ type FormatLocale = string | readonly string[] | undefined;
1662
+ /**
1663
+ * The text a value reads as in `column` — what a cell shows when the column
1664
+ * has no `cellTemplate`, and what an export or a print writes, so the two
1665
+ * cannot disagree.
1666
+ *
1667
+ * A `valueFormatter` decides outright. `null`/`undefined` read `""`, a
1668
+ * boolean `"true"`/`"false"` — or `messages.booleanTrue`/`booleanFalse`
1669
+ * when given, for a grid speaking another language — a string as it is, a
1670
+ * plain object or array as JSON.
1671
+ *
1672
+ * Dates and numbers are formatted through `Intl` only once asked to — the
1673
+ * column has a `format`, or a `locale` is given. Until then they print as a
1674
+ * grid always printed them, so adopting this changes nothing on screen: a
1675
+ * `Date` through `toLocaleString()`, a number as-is (`1234.5`, never
1676
+ * `1,234.5`). Once asked:
1677
+ *
1678
+ * - A `Date` → `Intl.DateTimeFormat`: the date alone under `"date"`, the time
1679
+ * alone under `"time"`, both otherwise.
1680
+ * - A number under a numeric `type` → `Intl.NumberFormat`: `"currency"` with
1681
+ * a currency symbol once `format.currency` names one (two fraction digits
1682
+ * until then), `"percent"` reading `0.25` as 25 %. Under any other type it
1683
+ * is still printed as-is, the way a number id should be.
1684
+ *
1685
+ * `format` and `locale` go to the `Intl` constructor unchanged, so any
1686
+ * option it accepts is honoured.
1687
+ */
1688
+ declare function formatCellValue<Row>(value: unknown, column: ColumnDefinition<Row, unknown>, locale?: FormatLocale, row?: Row, messages?: Pick<GridMessages, "booleanTrue" | "booleanFalse">): string;
1689
+ /**
1690
+ * The text an aggregate result reads as — a footer cell, a group's subtotal
1691
+ * — through `formatCellValue`, so once a `format` or `locale` asks for it a
1692
+ * `sum` of a currency column reads as currency and a `max` of a date column
1693
+ * as a date. `column` is `undefined` for a spec naming a column the grid
1694
+ * does not have, which then formats by its value alone.
1695
+ *
1696
+ * Until then a numeric result reads through `toLocaleString()`, with digit
1697
+ * grouping, where a cell prints its number as-is: that is how a grid has
1698
+ * always shown its totals, and a sum easily runs into the thousands.
1699
+ */
1700
+ declare function formatAggregateValue<Row>(value: unknown, spec: AggregateSpec<Row>, column: ColumnDefinition<Row, unknown> | undefined, locale?: FormatLocale): string;
1701
+
1702
+ /** Which cell borders a grid draws. */
1703
+ type Borders = "horizontal" | "vertical" | "all" | "none";
1704
+ /** Which hover highlighting a grid shows. Every member defaults to on. */
1705
+ interface HoverableConfig {
1706
+ rows?: boolean;
1707
+ columns?: boolean;
1708
+ cells?: boolean;
1709
+ }
1710
+ /**
1711
+ * How the group-by bar's visibility follows the active grouping. `"always"`
1712
+ * renders it even with an empty `groupBy` — a fixed drop target and a
1713
+ * constant reminder grouping exists. `"never"` never renders it, for a grid
1714
+ * driving `groupBy` entirely by its own UI (a header toggle, `Alt+ArrowDown`)
1715
+ * or programmatically. `"auto"` renders it once `groupBy` is non-empty, or
1716
+ * while a header drag eligible to drop into it is in progress — so there is
1717
+ * always somewhere to drop the very first column, even from a fully empty
1718
+ * grouping.
1719
+ */
1720
+ type GroupByBarVisibility = "always" | "auto" | "never";
1721
+ /**
1722
+ * What `getRowProps` adds to a data row: a class for the theme or the
1723
+ * app's own stylesheet to target, and `data-*` attributes for a test or a
1724
+ * script to find the row by. No inline style — styling belongs to the
1725
+ * stylesheet, which a class already reaches.
1726
+ */
1727
+ interface RowProps {
1728
+ className?: string | undefined;
1729
+ /**
1730
+ * Set on the row alongside the grid's own `data-gridkit-*` attributes,
1731
+ * which win over one of the same name — the grid finds its rows by them.
1732
+ */
1733
+ attributes?: Readonly<Record<`data-${string}`, string>> | undefined;
1734
+ }
1735
+ /**
1736
+ * Every setting of a grid that names no renderer's types: the data, what the
1737
+ * user may do with it, the state it starts in and the callbacks that report
1738
+ * changes. A renderer's own props are this plus what only it can express —
1739
+ * React's `columns` (whose templates return `ReactNode`), its pager and
1740
+ * infinite-scroll templates, its `ref` — so two renderers cannot drift apart
1741
+ * on what a setting is called or what it means.
1742
+ */
1743
+ interface GridOptions<Row> {
1744
+ dataSource?: readonly Row[] | undefined;
1745
+ /**
1746
+ * A row's stable identity, for state keyed by it. Defaults to the row's
1747
+ * position, which is enough for a static grid but ties that state to where a
1748
+ * row sits rather than to the row — so anything sorting, filtering or paging
1749
+ * its data should give one.
1750
+ *
1751
+ * Called for every row on every change to `dataSource`, so it should be
1752
+ * cheap and stable; an inline arrow is fine, one that re-reads the data is
1753
+ * not.
1754
+ */
1755
+ getRowId?: ((row: Row, index: number) => string) | undefined;
1756
+ /**
1757
+ * A class and `data-*` attributes for each data row, worked out from the
1758
+ * row — an `is-overdue` class, a `data-status` to style or find it by.
1759
+ * Group headers and summary rows are not passed to it.
1760
+ *
1761
+ * Called for each data row as it renders, so it should be cheap. A row
1762
+ * whose result reads the same as last time is not redrawn for it, so an
1763
+ * inline arrow returning a fresh object each time is fine.
1764
+ */
1765
+ getRowProps?: ((row: ResolvedRow<Row>) => RowProps) | undefined;
1766
+ /**
1767
+ * Called when a data row is clicked, after the click has changed the
1768
+ * selection — so a handler reading the selection sees the new one. Not
1769
+ * called for a group header, whose click expands or collapses it.
1770
+ */
1771
+ onRowClick?: ((event: RowPointerEvent<Row>) => void) | undefined;
1772
+ /**
1773
+ * Called once when a data row is double-clicked — the usual "open this
1774
+ * record" gesture. The two clicks before it still report through
1775
+ * `onRowClick` and select as clicks do.
1776
+ */
1777
+ onRowDoubleClick?: ((event: RowPointerEvent<Row>) => void) | undefined;
1778
+ borders?: Borders | undefined;
1779
+ hoverable?: HoverableConfig | undefined;
1780
+ /**
1781
+ * Which parts of the grid the user may select, and how many of each —
1782
+ * `{ rows: "multiple", cells: "single" }`. A cell addresses one value, so it
1783
+ * has no `"multiple"`.
1784
+ *
1785
+ * Off by default, unlike `hoverable`: selection claims the click, which a
1786
+ * grid that only displays data should not do. Give `getRowId` alongside it
1787
+ * for data that sorts, filters or pages, or a selection follows the position
1788
+ * rather than the row.
1789
+ */
1790
+ selectable?: SelectableConfig | undefined;
1791
+ /** Row ids selected to start with, keyed as `getRowId` resolves them. Uncontrolled. */
1792
+ defaultRowSelection?: SelectionState | undefined;
1793
+ /**
1794
+ * The selected row ids, controlled — applied as given, changed only through
1795
+ * the row selection callbacks (`onRowSelectionChange` carries the whole
1796
+ * next state). Leave it `undefined` for the grid to keep it itself,
1797
+ * starting from `defaultRowSelection`.
1798
+ */
1799
+ rowSelection?: SelectionState | undefined;
1800
+ /** Column ids selected to start with. Uncontrolled. */
1801
+ defaultColumnSelection?: SelectionState | undefined;
1802
+ /**
1803
+ * The selected column ids, controlled — changed only through the column
1804
+ * selection callbacks. Leave it `undefined` for the grid to keep it.
1805
+ */
1806
+ columnSelection?: SelectionState | undefined;
1807
+ /** The cell selected to start with. Uncontrolled. */
1808
+ defaultCellSelection?: CellSelectionState | undefined;
1809
+ /**
1810
+ * The selected cell, controlled — `null` for none, changed only through
1811
+ * the cell selection callbacks. Leave it `undefined` for the grid to keep
1812
+ * it.
1813
+ */
1814
+ cellSelection?: CellSelectionState | undefined;
1815
+ /** Whether columns can be dragged wider, unless a column says otherwise. */
1816
+ resizableColumns?: boolean | undefined;
1817
+ /**
1818
+ * Whether columns can be dragged into a new position, unless a column says
1819
+ * otherwise. Turning it off leaves an order the user already made in place.
1820
+ */
1821
+ reorderableColumns?: boolean | undefined;
1822
+ /**
1823
+ * Whether columns fill the grid's width or sit at their own. Defaults to
1824
+ * `"fit"`, under which columns the user has sized keep their width and the
1825
+ * rest share what is left.
1826
+ */
1827
+ resizeMode?: ResizeMode | undefined;
1828
+ /** Column widths to start from, keyed by column id. Uncontrolled. */
1829
+ defaultColumnSizing?: ColumnSizingState | undefined;
1830
+ /**
1831
+ * Column widths, controlled — applied as given, changed only through
1832
+ * `onColumnResize`, whose `sizing` is the next state. Leave it
1833
+ * `undefined` for the grid to keep the widths itself, starting from
1834
+ * `defaultColumnSizing`.
1835
+ */
1836
+ columnSizing?: ColumnSizingState | undefined;
1837
+ /**
1838
+ * Column ids in the order to start in. Uncontrolled, and partial: ids it
1839
+ * omits keep their position among `columns` and follow those it lists.
1840
+ */
1841
+ defaultColumnOrder?: ColumnOrderState | undefined;
1842
+ /**
1843
+ * The column order, controlled — applied as given, changed only through
1844
+ * `onColumnOrderChange`. Leave it `undefined` for the grid to keep the
1845
+ * order itself, starting from `defaultColumnOrder`.
1846
+ */
1847
+ columnOrder?: ColumnOrderState | undefined;
1848
+ /**
1849
+ * Columns shown (`true`) or hidden (`false`) to start with, keyed by
1850
+ * column id, over each definition's own `hidden`. Uncontrolled.
1851
+ */
1852
+ defaultColumnVisibility?: ColumnVisibilityState | undefined;
1853
+ /**
1854
+ * Which columns are shown, controlled — applied as given, changed only
1855
+ * through `onColumnVisibilityChange`. Leave it `undefined` for the grid to
1856
+ * keep it itself, starting from `defaultColumnVisibility`.
1857
+ */
1858
+ columnVisibility?: ColumnVisibilityState | undefined;
1859
+ /**
1860
+ * Called once when columns are shown or hidden, with every column that one
1861
+ * change touched. A call that changes nothing does not call it.
1862
+ */
1863
+ onColumnVisibilityChange?: ((event: ColumnVisibilityEvent) => void) | undefined;
1864
+ /**
1865
+ * Sizes applied to columns that do not set their own — the width they start
1866
+ * at and the bounds they may be resized between. Distinct from
1867
+ * `defaultColumnSizing`, which sets specific columns' starting widths.
1868
+ */
1869
+ columnSizeDefaults?: Partial<ColumnSizeDefaults> | undefined;
1870
+ /**
1871
+ * Called as the user resizes a column. Fires continuously with
1872
+ * `phase: "move"` and once on release with `phase: "end"` — the latter being
1873
+ * the one to persist. Auto-fit does not call it; it reports user intent only.
1874
+ */
1875
+ onColumnResize?: ((event: ColumnResizeEvent) => void) | undefined;
1876
+ /**
1877
+ * Called once when the user drops a column somewhere new. A drop that leaves
1878
+ * the order as it was does not call it.
1879
+ */
1880
+ onColumnOrderChange?: ((event: ColumnOrderEvent) => void) | undefined;
1881
+ /**
1882
+ * Whether columns can be sorted by clicking their header toggle, unless a
1883
+ * column says otherwise. Shift-click stacks a column into the sort instead
1884
+ * of replacing it.
1885
+ */
1886
+ sortableColumns?: boolean | undefined;
1887
+ /** The sort to start with, in priority order. Uncontrolled. */
1888
+ defaultColumnSort?: ColumnSortState | undefined;
1889
+ /**
1890
+ * The sort, controlled: the grid shows exactly this, and a header click
1891
+ * only asks for a change through `onColumnSortChange`, which takes effect
1892
+ * once this prop follows it. Leave it `undefined` for the grid to keep the
1893
+ * sort itself, starting from `defaultColumnSort`.
1894
+ */
1895
+ columnSort?: ColumnSortState | undefined;
1896
+ /**
1897
+ * Called once when the user changes the sort — a toggle, a stack, or a
1898
+ * clear back to "none".
1899
+ */
1900
+ onColumnSortChange?: ((event: ColumnSortEvent) => void) | undefined;
1901
+ /**
1902
+ * Whether columns can be grouped by — a header's click/`Alt+ArrowDown`
1903
+ * toggle — unless a column says otherwise. The grouping itself still
1904
+ * applies when this is off, via `defaultGroupBy` or the imperative API;
1905
+ * this only gates that one interaction, the same way `sortableColumns`
1906
+ * gates the sort toggle without disabling `defaultColumnSort`. Independent
1907
+ * of `groupByBarVisibility` and `groupByDraggableColumns`, which gate the
1908
+ * bar and the drag-in gesture respectively.
1909
+ */
1910
+ groupableColumns?: boolean | undefined;
1911
+ /**
1912
+ * Whether a groupable header shows its group-toggle icon, unless a column
1913
+ * says otherwise. Purely a rendering choice: `Alt+ArrowDown` keeps working
1914
+ * on a groupable header with the icon hidden.
1915
+ */
1916
+ groupToggleIconColumns?: boolean | undefined;
1917
+ /**
1918
+ * Whether a column's header may be dragged into the group-by bar to add
1919
+ * it to the grouping, unless a column says otherwise. Independent of
1920
+ * `groupableColumns`: a column can be groupable via its header's
1921
+ * click/keyboard toggle, via this drag, both, or neither.
1922
+ */
1923
+ groupByDraggableColumns?: boolean | undefined;
1924
+ /** How the group-by bar's visibility follows the active grouping. */
1925
+ groupByBarVisibility?: GroupByBarVisibility | undefined;
1926
+ /** The group-by stack to start with, outer to inner. Uncontrolled. */
1927
+ defaultGroupBy?: GroupByState | undefined;
1928
+ /**
1929
+ * The group-by stack, controlled — applied as given, changed only through
1930
+ * `onGroupByChange`. Leave it `undefined` for the grid to keep it itself,
1931
+ * starting from `defaultGroupBy`.
1932
+ */
1933
+ groupBy?: GroupByState | undefined;
1934
+ /**
1935
+ * Called once when the user changes the group-by stack — adding, removing,
1936
+ * or reordering a level.
1937
+ */
1938
+ onGroupByChange?: ((event: GroupByEvent) => void) | undefined;
1939
+ /** Group keys collapsed to start with — every other group starts expanded. Uncontrolled. */
1940
+ defaultGroupExpansion?: GroupExpansionState | undefined;
1941
+ /**
1942
+ * The collapsed groups, controlled — applied as given, changed only
1943
+ * through `onGroupExpansionChange`. Leave it `undefined` for the grid to
1944
+ * keep it itself, starting from `defaultGroupExpansion`.
1945
+ */
1946
+ groupExpansion?: GroupExpansionState | undefined;
1947
+ /** Called once when the user expands or collapses a group, or every group at once. */
1948
+ onGroupExpansionChange?: ((event: GroupExpansionEvent) => void) | undefined;
1949
+ /** The filter to start with — every applied entry, ANDed together. Uncontrolled. */
1950
+ defaultFilter?: FilterState<Row> | undefined;
1951
+ /**
1952
+ * The filter, controlled — applied as given, changed only through
1953
+ * `onFilterChange`. Leave it `undefined` for the grid to keep it itself,
1954
+ * starting from `defaultFilter`.
1955
+ */
1956
+ filter?: FilterState<Row> | undefined;
1957
+ /**
1958
+ * Called once when the filter changes — through `setFilter` for now, as
1959
+ * the grid has no filter UI of its own yet.
1960
+ */
1961
+ onFilterChange?: ((event: FilterChangeEvent<Row>) => void) | undefined;
1962
+ /**
1963
+ * Whether the grid's rows are split into pages. A page's unit is a
1964
+ * top-level group or a bare data row, never a leaf row — a group is never
1965
+ * split across a page boundary. Off by default, matching `sortableColumns`.
1966
+ */
1967
+ paginated?: boolean | undefined;
1968
+ /**
1969
+ * The page and page size to start on. Uncontrolled. Defaults to
1970
+ * `{ pageIndex: 0, pageSize: 25 }` when `paginated` is on and this is
1971
+ * omitted.
1972
+ */
1973
+ defaultPagination?: PaginationState | undefined;
1974
+ /**
1975
+ * The page and page size, controlled — applied as given, changed only
1976
+ * through `onPaginationChange`. Leave it `undefined` for the grid to keep
1977
+ * them itself, starting from `defaultPagination`.
1978
+ *
1979
+ * The grid sends an uncontrolled pagination back to the first page when
1980
+ * the filter, sort or grouping changes; a controlled one is the parent's
1981
+ * to reset alongside that change. Until it does, the grid shows the last
1982
+ * page that exists rather than an empty one.
1983
+ */
1984
+ pagination?: PaginationState | undefined;
1985
+ /** Called once when the user changes the page or the page size. */
1986
+ onPaginationChange?: ((event: PaginationChangeEvent) => void) | undefined;
1987
+ /**
1988
+ * Aggregates to compute — a subtotal per group (rendered in that group's
1989
+ * header) plus a grand total over the whole filtered/grouped dataset
1990
+ * (rendered in a footer). Always computed over every row, never scoped to
1991
+ * the current page. A plain controlled prop, unlike `sort`/`filter`/
1992
+ * `groupBy`/`pagination`: there is no built-in UI for a user to add or
1993
+ * remove an aggregate interactively, so there is no `defaultAggregates`/
1994
+ * `onAggregatesChange` pair to go with it.
1995
+ */
1996
+ aggregates?: AggregateState<Row> | undefined;
1997
+ /**
1998
+ * Where a group's own aggregate results render. `"inline"` (the default)
1999
+ * keeps them as text in the group header, next to its leaf-row count.
2000
+ * `"row"` instead renders a dedicated row after that group's last visible
2001
+ * entry, with each aggregate's value in the `<td>` for its own column —
2002
+ * the same alignment the grand-total footer's own cells have. Has no
2003
+ * effect when `aggregates` is empty or omitted.
2004
+ */
2005
+ groupAggregateDisplay?: GroupAggregateDisplay | undefined;
2006
+ /**
2007
+ * Bounds the row area's height, independently scrollable — the grid's own
2008
+ * chrome (group-by bar, header, footer, pager) stays outside it and
2009
+ * always visible. A number is pixels; a string is passed through as a CSS
2010
+ * length (e.g. "60vh"). Omitted, the body's height stays content-driven,
2011
+ * same as today.
2012
+ */
2013
+ height?: number | string | undefined;
2014
+ /**
2015
+ * Renders only the rows near the current scroll position rather than every
2016
+ * row at once — for a dataset too large to mount in full. Requires
2017
+ * `height` to be set; a grid without a bounded body has no viewport to
2018
+ * window rows against (a dev-time console warning fires when it's
2019
+ * missing). Off by default, matching every other opt-in behavior here.
2020
+ */
2021
+ virtualized?: boolean | undefined;
2022
+ /**
2023
+ * Rows rendered outside the visible range on each side, to reduce
2024
+ * blank-frame flashes on fast scrolling. Only meaningful with `virtualized`
2025
+ * on.
2026
+ */
2027
+ overscan?: number | undefined;
2028
+ /**
2029
+ * Assumed height for a row never yet measured — only matters for the very
2030
+ * first paint and for `scrollToRow`'s initial jump before it corrects
2031
+ * itself against that row's real, measured height. Only meaningful with
2032
+ * `virtualized` on.
2033
+ */
2034
+ estimatedRowHeight?: number | undefined;
2035
+ /**
2036
+ * The grid's accessible name, announced when it takes focus. A grid without
2037
+ * one is read only as "grid", which says nothing about which grid.
2038
+ */
2039
+ label?: string | undefined;
2040
+ /**
2041
+ * The id of an element naming the grid, for a heading already on the page.
2042
+ * Takes precedence over `label`, as `aria-labelledby` does.
2043
+ */
2044
+ labelledBy?: string | undefined;
2045
+ /**
2046
+ * The locale values are formatted for — a BCP 47 tag such as `"de-DE"`, or
2047
+ * a list to fall back through. Setting it turns on `Intl` formatting of
2048
+ * dates and numbers in every cell and aggregate shown without a template;
2049
+ * without it, only a column with its own `format` is formatted, in the
2050
+ * runtime's locale, and the rest print as they always have.
2051
+ */
2052
+ locale?: FormatLocale;
2053
+ /**
2054
+ * The grid's own strings, replacing its English key by key — the pager's
2055
+ * buttons, the group-by bar, the loading row, boolean and blank values,
2056
+ * the built-in commands' labels, the menus' names, and every live-region
2057
+ * announcement. Keys
2058
+ * left out keep their default.
2059
+ * Formatting is `locale`'s, not this.
2060
+ */
2061
+ messages?: Partial<GridMessages> | undefined;
2062
+ /**
2063
+ * The grid's own context menu, opened on a column header, a data cell, a
2064
+ * group row or the body's empty space by a right-click, Shift+F10 or the
2065
+ * ContextMenu key. Off by default, like every other feature, leaving the
2066
+ * browser's menu. `true` shows each area's defaults — see
2067
+ * `defaultContextMenu`; an object lists an area's entries, an area left
2068
+ * out keeping its defaults and one given `[]` showing the browser's menu
2069
+ * there.
2070
+ */
2071
+ contextMenu?: boolean | GridContextMenuOptions<Row> | undefined;
2072
+ /**
2073
+ * Called when the grid's context menu opens or closes, with where. A menu
2074
+ * opened in place of another reports that one closing first. The open
2075
+ * state is the renderer's to keep, so no option holds it.
2076
+ */
2077
+ onContextMenuOpenChange?: ((event: ContextMenuOpenChangeEvent) => void) | undefined;
2078
+ /**
2079
+ * The app's own commands, for its menus to list by id. One with a
2080
+ * built-in's id replaces it wherever that id is listed — a translated,
2081
+ * privilege-gated or differently behaving "Hide column" — see
2082
+ * `resolveCommands`.
2083
+ */
2084
+ commands?: readonly GridCommand<Row>[] | undefined;
2085
+ /**
2086
+ * Called after a command or an inline menu item runs — chosen from a menu,
2087
+ * or run through a renderer's API — saying which, where it was asked for
2088
+ * and from where. One that did not run, being hidden or disabled, is not
2089
+ * reported.
2090
+ */
2091
+ onCommand?: ((event: GridCommandEvent) => void) | undefined;
2092
+ /**
2093
+ * A toolbar above the grid: its own commands, a search box over the
2094
+ * filter's global text entry, dropdowns and the app's own content, in the
2095
+ * menu vocabulary. Off by default. `true` lists `defaultToolbar`; an object
2096
+ * lists its `items` and may name it with `label` — see `ToolbarEntry`.
2097
+ */
2098
+ toolbar?: boolean | GridToolbarOptions<Row> | undefined;
2099
+ }
2100
+ /**
2101
+ * Reported as the user selects. Every one of these is fanned out from a single
2102
+ * diff of the transition it describes, so no two can disagree about what one
2103
+ * interaction did.
2104
+ *
2105
+ * Kept apart from `GridOptions` because the column payloads carry resolved
2106
+ * columns, whose labels are whatever a renderer's `headerTemplate` returns —
2107
+ * `Node` is that renderer's node type.
2108
+ */
2109
+ interface SelectionCallbacks<Row, Node = string> {
2110
+ /** Called once per row newly selected. The last call names the last row. */
2111
+ onRowSelect?: ((event: RowSelectEvent<Row>) => void) | undefined;
2112
+ /** Called once with every row one interaction selected. */
2113
+ onRowsSelect?: ((event: RowsSelectEvent<Row>) => void) | undefined;
2114
+ onRowDeselect?: ((event: RowSelectEvent<Row>) => void) | undefined;
2115
+ onRowsDeselect?: ((event: RowsSelectEvent<Row>) => void) | undefined;
2116
+ /**
2117
+ * Called once per change with what it added, what it removed and everything
2118
+ * selected after it — the one to persist from.
2119
+ */
2120
+ onRowSelectionChange?: ((event: RowSelectionChangeEvent<Row>) => void) | undefined;
2121
+ onColumnSelect?: ((event: ColumnSelectEvent<Row, Node>) => void) | undefined;
2122
+ onColumnsSelect?: ((event: ColumnsSelectEvent<Row, Node>) => void) | undefined;
2123
+ onColumnDeselect?: ((event: ColumnSelectEvent<Row, Node>) => void) | undefined;
2124
+ onColumnsDeselect?: ((event: ColumnsSelectEvent<Row, Node>) => void) | undefined;
2125
+ onColumnSelectionChange?: ((event: ColumnSelectionChangeEvent<Row, Node>) => void) | undefined;
2126
+ onCellSelect?: ((event: CellSelectEvent<Row, Node>) => void) | undefined;
2127
+ onCellDeselect?: ((event: CellSelectEvent<Row, Node>) => void) | undefined;
2128
+ onCellSelectionChange?: ((event: CellSelectionChangeEvent<Row, Node>) => void) | undefined;
2129
+ }
2130
+
2131
+ /**
2132
+ * Creates the state container for one grid — see `GridController`. Hold one
2133
+ * per grid for its whole life: it keeps the uncontrolled slices, and its view
2134
+ * is memoised across calls the way `createGridViewResolver`'s is.
2135
+ */
2136
+ declare function createGridController<Row, Node = string>(initial: GridControllerOptions<Row, Node>): GridController<Row, Node>;
2137
+
2138
+ /** What `createCommandContext` builds a context from. */
2139
+ interface GridCommandContextInput<Row, Node> {
2140
+ readonly controller: GridController<Row, Node>;
2141
+ readonly target: GridCommandTarget;
2142
+ /** The grid's messages, already laid over the defaults — see `resolveMessages`. */
2143
+ readonly messages: GridMessages;
2144
+ readonly host: GridCommandHost;
2145
+ }
2146
+ /**
2147
+ * A command context for `target`, over the controller's state, view and
2148
+ * options as they are now. The controller itself serves as `actions`, typed
2149
+ * down to them, so a command cannot reach `setOptions`.
2150
+ *
2151
+ * `row` and `column` are looked up once here, against every filtered row and
2152
+ * every column, hidden ones included, so a target the API names off screen
2153
+ * still resolves.
2154
+ */
2155
+ declare function createCommandContext<Row, Node>({ controller, target, messages, host, }: GridCommandContextInput<Row, Node>): GridCommandContext<Row>;
2156
+
2157
+ /**
2158
+ * Every command a grid knows, by id: the built-ins, then `commands` — an app
2159
+ * command with a built-in's id replacing it, so every menu and toolbar
2160
+ * listing that id gets the app's version (translated, gated by a privilege,
2161
+ * or doing something else) without being changed itself.
2162
+ *
2163
+ * A fresh map per call; a renderer resolves it once per change to
2164
+ * `commands`, not per menu.
2165
+ */
2166
+ declare function resolveCommands<Row>(commands: readonly GridCommand<Row>[] | undefined): ReadonlyMap<string, GridCommand<Row>>;
2167
+ /**
2168
+ * Runs `command` when it is visible and enabled on `context`'s target, and
2169
+ * says whether it did — so a renderer reports only a command that ran, and a
2170
+ * stale button or a call through the API cannot run one the grid's state no
2171
+ * longer allows.
2172
+ */
2173
+ declare function runCommand<Row>(command: GridCommand<Row>, context: GridCommandContext<Row>): boolean;
2174
+
2175
+ /** What `resolveMenu` resolves a menu's entries against. */
2176
+ interface MenuResolveOptions<Row> {
2177
+ /** Every command the grid knows, by id — see `resolveCommands`. */
2178
+ readonly commands: ReadonlyMap<string, GridCommand<Row>>;
2179
+ readonly context: GridCommandContext<Row>;
2180
+ }
2181
+ /**
2182
+ * A menu's entries resolved against the grid as `context` sees it, ready to
2183
+ * draw:
2184
+ *
2185
+ * - A command id becomes its command's item, and a hidden command or item
2186
+ * is left out. An id naming no command is left out too, and reported once
2187
+ * per command map through `console.error`.
2188
+ * - Labels become strings and flags booleans; `checked` stays `undefined`
2189
+ * for an item that is not checkable.
2190
+ * - A submenu is resolved the same way, and left out when nothing in it
2191
+ * shows.
2192
+ * - Separators never lead, trail or double up, however the items around
2193
+ * them came and went.
2194
+ *
2195
+ * An empty result means there is nothing to show — no grid menu at all
2196
+ * here.
2197
+ */
2198
+ declare function resolveMenu<Row>(entries: readonly MenuEntry<Row>[], options: MenuResolveOptions<Row>): readonly ResolvedMenuEntry[];
2199
+
2200
+ /** Where an arrow, Home or End key moves a menu's focus. */
2201
+ type MenuMove = "next" | "previous" | "first" | "last";
2202
+ /**
2203
+ * The index of the item focus moves to from `from` — `-1` when nothing is
2204
+ * focused yet, so `"next"` lands on the first item and `"previous"` on the
2205
+ * last. Separators are skipped and `"next"`/`"previous"` wrap round the
2206
+ * ends; disabled items count, since they stay focusable for a screen reader
2207
+ * to find. `-1` when there is no item at all.
2208
+ *
2209
+ * Takes anything with a `type`, so a behaviour that reads its items off the
2210
+ * page can pass `{ type: "item" }` for each.
2211
+ */
2212
+ declare function nextMenuIndex(entries: readonly Pick<ResolvedMenuEntry, "type">[], from: number, move: MenuMove): number;
2213
+ /**
2214
+ * The index of the item `query` — what was typed, buffered for a moment —
2215
+ * picks, matched case-insensitively against the start of each label and
2216
+ * wrapping round the end; `-1` when none matches.
2217
+ *
2218
+ * `from` is the item focused now. A single letter, or the same letter
2219
+ * typed again and again, searches from the item after it, so repeating a
2220
+ * letter steps through every item it starts. A longer query searches from
2221
+ * `from` itself, so the item already found stays put while what is typed
2222
+ * still matches it.
2223
+ */
2224
+ declare function typeaheadIndex(labels: readonly string[], from: number, query: string): number;
2225
+
2226
+ /** What `resolveToolbar` resolves a toolbar's entries against. */
2227
+ interface ToolbarResolveOptions<Row> {
2228
+ /** Every command the grid knows, by id — see `resolveCommands`. */
2229
+ readonly commands: ReadonlyMap<string, GridCommand<Row>>;
2230
+ /**
2231
+ * The context an item resolves and runs in, for its target — the item
2232
+ * itself, or the dropdown an item in one is listed under. A command that
2233
+ * opens a panel anchors it there.
2234
+ */
2235
+ readonly contextFor: (target: GridToolbarTarget) => GridCommandContext<Row>;
2236
+ }
2237
+ /**
2238
+ * A toolbar's entries resolved against the grid, ready to draw, by the
2239
+ * rules `resolveMenu` follows:
2240
+ *
2241
+ * - A command id becomes its command's button, and an inline item a button
2242
+ * of its own; either is a toggle, with `pressed`, when it is checkable. A
2243
+ * hidden one is left out, and so is an id naming no command, reported
2244
+ * once per command map through `console.error`.
2245
+ * - A submenu becomes a dropdown, its items resolved as a menu's, and is
2246
+ * left out when nothing in it shows.
2247
+ * - `"search"`, `"spacer"` and custom entries stay as they are.
2248
+ * - Separators never lead, trail, double up or sit next to a spacer, which
2249
+ * already parts what is on either side of it.
2250
+ *
2251
+ * Resolve again whenever the grid changes, so each button's label, flags
2252
+ * and `run` follow its state.
2253
+ */
2254
+ declare function resolveToolbar<Row>(entries: readonly ToolbarEntry<Row>[], options: ToolbarResolveOptions<Row>): readonly ResolvedToolbarItem[];
2255
+
2256
+ /** What `fitToolbarItems` fits: a toolbar's entries, by width, into its space. */
2257
+ interface ToolbarFitInput {
2258
+ /** Each entry's width, in order — `0` for a spacer, whose width is only the space left over. */
2259
+ readonly widths: readonly number[];
2260
+ /** The width the entries share. */
2261
+ readonly available: number;
2262
+ /** The width of the "More" button the entries that do not fit go into. */
2263
+ readonly moreWidth: number;
2264
+ /** Whether each entry, in order, stays however little room there is. */
2265
+ readonly pinned: readonly boolean[];
2266
+ }
2267
+ /**
2268
+ * How many of a toolbar's entries fit, from the start: the first `count`
2269
+ * stay in the toolbar, with every pinned entry after them, and the rest go
2270
+ * into a "More" menu.
2271
+ *
2272
+ * Pinned entries take their room first, wherever they are. Room for "More"
2273
+ * is kept only when something does not fit — when everything does, the
2274
+ * result is every entry and no "More" is drawn. Entries are taken in order
2275
+ * and the first that does not fit ends the count, so the toolbar keeps its
2276
+ * order rather than filling gaps with later, narrower entries; one with no
2277
+ * width, a spacer, fits wherever the entries before it did.
2278
+ */
2279
+ declare function fitToolbarItems({ widths, available, moreWidth, pinned, }: ToolbarFitInput): number;
2280
+ /**
2281
+ * Whether a toolbar entry stays in the toolbar however narrow it gets: the
2282
+ * search box and custom entries, which have no menu item to become.
2283
+ */
2284
+ declare function isPinnedToolbarItem(item: Pick<ResolvedToolbarItem, "type">): boolean;
2285
+ /** A toolbar split at the count `fitToolbarItems` gave — see `splitToolbarItems`. */
2286
+ interface ToolbarSplit {
2287
+ /** What stays in the toolbar. */
2288
+ readonly shown: readonly ResolvedToolbarItem[];
2289
+ /** The "More" menu's entries, empty when everything fits. */
2290
+ readonly overflow: readonly ResolvedMenuEntry[];
2291
+ }
2292
+ /**
2293
+ * `items` split at the first `fit`: those before it, and every pinned item,
2294
+ * stay in the toolbar; the rest become the "More" menu's entries — a button
2295
+ * an item, checked where it was pressed, and a dropdown a submenu. Neither
2296
+ * side keeps a separator at its ends, doubled, or beside a spacer.
2297
+ */
2298
+ declare function splitToolbarItems(items: readonly ResolvedToolbarItem[], fit: number): ToolbarSplit;
2299
+
2300
+ /**
2301
+ * What a search box shows for `filter`: the global text entry's query — the
2302
+ * one naming no column — without the `%` anchors that make it a "contains"
2303
+ * match, or `""` when there is none. A `%` the user typed inside the text
2304
+ * stays: only the first and last characters are anchors.
2305
+ */
2306
+ declare function searchTextOf<Row>(filter: FilterState<Row>): string;
2307
+ /**
2308
+ * `filter` with its global text entry set to search for `text` anywhere in
2309
+ * any column — the query `%text%` — or removed for an empty `text`. Every
2310
+ * entry naming a column stays as it was. `filter` itself, unchanged, when
2311
+ * it already searches for `text`.
2312
+ *
2313
+ * `text` is written as typed, spaces and all: a search box reads its text
2314
+ * back from the filter, and trimming here would take a space away from
2315
+ * under the caret as the user types it.
2316
+ */
2317
+ declare function setSearchText<Row>(filter: FilterState<Row>, text: string): FilterState<Row>;
642
2318
 
643
2319
  /**
644
2320
  * How a column of `type` aligns by default. Numeric types align right so that
@@ -654,8 +2330,11 @@ declare function alignmentForType(type: ColumnType): ColumnAlignment;
654
2330
  *
655
2331
  * Order follows `Object.entries`, which lists integer-like keys first
656
2332
  * regardless of the order they were written in.
2333
+ *
2334
+ * `Node` is whatever the caller's renderer draws: an inferred column sets no
2335
+ * template, so it suits any.
657
2336
  */
658
- declare function defineColumnsFromRows<Row>(rows: readonly Row[]): readonly ColumnDefinition<Row>[];
2337
+ declare function defineColumnsFromRows<Row, Node = string>(rows: readonly Row[]): readonly ColumnDefinition<Row, Node>[];
659
2338
  /**
660
2339
  * The key state about a column is stored under, and the key it renders with.
661
2340
  * Every such lookup goes through here so the two can never disagree.
@@ -674,16 +2353,26 @@ declare function getColumnId<Row>(column: ColumnDefinition<Row, unknown>): strin
674
2353
  declare function resolveRowId<Row>(row: Row, index: number, getRowId?: (row: Row, index: number) => string): string;
675
2354
  /**
676
2355
  * What a column's header shows: its own `headerTemplate`, called first if it is
677
- * a function, or else a label read off the field path — `"Application.Id"`
678
- * reading as `"Application Id"`.
2356
+ * a function, or else its plain-text `header`, or else a label read off the
2357
+ * field path.
679
2358
  */
680
2359
  declare function resolveColumnLabel<Row, Node>(column: ColumnDefinition<Row, Node>): Node | string;
2360
+ /**
2361
+ * A column's name as text, for wherever markup will not do — an
2362
+ * announcement, an export. Its `header` first, even beside a
2363
+ * `headerTemplate`, since a template's output need not be text; then the
2364
+ * label `resolveColumnLabel` gives, when that is a string; then the label
2365
+ * read off the field path.
2366
+ */
2367
+ declare function resolveColumnHeaderText<Row>(column: ColumnDefinition<Row, unknown>): string;
681
2368
  /** Which of a column header's keyboard interactions to announce. */
682
2369
  interface KeyShortcutCapabilities {
683
2370
  reorderable: boolean;
684
2371
  resizable: boolean;
685
2372
  sortable: boolean;
686
2373
  groupable: boolean;
2374
+ /** Whether the header opens the grid's context menu. Defaults to `false`. */
2375
+ contextMenu?: boolean | undefined;
687
2376
  }
688
2377
  /**
689
2378
  * The `aria-keyshortcuts` string for a column header, naming only the keys
@@ -751,6 +2440,14 @@ declare function nextFocusForKey(key: string, modifiers: NavigationModifiers, fo
751
2440
  * was made against.
752
2441
  */
753
2442
  declare function applyColumnOrder<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], order: ColumnOrderState): readonly ColumnDefinition<Row, Node>[];
2443
+ /**
2444
+ * `columns` in the order `order` gives, each paired with its id — the
2445
+ * width-free column list the data stages (filter, sort, group, aggregate)
2446
+ * read. Ordered here, ahead of sizing, so every later stage sees the one
2447
+ * already-ordered list and no part of the grid has to know a reorder
2448
+ * happened.
2449
+ */
2450
+ declare function resolveDataColumns<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], order: ColumnOrderState): readonly DataColumn<Row, Node>[];
754
2451
  /**
755
2452
  * The order with `movedId` lifted out and put back in front of `beforeId`, or
756
2453
  * at the end when that is `null`.
@@ -840,11 +2537,19 @@ declare function selectCell(selection: CellSelectionState, cell: SelectedCellRef
840
2537
  * Ctrl-click, matching `toggleSelection`.
841
2538
  */
842
2539
  declare function toggleCellSelection(selection: CellSelectionState, cell: SelectedCellRef, mode: CellSelectionMode): CellSelectionState;
843
- /** The intent a click or key press carries, by the modifiers held with it. */
2540
+ /**
2541
+ * The intent a click or key press carries, by the modifiers held with it.
2542
+ *
2543
+ * `toggleOnClick` makes the unmodified press a toggle — the
2544
+ * `selectable.toggleOnClick` checklist behaviour — leaving Shift and Ctrl
2545
+ * to mean what they always do.
2546
+ */
844
2547
  declare function intentOf(event: {
845
2548
  ctrlKey: boolean;
846
2549
  metaKey: boolean;
847
2550
  shiftKey: boolean;
2551
+ }, options?: {
2552
+ toggleOnClick?: boolean | undefined;
848
2553
  }): SelectIntent;
849
2554
  /**
850
2555
  * The transform an intent asks for. A function rather than a branch inside
@@ -970,7 +2675,7 @@ declare function toggleColumnSort(sort: ColumnSortState, columnId: string, optio
970
2675
  * columns absent from `columns` — a stored sort tolerates a column removed
971
2676
  * from the definition the same way a stored `ColumnOrderState` does.
972
2677
  */
973
- declare function sortRows<Row>(rows: readonly ResolvedRow<Row>[], sort: ColumnSortState, columns: readonly ResolvedColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
2678
+ declare function sortRows<Row>(rows: readonly ResolvedRow<Row>[], sort: ColumnSortState, columns: readonly DataColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
974
2679
 
975
2680
  /**
976
2681
  * Whether `value`, stringified, matches `query`'s SQL LIKE-style pattern —
@@ -987,8 +2692,8 @@ declare function matchesQuery(value: unknown, query: string): boolean;
987
2692
  * This column's current text query, or the global entry's when `columnId`
988
2693
  * is omitted; `null` if no `TextFilterEntry` names it — including when the
989
2694
  * entry that exists for that key is a `ValueFilterEntry`/
990
- * `PredicateFilterEntry`/`GroupFilterEntry` instead, since none of those
991
- * hold a query string to report.
2695
+ * `PredicateFilterEntry`/`OperatorFilterEntry`/`GroupFilterEntry` instead,
2696
+ * since none of those hold a query string to report.
992
2697
  */
993
2698
  declare function filterQueryFor<Row>(filter: FilterState<Row>, columnId?: FieldPath<Row> | (string & {})): string | null;
994
2699
  /**
@@ -1022,7 +2727,7 @@ declare function clearAllFilters<Row>(filter: FilterState<Row>): FilterState<Row
1022
2727
  * columns absent from `columns` — a stored filter tolerates a column
1023
2728
  * removed from the definition the same way a stored `ColumnSortState` does.
1024
2729
  */
1025
- declare function filterRows<Row>(rows: readonly ResolvedRow<Row>[], filter: FilterState<Row>, columns: readonly ResolvedColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
2730
+ declare function filterRows<Row>(rows: readonly ResolvedRow<Row>[], filter: FilterState<Row>, columns: readonly DataColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
1026
2731
 
1027
2732
  /**
1028
2733
  * This group's id, from its path. Every group-id producer/consumer in this
@@ -1055,7 +2760,7 @@ declare function groupRowId(path: readonly unknown[]): string;
1055
2760
  * columns absent from `columns` — a stored grouping tolerates a column
1056
2761
  * removed from the definition the same way a stored `ColumnSortState` does.
1057
2762
  */
1058
- declare function groupRows<Row>(rows: readonly ResolvedRow<Row>[], groupBy: GroupByState, expansion: GroupExpansionState, columns: readonly ResolvedColumn<Row, unknown>[]): readonly DisplayRow<Row>[];
2763
+ declare function groupRows<Row>(rows: readonly ResolvedRow<Row>[], groupBy: GroupByState, expansion: GroupExpansionState, columns: readonly DataColumn<Row, unknown>[]): readonly DisplayRow<Row>[];
1059
2764
  /**
1060
2765
  * The expansion with `groupId` collapsed if it was expanded, or expanded if
1061
2766
  * it was collapsed.
@@ -1070,6 +2775,9 @@ declare function expandAllGroups(expansion: GroupExpansionState): GroupExpansion
1070
2775
  * absent from `rows`) keeps whatever expansion it already had rather than
1071
2776
  * being forced closed too; expanding that ancestor again reveals it exactly
1072
2777
  * as it was left.
2778
+ *
2779
+ * Group headers only: a summary row (`groupAggregateDisplay: "row"`) carries
2780
+ * its group's id too, and counting it would list that group twice.
1073
2781
  */
1074
2782
  declare function collapseAllGroups<Row>(rows: readonly DisplayRow<Row>[]): GroupExpansionState;
1075
2783
  /**
@@ -1111,7 +2819,7 @@ declare function movesGroupBy(groupBy: GroupByState, columnId: string, beforeCol
1111
2819
  * order-preserving predicate and sort is a stable total order over whatever
1112
2820
  * it's handed, so the final order is identical either way.
1113
2821
  */
1114
- declare function resolveShownRows<Row>(rows: readonly ResolvedRow<Row>[], filter: FilterState<Row>, sort: ColumnSortState, columns: readonly ResolvedColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
2822
+ declare function resolveShownRows<Row>(rows: readonly ResolvedRow<Row>[], filter: FilterState<Row>, sort: ColumnSortState, columns: readonly DataColumn<Row, unknown>[]): readonly ResolvedRow<Row>[];
1115
2823
  /**
1116
2824
  * `ids` resolved back to the rows behind them, keyed by `rowsById`.
1117
2825
  *
@@ -1187,8 +2895,290 @@ declare function paginationWindow(currentPage: number, pageCount: number, option
1187
2895
  * shared singleton — matching this codebase's general avoidance of shared
1188
2896
  * mutable module state.
1189
2897
  */
1190
- declare function computeAggregates<Row>(rows: readonly Row[], specs: AggregateState<Row>, columns: readonly ResolvedColumn<Row, unknown>[]): AggregateResults;
1191
- declare function withGroupAggregates<Row>(displayRows: readonly DisplayRow<Row>[], flatRows: readonly ResolvedRow<Row>[], groupBy: GroupByState, specs: AggregateState<Row>, columns: readonly ResolvedColumn<Row, unknown>[], display?: GroupAggregateDisplay): readonly DisplayRow<Row>[];
2898
+ declare function computeAggregates<Row>(rows: readonly Row[], specs: AggregateState<Row>, columns: readonly DataColumn<Row, unknown>[]): AggregateResults;
2899
+ declare function withGroupAggregates<Row>(displayRows: readonly DisplayRow<Row>[], flatRows: readonly ResolvedRow<Row>[], groupBy: GroupByState, specs: AggregateState<Row>, columns: readonly DataColumn<Row, unknown>[], display?: GroupAggregateDisplay): readonly DisplayRow<Row>[];
2900
+
2901
+ /**
2902
+ * Whether `column` is shown: what the user last chose for it, if anything,
2903
+ * else what its definition says. The one place that precedence is decided,
2904
+ * so the view and an imperative "is it showing?" cannot disagree.
2905
+ */
2906
+ declare function isColumnVisible<Row>(column: ColumnDefinition<Row, unknown>, visibility: ColumnVisibilityState): boolean;
2907
+ /**
2908
+ * `columns` without the hidden ones, in the same order. `columns` itself when
2909
+ * every column is shown — the common case — so a stage memoised on this
2910
+ * output sees nothing change.
2911
+ */
2912
+ declare function applyColumnVisibility<Row, Node>(columns: readonly DataColumn<Row, Node>[], visibility: ColumnVisibilityState): readonly DataColumn<Row, Node>[];
2913
+ /**
2914
+ * `visibility` with each of `columnIds` shown (`visible: true`) or hidden.
2915
+ * Only a column whose visibility actually changes gets an entry, and ids
2916
+ * naming no column are ignored, so asking to show what is already showing
2917
+ * hands back `visibility` itself — the same reference, for a caller deciding
2918
+ * whether anything happened.
2919
+ */
2920
+ declare function setColumnVisibility<Row>(columns: readonly DataColumn<Row, unknown>[], visibility: ColumnVisibilityState, columnIds: readonly string[], visible: boolean): ColumnVisibilityState;
2921
+
2922
+ /**
2923
+ * What one column's filter looks like to an editor — which of its forms can
2924
+ * show it, or that none can.
2925
+ *
2926
+ * - `"none"`: no entry touches the column.
2927
+ * - `"values"`: a checklist — one `in` entry, optionally OR-grouped with an
2928
+ * `isEmpty` on the same column (`includeBlanks`).
2929
+ * - `"conditions"`: one or two operator entries on the column (any but
2930
+ * `in`), at the top level (ANDed) or alone in one group with its
2931
+ * combinator.
2932
+ * - `"custom"`: anything else that touches the column — a text query, a
2933
+ * predicate, a group spanning several columns. An editor shows it as
2934
+ * such, and applying an editor's draft replaces it.
2935
+ */
2936
+ type ColumnFilterShape<Row> = {
2937
+ readonly kind: "none";
2938
+ } | {
2939
+ readonly kind: "values";
2940
+ readonly values: readonly FilterScalar[];
2941
+ readonly includeBlanks: boolean;
2942
+ } | {
2943
+ readonly kind: "conditions";
2944
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
2945
+ readonly combinator: "and" | "or";
2946
+ } | {
2947
+ readonly kind: "custom";
2948
+ };
2949
+ /** One distinct value a column holds, as a checklist offers it. */
2950
+ interface ColumnValueOption {
2951
+ readonly value: Exclude<FilterScalar, null>;
2952
+ /** The value as the column prints it — what a search matches against. */
2953
+ readonly label: string;
2954
+ /** How many rows hold it, among the rows the other columns' filters keep. */
2955
+ readonly count: number;
2956
+ }
2957
+ /** What `columnValueOptions` narrows its list by. */
2958
+ interface ColumnValueQuery {
2959
+ /** Keeps the values whose label contains this, ignoring case. */
2960
+ readonly search?: string;
2961
+ /** Keeps at most this many values, first in sorted order. */
2962
+ readonly limit?: number;
2963
+ /** The locale labels are formatted for — the grid's own `locale`. */
2964
+ readonly locale?: FormatLocale;
2965
+ /**
2966
+ * The grid's own `messages`, over the defaults: a boolean is labelled
2967
+ * `booleanTrue`/`booleanFalse`, as its cells print it.
2968
+ */
2969
+ readonly messages?: Partial<GridMessages>;
2970
+ }
2971
+ interface ColumnValueOptions {
2972
+ /** The distinct values, sorted as the column sorts, searched and cut to `limit`. */
2973
+ readonly options: readonly ColumnValueOption[];
2974
+ /** How many values matched the search, before `limit` cut them. */
2975
+ readonly total: number;
2976
+ /** Whether `limit` left values out. */
2977
+ readonly truncated: boolean;
2978
+ /** How many of the same rows hold a blank — `null`, `undefined` or `""`. */
2979
+ readonly blanks: number;
2980
+ /**
2981
+ * The column's `type`, which tells values apart the way an `in` filter
2982
+ * does — on a date column, a date string and the `Date` it names are one
2983
+ * value. `initialFilterEditorDraft` carries it into the draft.
2984
+ */
2985
+ readonly columnType?: ColumnType | undefined;
2986
+ }
2987
+ /**
2988
+ * A checklist or condition editor's working copy of one column's filter,
2989
+ * changed by `filterEditorReducer` and turned into a filter by
2990
+ * `draftToFilter` only when the user applies it — so cancelling is just
2991
+ * dropping the draft.
2992
+ */
2993
+ interface FilterEditorDraft<Row> {
2994
+ /** Which half of the draft `draftToFilter` applies: the last one changed. */
2995
+ readonly mode: "values" | "conditions";
2996
+ /** Every value the editor offers, from `columnValueOptions`. */
2997
+ readonly options: readonly ColumnValueOption[];
2998
+ /** How many rows hold a blank; the blanks entry only matters when some do. */
2999
+ readonly blanks: number;
3000
+ readonly search: string;
3001
+ /** The checked values, keyed as an `in` filter on the column keys them. */
3002
+ readonly checked: ReadonlyMap<string, FilterScalar>;
3003
+ readonly includeBlanks: boolean;
3004
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
3005
+ readonly combinator: "and" | "or";
3006
+ /** The column's `type`, from `ColumnValueOptions` — what values are keyed by. */
3007
+ readonly columnType?: ColumnType | undefined;
3008
+ }
3009
+ type FilterEditorAction<Row> = {
3010
+ readonly type: "search";
3011
+ readonly search: string;
3012
+ } | {
3013
+ readonly type: "toggleValue";
3014
+ readonly value: FilterScalar;
3015
+ }
3016
+ /** Checks every value the search shows, or unchecks them once all are. */
3017
+ | {
3018
+ readonly type: "toggleAll";
3019
+ } | {
3020
+ readonly type: "setIncludeBlanks";
3021
+ readonly includeBlanks: boolean;
3022
+ } | {
3023
+ readonly type: "setConditions";
3024
+ readonly conditions: readonly OperatorFilterEntry<Row>[];
3025
+ /** Keeps the draft's own when omitted. */
3026
+ readonly combinator?: "and" | "or";
3027
+ }
3028
+ /** Back to "no filter": every value checked, no conditions, no search. */
3029
+ | {
3030
+ readonly type: "clear";
3031
+ };
3032
+ /** A select-all checkbox's state over the values the search shows. */
3033
+ type SelectAllState = "checked" | "unchecked" | "mixed";
3034
+ /**
3035
+ * How `filter` filters `columnId`, as one of the forms an editor can show —
3036
+ * see `ColumnFilterShape`. Entries about other columns don't count, nor do
3037
+ * entries across every column (a global search).
3038
+ */
3039
+ declare function describeColumnFilter<Row>(filter: FilterState<Row>, columnId: string): ColumnFilterShape<Row>;
3040
+ /**
3041
+ * The distinct values `columnId` holds, for a checklist editor: each with
3042
+ * its label and how many rows hold it.
3043
+ *
3044
+ * Counted over the rows every *other* column's filter keeps — every entry
3045
+ * except those `describeColumnFilter` would count for this column — so a
3046
+ * column's list cascades from the other filters without its own pick
3047
+ * hiding the values the user unchecked. Values are told apart as an `in`
3048
+ * filter tells them apart — as grouping does, except that a date column's
3049
+ * date strings are the dates they name — ordered as the column sorts, and
3050
+ * labelled as its cells print, a boolean in `query.messages`' words; blanks
3051
+ * are counted apart, in `blanks`.
3052
+ *
3053
+ * Costs one pass over `rows` (tens of milliseconds at 100k rows), so compute
3054
+ * it when an editor opens rather than on every render, and hand the whole
3055
+ * list to `initialFilterEditorDraft`, whose search needs no recount.
3056
+ */
3057
+ declare function columnValueOptions<Row>(rows: readonly Row[], dataColumns: readonly DataColumn<Row, unknown>[], filter: FilterState<Row>, columnId: string, query?: ColumnValueQuery): ColumnValueOptions;
3058
+ /**
3059
+ * A draft showing `shape` over `values` — what an editor opens with. A
3060
+ * column with no filter, or one only a custom editor could show, opens with
3061
+ * every value checked; a checklist with its own values checked, kept even
3062
+ * when the other filters now hide them; conditions as they are.
3063
+ */
3064
+ declare function initialFilterEditorDraft<Row>(shape: ColumnFilterShape<Row>, values: ColumnValueOptions): FilterEditorDraft<Row>;
3065
+ /** The options the draft's search shows — those a select-all acts on. */
3066
+ declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): readonly ColumnValueOption[];
3067
+ /**
3068
+ * The select-all checkbox's state: whether every value the search shows is
3069
+ * checked, none is, or some are — blanks included while nothing is
3070
+ * searched.
3071
+ */
3072
+ declare function selectAllState<Row>(draft: FilterEditorDraft<Row>): SelectAllState;
3073
+ /**
3074
+ * The next draft after `action` — a plain reducer, so a renderer can hold
3075
+ * the draft in whatever state it has (`useReducer`, a signal, a store).
3076
+ * Changing a value or the blanks switches the draft to its checklist;
3077
+ * setting conditions switches it to them.
3078
+ */
3079
+ declare function filterEditorReducer<Row>(draft: FilterEditorDraft<Row>, action: FilterEditorAction<Row>): FilterEditorDraft<Row>;
3080
+ /**
3081
+ * `current` with `columnId`'s filter replaced by what `draft` holds — what
3082
+ * applying an editor sets. Every entry about the column goes (custom ones
3083
+ * included); the draft's entries take the place of the first, so the rest
3084
+ * keep their order.
3085
+ *
3086
+ * A checklist with everything checked is no filter at all, and a partial
3087
+ * pick is one `in` entry, OR-grouped with an `isEmpty` when blanks are
3088
+ * kept. One condition is stored as itself, two as a group with the
3089
+ * draft's combinator. Returns `current` itself when nothing changes.
3090
+ */
3091
+ declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: string, current: FilterState<Row>): FilterState<Row>;
3092
+
3093
+ /** What a column chooser is drawn from: every column, the visibility, and the search typed. */
3094
+ interface ColumnChooserInput<Row> {
3095
+ /** Every column in its current order, hidden ones included — a view's `dataColumns`. */
3096
+ readonly columns: readonly DataColumn<Row, unknown>[];
3097
+ readonly visibility: ColumnVisibilityState;
3098
+ /** Narrows the list to the columns whose header text contains it, ignoring case. */
3099
+ readonly search?: string | undefined;
3100
+ }
3101
+ /** One column's checkbox in a column chooser. */
3102
+ interface ColumnChooserEntry {
3103
+ readonly columnId: string;
3104
+ /** The column's header text — what the search matches, and the checkbox's label. */
3105
+ readonly label: string;
3106
+ /** Whether the column is shown — whether its checkbox is checked. */
3107
+ readonly visible: boolean;
3108
+ /**
3109
+ * Whether the checkbox cannot be unchecked: the column is shown and is
3110
+ * either not `hideable` or the last column shown. A hidden column can
3111
+ * always be shown, `hideable` or not.
3112
+ */
3113
+ readonly disabled: boolean;
3114
+ }
3115
+ /** What toggling a chooser's "Show all" checkbox does: shows these columns, or hides them. */
3116
+ interface ColumnChooserToggle {
3117
+ readonly visible: boolean;
3118
+ readonly columnIds: readonly string[];
3119
+ }
3120
+ interface ColumnChooserModel {
3121
+ /** The columns the search matches, in column order. */
3122
+ readonly entries: readonly ColumnChooserEntry[];
3123
+ /**
3124
+ * The "Show all" checkbox's state over the entries whose columns are
3125
+ * `hideable` — the ones it acts on. A column the user cannot hide is
3126
+ * always on, so counting it would leave "Show all" stuck at mixed.
3127
+ */
3128
+ readonly selectAll: SelectAllState;
3129
+ /** What toggling "Show all" does, or `null` when it can do nothing — a disabled checkbox. */
3130
+ readonly toggleAll: ColumnChooserToggle | null;
3131
+ }
3132
+ /**
3133
+ * A column chooser's list for a search, and what its "Show all" checkbox
3134
+ * says and does — the same tri-state over what the search shows that a
3135
+ * filter editor's select-all is (`selectAllState`).
3136
+ *
3137
+ * "Show all" shows every hidden column the search shows once any is hidden,
3138
+ * and hides those it shows once none is. It never touches a column that is
3139
+ * not `hideable`, and never hides the last column shown: when that is all
3140
+ * that would be left, the first of them in column order stays, since a grid
3141
+ * with no column shown has no header to bring one back from.
3142
+ */
3143
+ declare function resolveColumnChooser<Row>({ columns, visibility, search, }: ColumnChooserInput<Row>): ColumnChooserModel;
3144
+
3145
+ /**
3146
+ * `resolveGridView`, memoised per stage: each stage remembers its last
3147
+ * inputs and returns its last output when none of them changed identity, so
3148
+ * a call that changes one slice of state recomputes only what depends on
3149
+ * it. The data stages (filter → sort → group → aggregate → paginate) read
3150
+ * `dataColumns`, which carry no width, so a resize or a viewport change
3151
+ * leaves `rows`, `displayRows`, `pageRows`, `displayDataRows` and
3152
+ * `grandTotal` reference-equal to the previous call's — only `columns` is
3153
+ * new. The view object itself is reused when every field is unchanged, so a
3154
+ * snapshot-based renderer sees nothing to re-render.
3155
+ *
3156
+ * Hold one resolver per grid and call it with the current input every time
3157
+ * the view is needed; the memo only pays off across calls to the same one.
3158
+ */
3159
+ declare function createGridViewResolver<Row, Node = string>(): (input: GridViewInput<Row, Node>) => GridView<Row, Node>;
3160
+ /**
3161
+ * What the user is looking at, derived from the rows, the columns, the
3162
+ * grid's state and its options in one call: rows filtered → sorted →
3163
+ * grouped → aggregated → paginated, and columns ordered → hidden → sized.
3164
+ * The one function a renderer, an export or a toolbar calls instead of
3165
+ * composing the stages itself, so none of them can disagree about what is
3166
+ * shown.
3167
+ *
3168
+ * Unmemoised — a one-off resolver. A renderer that derives the view on every
3169
+ * change holds a `createGridViewResolver()` instead.
3170
+ */
3171
+ declare function resolveGridView<Row, Node = string>(input: GridViewInput<Row, Node>): GridView<Row, Node>;
3172
+
3173
+ /**
3174
+ * `state` in a form that survives `JSON.stringify` and back unchanged, for
3175
+ * saving a layout — to local storage, a URL, a user's profile — and handing
3176
+ * it to `restoreState` later. Every slice is plain data already except the
3177
+ * filter: a `Date` value or operand is written as its ISO string, and a
3178
+ * predicate entry, being a function, cannot be written at all and is left
3179
+ * out with a `console.error` naming its column.
3180
+ */
3181
+ declare function serializeGridState<Row>(state: GridState<Row>): SerializedGridState<Row>;
1192
3182
 
1193
3183
  /**
1194
3184
  * One entry per row: its measured height once known, `undefined` until then.
@@ -1217,11 +3207,11 @@ interface VisibleRange {
1217
3207
  *
1218
3208
  * `O(n)` in `heights.length`. Deliberately not a Fenwick tree or a
1219
3209
  * binary-searchable prefix-sum structure — that optimization belongs in the
1220
- * mutable React-side cache that already owns mutability
1221
- * (`useRowVirtualizer`), not in this pure function's contract, and is not
3210
+ * mutable height cache that already owns mutability (`createRowVirtualizer`
3211
+ * in `@gridkitjs/dom`), not in this pure function's contract, and is not
1222
3212
  * worth taking on until a profiled scenario actually shows it matters at
1223
3213
  * realistic row counts.
1224
3214
  */
1225
3215
  declare function visibleRange(heights: RowHeights, estimatedHeight: number, scrollTop: number, viewportHeight: number, overscan: number): VisibleRange;
1226
3216
 
1227
- export { type AggregateFn, type AggregateResults, type AggregateSpec, type AggregateState, type BuiltInAggregate, type CellSelectEvent, type CellSelectionChangeEvent, type CellSelectionMode, type CellSelectionState, type CellTemplateContext, type ColumnAlignment, type ColumnConstraints, type ColumnDefinition, type ColumnOrderEvent, type ColumnOrderState, type ColumnResizeEvent, type ColumnResizeSession, type ColumnResolveOptions, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnSizeDefaults, type ColumnSizingState, type ColumnSortEntry, type ColumnSortEvent, type ColumnSortState, type ColumnType, type ColumnWrapConfig, type ColumnsSelectEvent, DEFAULT_COLUMN_SIZES, type DisplayRow, type DropSide, type FieldPath, type FilterEntry, type FilterPredicate, type FilterState, type FooterTemplateContext, type GridFocus, type GroupAggregateDisplay, type GroupByEntry, type GroupByEvent, type GroupByState, type GroupExpansionEvent, type GroupExpansionState, type GroupFilterEntry, HEADER_ROW, KEYBOARD_STEP, type KeyShortcutCapabilities, type NavigationModifiers, type PaginatedRows, type PaginationChangeEvent, type PaginationState, type PaginationWindowEntry, type PredicateFilterEntry, type ResolvedColumn, type ResolvedGroupRow, type ResolvedGroupSummaryRow, type ResolvedRow, type RowHeights, type RowSelectEvent, type RowSelectionChangeEvent, type RowsSelectEvent, type SelectIntent, type SelectableConfig, type SelectedCell, type SelectedCellRef, type SelectedColumn, type SelectionDiff, type SelectionMode, type SelectionState, type SortDirection, type TextFilterEntry, type ValueFilterEntry, type VisibleRange, accessDotted, alignmentForType, applyColumnOrder, applyColumnResize, applySelectionIntent, beginColumnResize, buildKeyShortcuts, clampColumnWidth, clampFocus, clearAllFilters, clearSelection, collapseAllGroups, compareValues, computeAggregates, defineColumnsFromRows, diffSelection, expandAllGroups, filterQueryFor, filterRows, fitColumnsToWidth, getColumnId, groupRowId, groupRows, intentOf, isSameCell, matchesQuery, moveColumnBefore, moveGroupByBefore, movesColumn, movesGroupBy, nextFocusForKey, paginateRows, paginationWindow, resolveCell, resolveColumnConstraints, resolveColumnLabel, resolveColumnWidths, resolveColumns, resolveDropBefore, resolveKeyboardDropTarget, resolveRowId, resolveRows, resolveShownRows, revertColumnSize, selectAll, selectCell, selectOnly, selectRange, setColumnFilter, sizeColumnToContent, sortDirectionFor, sortPriorityFor, sortRows, toggleCellSelection, toggleColumnSort, toggleGroupExpansion, toggleSelection, totalColumnWidth, visibleRange, withGroupAggregates };
3217
+ export { type AggregateFn, type AggregateResults, type AggregateSpec, type AggregateState, type Borders, type BuiltInAggregate, type BuiltInCommandIcon, type BuiltInCommandId, type CellSelectEvent, type CellSelectionChangeEvent, type CellSelectionMode, type CellSelectionState, type CellTemplateContext, type ColumnAlignment, type ColumnChooserEntry, type ColumnChooserInput, type ColumnChooserModel, type ColumnChooserToggle, type ColumnConstraints, type ColumnDefinition, type ColumnFilterShape, type ColumnOrderEvent, type ColumnOrderState, type ColumnResizeEvent, type ColumnResizeSession, type ColumnResolveOptions, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnSizeDefaults, type ColumnSizingState, type ColumnSortEntry, type ColumnSortEvent, type ColumnSortState, type ColumnType, type ColumnValueOption, type ColumnValueOptions, type ColumnValueQuery, type ColumnVisibilityEvent, type ColumnVisibilityState, type ColumnWrapConfig, type ColumnsSelectEvent, type ContextMenuOpenChangeEvent, DEFAULT_COLUMN_SIZES, type DataColumn, type DisplayRow, type DropSide, type FieldPath, type FilterChangeEvent, type FilterEditorAction, type FilterEditorDraft, type FilterEntry, type FilterOperator, type FilterPredicate, type FilterScalar, type FilterState, type FooterTemplateContext, type FormatLocale, type GridCommand, type GridCommandActions, type GridCommandContext, type GridCommandContextInput, type GridCommandEvent, type GridCommandHost, type GridCommandSource, type GridCommandTarget, type GridContextMenuArea, type GridContextMenuEntries, type GridContextMenuOptions, type GridContextMenuRequest, type GridContextMenuTarget, type GridController, type GridControllerOptions, type GridFocus, type GridMessages, type GridOptions, type GridPanelKind, type GridState, type GridToolbarOptions, type GridToolbarTarget, type GridView, type GridViewInput, type GridViewOptions, type GridViewState, type GroupAggregateDisplay, type GroupByBarVisibility, type GroupByEntry, type GroupByEvent, type GroupByState, type GroupExpansionEvent, type GroupExpansionState, type GroupFilterEntry, HEADER_ROW, type HoverableConfig, KEYBOARD_STEP, type KeyShortcutCapabilities, type MenuEntry, type MenuItemEntry, type MenuMove, type MenuResolveOptions, type MenuSubmenuEntry, type NavigationModifiers, type OperatorFilterEntry, type PaginatedRows, type PaginationChangeEvent, type PaginationState, type PaginationWindowEntry, type PredicateFilterEntry, type ResizeMode, type ResolvedColumn, type ResolvedGroupRow, type ResolvedGroupSummaryRow, type ResolvedMenuEntry, type ResolvedMenuItem, type ResolvedMenuSeparator, type ResolvedMenuSubmenu, type ResolvedRow, type ResolvedToolbarButton, type ResolvedToolbarCustom, type ResolvedToolbarItem, type ResolvedToolbarMenu, type ResolvedToolbarSearch, type ResolvedToolbarSpacer, type RowHeights, type RowPointerEvent, type RowProps, type RowSelectEvent, type RowSelectionChangeEvent, type RowsSelectEvent, type SelectAllState, type SelectIntent, type SelectableConfig, type SelectedCell, type SelectedCellRef, type SelectedColumn, type SelectionCallbacks, type SelectionDiff, type SelectionDiffEvent, type SelectionMode, type SelectionState, type SerializedFilterEntry, type SerializedFilterScalar, type SerializedFilterState, type SerializedGridState, type SerializedGroupFilterEntry, type SerializedOperatorFilterEntry, type SerializedValueFilterEntry, type SortDirection, type TextFilterEntry, type ToolbarCustomEntry, type ToolbarEntry, type ToolbarFitInput, type ToolbarResolveOptions, type ToolbarSplit, type ValueFilterEntry, type VisibleRange, accessDotted, alignmentForType, applyColumnOrder, applyColumnResize, applyColumnVisibility, applySelectionIntent, beginColumnResize, buildKeyShortcuts, builtInCommands, clampColumnWidth, clampFocus, clearAllFilters, clearSelection, collapseAllGroups, columnValueOptions, compareValues, computeAggregates, contextMenuEntries, createCommandContext, createGridController, createGridViewResolver, defaultContextMenu, defaultMessages, defaultToolbar, defineColumnsFromRows, describeColumnFilter, diffSelection, draftToFilter, expandAllGroups, filterEditorReducer, filterQueryFor, filterRows, fitColumnsToWidth, fitToolbarItems, formatAggregateValue, formatCellValue, getColumnId, groupRowId, groupRows, hasContextMenu, initialFilterEditorDraft, intentOf, isColumnVisible, isPinnedToolbarItem, isSameCell, matchesQuery, moveColumnBefore, moveGroupByBefore, movesColumn, movesGroupBy, nextFocusForKey, nextMenuIndex, paginateRows, paginationWindow, resolveCell, resolveColumnChooser, resolveColumnConstraints, resolveColumnHeaderText, resolveColumnLabel, resolveColumnWidths, resolveColumns, resolveCommands, resolveDataColumns, resolveDropBefore, resolveGridView, resolveKeyboardDropTarget, resolveMenu, resolveMessages, resolveRowId, resolveRows, resolveShownRows, resolveToolbar, revertColumnSize, runCommand, searchTextOf, selectAll, selectAllState, selectCell, selectOnly, selectRange, serializeGridState, setColumnFilter, setColumnVisibility, setSearchText, sizeColumnToContent, sortDirectionFor, sortPriorityFor, sortRows, splitToolbarItems, toggleCellSelection, toggleColumnSort, toggleGroupExpansion, toggleSelection, toolbarEntries, totalColumnWidth, typeaheadIndex, visibleFilterOptions, visibleRange, withGroupAggregates };