@gridkitjs/core 0.15.0 → 0.17.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 +202 -70
- package/dist/index.js +599 -410
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -50,8 +50,10 @@ interface GridControllerOptions<Row, Node = string> extends GridOptions<Row>, Se
|
|
|
50
50
|
*
|
|
51
51
|
* Every action follows the same steps: work out the next value; stop if it
|
|
52
52
|
* is the very object the slice already holds; keep it, unless the slice is
|
|
53
|
-
* controlled; report it through the slice's callback; then
|
|
54
|
-
* subscriber, synchronously.
|
|
53
|
+
* controlled; report it through the slice's callback; then, if the state
|
|
54
|
+
* changed, call every subscriber, synchronously. A controlled slice's state
|
|
55
|
+
* changes only when the next `setOptions` carries the value, so an action on
|
|
56
|
+
* it reports without calling subscribers. The setters (`setColumnSort` and the like) also
|
|
55
57
|
* stop for a value equal to the current one, so restoring what is already
|
|
56
58
|
* there reports nothing.
|
|
57
59
|
*
|
|
@@ -76,8 +78,9 @@ interface GridController<Row, Node = string> {
|
|
|
76
78
|
/** What the user is looking at — see `resolveGridView`. The same object until something in it changes. */
|
|
77
79
|
readonly getView: () => GridView<Row, Node>;
|
|
78
80
|
/**
|
|
79
|
-
* Calls `listener` after each action that
|
|
80
|
-
*
|
|
81
|
+
* Calls `listener` after each action that changed the state, so
|
|
82
|
+
* `getState()` returns a new object whenever it runs. Returns the function
|
|
83
|
+
* that unsubscribes it.
|
|
81
84
|
*/
|
|
82
85
|
readonly subscribe: (listener: () => void) => () => void;
|
|
83
86
|
/**
|
|
@@ -85,9 +88,16 @@ interface GridController<Row, Node = string> {
|
|
|
85
88
|
* `serializeGridState` and back through JSON. Every slice given is set as
|
|
86
89
|
* its own `set*` action would set it, so each that changes fires its
|
|
87
90
|
* callback and a controlled one only asks; slices left out keep their value.
|
|
88
|
-
* Subscribers are called once, after every slice is in place,
|
|
91
|
+
* Subscribers are called once, after every slice is in place, if any
|
|
92
|
+
* changed, and a
|
|
89
93
|
* restored pagination is kept even when the same call changed the sort,
|
|
90
94
|
* filter or grouping that would otherwise send it back to the first page.
|
|
95
|
+
* A slice that throws stops the restore there, after the slices before it
|
|
96
|
+
* are shown, reported and announced as above.
|
|
97
|
+
*
|
|
98
|
+
* A `groupExpansion` saved as a bare list of group ids, as GridKit saved
|
|
99
|
+
* it before the slice carried a mode, restores as `allExpanded` with those
|
|
100
|
+
* ids as the exceptions.
|
|
91
101
|
*/
|
|
92
102
|
readonly restoreState: (saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>) => void;
|
|
93
103
|
/**
|
|
@@ -155,12 +165,18 @@ interface GridController<Row, Node = string> {
|
|
|
155
165
|
/**
|
|
156
166
|
* Applies one click or key press to a row: `"replace"`, `"toggle"` or
|
|
157
167
|
* `"range"` from the last row selected by anything but a range, across
|
|
158
|
-
* the data rows on the current page.
|
|
168
|
+
* the data rows on the current page. That anchor goes when the selection is
|
|
169
|
+
* cleared or replaced, or its row leaves the page; a range without one
|
|
170
|
+
* selects just this row and anchors there.
|
|
159
171
|
*/
|
|
160
172
|
readonly selectRow: (rowId: string, intent: SelectIntent) => void;
|
|
161
173
|
/** Selects every data row on the current page, when `selectable.rows` is `"multiple"`. */
|
|
162
174
|
readonly selectAllRows: () => void;
|
|
163
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Lets go of every row, column and cell selection at once, as Escape does:
|
|
177
|
+
* one change, so each selection that changes fires its callback and then
|
|
178
|
+
* subscribers are called once, if the state changed.
|
|
179
|
+
*/
|
|
164
180
|
readonly clearSelection: () => void;
|
|
165
181
|
/** Replaces the selected column ids as given — see `setRowSelection`. */
|
|
166
182
|
readonly setColumnSelection: (selection: SelectionState) => void;
|
|
@@ -208,13 +224,19 @@ interface GridController<Row, Node = string> {
|
|
|
208
224
|
*/
|
|
209
225
|
readonly moveGroupBy: (columnId: string, beforeColumnId: string | null) => void;
|
|
210
226
|
/**
|
|
211
|
-
* Replaces
|
|
212
|
-
* to every group at once; the same
|
|
227
|
+
* Replaces which groups are expanded. Reported with `groupId: null`, as a
|
|
228
|
+
* change to every group at once; the same mode with the same exceptions
|
|
229
|
+
* in the same order reports nothing.
|
|
213
230
|
*/
|
|
214
231
|
readonly setGroupExpansion: (expansion: GroupExpansionState) => void;
|
|
232
|
+
/** Expands a collapsed group or collapses an expanded one — see `toggleGroupExpansion`. */
|
|
215
233
|
readonly toggleGroupExpansion: (groupId: string) => void;
|
|
234
|
+
/** Expands every group, including those that appear later — see `expandAllGroups`. */
|
|
216
235
|
readonly expandAllGroups: () => void;
|
|
217
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* Collapses every group, including one under a collapsed ancestor and
|
|
238
|
+
* those that appear later — see `collapseAllGroups`.
|
|
239
|
+
*/
|
|
218
240
|
readonly collapseAllGroups: () => void;
|
|
219
241
|
/**
|
|
220
242
|
* Replaces the page and page size. A controlled pagination asks for them
|
|
@@ -568,7 +590,10 @@ interface GridMessages {
|
|
|
568
590
|
exportSelectionJson: string;
|
|
569
591
|
/** `exportSelection.xlsx` */
|
|
570
592
|
exportSelectionXlsx: string;
|
|
571
|
-
/**
|
|
593
|
+
/**
|
|
594
|
+
* Announced when an export's writer fails or the browser refuses its
|
|
595
|
+
* download, so no file is saved.
|
|
596
|
+
*/
|
|
572
597
|
exportFailed: string;
|
|
573
598
|
/** `copy.cell` */
|
|
574
599
|
copyCell: string;
|
|
@@ -582,6 +607,8 @@ interface GridMessages {
|
|
|
582
607
|
copyFailed: string;
|
|
583
608
|
/** `print` */
|
|
584
609
|
print: string;
|
|
610
|
+
/** Announced when the browser fails to print, so nothing is printed. */
|
|
611
|
+
printFailed: string;
|
|
585
612
|
}
|
|
586
613
|
/**
|
|
587
614
|
* The grid's own English, its counts printed in `locale`'s digits —
|
|
@@ -1119,8 +1146,19 @@ interface GridCommandHost {
|
|
|
1119
1146
|
* Saves an export as a file — in a browser, a download. A promise is the
|
|
1120
1147
|
* file of a writer still writing; the host waits for it, and reports a
|
|
1121
1148
|
* rejected one rather than saving.
|
|
1149
|
+
*
|
|
1150
|
+
* Returns `false` for a file it drops without saving, as a host that saves
|
|
1151
|
+
* one file at a time does with one asked for while it waits on the last.
|
|
1152
|
+
* The export command that asked then did not run.
|
|
1122
1153
|
*/
|
|
1123
|
-
readonly saveFile: (file: ExportFile | Promise<ExportFile>) => void;
|
|
1154
|
+
readonly saveFile: ((file: ExportFile | Promise<ExportFile>) => void) | ((file: ExportFile | Promise<ExportFile>) => boolean);
|
|
1155
|
+
/**
|
|
1156
|
+
* Whether `saveFile` would save a file asked for now. An export command
|
|
1157
|
+
* asks first, and while it is `false` builds no file and does not run, so
|
|
1158
|
+
* a writer is never run for a file the host would drop. Left out, every
|
|
1159
|
+
* file can be saved.
|
|
1160
|
+
*/
|
|
1161
|
+
readonly canSave?: (() => boolean) | undefined;
|
|
1124
1162
|
/**
|
|
1125
1163
|
* Puts a copy on the clipboard, as text and as HTML, and announces it —
|
|
1126
1164
|
* `count` and `unit` say what to announce — or that the browser refused.
|
|
@@ -1188,7 +1226,12 @@ interface GridCommand<Row> {
|
|
|
1188
1226
|
readonly isEnabled?: ((context: GridCommandContext<Row>) => boolean) | undefined;
|
|
1189
1227
|
/** Present for a checkable command — drawn as a checkbox item or a toggle button — and says whether it is checked. */
|
|
1190
1228
|
readonly isChecked?: ((context: GridCommandContext<Row>) => boolean) | undefined;
|
|
1191
|
-
|
|
1229
|
+
/**
|
|
1230
|
+
* Does what the command does. Returns `false` when it turns out to do
|
|
1231
|
+
* nothing after all, such as an export the host dropped, so `runCommand`
|
|
1232
|
+
* says it did not run and a renderer does not report it.
|
|
1233
|
+
*/
|
|
1234
|
+
readonly execute: ((context: GridCommandContext<Row>) => void) | ((context: GridCommandContext<Row>) => boolean);
|
|
1192
1235
|
}
|
|
1193
1236
|
|
|
1194
1237
|
/** The id of every command `builtInCommands` returns. */
|
|
@@ -1721,10 +1764,14 @@ interface GridOptions<Row> {
|
|
|
1721
1764
|
* or reordering a level.
|
|
1722
1765
|
*/
|
|
1723
1766
|
onGroupByChange?: ((event: GroupByEvent) => void) | undefined;
|
|
1724
|
-
/**
|
|
1767
|
+
/**
|
|
1768
|
+
* Which groups start expanded, as a mode with exceptions — `{ mode:
|
|
1769
|
+
* "allCollapsed", except: [] }` starts every group collapsed. Every group
|
|
1770
|
+
* starts expanded when it is left out. Uncontrolled.
|
|
1771
|
+
*/
|
|
1725
1772
|
defaultGroupExpansion?: GroupExpansionState | undefined;
|
|
1726
1773
|
/**
|
|
1727
|
-
*
|
|
1774
|
+
* Which groups are expanded, controlled — applied as given, changed only
|
|
1728
1775
|
* through `onGroupExpansionChange`. Leave it `undefined` for the grid to
|
|
1729
1776
|
* keep it itself, starting from `defaultGroupExpansion`.
|
|
1730
1777
|
*/
|
|
@@ -1883,8 +1930,11 @@ interface GridOptions<Row> {
|
|
|
1883
1930
|
contextMenu?: boolean | GridContextMenuOptions<Row> | undefined;
|
|
1884
1931
|
/**
|
|
1885
1932
|
* Called when the grid's context menu opens or closes, with where. A menu
|
|
1886
|
-
* opened in place of another reports that one closing first.
|
|
1887
|
-
*
|
|
1933
|
+
* opened in place of another reports that one closing first. It also
|
|
1934
|
+
* reports closing when a panel opens in its place (before the command of
|
|
1935
|
+
* a menu item that opened it runs), when the grid unmounts and when
|
|
1936
|
+
* `contextMenu` is turned off while it is open. The open state is the renderer's to keep, so no
|
|
1937
|
+
* option holds it.
|
|
1888
1938
|
*/
|
|
1889
1939
|
onContextMenuOpenChange?: ((event: ContextMenuOpenChangeEvent) => void) | undefined;
|
|
1890
1940
|
/**
|
|
@@ -2444,15 +2494,24 @@ interface GroupByEvent {
|
|
|
2444
2494
|
readonly groupBy: GroupByState;
|
|
2445
2495
|
}
|
|
2446
2496
|
/**
|
|
2447
|
-
*
|
|
2448
|
-
*
|
|
2449
|
-
*
|
|
2497
|
+
* Which groups are expanded, as a policy with exceptions: under
|
|
2498
|
+
* `allExpanded` every group is expanded but those whose `groupId` is in
|
|
2499
|
+
* `except`; under `allCollapsed` every group is collapsed but those. The
|
|
2500
|
+
* mode covers every group, including one hidden under a collapsed ancestor
|
|
2501
|
+
* and one that appears only after the state was set, so `except` holds just
|
|
2502
|
+
* the groups toggled against it.
|
|
2450
2503
|
*/
|
|
2451
|
-
type GroupExpansionState =
|
|
2504
|
+
type GroupExpansionState = {
|
|
2505
|
+
readonly mode: "allExpanded";
|
|
2506
|
+
readonly except: readonly string[];
|
|
2507
|
+
} | {
|
|
2508
|
+
readonly mode: "allCollapsed";
|
|
2509
|
+
readonly except: readonly string[];
|
|
2510
|
+
};
|
|
2452
2511
|
/**
|
|
2453
2512
|
* Reports a user expansion change. `groupId` is the group toggled, or `null`
|
|
2454
|
-
* for expandAllGroups/collapseAllGroups, which touch
|
|
2455
|
-
* rather than one at a time.
|
|
2513
|
+
* for expandAllGroups/collapseAllGroups and setGroupExpansion, which touch
|
|
2514
|
+
* every group in one call rather than one at a time.
|
|
2456
2515
|
*/
|
|
2457
2516
|
interface GroupExpansionEvent {
|
|
2458
2517
|
readonly groupId: string | null;
|
|
@@ -2468,7 +2527,7 @@ interface GroupExpansionEvent {
|
|
|
2468
2527
|
*/
|
|
2469
2528
|
interface ResolvedGroupRow {
|
|
2470
2529
|
readonly kind: "group";
|
|
2471
|
-
/** Stable id for this node: this plan's join of `path`, used as the React key and
|
|
2530
|
+
/** Stable id for this node: this plan's join of `path`, used as the React key and in GroupExpansionState's `except`. Opaque — build it with `groupRowId`, never construct one by hand. */
|
|
2472
2531
|
readonly groupId: string;
|
|
2473
2532
|
/** Nesting depth, 0 for a top-level group. */
|
|
2474
2533
|
readonly level: number;
|
|
@@ -2572,6 +2631,7 @@ interface FilterEntryBase<Row> {
|
|
|
2572
2631
|
}
|
|
2573
2632
|
/** Matches a column's stringified value against an SQL LIKE-style query. */
|
|
2574
2633
|
interface TextFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2634
|
+
readonly kind: "text";
|
|
2575
2635
|
/**
|
|
2576
2636
|
* A bare query is an exact match; `%text%` is contains; `text%` is
|
|
2577
2637
|
* starts-with; `%text` is ends-with. Always case-insensitive. Only the
|
|
@@ -2591,6 +2651,7 @@ interface TextFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
|
2591
2651
|
* `TextFilterEntry` is that it doesn't do that.
|
|
2592
2652
|
*/
|
|
2593
2653
|
interface ValueFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2654
|
+
readonly kind: "value";
|
|
2594
2655
|
readonly value: number | boolean | Date;
|
|
2595
2656
|
}
|
|
2596
2657
|
type FilterPredicate<Row> = (value: unknown, row: Row) => boolean;
|
|
@@ -2602,6 +2663,7 @@ type FilterPredicate<Row> = (value: unknown, row: Row) => boolean;
|
|
|
2602
2663
|
* the predicate is expected to read whatever it needs off `row` itself.
|
|
2603
2664
|
*/
|
|
2604
2665
|
interface PredicateFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2666
|
+
readonly kind: "predicate";
|
|
2605
2667
|
readonly predicate: FilterPredicate<Row>;
|
|
2606
2668
|
}
|
|
2607
2669
|
/**
|
|
@@ -2612,6 +2674,7 @@ interface PredicateFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
|
2612
2674
|
* to the entries it composes.
|
|
2613
2675
|
*/
|
|
2614
2676
|
interface GroupFilterEntry<Row> {
|
|
2677
|
+
readonly kind: "group";
|
|
2615
2678
|
readonly combinator: "and" | "or";
|
|
2616
2679
|
readonly entries: FilterState<Row>;
|
|
2617
2680
|
}
|
|
@@ -2648,10 +2711,12 @@ type FilterScalar = string | number | boolean | Date | null;
|
|
|
2648
2711
|
* `ValueFilterEntry` of the wrong type doesn't.
|
|
2649
2712
|
*/
|
|
2650
2713
|
interface OperatorFilterEntry<Row> {
|
|
2714
|
+
readonly kind: "operator";
|
|
2651
2715
|
readonly columnId: FieldPath<Row> | (string & {});
|
|
2652
2716
|
readonly operator: FilterOperator;
|
|
2653
2717
|
readonly value?: FilterScalar | readonly FilterScalar[];
|
|
2654
2718
|
}
|
|
2719
|
+
/** One condition of a `FilterState`, its `kind` naming which of the five. */
|
|
2655
2720
|
type FilterEntry<Row> = TextFilterEntry<Row> | ValueFilterEntry<Row> | PredicateFilterEntry<Row> | OperatorFilterEntry<Row> | GroupFilterEntry<Row>;
|
|
2656
2721
|
/**
|
|
2657
2722
|
* The active filter, every entry ANDed together at the top level — nest a
|
|
@@ -2664,6 +2729,7 @@ type FilterState<Row> = readonly FilterEntry<Row>[];
|
|
|
2664
2729
|
* string, which restoring turns back into a `Date`.
|
|
2665
2730
|
*/
|
|
2666
2731
|
interface SerializedValueFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2732
|
+
readonly kind: "value";
|
|
2667
2733
|
readonly value: number | boolean | string;
|
|
2668
2734
|
}
|
|
2669
2735
|
/** A `FilterScalar` as JSON holds it: a `Date` becomes its ISO string. */
|
|
@@ -2674,12 +2740,14 @@ type SerializedFilterScalar = string | number | boolean | null;
|
|
|
2674
2740
|
* date, date-time or time column.
|
|
2675
2741
|
*/
|
|
2676
2742
|
interface SerializedOperatorFilterEntry<Row> {
|
|
2743
|
+
readonly kind: "operator";
|
|
2677
2744
|
readonly columnId: FieldPath<Row> | (string & {});
|
|
2678
2745
|
readonly operator: FilterOperator;
|
|
2679
2746
|
readonly value?: SerializedFilterScalar | readonly SerializedFilterScalar[];
|
|
2680
2747
|
}
|
|
2681
2748
|
/** A `GroupFilterEntry` whose entries are serialised too. */
|
|
2682
2749
|
interface SerializedGroupFilterEntry<Row> {
|
|
2750
|
+
readonly kind: "group";
|
|
2683
2751
|
readonly combinator: "and" | "or";
|
|
2684
2752
|
readonly entries: SerializedFilterState<Row>;
|
|
2685
2753
|
}
|
|
@@ -2998,7 +3066,7 @@ declare function resolveCommands<Row>(commands: readonly GridCommand<Row>[] | un
|
|
|
2998
3066
|
* Runs `command` when it is visible and enabled on `context`'s target, and
|
|
2999
3067
|
* says whether it did — so a renderer reports only a command that ran, and a
|
|
3000
3068
|
* stale button or a call through the API cannot run one the grid's state no
|
|
3001
|
-
* longer allows.
|
|
3069
|
+
* longer allows. A command whose `execute` returns `false` did not run.
|
|
3002
3070
|
*/
|
|
3003
3071
|
declare function runCommand<Row>(command: GridCommand<Row>, context: GridCommandContext<Row>): boolean;
|
|
3004
3072
|
|
|
@@ -3227,16 +3295,17 @@ declare function buildKeyShortcuts(capabilities: KeyShortcutCapabilities): strin
|
|
|
3227
3295
|
declare function accessDotted(obj: unknown, path: string): unknown;
|
|
3228
3296
|
|
|
3229
3297
|
/**
|
|
3230
|
-
* The
|
|
3231
|
-
*
|
|
3232
|
-
* of its own, and every other move is plain arithmetic.
|
|
3298
|
+
* The cell the grid's single tab stop sits on: a header cell, or a cell of
|
|
3299
|
+
* body row `rowIndex`. A body focus's `rowIndex` counts from `0`.
|
|
3233
3300
|
*/
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3301
|
+
type GridFocus = {
|
|
3302
|
+
readonly area: "header";
|
|
3303
|
+
readonly columnIndex: number;
|
|
3304
|
+
} | {
|
|
3305
|
+
readonly area: "body";
|
|
3237
3306
|
readonly rowIndex: number;
|
|
3238
3307
|
readonly columnIndex: number;
|
|
3239
|
-
}
|
|
3308
|
+
};
|
|
3240
3309
|
/** The modifier keys held with a navigation key press. */
|
|
3241
3310
|
interface NavigationModifiers {
|
|
3242
3311
|
readonly ctrlKey: boolean;
|
|
@@ -3244,10 +3313,16 @@ interface NavigationModifiers {
|
|
|
3244
3313
|
readonly altKey: boolean;
|
|
3245
3314
|
readonly shiftKey: boolean;
|
|
3246
3315
|
}
|
|
3316
|
+
/** The header's cell at `columnIndex`. */
|
|
3317
|
+
declare function headerFocus(columnIndex: number): GridFocus;
|
|
3318
|
+
/** Body row `rowIndex`'s cell at `columnIndex`. */
|
|
3319
|
+
declare function bodyFocus(rowIndex: number, columnIndex: number): GridFocus;
|
|
3247
3320
|
/**
|
|
3248
3321
|
* Holds a coordinate inside the grid, so that a focus surviving a column
|
|
3249
3322
|
* removal or a shorter page never leaves the grid with no tab stop at all —
|
|
3250
|
-
* which is a grid a keyboard cannot reach.
|
|
3323
|
+
* which is a grid a keyboard cannot reach. A body focus below the last row
|
|
3324
|
+
* moves up to it; one above the first row, or in a grid with no rows, moves
|
|
3325
|
+
* to the header.
|
|
3251
3326
|
*/
|
|
3252
3327
|
declare function clampFocus(focus: GridFocus, rowCount: number, columnCount: number): GridFocus;
|
|
3253
3328
|
/**
|
|
@@ -3581,9 +3656,9 @@ declare function groupRowId(path: readonly unknown[]): string;
|
|
|
3581
3656
|
* `rows`, regrouped into `groupBy`'s stacked levels — a group header per
|
|
3582
3657
|
* distinct value at each level, ordered by `compareValues` per that level's
|
|
3583
3658
|
* own `direction`, followed depth-first by its nested groups and/or data
|
|
3584
|
-
* rows. A
|
|
3585
|
-
*
|
|
3586
|
-
*
|
|
3659
|
+
* rows. A group `expansion` collapses contributes only its own header,
|
|
3660
|
+
* nothing beneath it — but its `count` still reports the group's full
|
|
3661
|
+
* leaf-row count either way.
|
|
3587
3662
|
*
|
|
3588
3663
|
* Filter and sort are expected to have already run (see `resolveShownRows`):
|
|
3589
3664
|
* this only reshapes their output, and never changes which rows appear or
|
|
@@ -3600,25 +3675,28 @@ declare function groupRowId(path: readonly unknown[]): string;
|
|
|
3600
3675
|
* removed from the definition the same way a stored `ColumnSortState` does.
|
|
3601
3676
|
*/
|
|
3602
3677
|
declare function groupRows<Row>(rows: readonly ResolvedRow<Row>[], groupBy: GroupByState, expansion: GroupExpansionState, columns: readonly DataColumn<Row, unknown>[]): readonly DisplayRow<Row>[];
|
|
3678
|
+
/** Every group expanded, with no exceptions: where an uncontrolled grid starts. */
|
|
3679
|
+
declare const ALL_EXPANDED: GroupExpansionState;
|
|
3680
|
+
/** Every group collapsed, with no exceptions. */
|
|
3681
|
+
declare const ALL_COLLAPSED: GroupExpansionState;
|
|
3682
|
+
/** Whether `expansion` shows the group `groupId` names expanded. */
|
|
3683
|
+
declare function isGroupExpanded(expansion: GroupExpansionState, groupId: string): boolean;
|
|
3603
3684
|
/**
|
|
3604
3685
|
* The expansion with `groupId` collapsed if it was expanded, or expanded if
|
|
3605
|
-
* it was collapsed.
|
|
3686
|
+
* it was collapsed: it joins `except`, or leaves it, whatever the mode.
|
|
3606
3687
|
*/
|
|
3607
3688
|
declare function toggleGroupExpansion(expansion: GroupExpansionState, groupId: string): GroupExpansionState;
|
|
3608
|
-
/**
|
|
3689
|
+
/**
|
|
3690
|
+
* Every group expanded, now and as groups appear. Returns `expansion` itself
|
|
3691
|
+
* when it already says so, so expanding twice is no change.
|
|
3692
|
+
*/
|
|
3609
3693
|
declare function expandAllGroups(expansion: GroupExpansionState): GroupExpansionState;
|
|
3610
3694
|
/**
|
|
3611
|
-
* Every group
|
|
3612
|
-
*
|
|
3613
|
-
*
|
|
3614
|
-
* absent from `rows`) keeps whatever expansion it already had rather than
|
|
3615
|
-
* being forced closed too; expanding that ancestor again reveals it exactly
|
|
3616
|
-
* as it was left.
|
|
3617
|
-
*
|
|
3618
|
-
* Group headers only: a summary row (`groupAggregateDisplay: "row"`) carries
|
|
3619
|
-
* its group's id too, and counting it would list that group twice.
|
|
3695
|
+
* Every group collapsed, now and as groups appear: one hidden under a
|
|
3696
|
+
* collapsed ancestor too, so expanding that ancestor shows its children
|
|
3697
|
+
* collapsed. Returns `expansion` itself when it already says so.
|
|
3620
3698
|
*/
|
|
3621
|
-
declare function collapseAllGroups
|
|
3699
|
+
declare function collapseAllGroups(expansion: GroupExpansionState): GroupExpansionState;
|
|
3622
3700
|
/**
|
|
3623
3701
|
* `groupBy` with `columnId` positioned in front of `beforeColumnId` — or at
|
|
3624
3702
|
* the end when that is `null` — inserting a fresh entry if `columnId` isn't
|
|
@@ -3836,28 +3914,42 @@ interface ColumnValueOptions {
|
|
|
3836
3914
|
*/
|
|
3837
3915
|
readonly columnType?: ColumnType | undefined;
|
|
3838
3916
|
}
|
|
3839
|
-
/**
|
|
3840
|
-
|
|
3841
|
-
* changed by `filterEditorReducer` and turned into a filter by
|
|
3842
|
-
* `draftToFilter` only when the user applies it — so cancelling is just
|
|
3843
|
-
* dropping the draft.
|
|
3844
|
-
*/
|
|
3845
|
-
interface FilterEditorDraft<Row> {
|
|
3846
|
-
/** Which half of the draft `draftToFilter` applies: the last one changed. */
|
|
3847
|
-
readonly mode: "values" | "conditions";
|
|
3917
|
+
/** What a `FilterEditorDraft` holds on either arm. */
|
|
3918
|
+
interface FilterEditorDraftBase<Row> {
|
|
3848
3919
|
/** Every value the editor offers, from `columnValueOptions`. */
|
|
3849
3920
|
readonly options: readonly ColumnValueOption[];
|
|
3850
3921
|
/** How many rows hold a blank; the blanks entry only matters when some do. */
|
|
3851
3922
|
readonly blanks: number;
|
|
3852
3923
|
readonly search: string;
|
|
3924
|
+
/**
|
|
3925
|
+
* The column's filter as the editor opened on it. An action for the other
|
|
3926
|
+
* arm builds that arm from it, as reopening the editor would show it.
|
|
3927
|
+
*/
|
|
3928
|
+
readonly openedShape: ColumnFilterShape<Row>;
|
|
3929
|
+
/** The column's `type`, from `ColumnValueOptions` — what values are keyed by. */
|
|
3930
|
+
readonly columnType?: ColumnType | undefined;
|
|
3931
|
+
}
|
|
3932
|
+
/** A draft on its checklist: the values `draftToFilter` writes as an `in` entry. */
|
|
3933
|
+
interface ValuesDraft<Row> extends FilterEditorDraftBase<Row> {
|
|
3934
|
+
readonly kind: "values";
|
|
3853
3935
|
/** The checked values, keyed as an `in` filter on the column keys them. */
|
|
3854
3936
|
readonly checked: ReadonlyMap<string, FilterScalar>;
|
|
3855
3937
|
readonly includeBlanks: boolean;
|
|
3938
|
+
}
|
|
3939
|
+
/** A draft on its conditions: the operator entries `draftToFilter` writes. */
|
|
3940
|
+
interface ConditionsDraft<Row> extends FilterEditorDraftBase<Row> {
|
|
3941
|
+
readonly kind: "conditions";
|
|
3856
3942
|
readonly conditions: readonly OperatorFilterEntry<Row>[];
|
|
3857
3943
|
readonly combinator: "and" | "or";
|
|
3858
|
-
/** The column's `type`, from `ColumnValueOptions` — what values are keyed by. */
|
|
3859
|
-
readonly columnType?: ColumnType | undefined;
|
|
3860
3944
|
}
|
|
3945
|
+
/**
|
|
3946
|
+
* A checklist or condition editor's working copy of one column's filter,
|
|
3947
|
+
* changed by `filterEditorReducer` and turned into a filter by
|
|
3948
|
+
* `draftToFilter` only when the user applies it — so cancelling is just
|
|
3949
|
+
* dropping the draft. It is on one arm at a time, the one `draftToFilter`
|
|
3950
|
+
* applies: the last one changed.
|
|
3951
|
+
*/
|
|
3952
|
+
type FilterEditorDraft<Row> = ValuesDraft<Row> | ConditionsDraft<Row>;
|
|
3861
3953
|
type FilterEditorAction<Row> = {
|
|
3862
3954
|
readonly type: "search";
|
|
3863
3955
|
readonly search: string;
|
|
@@ -3874,10 +3966,16 @@ type FilterEditorAction<Row> = {
|
|
|
3874
3966
|
} | {
|
|
3875
3967
|
readonly type: "setConditions";
|
|
3876
3968
|
readonly conditions: readonly OperatorFilterEntry<Row>[];
|
|
3877
|
-
/**
|
|
3969
|
+
/**
|
|
3970
|
+
* Keeps the draft's own when omitted; a checklist draft's is the opened
|
|
3971
|
+
* filter's, or `"and"`.
|
|
3972
|
+
*/
|
|
3878
3973
|
readonly combinator?: "and" | "or";
|
|
3879
3974
|
}
|
|
3880
|
-
/**
|
|
3975
|
+
/**
|
|
3976
|
+
* Back to "no filter" on the draft's own arm — every value checked, or no
|
|
3977
|
+
* conditions — and no search.
|
|
3978
|
+
*/
|
|
3881
3979
|
| {
|
|
3882
3980
|
readonly type: "clear";
|
|
3883
3981
|
};
|
|
@@ -3915,11 +4013,24 @@ declare function isColumnFiltered<Row>(filter: FilterState<Row>, columnId: strin
|
|
|
3915
4013
|
declare function columnValueOptions<Row>(rows: readonly Row[], dataColumns: readonly DataColumn<Row, unknown>[], filter: FilterState<Row>, columnId: string, query?: ColumnValueQuery): ColumnValueOptions;
|
|
3916
4014
|
/**
|
|
3917
4015
|
* A draft showing `shape` over `values` — what an editor opens with. A
|
|
3918
|
-
* column
|
|
3919
|
-
*
|
|
3920
|
-
*
|
|
4016
|
+
* column filtered by conditions opens on them as they are. Anything else
|
|
4017
|
+
* opens on the checklist: with no filter, or one only a custom editor could
|
|
4018
|
+
* show, every value checked; a checklist with its own values checked, kept
|
|
4019
|
+
* even when the other filters now hide them.
|
|
3921
4020
|
*/
|
|
3922
4021
|
declare function initialFilterEditorDraft<Row>(shape: ColumnFilterShape<Row>, values: ColumnValueOptions): FilterEditorDraft<Row>;
|
|
4022
|
+
/**
|
|
4023
|
+
* `draft` on its checklist: itself when it is there, otherwise the checklist
|
|
4024
|
+
* the filter it opened on shows, its conditions dropped. What a value action
|
|
4025
|
+
* starts from, and what a checklist draws over a draft on its conditions.
|
|
4026
|
+
*/
|
|
4027
|
+
declare function toValuesDraft<Row>(draft: FilterEditorDraft<Row>): ValuesDraft<Row>;
|
|
4028
|
+
/**
|
|
4029
|
+
* `draft` on its conditions: itself when it is there, otherwise the
|
|
4030
|
+
* conditions the filter it opened on holds (none unless it was conditions),
|
|
4031
|
+
* its checklist dropped. What `setConditions` starts from.
|
|
4032
|
+
*/
|
|
4033
|
+
declare function toConditionsDraft<Row>(draft: FilterEditorDraft<Row>): ConditionsDraft<Row>;
|
|
3923
4034
|
/** The options the draft's search shows — those a select-all acts on. */
|
|
3924
4035
|
declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): readonly ColumnValueOption[];
|
|
3925
4036
|
/**
|
|
@@ -3927,12 +4038,14 @@ declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): reado
|
|
|
3927
4038
|
* checked, none is, or some are — blanks included while nothing is
|
|
3928
4039
|
* searched.
|
|
3929
4040
|
*/
|
|
3930
|
-
declare function selectAllState<Row>(draft:
|
|
4041
|
+
declare function selectAllState<Row>(draft: ValuesDraft<Row>): SelectAllState;
|
|
3931
4042
|
/**
|
|
3932
4043
|
* The next draft after `action` — a plain reducer, so a renderer can hold
|
|
3933
4044
|
* the draft in whatever state it has (`useReducer`, a signal, a store).
|
|
3934
|
-
* Changing a value or the blanks
|
|
3935
|
-
*
|
|
4045
|
+
* Changing a value or the blanks puts the draft on its checklist; setting
|
|
4046
|
+
* conditions puts it on its conditions. An action for the arm the draft
|
|
4047
|
+
* is not on starts that arm as the filter the editor opened on shows it
|
|
4048
|
+
* (`toValuesDraft`, `toConditionsDraft`), dropping what the other arm held.
|
|
3936
4049
|
*/
|
|
3937
4050
|
declare function filterEditorReducer<Row>(draft: FilterEditorDraft<Row>, action: FilterEditorAction<Row>): FilterEditorDraft<Row>;
|
|
3938
4051
|
/**
|
|
@@ -3947,6 +4060,25 @@ declare function filterEditorReducer<Row>(draft: FilterEditorDraft<Row>, action:
|
|
|
3947
4060
|
* draft's combinator. Returns `current` itself when nothing changes.
|
|
3948
4061
|
*/
|
|
3949
4062
|
declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: string, current: FilterState<Row>): FilterState<Row>;
|
|
4063
|
+
/**
|
|
4064
|
+
* Whether `draft` changes anything since the editor opened at `opened` — for
|
|
4065
|
+
* an Apply that changes nothing to leave the column's filter as it is,
|
|
4066
|
+
* rather than writing the draft over it. Compared by value, not identity, so
|
|
4067
|
+
* a value unchecked and checked again, or the same conditions typed again,
|
|
4068
|
+
* is no change; the search never is one.
|
|
4069
|
+
*
|
|
4070
|
+
* Only the arm `draft` is on counts. A checklist changes when its checked
|
|
4071
|
+
* values or blanks differ from those `opened` shows (`toValuesDraft`), so
|
|
4072
|
+
* one left as it opened over conditions or a custom filter leaves that
|
|
4073
|
+
* filter be. Conditions change when they differ from those `opened` holds,
|
|
4074
|
+
* and always when `opened` is on its checklist (it opened on a checklist,
|
|
4075
|
+
* no filter or a custom one): setting conditions there replaces it, none
|
|
4076
|
+
* removing it.
|
|
4077
|
+
*
|
|
4078
|
+
* `clear` over a custom filter leaves a draft equal to the one it opened
|
|
4079
|
+
* with, so this reads it as no change.
|
|
4080
|
+
*/
|
|
4081
|
+
declare function filterDraftChanged<Row>(opened: FilterEditorDraft<Row>, draft: FilterEditorDraft<Row>): boolean;
|
|
3950
4082
|
|
|
3951
4083
|
/** What a column chooser is drawn from: every column, the visibility, and the search typed. */
|
|
3952
4084
|
interface ColumnChooserInput<Row> {
|
|
@@ -4169,7 +4301,7 @@ interface FilterChecklist {
|
|
|
4169
4301
|
/**
|
|
4170
4302
|
* The list a checklist editor draws for `draft`: the window of values its
|
|
4171
4303
|
* search shows, as items carrying what each row says and whether it is
|
|
4172
|
-
* checked.
|
|
4304
|
+
* checked. A draft on its conditions draws through `toValuesDraft`.
|
|
4173
4305
|
*
|
|
4174
4306
|
* A column can hold far more values than a list is worth scrolling, so the
|
|
4175
4307
|
* list shows at most `valueLimit` of them. Past that, it shows nothing until
|
|
@@ -4182,7 +4314,7 @@ interface FilterChecklist {
|
|
|
4182
4314
|
* searched: exactly when select-all counts the blanks, so the checkbox acts
|
|
4183
4315
|
* on what the list shows.
|
|
4184
4316
|
*/
|
|
4185
|
-
declare function filterChecklist<Row>(draft:
|
|
4317
|
+
declare function filterChecklist<Row>(draft: ValuesDraft<Row>, { valueLimit, blanksLabel }: FilterChecklistOptions): FilterChecklist;
|
|
4186
4318
|
|
|
4187
4319
|
/**
|
|
4188
4320
|
* One entry per row: its measured height once known, `undefined` until then.
|
|
@@ -4291,4 +4423,4 @@ declare const excelFilter: {
|
|
|
4291
4423
|
};
|
|
4292
4424
|
};
|
|
4293
4425
|
|
|
4294
|
-
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 ColumnFilterMenuOptions, 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 ColumnValueCacheQuery, type ColumnValueOption, type ColumnValueOptions, type ColumnValueOptionsCache, type ColumnValueQuery, type ColumnVisibilityEvent, type ColumnVisibilityState, type ColumnWrapConfig, type ColumnsSelectEvent, type ConditionRowDraft, type ContextMenuOpenChangeEvent, type CopyContent, type CopyRequest, type CopySource, type CsvOptions, DEFAULT_COLUMN_SIZES, DEFAULT_FILTER_VALUE_LIMIT, type DataColumn, type DisplayRow, type DropSide, type ExportCell, type ExportColumn, type ExportDataRow, type ExportFile, type ExportFileSource, type ExportGroupRow, type ExportGroupSummaryRow, type ExportOptions, type ExportRow, type ExportScalar, type ExportSource, type ExportTable, type ExportTotalRow, type ExportWriteContext, type ExportWriter, type FieldPath, type FilterChangeEvent, type FilterChecklist, type FilterChecklistItem, type FilterChecklistOptions, type FilterEditorAction, type FilterEditorDraft, type FilterEntry, type FilterMenuUi, type FilterOperator, type FilterOperatorFamily, 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 GridExportOptions, type GridFilterMenuOptions, 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,
|
|
4426
|
+
export { ALL_COLLAPSED, ALL_EXPANDED, 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 ColumnFilterMenuOptions, 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 ColumnValueCacheQuery, type ColumnValueOption, type ColumnValueOptions, type ColumnValueOptionsCache, type ColumnValueQuery, type ColumnVisibilityEvent, type ColumnVisibilityState, type ColumnWrapConfig, type ColumnsSelectEvent, type ConditionRowDraft, type ConditionsDraft, type ContextMenuOpenChangeEvent, type CopyContent, type CopyRequest, type CopySource, type CsvOptions, DEFAULT_COLUMN_SIZES, DEFAULT_FILTER_VALUE_LIMIT, type DataColumn, type DisplayRow, type DropSide, type ExportCell, type ExportColumn, type ExportDataRow, type ExportFile, type ExportFileSource, type ExportGroupRow, type ExportGroupSummaryRow, type ExportOptions, type ExportRow, type ExportScalar, type ExportSource, type ExportTable, type ExportTotalRow, type ExportWriteContext, type ExportWriter, type FieldPath, type FilterChangeEvent, type FilterChecklist, type FilterChecklistItem, type FilterChecklistOptions, type FilterEditorAction, type FilterEditorDraft, type FilterEditorDraftBase, type FilterEntry, type FilterMenuUi, type FilterOperator, type FilterOperatorFamily, 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 GridExportOptions, type GridFilterMenuOptions, 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, type HoverableConfig, type HtmlTableOptions, type JsonOptions, KEYBOARD_STEP, type KeyShortcutCapabilities, type MenuEntry, type MenuItemEntry, type MenuMove, type MenuResolveOptions, type MenuSubmenuEntry, type NavigationModifiers, type OperatorFilterEntry, type PaginateRowsOptions, type PaginatedRows, type PaginationChangeEvent, type PaginationState, type PaginationUnit, type PaginationWindowEntry, type ParsedConditionRows, type PredicateFilterEntry, type PrintDocument, type PrintOptions, type PrintOrientation, type PrintPage, type PrintSource, type ResizeMode, type ResolvedColumn, type ResolvedColumnFilterMenu, 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 ToolbarItemAttributes, type ToolbarResolveOptions, type ToolbarSplit, type TsvOptions, type ValueFilterEntry, type ValuesDraft, type VisibleRange, accessDotted, alignmentForType, applyColumnOrder, applyColumnResize, applyColumnVisibility, applySelectionIntent, beginColumnResize, bodyFocus, buildExportTable, buildKeyShortcuts, buildPrintDocument, builtInCommands, clampColumnWidth, clampFocus, clearAllFilters, clearSelection, collapseAllGroups, columnValueOptions, compareValues, computeAggregates, conditionRowsFrom, conditionsFromRows, contextMenuEntries, copyContent, createColumnValueOptionsCache, createCommandContext, createDefaultMessages, createGridController, createGridViewResolver, csvWriter, defaultContextMenu, defaultFilterOperators, defaultMessages, defaultToolbar, defineColumnsFromRows, describeColumnFilter, diffSelection, draftToFilter, excelFilter, expandAllGroups, exportFile, exportPrintDocument, filterChecklist, filterDraftChanged, filterEditorReducer, filterOperandArity, filterOperatorFamily, filterQueryFor, filterRows, fitColumnsToWidth, fitToolbarItems, formatAggregateValue, formatCellValue, formatFilterOperand, formatGroupValue, getColumnId, groupRowId, groupRows, hasContextMenu, headerFocus, initialFilterEditorDraft, intentOf, isColumnFiltered, isColumnVisible, isGroupExpanded, isPinnedToolbarItem, isSameCell, jsonWriter, matchesQuery, moveColumnBefore, moveGroupByBefore, movesColumn, movesGroupBy, nextFocusForKey, nextMenuIndex, paginateRows, paginationWindow, parseFilterOperand, resolveCell, resolveColumnChooser, resolveColumnConstraints, resolveColumnFilterMenu, resolveColumnHeaderText, resolveColumnLabel, resolveColumnWidths, resolveColumns, resolveCommands, resolveDataColumns, resolveDropBefore, resolveExportWriters, 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, toConditionsDraft, toCsv, toHtmlTable, toJson, toTsv, toValuesDraft, toggleCellSelection, toggleColumnSort, toggleGroupExpansion, toggleSelection, toolbarEntries, totalColumnWidth, typeaheadIndex, visibleFilterOptions, visibleRange, withGroupAggregates };
|