@gridkitjs/core 0.16.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 +163 -71
- package/dist/index.js +491 -366
- 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,11 +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.
|
|
91
95
|
* A slice that throws stops the restore there, after the slices before it
|
|
92
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.
|
|
93
101
|
*/
|
|
94
102
|
readonly restoreState: (saved: Partial<GridState<Row>> | Partial<SerializedGridState<Row>>) => void;
|
|
95
103
|
/**
|
|
@@ -167,7 +175,7 @@ interface GridController<Row, Node = string> {
|
|
|
167
175
|
/**
|
|
168
176
|
* Lets go of every row, column and cell selection at once, as Escape does:
|
|
169
177
|
* one change, so each selection that changes fires its callback and then
|
|
170
|
-
* subscribers are called once.
|
|
178
|
+
* subscribers are called once, if the state changed.
|
|
171
179
|
*/
|
|
172
180
|
readonly clearSelection: () => void;
|
|
173
181
|
/** Replaces the selected column ids as given — see `setRowSelection`. */
|
|
@@ -216,13 +224,19 @@ interface GridController<Row, Node = string> {
|
|
|
216
224
|
*/
|
|
217
225
|
readonly moveGroupBy: (columnId: string, beforeColumnId: string | null) => void;
|
|
218
226
|
/**
|
|
219
|
-
* Replaces
|
|
220
|
-
* 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.
|
|
221
230
|
*/
|
|
222
231
|
readonly setGroupExpansion: (expansion: GroupExpansionState) => void;
|
|
232
|
+
/** Expands a collapsed group or collapses an expanded one — see `toggleGroupExpansion`. */
|
|
223
233
|
readonly toggleGroupExpansion: (groupId: string) => void;
|
|
234
|
+
/** Expands every group, including those that appear later — see `expandAllGroups`. */
|
|
224
235
|
readonly expandAllGroups: () => void;
|
|
225
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* Collapses every group, including one under a collapsed ancestor and
|
|
238
|
+
* those that appear later — see `collapseAllGroups`.
|
|
239
|
+
*/
|
|
226
240
|
readonly collapseAllGroups: () => void;
|
|
227
241
|
/**
|
|
228
242
|
* Replaces the page and page size. A controlled pagination asks for them
|
|
@@ -1138,6 +1152,13 @@ interface GridCommandHost {
|
|
|
1138
1152
|
* The export command that asked then did not run.
|
|
1139
1153
|
*/
|
|
1140
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;
|
|
1141
1162
|
/**
|
|
1142
1163
|
* Puts a copy on the clipboard, as text and as HTML, and announces it —
|
|
1143
1164
|
* `count` and `unit` say what to announce — or that the browser refused.
|
|
@@ -1743,10 +1764,14 @@ interface GridOptions<Row> {
|
|
|
1743
1764
|
* or reordering a level.
|
|
1744
1765
|
*/
|
|
1745
1766
|
onGroupByChange?: ((event: GroupByEvent) => void) | undefined;
|
|
1746
|
-
/**
|
|
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
|
+
*/
|
|
1747
1772
|
defaultGroupExpansion?: GroupExpansionState | undefined;
|
|
1748
1773
|
/**
|
|
1749
|
-
*
|
|
1774
|
+
* Which groups are expanded, controlled — applied as given, changed only
|
|
1750
1775
|
* through `onGroupExpansionChange`. Leave it `undefined` for the grid to
|
|
1751
1776
|
* keep it itself, starting from `defaultGroupExpansion`.
|
|
1752
1777
|
*/
|
|
@@ -1905,8 +1930,11 @@ interface GridOptions<Row> {
|
|
|
1905
1930
|
contextMenu?: boolean | GridContextMenuOptions<Row> | undefined;
|
|
1906
1931
|
/**
|
|
1907
1932
|
* Called when the grid's context menu opens or closes, with where. A menu
|
|
1908
|
-
* opened in place of another reports that one closing first.
|
|
1909
|
-
*
|
|
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.
|
|
1910
1938
|
*/
|
|
1911
1939
|
onContextMenuOpenChange?: ((event: ContextMenuOpenChangeEvent) => void) | undefined;
|
|
1912
1940
|
/**
|
|
@@ -2466,15 +2494,24 @@ interface GroupByEvent {
|
|
|
2466
2494
|
readonly groupBy: GroupByState;
|
|
2467
2495
|
}
|
|
2468
2496
|
/**
|
|
2469
|
-
*
|
|
2470
|
-
*
|
|
2471
|
-
*
|
|
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.
|
|
2472
2503
|
*/
|
|
2473
|
-
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
|
+
};
|
|
2474
2511
|
/**
|
|
2475
2512
|
* Reports a user expansion change. `groupId` is the group toggled, or `null`
|
|
2476
|
-
* for expandAllGroups/collapseAllGroups, which touch
|
|
2477
|
-
* 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.
|
|
2478
2515
|
*/
|
|
2479
2516
|
interface GroupExpansionEvent {
|
|
2480
2517
|
readonly groupId: string | null;
|
|
@@ -2490,7 +2527,7 @@ interface GroupExpansionEvent {
|
|
|
2490
2527
|
*/
|
|
2491
2528
|
interface ResolvedGroupRow {
|
|
2492
2529
|
readonly kind: "group";
|
|
2493
|
-
/** 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. */
|
|
2494
2531
|
readonly groupId: string;
|
|
2495
2532
|
/** Nesting depth, 0 for a top-level group. */
|
|
2496
2533
|
readonly level: number;
|
|
@@ -2594,6 +2631,7 @@ interface FilterEntryBase<Row> {
|
|
|
2594
2631
|
}
|
|
2595
2632
|
/** Matches a column's stringified value against an SQL LIKE-style query. */
|
|
2596
2633
|
interface TextFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2634
|
+
readonly kind: "text";
|
|
2597
2635
|
/**
|
|
2598
2636
|
* A bare query is an exact match; `%text%` is contains; `text%` is
|
|
2599
2637
|
* starts-with; `%text` is ends-with. Always case-insensitive. Only the
|
|
@@ -2613,6 +2651,7 @@ interface TextFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
|
2613
2651
|
* `TextFilterEntry` is that it doesn't do that.
|
|
2614
2652
|
*/
|
|
2615
2653
|
interface ValueFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2654
|
+
readonly kind: "value";
|
|
2616
2655
|
readonly value: number | boolean | Date;
|
|
2617
2656
|
}
|
|
2618
2657
|
type FilterPredicate<Row> = (value: unknown, row: Row) => boolean;
|
|
@@ -2624,6 +2663,7 @@ type FilterPredicate<Row> = (value: unknown, row: Row) => boolean;
|
|
|
2624
2663
|
* the predicate is expected to read whatever it needs off `row` itself.
|
|
2625
2664
|
*/
|
|
2626
2665
|
interface PredicateFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2666
|
+
readonly kind: "predicate";
|
|
2627
2667
|
readonly predicate: FilterPredicate<Row>;
|
|
2628
2668
|
}
|
|
2629
2669
|
/**
|
|
@@ -2634,6 +2674,7 @@ interface PredicateFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
|
2634
2674
|
* to the entries it composes.
|
|
2635
2675
|
*/
|
|
2636
2676
|
interface GroupFilterEntry<Row> {
|
|
2677
|
+
readonly kind: "group";
|
|
2637
2678
|
readonly combinator: "and" | "or";
|
|
2638
2679
|
readonly entries: FilterState<Row>;
|
|
2639
2680
|
}
|
|
@@ -2670,10 +2711,12 @@ type FilterScalar = string | number | boolean | Date | null;
|
|
|
2670
2711
|
* `ValueFilterEntry` of the wrong type doesn't.
|
|
2671
2712
|
*/
|
|
2672
2713
|
interface OperatorFilterEntry<Row> {
|
|
2714
|
+
readonly kind: "operator";
|
|
2673
2715
|
readonly columnId: FieldPath<Row> | (string & {});
|
|
2674
2716
|
readonly operator: FilterOperator;
|
|
2675
2717
|
readonly value?: FilterScalar | readonly FilterScalar[];
|
|
2676
2718
|
}
|
|
2719
|
+
/** One condition of a `FilterState`, its `kind` naming which of the five. */
|
|
2677
2720
|
type FilterEntry<Row> = TextFilterEntry<Row> | ValueFilterEntry<Row> | PredicateFilterEntry<Row> | OperatorFilterEntry<Row> | GroupFilterEntry<Row>;
|
|
2678
2721
|
/**
|
|
2679
2722
|
* The active filter, every entry ANDed together at the top level — nest a
|
|
@@ -2686,6 +2729,7 @@ type FilterState<Row> = readonly FilterEntry<Row>[];
|
|
|
2686
2729
|
* string, which restoring turns back into a `Date`.
|
|
2687
2730
|
*/
|
|
2688
2731
|
interface SerializedValueFilterEntry<Row> extends FilterEntryBase<Row> {
|
|
2732
|
+
readonly kind: "value";
|
|
2689
2733
|
readonly value: number | boolean | string;
|
|
2690
2734
|
}
|
|
2691
2735
|
/** A `FilterScalar` as JSON holds it: a `Date` becomes its ISO string. */
|
|
@@ -2696,12 +2740,14 @@ type SerializedFilterScalar = string | number | boolean | null;
|
|
|
2696
2740
|
* date, date-time or time column.
|
|
2697
2741
|
*/
|
|
2698
2742
|
interface SerializedOperatorFilterEntry<Row> {
|
|
2743
|
+
readonly kind: "operator";
|
|
2699
2744
|
readonly columnId: FieldPath<Row> | (string & {});
|
|
2700
2745
|
readonly operator: FilterOperator;
|
|
2701
2746
|
readonly value?: SerializedFilterScalar | readonly SerializedFilterScalar[];
|
|
2702
2747
|
}
|
|
2703
2748
|
/** A `GroupFilterEntry` whose entries are serialised too. */
|
|
2704
2749
|
interface SerializedGroupFilterEntry<Row> {
|
|
2750
|
+
readonly kind: "group";
|
|
2705
2751
|
readonly combinator: "and" | "or";
|
|
2706
2752
|
readonly entries: SerializedFilterState<Row>;
|
|
2707
2753
|
}
|
|
@@ -3249,16 +3295,17 @@ declare function buildKeyShortcuts(capabilities: KeyShortcutCapabilities): strin
|
|
|
3249
3295
|
declare function accessDotted(obj: unknown, path: string): unknown;
|
|
3250
3296
|
|
|
3251
3297
|
/**
|
|
3252
|
-
* The
|
|
3253
|
-
*
|
|
3254
|
-
* 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`.
|
|
3255
3300
|
*/
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3301
|
+
type GridFocus = {
|
|
3302
|
+
readonly area: "header";
|
|
3303
|
+
readonly columnIndex: number;
|
|
3304
|
+
} | {
|
|
3305
|
+
readonly area: "body";
|
|
3259
3306
|
readonly rowIndex: number;
|
|
3260
3307
|
readonly columnIndex: number;
|
|
3261
|
-
}
|
|
3308
|
+
};
|
|
3262
3309
|
/** The modifier keys held with a navigation key press. */
|
|
3263
3310
|
interface NavigationModifiers {
|
|
3264
3311
|
readonly ctrlKey: boolean;
|
|
@@ -3266,10 +3313,16 @@ interface NavigationModifiers {
|
|
|
3266
3313
|
readonly altKey: boolean;
|
|
3267
3314
|
readonly shiftKey: boolean;
|
|
3268
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;
|
|
3269
3320
|
/**
|
|
3270
3321
|
* Holds a coordinate inside the grid, so that a focus surviving a column
|
|
3271
3322
|
* removal or a shorter page never leaves the grid with no tab stop at all —
|
|
3272
|
-
* 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.
|
|
3273
3326
|
*/
|
|
3274
3327
|
declare function clampFocus(focus: GridFocus, rowCount: number, columnCount: number): GridFocus;
|
|
3275
3328
|
/**
|
|
@@ -3603,9 +3656,9 @@ declare function groupRowId(path: readonly unknown[]): string;
|
|
|
3603
3656
|
* `rows`, regrouped into `groupBy`'s stacked levels — a group header per
|
|
3604
3657
|
* distinct value at each level, ordered by `compareValues` per that level's
|
|
3605
3658
|
* own `direction`, followed depth-first by its nested groups and/or data
|
|
3606
|
-
* rows. A
|
|
3607
|
-
*
|
|
3608
|
-
*
|
|
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.
|
|
3609
3662
|
*
|
|
3610
3663
|
* Filter and sort are expected to have already run (see `resolveShownRows`):
|
|
3611
3664
|
* this only reshapes their output, and never changes which rows appear or
|
|
@@ -3622,25 +3675,28 @@ declare function groupRowId(path: readonly unknown[]): string;
|
|
|
3622
3675
|
* removed from the definition the same way a stored `ColumnSortState` does.
|
|
3623
3676
|
*/
|
|
3624
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;
|
|
3625
3684
|
/**
|
|
3626
3685
|
* The expansion with `groupId` collapsed if it was expanded, or expanded if
|
|
3627
|
-
* it was collapsed.
|
|
3686
|
+
* it was collapsed: it joins `except`, or leaves it, whatever the mode.
|
|
3628
3687
|
*/
|
|
3629
3688
|
declare function toggleGroupExpansion(expansion: GroupExpansionState, groupId: string): GroupExpansionState;
|
|
3630
|
-
/**
|
|
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
|
+
*/
|
|
3631
3693
|
declare function expandAllGroups(expansion: GroupExpansionState): GroupExpansionState;
|
|
3632
3694
|
/**
|
|
3633
|
-
* Every group
|
|
3634
|
-
*
|
|
3635
|
-
*
|
|
3636
|
-
* absent from `rows`) keeps whatever expansion it already had rather than
|
|
3637
|
-
* being forced closed too; expanding that ancestor again reveals it exactly
|
|
3638
|
-
* as it was left.
|
|
3639
|
-
*
|
|
3640
|
-
* Group headers only: a summary row (`groupAggregateDisplay: "row"`) carries
|
|
3641
|
-
* 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.
|
|
3642
3698
|
*/
|
|
3643
|
-
declare function collapseAllGroups
|
|
3699
|
+
declare function collapseAllGroups(expansion: GroupExpansionState): GroupExpansionState;
|
|
3644
3700
|
/**
|
|
3645
3701
|
* `groupBy` with `columnId` positioned in front of `beforeColumnId` — or at
|
|
3646
3702
|
* the end when that is `null` — inserting a fresh entry if `columnId` isn't
|
|
@@ -3858,28 +3914,42 @@ interface ColumnValueOptions {
|
|
|
3858
3914
|
*/
|
|
3859
3915
|
readonly columnType?: ColumnType | undefined;
|
|
3860
3916
|
}
|
|
3861
|
-
/**
|
|
3862
|
-
|
|
3863
|
-
* changed by `filterEditorReducer` and turned into a filter by
|
|
3864
|
-
* `draftToFilter` only when the user applies it — so cancelling is just
|
|
3865
|
-
* dropping the draft.
|
|
3866
|
-
*/
|
|
3867
|
-
interface FilterEditorDraft<Row> {
|
|
3868
|
-
/** Which half of the draft `draftToFilter` applies: the last one changed. */
|
|
3869
|
-
readonly mode: "values" | "conditions";
|
|
3917
|
+
/** What a `FilterEditorDraft` holds on either arm. */
|
|
3918
|
+
interface FilterEditorDraftBase<Row> {
|
|
3870
3919
|
/** Every value the editor offers, from `columnValueOptions`. */
|
|
3871
3920
|
readonly options: readonly ColumnValueOption[];
|
|
3872
3921
|
/** How many rows hold a blank; the blanks entry only matters when some do. */
|
|
3873
3922
|
readonly blanks: number;
|
|
3874
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";
|
|
3875
3935
|
/** The checked values, keyed as an `in` filter on the column keys them. */
|
|
3876
3936
|
readonly checked: ReadonlyMap<string, FilterScalar>;
|
|
3877
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";
|
|
3878
3942
|
readonly conditions: readonly OperatorFilterEntry<Row>[];
|
|
3879
3943
|
readonly combinator: "and" | "or";
|
|
3880
|
-
/** The column's `type`, from `ColumnValueOptions` — what values are keyed by. */
|
|
3881
|
-
readonly columnType?: ColumnType | undefined;
|
|
3882
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>;
|
|
3883
3953
|
type FilterEditorAction<Row> = {
|
|
3884
3954
|
readonly type: "search";
|
|
3885
3955
|
readonly search: string;
|
|
@@ -3896,10 +3966,16 @@ type FilterEditorAction<Row> = {
|
|
|
3896
3966
|
} | {
|
|
3897
3967
|
readonly type: "setConditions";
|
|
3898
3968
|
readonly conditions: readonly OperatorFilterEntry<Row>[];
|
|
3899
|
-
/**
|
|
3969
|
+
/**
|
|
3970
|
+
* Keeps the draft's own when omitted; a checklist draft's is the opened
|
|
3971
|
+
* filter's, or `"and"`.
|
|
3972
|
+
*/
|
|
3900
3973
|
readonly combinator?: "and" | "or";
|
|
3901
3974
|
}
|
|
3902
|
-
/**
|
|
3975
|
+
/**
|
|
3976
|
+
* Back to "no filter" on the draft's own arm — every value checked, or no
|
|
3977
|
+
* conditions — and no search.
|
|
3978
|
+
*/
|
|
3903
3979
|
| {
|
|
3904
3980
|
readonly type: "clear";
|
|
3905
3981
|
};
|
|
@@ -3937,11 +4013,24 @@ declare function isColumnFiltered<Row>(filter: FilterState<Row>, columnId: strin
|
|
|
3937
4013
|
declare function columnValueOptions<Row>(rows: readonly Row[], dataColumns: readonly DataColumn<Row, unknown>[], filter: FilterState<Row>, columnId: string, query?: ColumnValueQuery): ColumnValueOptions;
|
|
3938
4014
|
/**
|
|
3939
4015
|
* A draft showing `shape` over `values` — what an editor opens with. A
|
|
3940
|
-
* column
|
|
3941
|
-
*
|
|
3942
|
-
*
|
|
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.
|
|
3943
4020
|
*/
|
|
3944
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>;
|
|
3945
4034
|
/** The options the draft's search shows — those a select-all acts on. */
|
|
3946
4035
|
declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): readonly ColumnValueOption[];
|
|
3947
4036
|
/**
|
|
@@ -3949,12 +4038,14 @@ declare function visibleFilterOptions<Row>(draft: FilterEditorDraft<Row>): reado
|
|
|
3949
4038
|
* checked, none is, or some are — blanks included while nothing is
|
|
3950
4039
|
* searched.
|
|
3951
4040
|
*/
|
|
3952
|
-
declare function selectAllState<Row>(draft:
|
|
4041
|
+
declare function selectAllState<Row>(draft: ValuesDraft<Row>): SelectAllState;
|
|
3953
4042
|
/**
|
|
3954
4043
|
* The next draft after `action` — a plain reducer, so a renderer can hold
|
|
3955
4044
|
* the draft in whatever state it has (`useReducer`, a signal, a store).
|
|
3956
|
-
* Changing a value or the blanks
|
|
3957
|
-
*
|
|
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.
|
|
3958
4049
|
*/
|
|
3959
4050
|
declare function filterEditorReducer<Row>(draft: FilterEditorDraft<Row>, action: FilterEditorAction<Row>): FilterEditorDraft<Row>;
|
|
3960
4051
|
/**
|
|
@@ -3976,12 +4067,13 @@ declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: str
|
|
|
3976
4067
|
* a value unchecked and checked again, or the same conditions typed again,
|
|
3977
4068
|
* is no change; the search never is one.
|
|
3978
4069
|
*
|
|
3979
|
-
* Only the
|
|
3980
|
-
*
|
|
3981
|
-
* it opened over conditions or a custom filter leaves that
|
|
3982
|
-
* Conditions change when they differ from those
|
|
3983
|
-
* always when
|
|
3984
|
-
* conditions there replaces it, none
|
|
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.
|
|
3985
4077
|
*
|
|
3986
4078
|
* `clear` over a custom filter leaves a draft equal to the one it opened
|
|
3987
4079
|
* with, so this reads it as no change.
|
|
@@ -4209,7 +4301,7 @@ interface FilterChecklist {
|
|
|
4209
4301
|
/**
|
|
4210
4302
|
* The list a checklist editor draws for `draft`: the window of values its
|
|
4211
4303
|
* search shows, as items carrying what each row says and whether it is
|
|
4212
|
-
* checked.
|
|
4304
|
+
* checked. A draft on its conditions draws through `toValuesDraft`.
|
|
4213
4305
|
*
|
|
4214
4306
|
* A column can hold far more values than a list is worth scrolling, so the
|
|
4215
4307
|
* list shows at most `valueLimit` of them. Past that, it shows nothing until
|
|
@@ -4222,7 +4314,7 @@ interface FilterChecklist {
|
|
|
4222
4314
|
* searched: exactly when select-all counts the blanks, so the checkbox acts
|
|
4223
4315
|
* on what the list shows.
|
|
4224
4316
|
*/
|
|
4225
|
-
declare function filterChecklist<Row>(draft:
|
|
4317
|
+
declare function filterChecklist<Row>(draft: ValuesDraft<Row>, { valueLimit, blanksLabel }: FilterChecklistOptions): FilterChecklist;
|
|
4226
4318
|
|
|
4227
4319
|
/**
|
|
4228
4320
|
* One entry per row: its measured height once known, `undefined` until then.
|
|
@@ -4331,4 +4423,4 @@ declare const excelFilter: {
|
|
|
4331
4423
|
};
|
|
4332
4424
|
};
|
|
4333
4425
|
|
|
4334
|
-
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 };
|