@atscript/ui-table 0.1.139 → 0.1.141
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.cjs +414 -63
- package/dist/index.d.cts +287 -20
- package/dist/index.d.mts +287 -20
- package/dist/index.mjs +407 -65
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -175,6 +175,88 @@ interface UnsupportedFilter {
|
|
|
175
175
|
/** Field paths the sub-expression references, in order of appearance. */
|
|
176
176
|
fields: string[];
|
|
177
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* One AND-ed piece of a Uniquery filter left out because it names a field
|
|
180
|
+
* outside `knownFields` — alone or next to known ones.
|
|
181
|
+
*
|
|
182
|
+
* @since 0.1.141
|
|
183
|
+
*/
|
|
184
|
+
interface UnknownFilter {
|
|
185
|
+
/** The left-out sub-expression, as it appeared in the input. */
|
|
186
|
+
expr: FilterExpr;
|
|
187
|
+
/** The paths it names that are outside `knownFields`. */
|
|
188
|
+
fields: string[];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Field paths a Uniquery filter expression references, deduped, in order of
|
|
192
|
+
* appearance (logical operators are walked, operator keys skipped).
|
|
193
|
+
*
|
|
194
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
195
|
+
*/
|
|
196
|
+
declare function filterExprFields(expr: unknown): string[];
|
|
197
|
+
/** Options for {@link decomposeUniqueryFilter}. @since 0.1.140 */
|
|
198
|
+
interface DecomposeUniqueryFilterOptions {
|
|
199
|
+
/**
|
|
200
|
+
* Field paths the table knows. A piece that names a field outside it —
|
|
201
|
+
* alone or mixed with known ones — is left out whole and listed in
|
|
202
|
+
* `unknown`, never carried or reported as `unsupported`. Omit to accept
|
|
203
|
+
* every field.
|
|
204
|
+
*/
|
|
205
|
+
knownFields?: Iterable<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Keep left-out pieces whose fields are all known as `residual` instead of
|
|
208
|
+
* reporting them. Default `false` — the 0.1.139 split. See
|
|
209
|
+
* [Custom filter conditions](https://ui.atscript.dev/tables/filtering#custom-filter-conditions).
|
|
210
|
+
*/
|
|
211
|
+
carry?: boolean;
|
|
212
|
+
}
|
|
213
|
+
/** Result of {@link decomposeUniqueryFilter}. @since 0.1.140 */
|
|
214
|
+
interface DecomposedUniqueryFilter {
|
|
215
|
+
/** The part field filters express exactly. */
|
|
216
|
+
filters: FieldFilters;
|
|
217
|
+
/** Carried pieces — AND-ed conditions, deduped, canonical order. `[]` unless `carry` is on. */
|
|
218
|
+
residual: FilterExpr[];
|
|
219
|
+
/** Pieces left out and lost — the result is broader by exactly these. */
|
|
220
|
+
unsupported: UnsupportedFilter[];
|
|
221
|
+
/**
|
|
222
|
+
* Pieces left out because they name a field outside `knownFields` (hidden
|
|
223
|
+
* from the caller, or not in the schema). Each is a whole AND-ed piece, so
|
|
224
|
+
* the result is broader by exactly these too. `[]` without `knownFields`.
|
|
225
|
+
* Since 0.1.141 — before, pieces on unknown fields only were dropped
|
|
226
|
+
* silently and mixed known/unknown pieces went to `unsupported`.
|
|
227
|
+
*/
|
|
228
|
+
unknown: UnknownFilter[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Split a Uniquery `FilterExpr` into what the table's field-filter model
|
|
232
|
+
* holds exactly (`filters`), what it cannot hold but carries as residual
|
|
233
|
+
* conditions (`residual`, with `carry`), what it leaves out (`unsupported`)
|
|
234
|
+
* and what names a field outside `knownFields` (`unknown`). Nothing is
|
|
235
|
+
* approximated: `filters AND residual` selects `expr` minus the
|
|
236
|
+
* `unsupported` and `unknown` pieces.
|
|
237
|
+
*
|
|
238
|
+
* Never throws, never warns — the caller decides how to report.
|
|
239
|
+
*
|
|
240
|
+
* @since 0.1.140
|
|
241
|
+
*/
|
|
242
|
+
declare function decomposeUniqueryFilter(expr: FilterExpr | undefined, opts?: DecomposeUniqueryFilterOptions): DecomposedUniqueryFilter;
|
|
243
|
+
/**
|
|
244
|
+
* Canonical identity of a filter expression — its `@uniqu/url` spelling.
|
|
245
|
+
* Two expressions with the same key select the same rows.
|
|
246
|
+
*
|
|
247
|
+
* @since 0.1.140
|
|
248
|
+
*/
|
|
249
|
+
declare function filterExprKey(expr: FilterExpr): string;
|
|
250
|
+
/**
|
|
251
|
+
* A residual-condition list with empty expressions and duplicates (by
|
|
252
|
+
* {@link filterExprKey}) dropped, sorted by key. Sorted, not first-appearance:
|
|
253
|
+
* the URL parser moves \`$not\`-wrapped clauses (how \`mergeFilters\` spells
|
|
254
|
+
* a repeated same-field clause) ahead of plain ones, so appearance order would
|
|
255
|
+
* flip on every round trip.
|
|
256
|
+
*
|
|
257
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
258
|
+
*/
|
|
259
|
+
declare function normalizeResidualFilters(exprs: readonly FilterExpr[]): FilterExpr[];
|
|
178
260
|
/**
|
|
179
261
|
* Convert a Uniquery `FilterExpr` back into the UI's `FieldFilters` shape.
|
|
180
262
|
*
|
|
@@ -189,16 +271,32 @@ interface UnsupportedFilter {
|
|
|
189
271
|
* - Anything else (see {@link UnsupportedFilterReason}) is left out. Leaving
|
|
190
272
|
* an AND-ed piece out only ever widens the match, so the result selects a
|
|
191
273
|
* superset of `expr`. Each left-out piece goes to `onUnsupportedFilter`, or
|
|
192
|
-
* to a dev-mode `console.warn` when no handler is given.
|
|
274
|
+
* to a dev-mode `console.warn` when no handler is given. To keep those
|
|
275
|
+
* pieces instead, use {@link decomposeUniqueryFilter} with `carry`.
|
|
193
276
|
*
|
|
194
|
-
*
|
|
195
|
-
* silently: they are not this table's (a host page flag, a
|
|
196
|
-
*
|
|
277
|
+
* Pieces that name a field outside `knownFields` (when provided) are ignored
|
|
278
|
+
* silently: they are not this table's (a host page flag, a hidden or stale
|
|
279
|
+
* column). Since 0.1.141 that includes a piece mixing known and unknown
|
|
280
|
+
* fields — {@link decomposeUniqueryFilter} lists them as `unknown`.
|
|
197
281
|
*
|
|
198
282
|
* Returns `{}` for an empty/missing expression. Never throws.
|
|
199
283
|
*/
|
|
200
284
|
declare function uniqueryFilterToFieldFilters(expr: FilterExpr | undefined, knownFields?: Iterable<string> | Set<string>, onUnsupportedFilter?: (issue: UnsupportedFilter) => void): FieldFilters;
|
|
201
285
|
//#endregion
|
|
286
|
+
//#region src/filters/format-filter-expr.d.ts
|
|
287
|
+
/**
|
|
288
|
+
* Human-readable rendering of a Uniquery filter expression, worded like the
|
|
289
|
+
* filter-field chips: `(Status equals shipped and Total greater than 500) or
|
|
290
|
+
* (Status equals pending and Total less or equal 50)`. `and` binds tighter
|
|
291
|
+
* than `or`; groups are parenthesized only where needed. Operators without a
|
|
292
|
+
* wording fall back to their `@uniqu/url` spelling.
|
|
293
|
+
*
|
|
294
|
+
* @param labelOf — display label for a field path (e.g. the column label);
|
|
295
|
+
* the path itself when omitted or when it returns `undefined`.
|
|
296
|
+
* @since 0.1.140
|
|
297
|
+
*/
|
|
298
|
+
declare function formatFilterExpr(expr: FilterExpr, labelOf?: (path: string) => string | undefined): string;
|
|
299
|
+
//#endregion
|
|
202
300
|
//#region src/filters/date-shortcuts.d.ts
|
|
203
301
|
/** A date shortcut produces a label and a [start, end] ISO date range. */
|
|
204
302
|
interface DateShortcut {
|
|
@@ -454,6 +552,96 @@ interface SystemPresetInput {
|
|
|
454
552
|
*/
|
|
455
553
|
declare function resolveSystemPresets(input?: SystemPresetInput[]): SystemPreset[];
|
|
456
554
|
//#endregion
|
|
555
|
+
//#region src/presets/prune-preset-snapshot.d.ts
|
|
556
|
+
/**
|
|
557
|
+
* The field paths a table can use, derived from its column list. A path
|
|
558
|
+
* outside these sets is one the server does not expose to the current caller
|
|
559
|
+
* (hidden by role, removed from the schema) — naming it in a query is rejected.
|
|
560
|
+
*
|
|
561
|
+
* @since 0.1.141
|
|
562
|
+
*/
|
|
563
|
+
interface KnownFields {
|
|
564
|
+
/**
|
|
565
|
+
* Every column path, client-owned (display) columns included, in column
|
|
566
|
+
* order. Gates `columnNames`, column widths and sorters (a sorter on a
|
|
567
|
+
* client-owned column is applied in memory).
|
|
568
|
+
*/
|
|
569
|
+
columns: ReadonlySet<string>;
|
|
570
|
+
/**
|
|
571
|
+
* Server-backed column paths. Gates displayed filter inputs, field filters
|
|
572
|
+
* and residual filter conditions.
|
|
573
|
+
*/
|
|
574
|
+
server: ReadonlySet<string>;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* What pruning left out of a preset snapshot or of residual conditions
|
|
578
|
+
* because it names a field outside {@link KnownFields}.
|
|
579
|
+
*
|
|
580
|
+
* @since 0.1.141
|
|
581
|
+
*/
|
|
582
|
+
interface DroppedFields {
|
|
583
|
+
/** The unavailable field paths behind the drops, deduped, in order of appearance. */
|
|
584
|
+
fields: string[];
|
|
585
|
+
/** Dropped `columnNames` entries. */
|
|
586
|
+
columns: string[];
|
|
587
|
+
/** Dropped displayed filter inputs. */
|
|
588
|
+
filterFields: string[];
|
|
589
|
+
/** Dropped field filters — whole entries, one per field. */
|
|
590
|
+
filters: FieldFilters;
|
|
591
|
+
/** Dropped filter conditions — each a whole AND-ed conjunct. */
|
|
592
|
+
residual: FilterExpr[];
|
|
593
|
+
/** Dropped sorters. */
|
|
594
|
+
sorters: SortControl[];
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Remove every entry of `snapshot` that names a field outside `known`, per
|
|
598
|
+
* aspect:
|
|
599
|
+
*
|
|
600
|
+
* - `columns.columnNames` — unknown names go, the rest keep their order. When
|
|
601
|
+
* none survives, it falls back to every column, never an empty grid.
|
|
602
|
+
* - `columns.columnWidths` — unknown keys go.
|
|
603
|
+
* - `filters` (displayed inputs) and `filterOps` — entries on a field outside
|
|
604
|
+
* `known.server` go. A field's conditions are one AND-ed conjunct, so
|
|
605
|
+
* dropping one only broadens the result.
|
|
606
|
+
* - `sorters` — unknown entries go, the rest keep their priority.
|
|
607
|
+
* - `itemsPerPage` — untouched.
|
|
608
|
+
*
|
|
609
|
+
* `dropped` is `null` when nothing user-visible went (a width-only drop is
|
|
610
|
+
* hygiene). The input is never mutated.
|
|
611
|
+
*
|
|
612
|
+
* @since 0.1.141
|
|
613
|
+
*/
|
|
614
|
+
declare function prunePresetSnapshot(snapshot: PresetSnapshot, known: KnownFields): {
|
|
615
|
+
snapshot: PresetSnapshot;
|
|
616
|
+
dropped: DroppedFields | null;
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* Split residual filter conditions, in one pass, into the ones that name
|
|
620
|
+
* only `known` fields and the ones that do not. A condition naming any
|
|
621
|
+
* unknown field is dropped WHOLE — never pruned inside an `$or` (that would
|
|
622
|
+
* narrow the result) or a `$not` (that would invert it). Each condition is an
|
|
623
|
+
* AND-ed conjunct, so dropping one only broadens the result.
|
|
624
|
+
*
|
|
625
|
+
* `dropped` holds the conditions in `residual` and the unknown paths in
|
|
626
|
+
* `fields`; `null` when every condition is kept.
|
|
627
|
+
*
|
|
628
|
+
* @since 0.1.141
|
|
629
|
+
*/
|
|
630
|
+
declare function pruneResidualFilters(exprs: FilterExpr[], known: ReadonlySet<string>): {
|
|
631
|
+
kept: FilterExpr[];
|
|
632
|
+
dropped: DroppedFields | null;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* Append what a prune dropped back onto a snapshot captured from (pruned)
|
|
636
|
+
* table state, so overwriting a preset with a narrower view does not destroy
|
|
637
|
+
* the parts the saver cannot see. Column names, filter inputs and sorters go
|
|
638
|
+
* after the captured ones; field filters are added back. Only aspects
|
|
639
|
+
* `captured` carries are touched; widths of hidden columns are not kept.
|
|
640
|
+
*
|
|
641
|
+
* @since 0.1.141
|
|
642
|
+
*/
|
|
643
|
+
declare function restoreDroppedEntries(captured: PresetSnapshot, dropped: DroppedFields): PresetSnapshot;
|
|
644
|
+
//#endregion
|
|
457
645
|
//#region src/presets/preset-dirty.d.ts
|
|
458
646
|
/**
|
|
459
647
|
* JSON-stringify with object keys sorted alphabetically at every depth so
|
|
@@ -694,6 +882,12 @@ interface BuildTableQueryOptions {
|
|
|
694
882
|
ignoreSorters?: boolean;
|
|
695
883
|
/** User-configured field filters. */
|
|
696
884
|
filters: FieldFilters;
|
|
885
|
+
/**
|
|
886
|
+
* Residual filter conditions — AND-ed conjuncts the field-filter model
|
|
887
|
+
* cannot hold (a cross-field `$or`, a second range on one field, …). AND'd
|
|
888
|
+
* after `filters`. Since 0.1.140.
|
|
889
|
+
*/
|
|
890
|
+
residualFilters?: FilterExpr[];
|
|
697
891
|
/** Always-applied Uniquery filter (AND'd with user filters). */
|
|
698
892
|
forceFilters?: FilterExpr;
|
|
699
893
|
/** Full-text search term. */
|
|
@@ -712,7 +906,8 @@ interface BuildTableQueryOptions {
|
|
|
712
906
|
* Build a Uniquery object from table UI state.
|
|
713
907
|
*
|
|
714
908
|
* Pure function — no framework dependencies.
|
|
715
|
-
* Combines user filters
|
|
909
|
+
* Combines user filters (field filters, then residual conditions) with force
|
|
910
|
+
* filters, merges sorters,
|
|
716
911
|
* projects visible columns, and applies pagination.
|
|
717
912
|
*/
|
|
718
913
|
declare function buildTableQuery(opts: BuildTableQueryOptions): Uniquery;
|
|
@@ -728,8 +923,9 @@ declare function mergeSorters(forceSorters: SortControl[], userSorters: SortCont
|
|
|
728
923
|
//#endregion
|
|
729
924
|
//#region src/query/merge-filters.d.ts
|
|
730
925
|
/**
|
|
731
|
-
* AND-merge
|
|
732
|
-
* `@uniqu/url`'s `mergeConjunction` parser collapse.
|
|
926
|
+
* AND-merge filter expressions (`undefined` ones skipped), producing a wire
|
|
927
|
+
* shape that survives `@uniqu/url`'s `mergeConjunction` parser collapse.
|
|
928
|
+
* Variadic since 0.1.140.
|
|
733
929
|
*
|
|
734
930
|
* The collapse problem: when two `$and` siblings target the same field
|
|
735
931
|
* with the same op (e.g. `{status: 'cancelled'}` AND `{status: 'shipped'}`),
|
|
@@ -742,12 +938,17 @@ declare function mergeSorters(forceSorters: SortControl[], userSorters: SortCont
|
|
|
742
938
|
* and `!!p ≡ p` is a semantic identity, so the server evaluator sees the
|
|
743
939
|
* same AND. Non-colliding merges produce the canonical `$and` shape.
|
|
744
940
|
*/
|
|
745
|
-
declare function mergeFilters(
|
|
941
|
+
declare function mergeFilters(...exprs: (FilterExpr | undefined)[]): FilterExpr | undefined;
|
|
746
942
|
//#endregion
|
|
747
943
|
//#region src/query/url-query.d.ts
|
|
748
944
|
/** State subset that round-trips through the URL bridge. */
|
|
749
945
|
interface UrlQueryStateLike {
|
|
750
946
|
filters: FieldFilters;
|
|
947
|
+
/**
|
|
948
|
+
* Residual filter conditions, AND-ed after `filters`. Only the ones the
|
|
949
|
+
* filter gate owns are written (see {@link residualGateOwns}). Since 0.1.140.
|
|
950
|
+
*/
|
|
951
|
+
residualFilters?: FilterExpr[];
|
|
751
952
|
sorters: SortControl[];
|
|
752
953
|
/** 1-based page number. `1` is the default and is omitted from the URL. */
|
|
753
954
|
page?: number;
|
|
@@ -788,11 +989,32 @@ interface UrlQueryStateSnapshot {
|
|
|
788
989
|
*/
|
|
789
990
|
snapshot?: true;
|
|
790
991
|
/**
|
|
791
|
-
* Pieces of the URL's filter that
|
|
792
|
-
* cannot express them — see `uniqueryFilterToFieldFilters`.
|
|
793
|
-
* the
|
|
992
|
+
* Pieces of the URL's filter that are left out because field filters
|
|
993
|
+
* cannot express them — see `uniqueryFilterToFieldFilters`. Since 0.1.140
|
|
994
|
+
* only the pieces NOT carried in `residual`. Omitted when none. Since 0.1.139.
|
|
794
995
|
*/
|
|
795
996
|
unsupported?: UnsupportedFilter[];
|
|
997
|
+
/**
|
|
998
|
+
* Filter pieces field filters cannot express, carried as residual
|
|
999
|
+
* conditions (see `decomposeUniqueryFilter`). Omitted when there are none
|
|
1000
|
+
* or `sync.residual` is `false`. Since 0.1.140.
|
|
1001
|
+
*/
|
|
1002
|
+
residual?: FilterExpr[];
|
|
1003
|
+
/**
|
|
1004
|
+
* Filter pieces left out because they name a field outside `knownFields`
|
|
1005
|
+
* and `localFields` — a column hidden from this caller, or gone from the
|
|
1006
|
+
* schema — with those paths in `fields`. Each is a whole AND-ed piece (a
|
|
1007
|
+
* mixed known/unknown one included), so the result is broader by exactly
|
|
1008
|
+
* these. A bare `field=value` piece is not listed: without the table
|
|
1009
|
+
* definition it reads the same as a flag of the host page. Omitted when
|
|
1010
|
+
* none. Since 0.1.141 — before, a mixed piece was listed in `unsupported`.
|
|
1011
|
+
*/
|
|
1012
|
+
unknown?: UnknownFilter[];
|
|
1013
|
+
/**
|
|
1014
|
+
* `$sort` entries left out because their field is outside `knownFields`
|
|
1015
|
+
* and `localFields`. Omitted when none. Since 0.1.141.
|
|
1016
|
+
*/
|
|
1017
|
+
unknownSorters?: SortControl[];
|
|
796
1018
|
/**
|
|
797
1019
|
* Raw record offset from `$skip` (omitted when no `$skip` in URL). The
|
|
798
1020
|
* decoder does NOT compute a page index — that requires `itemsPerPage`,
|
|
@@ -836,6 +1058,15 @@ interface UrlQuerySync {
|
|
|
836
1058
|
* Since 0.1.139.
|
|
837
1059
|
*/
|
|
838
1060
|
snapshot?: boolean;
|
|
1061
|
+
/**
|
|
1062
|
+
* Whether filter pieces the field-filter model cannot hold travel as
|
|
1063
|
+
* residual conditions. Default `true`: the encoder writes
|
|
1064
|
+
* `UrlQueryStateLike.residualFilters` and the decoder returns them as
|
|
1065
|
+
* `residual`. `false`: neither — the 0.1.139 behaviour, where such
|
|
1066
|
+
* pieces are left out and reported. Inert when `filters` is off.
|
|
1067
|
+
* Since 0.1.140.
|
|
1068
|
+
*/
|
|
1069
|
+
residual?: boolean;
|
|
839
1070
|
}
|
|
840
1071
|
interface UrlQueryDefaults {
|
|
841
1072
|
/** Consumer's `:limit` prop. Used to omit `$limit` from the URL when state matches it. */
|
|
@@ -872,6 +1103,14 @@ declare function resolveAspectGate(value: boolean | string[] | undefined): Aspec
|
|
|
872
1103
|
* @since 0.1.137
|
|
873
1104
|
*/
|
|
874
1105
|
declare function gateOwns(gate: AspectGate, path: string): boolean;
|
|
1106
|
+
/**
|
|
1107
|
+
* Does a URL under `gate` own the residual condition `expr`? Only when it
|
|
1108
|
+
* owns every field the condition references — a condition that touches a
|
|
1109
|
+
* private field stays private as a whole.
|
|
1110
|
+
*
|
|
1111
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
1112
|
+
*/
|
|
1113
|
+
declare function residualGateOwns(gate: AspectGate, expr: FilterExpr): boolean;
|
|
875
1114
|
/**
|
|
876
1115
|
* Serialize the table state subset into a URL query string.
|
|
877
1116
|
*
|
|
@@ -901,23 +1140,34 @@ declare function stateToUrlQueryString(state: UrlQueryStateLike, defaults: UrlQu
|
|
|
901
1140
|
declare function urlQueryConsumesKey(key: string): boolean;
|
|
902
1141
|
interface UrlQueryParseOptions {
|
|
903
1142
|
/**
|
|
904
|
-
* Field paths the table knows about. Conditions on fields
|
|
905
|
-
*
|
|
906
|
-
* definition isn't loaded
|
|
1143
|
+
* Field paths the table knows about. Conditions and sorters on fields
|
|
1144
|
+
* outside this set are dropped and listed in `unknown` / `unknownSorters`.
|
|
1145
|
+
* Omit to accept any field (useful when the table definition isn't loaded
|
|
1146
|
+
* yet).
|
|
907
1147
|
*/
|
|
908
1148
|
knownFields?: Iterable<string>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Client-owned column paths. The URL never restores them (no server query
|
|
1151
|
+
* can use them), but they are not unknown either: a sorter on one is
|
|
1152
|
+
* ignored, and a filter piece correlating one with a known field is
|
|
1153
|
+
* reported as `unsupported` (`"cross-field"`). Since 0.1.141.
|
|
1154
|
+
*/
|
|
1155
|
+
localFields?: Iterable<string>;
|
|
909
1156
|
/** Per-aspect sync gates — must match the encoder's config to keep the round-trip symmetric. */
|
|
910
1157
|
sync?: UrlQuerySync;
|
|
911
1158
|
}
|
|
912
1159
|
/**
|
|
913
1160
|
* Parse a URL query string back into the table state subset.
|
|
914
1161
|
*
|
|
915
|
-
* Robust by design — schema drift
|
|
916
|
-
* recipient's view:
|
|
917
|
-
* - unknown fields (not in `knownFields`) →
|
|
1162
|
+
* Robust by design — schema drift, fields hidden from the recipient and
|
|
1163
|
+
* copy-paste errors must not break the recipient's view:
|
|
1164
|
+
* - unknown fields (not in `knownFields`) → dropped, listed in `unknown` /
|
|
1165
|
+
* `unknownSorters` (the parser does not warn — the caller decides)
|
|
918
1166
|
* - filter pieces field filters cannot express (cross-field OR, unknown
|
|
919
1167
|
* operator, …) → left out of `filters` and listed in `unsupported`, never
|
|
920
|
-
* approximated (the parser does not warn — the caller decides)
|
|
1168
|
+
* approximated (the parser does not warn — the caller decides). Unless
|
|
1169
|
+
* `sync.residual` is `false`, those whose fields are all known come back
|
|
1170
|
+
* in `residual` instead
|
|
921
1171
|
* - unknown controls (e.g. `$weird=42`) → silently ignored
|
|
922
1172
|
* - malformed query → `{ filters: {}, sorters: [], searchTerm: "" }`
|
|
923
1173
|
*
|
|
@@ -1012,6 +1262,13 @@ interface TableStateData {
|
|
|
1012
1262
|
filterFields: string[];
|
|
1013
1263
|
/** Active field filters. */
|
|
1014
1264
|
filters: FieldFilters;
|
|
1265
|
+
/**
|
|
1266
|
+
* Residual filter conditions — AND-ed Uniquery conjuncts the field-filter
|
|
1267
|
+
* model cannot hold (a cross-field `$or`, a second range on one field, …),
|
|
1268
|
+
* applied after `filters`. Restored from URLs, shown as "custom filter"
|
|
1269
|
+
* chips. Since 0.1.140.
|
|
1270
|
+
*/
|
|
1271
|
+
residualFilters: FilterExpr[];
|
|
1015
1272
|
/** Active sorters. */
|
|
1016
1273
|
sorters: SortControl[];
|
|
1017
1274
|
/**
|
|
@@ -1132,8 +1389,18 @@ interface TableStateMethods {
|
|
|
1132
1389
|
loadingAt(absIdx: number): boolean;
|
|
1133
1390
|
/** Returns the last error attached to the block covering `absIdx`, or null. */
|
|
1134
1391
|
errorAt(absIdx: number): Error | null;
|
|
1135
|
-
/**
|
|
1392
|
+
/**
|
|
1393
|
+
* Clear all applied filters — field filters and residual conditions. Does
|
|
1394
|
+
* not touch `filterFields`.
|
|
1395
|
+
*/
|
|
1136
1396
|
resetFilters(): void;
|
|
1397
|
+
/**
|
|
1398
|
+
* Replace the residual filter conditions (AND-ed Uniquery conjuncts).
|
|
1399
|
+
* Empty expressions and duplicates are dropped. Since 0.1.140.
|
|
1400
|
+
*/
|
|
1401
|
+
setResidualFilters(exprs: FilterExpr[]): void;
|
|
1402
|
+
/** Remove the residual condition at `index`. Since 0.1.140. */
|
|
1403
|
+
removeResidualFilter(index: number): void;
|
|
1137
1404
|
/** Open the config dialog (optionally to a specific tab). */
|
|
1138
1405
|
showConfigDialog(tab?: ConfigTab): void;
|
|
1139
1406
|
/** Append a field to the displayed filter fields (deduped). */
|
|
@@ -1430,4 +1697,4 @@ declare function sortRowsLocally<T extends Record<string, unknown>>(rows: T[], s
|
|
|
1430
1697
|
//#region src/utils/dev.d.ts
|
|
1431
1698
|
declare const DEV: boolean;
|
|
1432
1699
|
//#endregion
|
|
1433
|
-
export { APP_CONF_PREFIX, type AppConfData, AppPrefsClient, type AppPrefsClientConfig, type AppPrefsLoadResult, type AsPresetEntryData, type AsPresetEntryRow, type AsPresetsErrorCode, type AspectGate, type AspectMask, type BuildTableQueryOptions, type ColumnFilterType, type ColumnReorderPosition, type ColumnWidthEntry, type ColumnWidthsMap, type ConfigTab, type CsvOptions, DEFAULT_EXPORT_PAGE_SIZE, DEFAULT_ROW_HEIGHT_PX, DEV, DRAFT_PERSISTED_ASPECTS, type DateShortcut, type DisplayColumnDef, type DraftPersistedAspect, ExportAbortError, type ExportPage, type ExportPageFetcher, type ExportScalar, type FetchPlan, type FetchPlanMode, type FieldFilters, type FilterCondition, type FilterConditionType, type FilterableColumn, MAX_DEFAULT_COLUMN_WIDTH_PX, type MergeResult, NULL_OPS, PRESET_ASPECTS, type PageAlignedBlock, type PlanFetchArgs, type PresetAspect, type PresetCapabilities, type PresetColumnWidthEntry, type PresetData, type PresetDraft, type PresetFilterOpEntry, type PresetLimitReachedBody, type PresetSnapshot, type PresetSnapshotWire, type PresetSorterEntry, PresetsClient, type PresetsClientConfig, PresetsHttpError, type PresetsListResult, type PresetsSaveAsOptions, type PresetsSaveResult, type QueryOptions, RESERVED_ID_PREFIXES, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, type SelectionMode, type SystemPreset, type SystemPresetInput, type TableStateData, type TableStateMethods, URL_SNAPSHOT_KEY, USER_CONF_PREFIX, type UnsupportedFilter, type UnsupportedFilterReason, type UrlQueryDefaults, type UrlQueryParseOptions, type UrlQueryStateLike, type UrlQueryStateSnapshot, type UrlQuerySync, type UserConfData, appConfId, arraysEqual, blockStartFor, buildTableQuery, cellAsString, clampTopIndex, collectExportRows, columnDefaultCondition, columnFilterConditions, columnFilterType, computeDefaultColumnWidth, conditionLabel, conditionsForType, csvCell, dateShortcuts, debounce, defaultCondition, derivePresetAspects, deserializeDraft, draftMatchesPreset, escapeRegex, filledFilterCount, filterTokenLabel, filtersToUniqueryFilter, formatFilterCondition, fromWireSnapshot, gateOwns, hasSecondValue, isAuthError, isColumnFilterable, isDirtyAgainst, isEmptyDraft, isFilled, isSimpleEq, isSystemPresetId, isUnavailableError, mergeDisplayColumns, mergeFilters, mergeSorters, normaliseSystemPresetId, pageAlignedBlocksFor, parseColumnFilterInput, parseFilterInput, planFetch, reconcileColumnWidthDefaults, reorderColumnNames, resolveAspectGate, resolveExportValue, resolveSystemPresets, rowsToPks, sameColumnSet, serializeDraft, setsEqual, sortRowsLocally, sortersEqual, stableStringify, stateToUrlQueryString, toCsv, toWireSnapshot, togglePk, trimSelection, unescapeRegex, uniqueryFilterToFieldFilters, urlQueryConsumesKey, urlQueryStringToState, userConfId, walkBackwardAbsorb, walkForwardAbsorb, withStableOrder };
|
|
1700
|
+
export { APP_CONF_PREFIX, type AppConfData, AppPrefsClient, type AppPrefsClientConfig, type AppPrefsLoadResult, type AsPresetEntryData, type AsPresetEntryRow, type AsPresetsErrorCode, type AspectGate, type AspectMask, type BuildTableQueryOptions, type ColumnFilterType, type ColumnReorderPosition, type ColumnWidthEntry, type ColumnWidthsMap, type ConfigTab, type CsvOptions, DEFAULT_EXPORT_PAGE_SIZE, DEFAULT_ROW_HEIGHT_PX, DEV, DRAFT_PERSISTED_ASPECTS, type DateShortcut, type DecomposeUniqueryFilterOptions, type DecomposedUniqueryFilter, type DisplayColumnDef, type DraftPersistedAspect, type DroppedFields, ExportAbortError, type ExportPage, type ExportPageFetcher, type ExportScalar, type FetchPlan, type FetchPlanMode, type FieldFilters, type FilterCondition, type FilterConditionType, type FilterableColumn, type KnownFields, MAX_DEFAULT_COLUMN_WIDTH_PX, type MergeResult, NULL_OPS, PRESET_ASPECTS, type PageAlignedBlock, type PlanFetchArgs, type PresetAspect, type PresetCapabilities, type PresetColumnWidthEntry, type PresetData, type PresetDraft, type PresetFilterOpEntry, type PresetLimitReachedBody, type PresetSnapshot, type PresetSnapshotWire, type PresetSorterEntry, PresetsClient, type PresetsClientConfig, PresetsHttpError, type PresetsListResult, type PresetsSaveAsOptions, type PresetsSaveResult, type QueryOptions, RESERVED_ID_PREFIXES, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, type SelectionMode, type SystemPreset, type SystemPresetInput, type TableStateData, type TableStateMethods, URL_SNAPSHOT_KEY, USER_CONF_PREFIX, type UnknownFilter, type UnsupportedFilter, type UnsupportedFilterReason, type UrlQueryDefaults, type UrlQueryParseOptions, type UrlQueryStateLike, type UrlQueryStateSnapshot, type UrlQuerySync, type UserConfData, appConfId, arraysEqual, blockStartFor, buildTableQuery, cellAsString, clampTopIndex, collectExportRows, columnDefaultCondition, columnFilterConditions, columnFilterType, computeDefaultColumnWidth, conditionLabel, conditionsForType, csvCell, dateShortcuts, debounce, decomposeUniqueryFilter, defaultCondition, derivePresetAspects, deserializeDraft, draftMatchesPreset, escapeRegex, filledFilterCount, filterExprFields, filterExprKey, filterTokenLabel, filtersToUniqueryFilter, formatFilterCondition, formatFilterExpr, fromWireSnapshot, gateOwns, hasSecondValue, isAuthError, isColumnFilterable, isDirtyAgainst, isEmptyDraft, isFilled, isSimpleEq, isSystemPresetId, isUnavailableError, mergeDisplayColumns, mergeFilters, mergeSorters, normaliseSystemPresetId, normalizeResidualFilters, pageAlignedBlocksFor, parseColumnFilterInput, parseFilterInput, planFetch, prunePresetSnapshot, pruneResidualFilters, reconcileColumnWidthDefaults, reorderColumnNames, residualGateOwns, resolveAspectGate, resolveExportValue, resolveSystemPresets, restoreDroppedEntries, rowsToPks, sameColumnSet, serializeDraft, setsEqual, sortRowsLocally, sortersEqual, stableStringify, stateToUrlQueryString, toCsv, toWireSnapshot, togglePk, trimSelection, unescapeRegex, uniqueryFilterToFieldFilters, urlQueryConsumesKey, urlQueryStringToState, userConfId, walkBackwardAbsorb, walkForwardAbsorb, withStableOrder };
|