@atscript/ui-table 0.1.138 → 0.1.140
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 +605 -114
- package/dist/index.d.cts +270 -15
- package/dist/index.d.mts +270 -15
- package/dist/index.mjs +594 -115
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FilterExpr, Uniquery } from "@uniqu/core";
|
|
1
2
|
import { Client } from "@atscript/db-client";
|
|
2
3
|
import { ColumnDef, PaginationControl, SortControl, TableDef } from "@atscript/ui";
|
|
3
|
-
import { FilterExpr, Uniquery } from "@uniqu/core";
|
|
4
4
|
|
|
5
5
|
//#region src/filters/filter-types.d.ts
|
|
6
6
|
/** Filter condition type identifiers. */
|
|
@@ -44,6 +44,34 @@ type ColumnFilterType = "text" | "number" | "date" | "boolean" | "enum" | "ref";
|
|
|
44
44
|
declare function conditionsForType(type: ColumnFilterType, nullable?: boolean): readonly FilterConditionType[];
|
|
45
45
|
/** Map a ColumnDef display type string to a ColumnFilterType. */
|
|
46
46
|
declare function columnFilterType(columnType: string): ColumnFilterType;
|
|
47
|
+
/** The `ColumnDef` fields that decide which filter conditions a column offers. */
|
|
48
|
+
type FilterableColumn = Pick<ColumnDef, "type" | "nullable" | "filterable" | "filterOps">;
|
|
49
|
+
/**
|
|
50
|
+
* Filter conditions a column offers — the one answer every filter UI (column
|
|
51
|
+
* menu, filter dialog, filter bar, config dialog) reads.
|
|
52
|
+
*
|
|
53
|
+
* - Value-filterable (`filterable: true`) → {@link conditionsForType} for its
|
|
54
|
+
* display type.
|
|
55
|
+
* - Existence-only (`filterable: false`, `filterOps` includes `$exists` — a
|
|
56
|
+
* JSON-stored column) → `null` / `notNull`: whether a value is present,
|
|
57
|
+
* never what it is.
|
|
58
|
+
* - Otherwise → `[]`: the column takes no filter.
|
|
59
|
+
*
|
|
60
|
+
* `null` / `notNull` are dropped for non-nullable columns, so an existence-only
|
|
61
|
+
* column that is never empty offers nothing.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.1.139
|
|
64
|
+
*/
|
|
65
|
+
declare function columnFilterConditions(column: FilterableColumn): readonly FilterConditionType[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether a column takes any filter at all — value comparisons or the
|
|
68
|
+
* existence-only `null` / `notNull` pair. Use it (not
|
|
69
|
+
* `column.filterable`, which is value comparison only) to decide whether to
|
|
70
|
+
* show a column in a filter UI.
|
|
71
|
+
*
|
|
72
|
+
* @since 0.1.139
|
|
73
|
+
*/
|
|
74
|
+
declare function isColumnFilterable(column: FilterableColumn): boolean;
|
|
47
75
|
//#endregion
|
|
48
76
|
//#region src/filters/escape-regex.d.ts
|
|
49
77
|
/** Escape special regex characters in user input for safe embedding in $regex. */
|
|
@@ -54,6 +82,14 @@ declare function unescapeRegex(input: string): string;
|
|
|
54
82
|
//#region src/filters/filter-input-format.d.ts
|
|
55
83
|
/** Default condition type when no symbol matches the input. */
|
|
56
84
|
declare function defaultCondition(columnType: ColumnFilterType): FilterConditionType;
|
|
85
|
+
/**
|
|
86
|
+
* The condition a column's filter input starts with: its type's
|
|
87
|
+
* {@link defaultCondition} when the column offers it, otherwise the first
|
|
88
|
+
* condition it does offer (`null` on an existence-only column).
|
|
89
|
+
*
|
|
90
|
+
* @since 0.1.139
|
|
91
|
+
*/
|
|
92
|
+
declare function columnDefaultCondition(column: FilterableColumn): FilterConditionType;
|
|
57
93
|
/**
|
|
58
94
|
* Parse a user-typed filter input string into a FilterCondition.
|
|
59
95
|
*
|
|
@@ -77,9 +113,19 @@ declare function defaultCondition(columnType: ColumnFilterType): FilterCondition
|
|
|
77
113
|
* number/date/boolean → eq
|
|
78
114
|
*
|
|
79
115
|
* Returns undefined for empty/invalid input or if the parsed operator
|
|
80
|
-
* is not available for the column type.
|
|
116
|
+
* is not available for the column type. To honour what a specific column
|
|
117
|
+
* offers (an existence-only column takes only `<empty>` / `!<empty>`), use
|
|
118
|
+
* {@link parseColumnFilterInput}.
|
|
81
119
|
*/
|
|
82
120
|
declare function parseFilterInput(text: string, columnType: ColumnFilterType, nullable?: boolean): FilterCondition | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* {@link parseFilterInput} for a column: the type comes from the column and
|
|
123
|
+
* the accepted operators are {@link columnFilterConditions} — the ones the
|
|
124
|
+
* column's filter UI offers.
|
|
125
|
+
*
|
|
126
|
+
* @since 0.1.139
|
|
127
|
+
*/
|
|
128
|
+
declare function parseColumnFilterInput(text: string, column: FilterableColumn): FilterCondition | undefined;
|
|
83
129
|
/**
|
|
84
130
|
* Format a FilterCondition for chip/token display using operator symbols.
|
|
85
131
|
*
|
|
@@ -101,17 +147,133 @@ declare function formatFilterCondition(condition: FilterCondition): string;
|
|
|
101
147
|
declare function filtersToUniqueryFilter(fieldFilters: FieldFilters): FilterExpr | undefined;
|
|
102
148
|
//#endregion
|
|
103
149
|
//#region src/filters/uniquery-to-filters.d.ts
|
|
150
|
+
/**
|
|
151
|
+
* Why part of a Uniquery filter has no `FieldFilters` equivalent.
|
|
152
|
+
*
|
|
153
|
+
* - `"cross-field"` — an `$or` / `$not` that spans several fields
|
|
154
|
+
* (`a=1 OR b=2`). The model ANDs fields, so it cannot hold a correlation.
|
|
155
|
+
* - `"operator"` — an operator or operand no condition type expresses
|
|
156
|
+
* (`$nor`, an unknown `$op`, an object value, an empty `$in`, …).
|
|
157
|
+
* - `"negation"` — a negative inside an `$or`, or a `$not` that is not a
|
|
158
|
+
* plain inversion of equality / emptiness.
|
|
159
|
+
* - `"conjunction"` — a second positive group AND'd onto a field that already
|
|
160
|
+
* has one (`a>1 AND a<5`). A field's positive conditions are OR'd.
|
|
161
|
+
*
|
|
162
|
+
* @since 0.1.139
|
|
163
|
+
*/
|
|
164
|
+
type UnsupportedFilterReason = "cross-field" | "operator" | "negation" | "conjunction";
|
|
165
|
+
/**
|
|
166
|
+
* One AND-ed piece of a Uniquery filter that {@link uniqueryFilterToFieldFilters}
|
|
167
|
+
* left out of its result.
|
|
168
|
+
*
|
|
169
|
+
* @since 0.1.139
|
|
170
|
+
*/
|
|
171
|
+
interface UnsupportedFilter {
|
|
172
|
+
reason: UnsupportedFilterReason;
|
|
173
|
+
/** The left-out sub-expression, as it appeared in the input. */
|
|
174
|
+
expr: FilterExpr;
|
|
175
|
+
/** Field paths the sub-expression references, in order of appearance. */
|
|
176
|
+
fields: string[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Field paths a Uniquery filter expression references, deduped, in order of
|
|
180
|
+
* appearance (logical operators are walked, operator keys skipped).
|
|
181
|
+
*
|
|
182
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
183
|
+
*/
|
|
184
|
+
declare function filterExprFields(expr: unknown): string[];
|
|
185
|
+
/** Options for {@link decomposeUniqueryFilter}. @since 0.1.140 */
|
|
186
|
+
interface DecomposeUniqueryFilterOptions {
|
|
187
|
+
/**
|
|
188
|
+
* Field paths the table knows. Pieces on fields outside it are ignored
|
|
189
|
+
* silently; a piece mixing known and unknown fields is reported, never
|
|
190
|
+
* carried. Omit to accept every field.
|
|
191
|
+
*/
|
|
192
|
+
knownFields?: Iterable<string>;
|
|
193
|
+
/**
|
|
194
|
+
* Keep left-out pieces whose fields are all known as `residual` instead of
|
|
195
|
+
* reporting them. Default `false` — the 0.1.139 split. See
|
|
196
|
+
* [Custom filter conditions](https://ui.atscript.dev/tables/filtering#custom-filter-conditions).
|
|
197
|
+
*/
|
|
198
|
+
carry?: boolean;
|
|
199
|
+
}
|
|
200
|
+
/** Result of {@link decomposeUniqueryFilter}. @since 0.1.140 */
|
|
201
|
+
interface DecomposedUniqueryFilter {
|
|
202
|
+
/** The part field filters express exactly. */
|
|
203
|
+
filters: FieldFilters;
|
|
204
|
+
/** Carried pieces — AND-ed conditions, deduped, canonical order. `[]` unless `carry` is on. */
|
|
205
|
+
residual: FilterExpr[];
|
|
206
|
+
/** Pieces left out and lost — the result is broader by exactly these. */
|
|
207
|
+
unsupported: UnsupportedFilter[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Split a Uniquery `FilterExpr` into what the table's field-filter model
|
|
211
|
+
* holds exactly (`filters`), what it cannot hold but carries as residual
|
|
212
|
+
* conditions (`residual`, with `carry`), and what it leaves out
|
|
213
|
+
* (`unsupported`). Nothing is approximated: `filters AND residual` selects
|
|
214
|
+
* `expr` minus the `unsupported` pieces and pieces on fields outside
|
|
215
|
+
* `knownFields`.
|
|
216
|
+
*
|
|
217
|
+
* Never throws, never warns — the caller decides how to report.
|
|
218
|
+
*
|
|
219
|
+
* @since 0.1.140
|
|
220
|
+
*/
|
|
221
|
+
declare function decomposeUniqueryFilter(expr: FilterExpr | undefined, opts?: DecomposeUniqueryFilterOptions): DecomposedUniqueryFilter;
|
|
222
|
+
/**
|
|
223
|
+
* Canonical identity of a filter expression — its `@uniqu/url` spelling.
|
|
224
|
+
* Two expressions with the same key select the same rows.
|
|
225
|
+
*
|
|
226
|
+
* @since 0.1.140
|
|
227
|
+
*/
|
|
228
|
+
declare function filterExprKey(expr: FilterExpr): string;
|
|
229
|
+
/**
|
|
230
|
+
* A residual-condition list with empty expressions and duplicates (by
|
|
231
|
+
* {@link filterExprKey}) dropped, sorted by key. Sorted, not first-appearance:
|
|
232
|
+
* the URL parser moves \`$not\`-wrapped clauses (how \`mergeFilters\` spells
|
|
233
|
+
* a repeated same-field clause) ahead of plain ones, so appearance order would
|
|
234
|
+
* flip on every round trip.
|
|
235
|
+
*
|
|
236
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
237
|
+
*/
|
|
238
|
+
declare function normalizeResidualFilters(exprs: readonly FilterExpr[]): FilterExpr[];
|
|
104
239
|
/**
|
|
105
240
|
* Convert a Uniquery `FilterExpr` back into the UI's `FieldFilters` shape.
|
|
106
241
|
*
|
|
107
|
-
* Inverse of `filtersToUniqueryFilter
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
242
|
+
* Inverse of `filtersToUniqueryFilter`, and exact for everything that encoder
|
|
243
|
+
* produces. For any other input, each AND-ed piece is either converted exactly
|
|
244
|
+
* or left out whole and reported — never approximated:
|
|
245
|
+
*
|
|
246
|
+
* - `$in` becomes equality conditions on the field, `$nin` inequality ones.
|
|
247
|
+
* - A same-field `$or` becomes that field's OR'd conditions.
|
|
248
|
+
* - A `$not` that inverts equality / emptiness becomes the inverse conditions.
|
|
249
|
+
* - Fields next to `$and` / `$or` / `$not` in one object are all kept.
|
|
250
|
+
* - Anything else (see {@link UnsupportedFilterReason}) is left out. Leaving
|
|
251
|
+
* an AND-ed piece out only ever widens the match, so the result selects a
|
|
252
|
+
* superset of `expr`. Each left-out piece goes to `onUnsupportedFilter`, or
|
|
253
|
+
* to a dev-mode `console.warn` when no handler is given. To keep those
|
|
254
|
+
* pieces instead, use {@link decomposeUniqueryFilter} with `carry`.
|
|
255
|
+
*
|
|
256
|
+
* Conditions on fields outside `knownFields` (when provided) are ignored
|
|
257
|
+
* silently: they are not this table's (a host page flag, a stale column). A
|
|
258
|
+
* piece that mixes known and unknown fields is reported.
|
|
111
259
|
*
|
|
112
260
|
* Returns `{}` for an empty/missing expression. Never throws.
|
|
113
261
|
*/
|
|
114
|
-
declare function uniqueryFilterToFieldFilters(expr: FilterExpr | undefined, knownFields?: Iterable<string> | Set<string
|
|
262
|
+
declare function uniqueryFilterToFieldFilters(expr: FilterExpr | undefined, knownFields?: Iterable<string> | Set<string>, onUnsupportedFilter?: (issue: UnsupportedFilter) => void): FieldFilters;
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/filters/format-filter-expr.d.ts
|
|
265
|
+
/**
|
|
266
|
+
* Human-readable rendering of a Uniquery filter expression, worded like the
|
|
267
|
+
* filter-field chips: `(Status equals shipped and Total greater than 500) or
|
|
268
|
+
* (Status equals pending and Total less or equal 50)`. `and` binds tighter
|
|
269
|
+
* than `or`; groups are parenthesized only where needed. Operators without a
|
|
270
|
+
* wording fall back to their `@uniqu/url` spelling.
|
|
271
|
+
*
|
|
272
|
+
* @param labelOf — display label for a field path (e.g. the column label);
|
|
273
|
+
* the path itself when omitted or when it returns `undefined`.
|
|
274
|
+
* @since 0.1.140
|
|
275
|
+
*/
|
|
276
|
+
declare function formatFilterExpr(expr: FilterExpr, labelOf?: (path: string) => string | undefined): string;
|
|
115
277
|
//#endregion
|
|
116
278
|
//#region src/filters/date-shortcuts.d.ts
|
|
117
279
|
/** A date shortcut produces a label and a [start, end] ISO date range. */
|
|
@@ -608,6 +770,12 @@ interface BuildTableQueryOptions {
|
|
|
608
770
|
ignoreSorters?: boolean;
|
|
609
771
|
/** User-configured field filters. */
|
|
610
772
|
filters: FieldFilters;
|
|
773
|
+
/**
|
|
774
|
+
* Residual filter conditions — AND-ed conjuncts the field-filter model
|
|
775
|
+
* cannot hold (a cross-field `$or`, a second range on one field, …). AND'd
|
|
776
|
+
* after `filters`. Since 0.1.140.
|
|
777
|
+
*/
|
|
778
|
+
residualFilters?: FilterExpr[];
|
|
611
779
|
/** Always-applied Uniquery filter (AND'd with user filters). */
|
|
612
780
|
forceFilters?: FilterExpr;
|
|
613
781
|
/** Full-text search term. */
|
|
@@ -626,7 +794,8 @@ interface BuildTableQueryOptions {
|
|
|
626
794
|
* Build a Uniquery object from table UI state.
|
|
627
795
|
*
|
|
628
796
|
* Pure function — no framework dependencies.
|
|
629
|
-
* Combines user filters
|
|
797
|
+
* Combines user filters (field filters, then residual conditions) with force
|
|
798
|
+
* filters, merges sorters,
|
|
630
799
|
* projects visible columns, and applies pagination.
|
|
631
800
|
*/
|
|
632
801
|
declare function buildTableQuery(opts: BuildTableQueryOptions): Uniquery;
|
|
@@ -642,8 +811,9 @@ declare function mergeSorters(forceSorters: SortControl[], userSorters: SortCont
|
|
|
642
811
|
//#endregion
|
|
643
812
|
//#region src/query/merge-filters.d.ts
|
|
644
813
|
/**
|
|
645
|
-
* AND-merge
|
|
646
|
-
* `@uniqu/url`'s `mergeConjunction` parser collapse.
|
|
814
|
+
* AND-merge filter expressions (`undefined` ones skipped), producing a wire
|
|
815
|
+
* shape that survives `@uniqu/url`'s `mergeConjunction` parser collapse.
|
|
816
|
+
* Variadic since 0.1.140.
|
|
647
817
|
*
|
|
648
818
|
* The collapse problem: when two `$and` siblings target the same field
|
|
649
819
|
* with the same op (e.g. `{status: 'cancelled'}` AND `{status: 'shipped'}`),
|
|
@@ -656,12 +826,17 @@ declare function mergeSorters(forceSorters: SortControl[], userSorters: SortCont
|
|
|
656
826
|
* and `!!p ≡ p` is a semantic identity, so the server evaluator sees the
|
|
657
827
|
* same AND. Non-colliding merges produce the canonical `$and` shape.
|
|
658
828
|
*/
|
|
659
|
-
declare function mergeFilters(
|
|
829
|
+
declare function mergeFilters(...exprs: (FilterExpr | undefined)[]): FilterExpr | undefined;
|
|
660
830
|
//#endregion
|
|
661
831
|
//#region src/query/url-query.d.ts
|
|
662
832
|
/** State subset that round-trips through the URL bridge. */
|
|
663
833
|
interface UrlQueryStateLike {
|
|
664
834
|
filters: FieldFilters;
|
|
835
|
+
/**
|
|
836
|
+
* Residual filter conditions, AND-ed after `filters`. Only the ones the
|
|
837
|
+
* filter gate owns are written (see {@link residualGateOwns}). Since 0.1.140.
|
|
838
|
+
*/
|
|
839
|
+
residualFilters?: FilterExpr[];
|
|
665
840
|
sorters: SortControl[];
|
|
666
841
|
/** 1-based page number. `1` is the default and is omitted from the URL. */
|
|
667
842
|
page?: number;
|
|
@@ -678,10 +853,41 @@ interface UrlQueryStateLike {
|
|
|
678
853
|
*/
|
|
679
854
|
ignoreSorters?: boolean;
|
|
680
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* The URL control that marks a query string as a complete snapshot of the
|
|
858
|
+
* table's filters and sorters. Restoring a URL that carries it clears every
|
|
859
|
+
* filter and sorter the URL owns before applying its own, so nothing the URL
|
|
860
|
+
* omits survives (empty `$sort` included). A URL without it is an overlay:
|
|
861
|
+
* its filters and sorters are laid over the table's starting ones.
|
|
862
|
+
*
|
|
863
|
+
* The encoder writes it bare (`…&$snapshot`) on every URL; the decoder goes
|
|
864
|
+
* by presence alone, whatever the value. `UrlQuerySync.snapshot: false` turns
|
|
865
|
+
* both off.
|
|
866
|
+
*
|
|
867
|
+
* @since 0.1.139
|
|
868
|
+
*/
|
|
869
|
+
declare const URL_SNAPSHOT_KEY = "$snapshot";
|
|
681
870
|
/** Snapshot recovered from a URL string — partial on purpose so callers can layer it onto state. */
|
|
682
871
|
interface UrlQueryStateSnapshot {
|
|
683
872
|
filters: FieldFilters;
|
|
684
873
|
sorters: SortControl[];
|
|
874
|
+
/**
|
|
875
|
+
* `true` when the URL carried {@link URL_SNAPSHOT_KEY} (and `sync.snapshot`
|
|
876
|
+
* is not `false`). Omitted otherwise. Since 0.1.139.
|
|
877
|
+
*/
|
|
878
|
+
snapshot?: true;
|
|
879
|
+
/**
|
|
880
|
+
* Pieces of the URL's filter that are left out because field filters
|
|
881
|
+
* cannot express them — see `uniqueryFilterToFieldFilters`. Since 0.1.140
|
|
882
|
+
* only the pieces NOT carried in `residual`. Omitted when none. Since 0.1.139.
|
|
883
|
+
*/
|
|
884
|
+
unsupported?: UnsupportedFilter[];
|
|
885
|
+
/**
|
|
886
|
+
* Filter pieces field filters cannot express, carried as residual
|
|
887
|
+
* conditions (see `decomposeUniqueryFilter`). Omitted when there are none
|
|
888
|
+
* or `sync.residual` is `false`. Since 0.1.140.
|
|
889
|
+
*/
|
|
890
|
+
residual?: FilterExpr[];
|
|
685
891
|
/**
|
|
686
892
|
* Raw record offset from `$skip` (omitted when no `$skip` in URL). The
|
|
687
893
|
* decoder does NOT compute a page index — that requires `itemsPerPage`,
|
|
@@ -719,6 +925,21 @@ interface UrlQuerySync {
|
|
|
719
925
|
search?: boolean;
|
|
720
926
|
/** Whether pagination (`$skip` + `$limit`) syncs. Page and limit are coupled — one knob. */
|
|
721
927
|
pagination?: boolean;
|
|
928
|
+
/**
|
|
929
|
+
* Whether the encoder writes {@link URL_SNAPSHOT_KEY} and the decoder
|
|
930
|
+
* honours it. Default `true`; `false` makes every URL an overlay.
|
|
931
|
+
* Since 0.1.139.
|
|
932
|
+
*/
|
|
933
|
+
snapshot?: boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Whether filter pieces the field-filter model cannot hold travel as
|
|
936
|
+
* residual conditions. Default `true`: the encoder writes
|
|
937
|
+
* `UrlQueryStateLike.residualFilters` and the decoder returns them as
|
|
938
|
+
* `residual`. `false`: neither — the 0.1.139 behaviour, where such
|
|
939
|
+
* pieces are left out and reported. Inert when `filters` is off.
|
|
940
|
+
* Since 0.1.140.
|
|
941
|
+
*/
|
|
942
|
+
residual?: boolean;
|
|
722
943
|
}
|
|
723
944
|
interface UrlQueryDefaults {
|
|
724
945
|
/** Consumer's `:limit` prop. Used to omit `$limit` from the URL when state matches it. */
|
|
@@ -755,6 +976,14 @@ declare function resolveAspectGate(value: boolean | string[] | undefined): Aspec
|
|
|
755
976
|
* @since 0.1.137
|
|
756
977
|
*/
|
|
757
978
|
declare function gateOwns(gate: AspectGate, path: string): boolean;
|
|
979
|
+
/**
|
|
980
|
+
* Does a URL under `gate` own the residual condition `expr`? Only when it
|
|
981
|
+
* owns every field the condition references — a condition that touches a
|
|
982
|
+
* private field stays private as a whole.
|
|
983
|
+
*
|
|
984
|
+
* @internal Exported for `@atscript/vue-table`.
|
|
985
|
+
*/
|
|
986
|
+
declare function residualGateOwns(gate: AspectGate, expr: FilterExpr): boolean;
|
|
758
987
|
/**
|
|
759
988
|
* Serialize the table state subset into a URL query string.
|
|
760
989
|
*
|
|
@@ -762,7 +991,9 @@ declare function gateOwns(gate: AspectGate, path: string): boolean;
|
|
|
762
991
|
* `$actions`, `forceFilters`, `forceSorters` — those are not user state) and
|
|
763
992
|
* appends `$skip` / `$limit` for pagination.
|
|
764
993
|
*
|
|
765
|
-
*
|
|
994
|
+
* Stamps {@link URL_SNAPSHOT_KEY} unless `defaults.sync.snapshot` is `false`
|
|
995
|
+
* (or neither filters nor sorters sync), so the default view serializes to
|
|
996
|
+
* `"$snapshot"`; with the marker off it serializes to `""` (no leading `?`).
|
|
766
997
|
*/
|
|
767
998
|
declare function stateToUrlQueryString(state: UrlQueryStateLike, defaults: UrlQueryDefaults): string;
|
|
768
999
|
/**
|
|
@@ -796,7 +1027,11 @@ interface UrlQueryParseOptions {
|
|
|
796
1027
|
* Robust by design — schema drift and copy-paste errors must not break the
|
|
797
1028
|
* recipient's view:
|
|
798
1029
|
* - unknown fields (not in `knownFields`) → silently dropped
|
|
799
|
-
* -
|
|
1030
|
+
* - filter pieces field filters cannot express (cross-field OR, unknown
|
|
1031
|
+
* operator, …) → left out of `filters` and listed in `unsupported`, never
|
|
1032
|
+
* approximated (the parser does not warn — the caller decides). Unless
|
|
1033
|
+
* `sync.residual` is `false`, those whose fields are all known come back
|
|
1034
|
+
* in `residual` instead
|
|
800
1035
|
* - unknown controls (e.g. `$weird=42`) → silently ignored
|
|
801
1036
|
* - malformed query → `{ filters: {}, sorters: [], searchTerm: "" }`
|
|
802
1037
|
*
|
|
@@ -891,6 +1126,13 @@ interface TableStateData {
|
|
|
891
1126
|
filterFields: string[];
|
|
892
1127
|
/** Active field filters. */
|
|
893
1128
|
filters: FieldFilters;
|
|
1129
|
+
/**
|
|
1130
|
+
* Residual filter conditions — AND-ed Uniquery conjuncts the field-filter
|
|
1131
|
+
* model cannot hold (a cross-field `$or`, a second range on one field, …),
|
|
1132
|
+
* applied after `filters`. Restored from URLs, shown as "custom filter"
|
|
1133
|
+
* chips. Since 0.1.140.
|
|
1134
|
+
*/
|
|
1135
|
+
residualFilters: FilterExpr[];
|
|
894
1136
|
/** Active sorters. */
|
|
895
1137
|
sorters: SortControl[];
|
|
896
1138
|
/**
|
|
@@ -1011,8 +1253,18 @@ interface TableStateMethods {
|
|
|
1011
1253
|
loadingAt(absIdx: number): boolean;
|
|
1012
1254
|
/** Returns the last error attached to the block covering `absIdx`, or null. */
|
|
1013
1255
|
errorAt(absIdx: number): Error | null;
|
|
1014
|
-
/**
|
|
1256
|
+
/**
|
|
1257
|
+
* Clear all applied filters — field filters and residual conditions. Does
|
|
1258
|
+
* not touch `filterFields`.
|
|
1259
|
+
*/
|
|
1015
1260
|
resetFilters(): void;
|
|
1261
|
+
/**
|
|
1262
|
+
* Replace the residual filter conditions (AND-ed Uniquery conjuncts).
|
|
1263
|
+
* Empty expressions and duplicates are dropped. Since 0.1.140.
|
|
1264
|
+
*/
|
|
1265
|
+
setResidualFilters(exprs: FilterExpr[]): void;
|
|
1266
|
+
/** Remove the residual condition at `index`. Since 0.1.140. */
|
|
1267
|
+
removeResidualFilter(index: number): void;
|
|
1016
1268
|
/** Open the config dialog (optionally to a specific tab). */
|
|
1017
1269
|
showConfigDialog(tab?: ConfigTab): void;
|
|
1018
1270
|
/** Append a field to the displayed filter fields (deduped). */
|
|
@@ -1306,4 +1558,7 @@ declare function cellAsString(v: unknown): string;
|
|
|
1306
1558
|
*/
|
|
1307
1559
|
declare function sortRowsLocally<T extends Record<string, unknown>>(rows: T[], sorters: readonly SortControl[], getValue?: (row: T, field: string) => unknown): T[];
|
|
1308
1560
|
//#endregion
|
|
1309
|
-
|
|
1561
|
+
//#region src/utils/dev.d.ts
|
|
1562
|
+
declare const DEV: boolean;
|
|
1563
|
+
//#endregion
|
|
1564
|
+
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, 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, 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, reconcileColumnWidthDefaults, reorderColumnNames, residualGateOwns, resolveAspectGate, resolveExportValue, resolveSystemPresets, rowsToPks, sameColumnSet, serializeDraft, setsEqual, sortRowsLocally, sortersEqual, stableStringify, stateToUrlQueryString, toCsv, toWireSnapshot, togglePk, trimSelection, unescapeRegex, uniqueryFilterToFieldFilters, urlQueryConsumesKey, urlQueryStringToState, userConfId, walkBackwardAbsorb, walkForwardAbsorb, withStableOrder };
|