@gemologic/sheen-table 0.2.0 → 0.3.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/DataTable.d.ts +7 -0
- package/dist/DataTable.js +1154 -1624
- package/dist/DataTableToolbar.js +1 -2
- package/dist/FilterBar.d.ts +3 -0
- package/dist/FilterBar.js +127 -108
- package/dist/QueryBuilder.js +72 -68
- package/dist/cell-edit.js +1 -2
- package/dist/client-state.js +20 -21
- package/dist/client-view.js +12 -13
- package/dist/column-layout.js +1 -2
- package/dist/columns.d.ts +5 -1
- package/dist/columns.js +7 -5
- package/dist/constrained-columns.js +1 -2
- package/dist/data-table-features.d.ts +129 -0
- package/dist/data-table-features.js +550 -0
- package/dist/export.js +1 -2
- package/dist/facets.js +5 -7
- package/dist/filter-bar-state.js +14 -18
- package/dist/filter-client.js +1 -2
- package/dist/filter.js +1 -2
- package/dist/grouping.js +1 -2
- package/dist/index.js +3 -3
- package/dist/messages.d.ts +1 -1
- package/dist/messages.js +2 -3
- package/dist/pagination.js +1 -2
- package/dist/query-builder-state.js +1 -2
- package/dist/requests.js +1 -2
- package/dist/row-hierarchy.js +1 -2
- package/dist/row-identity.js +1 -2
- package/dist/saved-views.js +1 -2
- package/dist/search-controller.js +1 -2
- package/dist/search.js +1 -2
- package/dist/selection-client.js +1 -2
- package/dist/selection.d.ts +3 -0
- package/dist/selection.js +9 -2
- package/dist/server-export.js +1 -2
- package/dist/sorting.js +1 -2
- package/dist/table-state-changes.js +1 -2
- package/dist/table-state.js +1 -2
- package/dist/text-normalization.js +1 -2
- package/dist/url-state.js +1 -2
- package/package.json +5 -5
- package/src/DataTable.tsx +285 -712
- package/src/FilterBar.tsx +17 -3
- package/src/QueryBuilder.tsx +5 -5
- package/src/columns.ts +9 -3
- package/src/data-table-features.tsx +579 -0
- package/src/messages.ts +1 -1
- package/src/selection.ts +8 -0
- package/src/styles.css +17 -11
package/dist/DataTableToolbar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as e, effect as t, insert as n, memo as r, mergeProps as i, setAttribute as a, template as o } from "solid-js/web";
|
|
2
2
|
import { Button as s, DropdownMenu as c, useTheme as l } from "@gemologic/sheen";
|
|
3
3
|
import { For as u, Show as d, children as f, createMemo as p } from "solid-js";
|
|
4
|
-
|
|
4
|
+
// src/DataTableToolbar.tsx
|
|
5
5
|
var m = /*#__PURE__*/ o("<div class=sheen-data-table-toolbar-query>"), h = /*#__PURE__*/ o("<div class=sheen-data-table-toolbar-status>"), g = /*#__PURE__*/ o("<div class=sheen-data-table-toolbar-actions><div class=sheen-data-table-toolbar-overflow>"), _ = /*#__PURE__*/ o("<div class=sheen-data-table-toolbar role=toolbar>"), v = /*#__PURE__*/ o("<output class=sheen-data-table-result-count aria-live=polite aria-atomic=true>"), y = /*#__PURE__*/ o("<span class=sheen-data-table-previous-label>"), b = /*#__PURE__*/ o("<div class=sheen-data-table-toolbar-action>");
|
|
6
6
|
function x(e) {
|
|
7
7
|
if (!Array.isArray(e)) throw Error("DataTable toolbar actions must be an array");
|
|
@@ -128,5 +128,4 @@ function w(r) {
|
|
|
128
128
|
}), null), t(() => a(l, "aria-label", r.label)), l;
|
|
129
129
|
})();
|
|
130
130
|
}
|
|
131
|
-
//#endregion
|
|
132
131
|
export { w as DataTableToolbar };
|
package/dist/FilterBar.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JSX } from "solid-js";
|
|
2
2
|
import type { SheenColumns } from "./columns.ts";
|
|
3
3
|
import type { FilterNode } from "./filter.ts";
|
|
4
|
+
import type { DataTableFeatureContext, DataTableFeatureInstance } from "./data-table-features.tsx";
|
|
4
5
|
export interface FilterBarProps<Row extends object> {
|
|
5
6
|
readonly columns: SheenColumns<Row>;
|
|
6
7
|
readonly value: FilterNode;
|
|
@@ -22,3 +23,5 @@ export interface FilterDateEditorProps {
|
|
|
22
23
|
}
|
|
23
24
|
export type FilterDateEditor = (props: FilterDateEditorProps) => JSX.Element;
|
|
24
25
|
export declare function FilterBar<Row extends object>(props: FilterBarProps<Row>): JSX.Element;
|
|
26
|
+
/** DataTable toolbar integration for the filters declared by its column definitions. */
|
|
27
|
+
export declare function filterBarFeature<Row extends object>(context: DataTableFeatureContext<Row>): DataTableFeatureInstance<Row> | undefined;
|
package/dist/FilterBar.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { readColumnDefinitions as e } from "./columns.js";
|
|
2
|
+
import { parseFilter as t } from "./filter.js";
|
|
3
|
+
import { appendFilterCondition as n, listFilterConditions as r, removeFilterCondition as i, replaceFilterCondition as a } from "./filter-bar-state.js";
|
|
4
4
|
import { resolveTableMessages as o } from "./messages.js";
|
|
5
5
|
import { Dynamic as s, className as c, createComponent as l, delegateEvents as u, effect as d, insert as f, memo as p, mergeProps as m, setAttribute as h, template as g, use as _ } from "solid-js/web";
|
|
6
|
-
import { Button as v, Checkbox as y, CheckboxGroup as b,
|
|
7
|
-
import { For as
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
function
|
|
6
|
+
import { Button as v, Checkbox as y, CheckboxGroup as b, Glyph as x, Input as S, Popover as C, Select as w, cn as T, useTheme as E } from "@gemologic/sheen";
|
|
7
|
+
import { For as D, Show as O, createEffect as k, createMemo as A, createSignal as j, untrack as M } from "solid-js";
|
|
8
|
+
// src/FilterBar.tsx
|
|
9
|
+
var N = /*#__PURE__*/ g("<form class=sheen-filter-editor-form>"), P = /*#__PURE__*/ g("<p class=sheen-filter-error role=alert>"), F = /*#__PURE__*/ g("<li class=sheen-filter-chip><button type=button class=sheen-filter-remove>"), I = /*#__PURE__*/ g("<div><ul class=sheen-filter-list></ul><div class=sheen-filter-add>"), ee = /*#__PURE__*/ g("<ul class=sheen-filter-column-list>"), L = /*#__PURE__*/ g("<p>"), R = /*#__PURE__*/ g("<li>");
|
|
10
|
+
function z(e) {
|
|
11
11
|
return JSON.stringify({
|
|
12
12
|
condition: e.condition,
|
|
13
13
|
directNegated: e.directNegated,
|
|
@@ -15,24 +15,24 @@ function L(e) {
|
|
|
15
15
|
groups: e.groups
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function B(e) {
|
|
19
19
|
return `${e.condition.column}\u0000${JSON.stringify(e.path)}`;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function V(e, t, n) {
|
|
22
22
|
let r = e.get(t);
|
|
23
23
|
r ? r.push(n) : e.set(t, [n]);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function H(e, t, n) {
|
|
26
26
|
let r = e.get(t);
|
|
27
27
|
for (; r?.length;) {
|
|
28
28
|
let e = r.shift();
|
|
29
29
|
if (e && n.has(e)) return e;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function te(e) {
|
|
33
33
|
return e === "eq" || e === "lt" || e === "lte" || e === "gt" || e === "gte" || e === "between";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function ne(e) {
|
|
36
36
|
return e === "eq" || e === "contains" || e === "startsWith" || e === "endsWith";
|
|
37
37
|
}
|
|
38
38
|
function U(e) {
|
|
@@ -52,7 +52,7 @@ function K(e) {
|
|
|
52
52
|
function q(e) {
|
|
53
53
|
return e.kind === "empty" ? "empty" : e.operator;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function re(e) {
|
|
56
56
|
return e.filter.type === "enum" ? Object.freeze({
|
|
57
57
|
id: e.id,
|
|
58
58
|
type: "enum",
|
|
@@ -63,19 +63,19 @@ function ne(e) {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
function J(e) {
|
|
66
|
-
let t =
|
|
67
|
-
function
|
|
66
|
+
let t = E(), n = A(() => o(t.messages())), [r, i] = j(e.initialOperator ?? q(e.condition)), [a, c] = j(e.condition.kind === "text" ? e.condition.value : ""), [u, d] = j(G(e.condition)), [h, g] = j(K(e.condition)), [_, x] = j(e.condition.kind === "enum" ? e.condition.values : []), [C, T] = j(e.condition.kind === "text" && e.condition.caseSensitive), [D, k] = j(e.directNegated), [M, F] = j(null), I = A(() => new Intl.NumberFormat(t.state().locale));
|
|
67
|
+
function ee() {
|
|
68
68
|
let t = r();
|
|
69
69
|
if (t === "empty") return Object.freeze({
|
|
70
70
|
kind: "empty",
|
|
71
71
|
column: e.definition.id
|
|
72
72
|
});
|
|
73
|
-
if (e.definition.filter.type === "text") return
|
|
73
|
+
if (e.definition.filter.type === "text") return ne(t) ? Object.freeze({
|
|
74
74
|
kind: "text",
|
|
75
75
|
column: e.definition.id,
|
|
76
76
|
operator: t,
|
|
77
77
|
value: a(),
|
|
78
|
-
caseSensitive:
|
|
78
|
+
caseSensitive: C()
|
|
79
79
|
}) : null;
|
|
80
80
|
if (e.definition.filter.type === "enum") return t !== "in" || _().length === 0 ? null : Object.freeze({
|
|
81
81
|
kind: "enum",
|
|
@@ -83,7 +83,7 @@ function J(e) {
|
|
|
83
83
|
operator: "in",
|
|
84
84
|
values: Object.freeze([..._()])
|
|
85
85
|
});
|
|
86
|
-
if (!
|
|
86
|
+
if (!te(t) || !u().trim()) return null;
|
|
87
87
|
if (e.definition.filter.type === "number") {
|
|
88
88
|
let n = Number(u());
|
|
89
89
|
if (!Number.isFinite(n)) return null;
|
|
@@ -122,7 +122,7 @@ function J(e) {
|
|
|
122
122
|
max: o
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
let
|
|
125
|
+
let L = () => [
|
|
126
126
|
{
|
|
127
127
|
value: "contains",
|
|
128
128
|
label: n().filterContains
|
|
@@ -143,7 +143,7 @@ function J(e) {
|
|
|
143
143
|
value: "empty",
|
|
144
144
|
label: n().filterIsEmpty
|
|
145
145
|
}
|
|
146
|
-
],
|
|
146
|
+
], R = () => [
|
|
147
147
|
{
|
|
148
148
|
value: "eq",
|
|
149
149
|
label: n().filterEquals
|
|
@@ -172,36 +172,32 @@ function J(e) {
|
|
|
172
172
|
value: "empty",
|
|
173
173
|
label: n().filterIsEmpty
|
|
174
174
|
}
|
|
175
|
-
],
|
|
175
|
+
], z = () => [{
|
|
176
176
|
value: "in",
|
|
177
177
|
label: n().filterIsAnyOf
|
|
178
178
|
}, {
|
|
179
179
|
value: "empty",
|
|
180
180
|
label: n().filterIsEmpty
|
|
181
|
-
}],
|
|
181
|
+
}], B = () => e.definition.filter.type === "text" ? L() : e.definition.filter.type === "enum" ? z() : R(), V = () => e.definition.filter.type === "enum" ? e.definition.filter.options.map((t) => {
|
|
182
182
|
let n = e.facets?.[t];
|
|
183
183
|
return {
|
|
184
184
|
value: t,
|
|
185
|
-
label: n === void 0 ? t : `${t} (${
|
|
185
|
+
label: n === void 0 ? t : `${t} (${I().format(n)})`
|
|
186
186
|
};
|
|
187
187
|
}) : [];
|
|
188
|
-
function
|
|
188
|
+
function H(t) {
|
|
189
189
|
if (t.preventDefault(), e.disabled) return;
|
|
190
|
-
let r =
|
|
191
|
-
|
|
192
|
-
F(n().filterInvalid);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
F(null), e.onApply(r, O());
|
|
190
|
+
let r = ee();
|
|
191
|
+
r ? (F(null), e.onApply(r, D())) : F(n().filterInvalid);
|
|
196
192
|
}
|
|
197
193
|
return (() => {
|
|
198
|
-
var t =
|
|
199
|
-
return t.addEventListener("submit",
|
|
194
|
+
var t = N();
|
|
195
|
+
return t.addEventListener("submit", H), f(t, l(w, {
|
|
200
196
|
get label() {
|
|
201
197
|
return n().filterOperator;
|
|
202
198
|
},
|
|
203
199
|
get options() {
|
|
204
|
-
return
|
|
200
|
+
return B();
|
|
205
201
|
},
|
|
206
202
|
get value() {
|
|
207
203
|
return r();
|
|
@@ -212,12 +208,12 @@ function J(e) {
|
|
|
212
208
|
get disabled() {
|
|
213
209
|
return e.disabled ?? !1;
|
|
214
210
|
}
|
|
215
|
-
}), null), f(t, l(
|
|
211
|
+
}), null), f(t, l(O, {
|
|
216
212
|
get when() {
|
|
217
213
|
return p(() => r() !== "empty")() && e.definition.filter.type === "text";
|
|
218
214
|
},
|
|
219
215
|
get children() {
|
|
220
|
-
return [l(
|
|
216
|
+
return [l(S, {
|
|
221
217
|
get label() {
|
|
222
218
|
return n().filterValue;
|
|
223
219
|
},
|
|
@@ -233,20 +229,20 @@ function J(e) {
|
|
|
233
229
|
return n().filterCaseSensitive;
|
|
234
230
|
},
|
|
235
231
|
get checked() {
|
|
236
|
-
return
|
|
232
|
+
return C();
|
|
237
233
|
},
|
|
238
|
-
onCheckedChange:
|
|
234
|
+
onCheckedChange: T,
|
|
239
235
|
get disabled() {
|
|
240
236
|
return e.disabled ?? !1;
|
|
241
237
|
}
|
|
242
238
|
})];
|
|
243
239
|
}
|
|
244
|
-
}), null), f(t, l(
|
|
240
|
+
}), null), f(t, l(O, {
|
|
245
241
|
get when() {
|
|
246
242
|
return p(() => r() !== "empty")() && e.definition.filter.type === "number";
|
|
247
243
|
},
|
|
248
244
|
get children() {
|
|
249
|
-
return [l(
|
|
245
|
+
return [l(S, {
|
|
250
246
|
type: "number",
|
|
251
247
|
inputMode: "decimal",
|
|
252
248
|
get label() {
|
|
@@ -259,12 +255,12 @@ function J(e) {
|
|
|
259
255
|
get disabled() {
|
|
260
256
|
return e.disabled ?? !1;
|
|
261
257
|
}
|
|
262
|
-
}), l(
|
|
258
|
+
}), l(O, {
|
|
263
259
|
get when() {
|
|
264
260
|
return r() === "between";
|
|
265
261
|
},
|
|
266
262
|
get children() {
|
|
267
|
-
return l(
|
|
263
|
+
return l(S, {
|
|
268
264
|
type: "number",
|
|
269
265
|
inputMode: "decimal",
|
|
270
266
|
get label() {
|
|
@@ -281,17 +277,17 @@ function J(e) {
|
|
|
281
277
|
}
|
|
282
278
|
})];
|
|
283
279
|
}
|
|
284
|
-
}), null), f(t, l(
|
|
280
|
+
}), null), f(t, l(O, {
|
|
285
281
|
get when() {
|
|
286
282
|
return p(() => r() !== "empty")() && e.definition.filter.type === "date";
|
|
287
283
|
},
|
|
288
284
|
get children() {
|
|
289
|
-
return l(
|
|
285
|
+
return l(O, {
|
|
290
286
|
get when() {
|
|
291
287
|
return e.dateEditor;
|
|
292
288
|
},
|
|
293
289
|
get fallback() {
|
|
294
|
-
return [l(
|
|
290
|
+
return [l(S, {
|
|
295
291
|
type: "date",
|
|
296
292
|
get label() {
|
|
297
293
|
return p(() => r() === "between")() ? n().filterStartDate : n().filterDate;
|
|
@@ -303,12 +299,12 @@ function J(e) {
|
|
|
303
299
|
get disabled() {
|
|
304
300
|
return e.disabled ?? !1;
|
|
305
301
|
}
|
|
306
|
-
}), l(
|
|
302
|
+
}), l(O, {
|
|
307
303
|
get when() {
|
|
308
304
|
return r() === "between";
|
|
309
305
|
},
|
|
310
306
|
get children() {
|
|
311
|
-
return l(
|
|
307
|
+
return l(S, {
|
|
312
308
|
type: "date",
|
|
313
309
|
get label() {
|
|
314
310
|
return n().filterEndDate;
|
|
@@ -352,7 +348,7 @@ function J(e) {
|
|
|
352
348
|
})
|
|
353
349
|
});
|
|
354
350
|
}
|
|
355
|
-
}), null), f(t, l(
|
|
351
|
+
}), null), f(t, l(O, {
|
|
356
352
|
get when() {
|
|
357
353
|
return p(() => r() === "in")() && e.definition.filter.type === "enum";
|
|
358
354
|
},
|
|
@@ -362,12 +358,12 @@ function J(e) {
|
|
|
362
358
|
return n().filterValues;
|
|
363
359
|
},
|
|
364
360
|
get options() {
|
|
365
|
-
return
|
|
361
|
+
return V();
|
|
366
362
|
},
|
|
367
363
|
get value() {
|
|
368
364
|
return _();
|
|
369
365
|
},
|
|
370
|
-
onValueChange:
|
|
366
|
+
onValueChange: x,
|
|
371
367
|
get disabled() {
|
|
372
368
|
return e.disabled ?? !1;
|
|
373
369
|
}
|
|
@@ -377,18 +373,18 @@ function J(e) {
|
|
|
377
373
|
return n().filterNegated;
|
|
378
374
|
} }, () => e.inheritedNegated ? { description: n().filterInheritedNegation } : {}, {
|
|
379
375
|
get checked() {
|
|
380
|
-
return
|
|
376
|
+
return D();
|
|
381
377
|
},
|
|
382
|
-
onCheckedChange:
|
|
378
|
+
onCheckedChange: k,
|
|
383
379
|
get disabled() {
|
|
384
380
|
return e.disabled ?? !1;
|
|
385
381
|
}
|
|
386
|
-
})), null), f(t, l(
|
|
382
|
+
})), null), f(t, l(O, {
|
|
387
383
|
get when() {
|
|
388
|
-
return
|
|
384
|
+
return M();
|
|
389
385
|
},
|
|
390
386
|
children: (e) => (() => {
|
|
391
|
-
var t =
|
|
387
|
+
var t = P();
|
|
392
388
|
return f(t, e), t;
|
|
393
389
|
})()
|
|
394
390
|
}), null), f(t, l(v, {
|
|
@@ -405,7 +401,7 @@ function J(e) {
|
|
|
405
401
|
function Y(e, t) {
|
|
406
402
|
return e === "empty" ? t.filterIsEmpty : e === "eq" ? t.filterEquals : e === "contains" ? t.filterContains : e === "startsWith" ? t.filterStartsWith : e === "endsWith" ? t.filterEndsWith : e === "lt" ? t.filterLessThan : e === "lte" ? t.filterAtMost : e === "gt" ? t.filterGreaterThan : e === "gte" ? t.filterAtLeast : e === "between" ? t.filterBetween : t.filterIsAnyOf;
|
|
407
403
|
}
|
|
408
|
-
function
|
|
404
|
+
function ie(e) {
|
|
409
405
|
return e.filter.type === "text" ? "contains" : e.filter.type === "enum" ? "in" : e.filter.type === "date" ? "between" : "eq";
|
|
410
406
|
}
|
|
411
407
|
function X(e, t, n, r) {
|
|
@@ -427,11 +423,11 @@ function X(e, t, n, r) {
|
|
|
427
423
|
let o = Y(i.kind === "empty" ? "empty" : i.operator, r), s = r.filterSummary.replace("{column}", t.header).replace("{operator}", o).replace("{value}", a).trim(), c = e.directNegated ? r.filterNot.replace("{filter}", s) : s;
|
|
428
424
|
return e.inheritedNegated ? r.filterInheritedNot.replace("{filter}", c) : c;
|
|
429
425
|
}
|
|
430
|
-
function
|
|
431
|
-
let t =
|
|
426
|
+
function ae(e) {
|
|
427
|
+
let t = E(), n = A(() => o(t.messages())), [r, i] = j(!1), a = A(() => X(e.record.entry(), e.definition(), t.state().locale, n()));
|
|
432
428
|
return (() => {
|
|
433
|
-
var t =
|
|
434
|
-
return f(t, l(
|
|
429
|
+
var t = F(), o = t.firstChild;
|
|
430
|
+
return f(t, l(C, {
|
|
435
431
|
get trigger() {
|
|
436
432
|
return a();
|
|
437
433
|
},
|
|
@@ -444,7 +440,7 @@ function ie(e) {
|
|
|
444
440
|
onOpenChange: i,
|
|
445
441
|
class: "sheen-filter-editor",
|
|
446
442
|
get children() {
|
|
447
|
-
return l(
|
|
443
|
+
return l(O, {
|
|
448
444
|
get when() {
|
|
449
445
|
return r();
|
|
450
446
|
},
|
|
@@ -478,7 +474,7 @@ function ie(e) {
|
|
|
478
474
|
}
|
|
479
475
|
});
|
|
480
476
|
}
|
|
481
|
-
}), o), o.$$click = () => e.onRemove(e.record.key, e.record.entry()), _((t) => e.removeRef(e.record.key, t), o), d((r) => {
|
|
477
|
+
}), o), o.$$click = () => e.onRemove(e.record.key, e.record.entry()), _((t) => e.removeRef(e.record.key, t), o), f(o, l(x, { name: "close" })), d((r) => {
|
|
482
478
|
var i = e.disabled || void 0, s = e.disabled, c = `${n().filterRemove}: ${a()}`;
|
|
483
479
|
return i !== r.e && h(t, "data-disabled", r.e = i), s !== r.t && (o.disabled = r.t = s), c !== r.a && h(o, "aria-label", r.a = c), r;
|
|
484
480
|
}, {
|
|
@@ -489,46 +485,46 @@ function ie(e) {
|
|
|
489
485
|
})();
|
|
490
486
|
}
|
|
491
487
|
function Z(s) {
|
|
492
|
-
let u =
|
|
488
|
+
let u = E(), m = A(() => o(u.messages())), g = e(s.columns).flatMap((e) => e.filter ? [Object.freeze({
|
|
493
489
|
id: e.id,
|
|
494
490
|
header: e.header,
|
|
495
491
|
filter: e.filter
|
|
496
492
|
})] : []);
|
|
497
493
|
if (g.length === 0) throw Error("FilterBar requires at least one filterable column");
|
|
498
|
-
let y = Object.freeze(g.map(
|
|
499
|
-
function
|
|
500
|
-
let [t, n] =
|
|
494
|
+
let y = Object.freeze(g.map(re)), b = new Map(g.map((e) => [e.id, e])), w = A(() => t(s.value, y)), N = 0;
|
|
495
|
+
function P(e) {
|
|
496
|
+
let [t, n] = j(e);
|
|
501
497
|
return Object.freeze({
|
|
502
|
-
key: `filter-${++
|
|
498
|
+
key: `filter-${++N}`,
|
|
503
499
|
entry: t,
|
|
504
500
|
update: n
|
|
505
501
|
});
|
|
506
502
|
}
|
|
507
|
-
let [
|
|
508
|
-
|
|
509
|
-
let e =
|
|
510
|
-
for (let e of t)
|
|
511
|
-
|
|
503
|
+
let [F, te] = j(Object.freeze(r(w()).map(P)), { equals: !1 });
|
|
504
|
+
k(() => {
|
|
505
|
+
let e = r(w()), t = M(F), n = new Set(t), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
506
|
+
for (let e of t) M(() => {
|
|
507
|
+
V(i, z(e.entry()), e), V(a, B(e.entry()), e);
|
|
512
508
|
});
|
|
513
509
|
let o = e.map((e) => {
|
|
514
|
-
let t =
|
|
515
|
-
return t ? (
|
|
510
|
+
let t = H(i, z(e), n) ?? H(a, B(e), n);
|
|
511
|
+
return t ? (n.delete(t), t.update(e), t) : P(e);
|
|
516
512
|
});
|
|
517
|
-
|
|
513
|
+
te(Object.freeze(o));
|
|
518
514
|
});
|
|
519
|
-
let [
|
|
515
|
+
let [ne, U] = j(!1), [W, G] = j(null), [K, q] = j(""), Y, X, Z = A(() => {
|
|
520
516
|
let e = K().trim().toLocaleLowerCase(u.state().locale);
|
|
521
517
|
return e ? g.filter((t) => `${t.header} ${t.id}`.toLocaleLowerCase(u.state().locale).includes(e)) : g;
|
|
522
518
|
});
|
|
523
|
-
function Q(
|
|
524
|
-
s.disabled || s.onChange(e
|
|
519
|
+
function Q(e) {
|
|
520
|
+
s.disabled || s.onChange(t(e, y));
|
|
525
521
|
}
|
|
526
|
-
function
|
|
527
|
-
|
|
522
|
+
function oe(e, t, n, r) {
|
|
523
|
+
F().some((t) => t.key === e) && Q(a(w(), t.path, n, r));
|
|
528
524
|
}
|
|
529
|
-
function
|
|
530
|
-
let n =
|
|
531
|
-
Q(
|
|
525
|
+
function se(e, t) {
|
|
526
|
+
let n = F().map((e) => e.key), r = n.indexOf(e), a = n[r + 1] ?? n[r - 1];
|
|
527
|
+
Q(i(w(), t.path));
|
|
532
528
|
let o = Y?.ownerDocument.defaultView;
|
|
533
529
|
o?.requestAnimationFrame(() => o.requestAnimationFrame(() => {
|
|
534
530
|
let e = a ? [...Y?.querySelectorAll("button[data-filter-key]") ?? []].find((e) => e.dataset.filterKey === a) : X?.querySelector("button");
|
|
@@ -536,19 +532,19 @@ function Z(s) {
|
|
|
536
532
|
}));
|
|
537
533
|
}
|
|
538
534
|
let $ = () => b.get(W() ?? "");
|
|
539
|
-
function
|
|
535
|
+
function ce() {
|
|
540
536
|
G(null), q("");
|
|
541
537
|
}
|
|
542
|
-
function
|
|
543
|
-
U(e), e ||
|
|
538
|
+
function le(e) {
|
|
539
|
+
U(e), e || ce();
|
|
544
540
|
}
|
|
545
541
|
return (() => {
|
|
546
|
-
var e =
|
|
547
|
-
typeof i == "function" ? _(i, e) : Y = e, f(
|
|
542
|
+
var e = I(), t = e.firstChild, r = t.nextSibling, i = Y;
|
|
543
|
+
typeof i == "function" ? _(i, e) : Y = e, f(t, l(D, {
|
|
548
544
|
get each() {
|
|
549
|
-
return
|
|
545
|
+
return F();
|
|
550
546
|
},
|
|
551
|
-
children: (e) => l(
|
|
547
|
+
children: (e) => l(ae, {
|
|
552
548
|
record: e,
|
|
553
549
|
definition: () => {
|
|
554
550
|
let t = b.get(e.entry().condition.column);
|
|
@@ -564,34 +560,34 @@ function Z(s) {
|
|
|
564
560
|
get dateEditor() {
|
|
565
561
|
return s.dateEditor;
|
|
566
562
|
},
|
|
567
|
-
onApply:
|
|
568
|
-
onRemove:
|
|
563
|
+
onApply: oe,
|
|
564
|
+
onRemove: se,
|
|
569
565
|
removeRef: (e, t) => {
|
|
570
566
|
t.dataset.filterKey = e;
|
|
571
567
|
}
|
|
572
568
|
})
|
|
573
569
|
}));
|
|
574
570
|
var a = X;
|
|
575
|
-
return typeof a == "function" ? _(a, r) : X = r, f(r, l(
|
|
571
|
+
return typeof a == "function" ? _(a, r) : X = r, f(r, l(C, {
|
|
576
572
|
get trigger() {
|
|
577
|
-
return m().filterAdd;
|
|
573
|
+
return [l(x, { name: "plus" }), p(() => m().filterAdd)];
|
|
578
574
|
},
|
|
579
575
|
get title() {
|
|
580
576
|
return p(() => !!$())() ? `${m().filterAdd}: ${$()?.header}` : m().filterColumns;
|
|
581
577
|
},
|
|
582
578
|
get open() {
|
|
583
|
-
return
|
|
579
|
+
return ne();
|
|
584
580
|
},
|
|
585
|
-
onOpenChange:
|
|
581
|
+
onOpenChange: le,
|
|
586
582
|
class: "sheen-filter-picker",
|
|
587
583
|
get children() {
|
|
588
|
-
return l(
|
|
584
|
+
return l(O, {
|
|
589
585
|
get when() {
|
|
590
586
|
return $();
|
|
591
587
|
},
|
|
592
588
|
get fallback() {
|
|
593
589
|
return [
|
|
594
|
-
l(
|
|
590
|
+
l(S, {
|
|
595
591
|
type: "search",
|
|
596
592
|
get label() {
|
|
597
593
|
return m().filterSearchColumns;
|
|
@@ -606,12 +602,12 @@ function Z(s) {
|
|
|
606
602
|
}),
|
|
607
603
|
(() => {
|
|
608
604
|
var e = ee();
|
|
609
|
-
return f(e, l(
|
|
605
|
+
return f(e, l(D, {
|
|
610
606
|
get each() {
|
|
611
607
|
return Z();
|
|
612
608
|
},
|
|
613
609
|
children: (e) => (() => {
|
|
614
|
-
var t =
|
|
610
|
+
var t = R();
|
|
615
611
|
return f(t, l(v, {
|
|
616
612
|
variant: "ghost",
|
|
617
613
|
get disabled() {
|
|
@@ -625,12 +621,12 @@ function Z(s) {
|
|
|
625
621
|
})()
|
|
626
622
|
})), e;
|
|
627
623
|
})(),
|
|
628
|
-
l(
|
|
624
|
+
l(O, {
|
|
629
625
|
get when() {
|
|
630
626
|
return Z().length === 0;
|
|
631
627
|
},
|
|
632
628
|
get children() {
|
|
633
|
-
var e =
|
|
629
|
+
var e = L();
|
|
634
630
|
return f(e, () => m().noResults), e;
|
|
635
631
|
}
|
|
636
632
|
})
|
|
@@ -647,7 +643,7 @@ function Z(s) {
|
|
|
647
643
|
});
|
|
648
644
|
},
|
|
649
645
|
get initialOperator() {
|
|
650
|
-
return
|
|
646
|
+
return ie(e());
|
|
651
647
|
},
|
|
652
648
|
directNegated: !1,
|
|
653
649
|
inheritedNegated: !1,
|
|
@@ -660,14 +656,14 @@ function Z(s) {
|
|
|
660
656
|
get dateEditor() {
|
|
661
657
|
return s.dateEditor;
|
|
662
658
|
},
|
|
663
|
-
onApply: (e,
|
|
664
|
-
|
|
659
|
+
onApply: (e, t) => {
|
|
660
|
+
le(!1), Q(n(w(), e, t));
|
|
665
661
|
}
|
|
666
662
|
})
|
|
667
663
|
});
|
|
668
664
|
}
|
|
669
665
|
})), d((t) => {
|
|
670
|
-
var n =
|
|
666
|
+
var n = T("sheen-filter-bar", s.class), r = m().filters, i = s.disabled || void 0;
|
|
671
667
|
return n !== t.e && c(e, t.e = n), r !== t.t && h(e, "aria-label", t.t = r), i !== t.a && h(e, "data-disabled", t.a = i), t;
|
|
672
668
|
}, {
|
|
673
669
|
e: void 0,
|
|
@@ -676,6 +672,29 @@ function Z(s) {
|
|
|
676
672
|
}), e;
|
|
677
673
|
})();
|
|
678
674
|
}
|
|
675
|
+
function Q(e) {
|
|
676
|
+
if (e.filterColumns.length === 0) return;
|
|
677
|
+
let t = e.props;
|
|
678
|
+
return { query: {
|
|
679
|
+
visible: () => t.filterBar !== !1,
|
|
680
|
+
render: () => l(Z, m({
|
|
681
|
+
get columns() {
|
|
682
|
+
return t.columns;
|
|
683
|
+
},
|
|
684
|
+
get value() {
|
|
685
|
+
return e.acceptedFilter();
|
|
686
|
+
},
|
|
687
|
+
get facets() {
|
|
688
|
+
return e.result().facets;
|
|
689
|
+
},
|
|
690
|
+
get disabled() {
|
|
691
|
+
return e.pending();
|
|
692
|
+
},
|
|
693
|
+
get onChange() {
|
|
694
|
+
return e.requestFilter;
|
|
695
|
+
}
|
|
696
|
+
}, () => typeof t.filterBar == "object" && t.filterBar.dateEditor ? { dateEditor: t.filterBar.dateEditor } : {}))
|
|
697
|
+
} };
|
|
698
|
+
}
|
|
679
699
|
u(["click"]);
|
|
680
|
-
|
|
681
|
-
export { Z as FilterBar };
|
|
700
|
+
export { Z as FilterBar, Q as filterBarFeature };
|