@serkonda7/solid-components 0.2.0 → 0.2.1
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/filter-table.d.ts +1 -1
- package/dist/index.js +115 -118
- package/package.json +1 -1
package/dist/filter-table.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface FilterTableProps<TRow> extends Omit<DataTableProps<TRow>, 'tool
|
|
|
60
60
|
saveLabel?: string;
|
|
61
61
|
saveNameLabel?: string;
|
|
62
62
|
cancelLabel?: string;
|
|
63
|
-
|
|
63
|
+
clearSavedFilterLabel?: string;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* `DataTable` with filtering: a Results tab with a quick search and
|
package/dist/index.js
CHANGED
|
@@ -57,15 +57,15 @@ var C = {
|
|
|
57
57
|
})();
|
|
58
58
|
};
|
|
59
59
|
return u.displayName = `${i}`, u;
|
|
60
|
-
}, ee = E("outline", "chevron-down", "ChevronDown", [["path", { d: "M6 9l6 6l6 -6" }]]),
|
|
61
|
-
function
|
|
62
|
-
let s, l, u = v(), m = () => r.id ?? u, y = () => `${m()}-listbox`, b = (e) => `${m()}-option-${e}`, [S, C] = _(!1), [w, T] = _(""), [E,
|
|
60
|
+
}, ee = E("outline", "chevron-down", "ChevronDown", [["path", { d: "M6 9l6 6l6 -6" }]]), te = E("outline", "plus", "Plus", [["path", { d: "M12 5l0 14" }], ["path", { d: "M5 12l14 0" }]]), D = /*#__PURE__*/ u("<span class=combobox-value aria-hidden=true><span class=combobox-option-label></span><span class=combobox-detail>"), ne = /*#__PURE__*/ u("<div role=option class=\"combobox-option combobox-option-add\">"), re = /*#__PURE__*/ u("<div class=combobox-list role=listbox>"), O = /*#__PURE__*/ u("<div><input class=combobox-input role=combobox aria-autocomplete=list autocomplete=off>"), k = /*#__PURE__*/ u("<span class=combobox-icon aria-hidden=true>"), ie = /*#__PURE__*/ u("<div class=combobox-empty>"), A = /*#__PURE__*/ u("<span class=combobox-detail>"), j = /*#__PURE__*/ u("<div role=option class=combobox-option><span class=combobox-option-label>"), M = /*#__PURE__*/ u("<span class=combobox-option-icon aria-hidden=true>");
|
|
61
|
+
function N(r) {
|
|
62
|
+
let s, l, u = v(), m = () => r.id ?? u, y = () => `${m()}-listbox`, b = (e) => `${m()}-option-${e}`, [S, C] = _(!1), [w, T] = _(""), [E, N] = _(0), P = g(() => r.emptyLabel === void 0 ? r.options : [{
|
|
63
63
|
value: "",
|
|
64
64
|
label: r.emptyLabel
|
|
65
|
-
}, ...r.options]),
|
|
65
|
+
}, ...r.options]), F = g(() => r.value === "" ? void 0 : P().find((e) => String(e.value) === r.value)), I = g(() => {
|
|
66
66
|
let e = w().trim().toLowerCase();
|
|
67
|
-
return e === "" ?
|
|
68
|
-
}),
|
|
67
|
+
return e === "" ? P() : P().filter((t) => t.label.toLowerCase().includes(e) || (t.detail?.toLowerCase().includes(e) ?? !1));
|
|
68
|
+
}), ae = () => r.options.some((e) => e.detail !== void 0), L = () => I().length, oe = () => I().length + +!!r.onAdd, se = () => !r.disabled && r.onChange !== void 0;
|
|
69
69
|
x(() => {
|
|
70
70
|
r.autofocus === !0 && s?.focus();
|
|
71
71
|
}), h(() => {
|
|
@@ -74,35 +74,35 @@ function M(r) {
|
|
|
74
74
|
function R() {
|
|
75
75
|
if (S() || !se()) return;
|
|
76
76
|
T("");
|
|
77
|
-
let e =
|
|
78
|
-
|
|
77
|
+
let e = P().findIndex((e) => String(e.value) === r.value);
|
|
78
|
+
N(Math.max(e, 0)), C(!0), r.onOpen?.();
|
|
79
79
|
}
|
|
80
80
|
function z(e) {
|
|
81
81
|
if (C(!1), r.onAdd && e === L()) {
|
|
82
82
|
r.onAdd(w().trim());
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
let t =
|
|
85
|
+
let t = I()[e];
|
|
86
86
|
t && String(t.value) !== r.value && r.onChange?.(String(t.value));
|
|
87
87
|
}
|
|
88
88
|
function B(e) {
|
|
89
89
|
let t = oe();
|
|
90
|
-
S() ? t > 0 &&
|
|
90
|
+
S() ? t > 0 && N((E() + e + t) % t) : R();
|
|
91
91
|
}
|
|
92
92
|
function V(e) {
|
|
93
93
|
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), B(e.key === "ArrowDown" ? 1 : -1)) : S() && (e.key === "Enter" ? (e.preventDefault(), z(E())) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), C(!1)));
|
|
94
94
|
}
|
|
95
|
-
let
|
|
95
|
+
let ce = () => S() ? F()?.label ?? r.emptyLabel ?? r.searchLabel ?? "Search" : r.emptyLabel ?? r.placeholder;
|
|
96
96
|
return (() => {
|
|
97
97
|
var u = O(), h = u.firstChild;
|
|
98
98
|
h.addEventListener("blur", () => C(!1)), h.$$keydown = V, h.$$input = (e) => {
|
|
99
99
|
let t = e.currentTarget.value;
|
|
100
|
-
R(), T(t),
|
|
100
|
+
R(), T(t), N(0);
|
|
101
101
|
}, h.$$click = R;
|
|
102
102
|
var g = s;
|
|
103
103
|
return typeof g == "function" ? d(g, h) : s = h, a(u, n(p, {
|
|
104
104
|
get when() {
|
|
105
|
-
return o(() => !S())() &&
|
|
105
|
+
return o(() => !S())() && F()?.icon;
|
|
106
106
|
},
|
|
107
107
|
children: (t) => (() => {
|
|
108
108
|
var r = k();
|
|
@@ -115,11 +115,11 @@ function M(r) {
|
|
|
115
115
|
})()
|
|
116
116
|
}), null), a(u, n(p, {
|
|
117
117
|
get when() {
|
|
118
|
-
return o(() => !S())() &&
|
|
118
|
+
return o(() => !S())() && F()?.detail;
|
|
119
119
|
},
|
|
120
120
|
get children() {
|
|
121
|
-
var e =
|
|
122
|
-
return a(t, () =>
|
|
121
|
+
var e = D(), t = e.firstChild, n = t.nextSibling;
|
|
122
|
+
return a(t, () => F()?.label), a(n, () => F()?.detail), e;
|
|
123
123
|
}
|
|
124
124
|
}), null), a(u, n(ee, {
|
|
125
125
|
class: "combobox-chevron",
|
|
@@ -133,7 +133,7 @@ function M(r) {
|
|
|
133
133
|
var t = re(), o = l;
|
|
134
134
|
return typeof o == "function" ? d(o, t) : l = t, a(t, n(f, {
|
|
135
135
|
get each() {
|
|
136
|
-
return
|
|
136
|
+
return I();
|
|
137
137
|
},
|
|
138
138
|
get fallback() {
|
|
139
139
|
return (() => {
|
|
@@ -142,13 +142,13 @@ function M(r) {
|
|
|
142
142
|
})();
|
|
143
143
|
},
|
|
144
144
|
children: (t, o) => (() => {
|
|
145
|
-
var s =
|
|
146
|
-
return s.$$click = () => z(o()), s.$$mousemove = () =>
|
|
145
|
+
var s = j(), l = s.firstChild;
|
|
146
|
+
return s.$$click = () => z(o()), s.$$mousemove = () => N(o()), s.$$mousedown = (e) => e.preventDefault(), a(l, n(p, {
|
|
147
147
|
get when() {
|
|
148
148
|
return t.icon;
|
|
149
149
|
},
|
|
150
150
|
children: (t) => (() => {
|
|
151
|
-
var r =
|
|
151
|
+
var r = M();
|
|
152
152
|
return a(r, n(e, {
|
|
153
153
|
get component() {
|
|
154
154
|
return t();
|
|
@@ -161,7 +161,7 @@ function M(r) {
|
|
|
161
161
|
return t.detail;
|
|
162
162
|
},
|
|
163
163
|
get children() {
|
|
164
|
-
var e =
|
|
164
|
+
var e = A();
|
|
165
165
|
return a(e, () => t.detail), e;
|
|
166
166
|
}
|
|
167
167
|
}), null), i((e) => {
|
|
@@ -181,7 +181,7 @@ function M(r) {
|
|
|
181
181
|
},
|
|
182
182
|
get children() {
|
|
183
183
|
var e = ne();
|
|
184
|
-
return e.$$click = () => z(L()), e.$$mousemove = () =>
|
|
184
|
+
return e.$$click = () => z(L()), e.$$mousemove = () => N(L()), e.$$mousedown = (e) => e.preventDefault(), c(e, "aria-selected", !1), a(e, n(te, {
|
|
185
185
|
size: 14,
|
|
186
186
|
"aria-hidden": "true"
|
|
187
187
|
}), null), a(e, () => r.addLabel ?? "Add", null), i((t) => {
|
|
@@ -194,7 +194,7 @@ function M(r) {
|
|
|
194
194
|
}), e;
|
|
195
195
|
}
|
|
196
196
|
}), null), i((e) => {
|
|
197
|
-
var n = !!
|
|
197
|
+
var n = !!ae(), r = y();
|
|
198
198
|
return n !== e.e && t.classList.toggle("combobox-list-detail", e.e = n), r !== e.t && c(t, "id", e.t = r), e;
|
|
199
199
|
}, {
|
|
200
200
|
e: void 0,
|
|
@@ -202,7 +202,7 @@ function M(r) {
|
|
|
202
202
|
}), t;
|
|
203
203
|
}
|
|
204
204
|
}), null), i((e) => {
|
|
205
|
-
var n = r.class ? `combobox ${r.class}` : "combobox", i = !!S(), a = !(S() || !
|
|
205
|
+
var n = r.class ? `combobox ${r.class}` : "combobox", i = !!S(), a = !(S() || !F()?.detail), o = !(S() || F()?.icon === void 0), s = m(), l = S(), d = y(), f = S() && oe() > 0 ? b(E()) : void 0, p = r.ariaLabel, g = r.describedBy, _ = r.required, v = r.disabled, x = r.onChange === void 0, C = r.value, w = ce();
|
|
206
206
|
return n !== e.e && t(u, e.e = n), i !== e.t && u.classList.toggle("combobox-open", e.t = i), a !== e.a && u.classList.toggle("combobox-with-detail", e.a = a), o !== e.o && u.classList.toggle("combobox-with-icon", e.o = o), s !== e.i && c(h, "id", e.i = s), l !== e.n && c(h, "aria-expanded", e.n = l), d !== e.s && c(h, "aria-controls", e.s = d), f !== e.h && c(h, "aria-activedescendant", e.h = f), p !== e.r && c(h, "aria-label", e.r = p), g !== e.d && c(h, "aria-describedby", e.d = g), _ !== e.l && (h.required = e.l = _), v !== e.u && (h.disabled = e.u = v), x !== e.c && (h.readOnly = e.c = x), C !== e.w && c(h, "data-value", e.w = C), w !== e.m && c(h, "placeholder", e.m = w), e;
|
|
207
207
|
}, {
|
|
208
208
|
e: void 0,
|
|
@@ -220,7 +220,7 @@ function M(r) {
|
|
|
220
220
|
c: void 0,
|
|
221
221
|
w: void 0,
|
|
222
222
|
m: void 0
|
|
223
|
-
}), i(() => h.value = S() ? w() :
|
|
223
|
+
}), i(() => h.value = S() ? w() : F()?.label ?? ""), u;
|
|
224
224
|
})();
|
|
225
225
|
}
|
|
226
226
|
r([
|
|
@@ -232,20 +232,20 @@ r([
|
|
|
232
232
|
]);
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region node_modules/@tabler/icons-solidjs/dist/source/icons/IconChevronUp.js
|
|
235
|
-
var
|
|
235
|
+
var P = E("outline", "chevron-up", "ChevronUp", [["path", { d: "M6 15l6 -6l6 6" }]]), F = E("outline", "menu", "Menu", [["path", { d: "M4 8l16 0" }], ["path", { d: "M4 16l16 0" }]]), I = /*#__PURE__*/ u("<div class=data-table-toolbar-start>"), ae = /*#__PURE__*/ u("<div role=dialog class=data-table-customizer-panel><p class=data-table-customizer-title></p><ul class=data-table-customizer-list></ul><div class=data-table-customizer-actions><button type=button></button><button type=button>"), L = /*#__PURE__*/ u("<div class=data-table-customizer><button type=button class=data-table-customizer-button aria-haspopup=dialog><span aria-hidden=true>⚙</span> "), oe = /*#__PURE__*/ u("<div class=data-table-toolbar>"), se = /*#__PURE__*/ u("<th class=data-table-checkbox><span class=data-table-visually-hidden>Select rows</span><input type=checkbox>"), R = /*#__PURE__*/ u("<th>Actions"), z = /*#__PURE__*/ u("<div><div class=data-table-scroll><table class=data-table><thead><tr></tr></thead><tbody>"), B = /*#__PURE__*/ u("<li class=data-table-customizer-item draggable=true><label class=data-table-customizer-option><input type=checkbox></label><button type=button class=data-table-customizer-move></button><button type=button class=data-table-customizer-move>"), V = /*#__PURE__*/ u("<button type=button class=data-table-sort><span class=data-table-sort-indicator aria-hidden=true>"), ce = /*#__PURE__*/ u("<th>"), le = /*#__PURE__*/ u("<td class=data-table-checkbox><input type=checkbox>"), H = /*#__PURE__*/ u("<td>"), U = /*#__PURE__*/ u("<tr>"), W = /*#__PURE__*/ u("<p class=data-table-status>Loading…"), G = /*#__PURE__*/ u("<p class=data-table-status>No results.");
|
|
236
236
|
function K(e) {
|
|
237
237
|
return typeof e == "function" ? e() : e;
|
|
238
238
|
}
|
|
239
239
|
function ue(e) {
|
|
240
|
-
let r = g(() => K(e.rows)), s = () => K(e.loading ?? !1), l = () => K(e.selected ?? []), u = e.sortKey !== void 0 || e.sortDirection !== void 0, [y, x] = _(e.defaultSort), S = () => u ? K(e.sortKey ?? void 0) : y()?.key, C = () => u ? K(e.sortDirection ?? "asc") : y()?.direction ?? "asc", w = () => K(e.showColumnCustomizer ?? !1), T = m(() => e.toolbar), E = () => e.selected !== void 0 && e.onSelectionChange !== void 0,
|
|
240
|
+
let r = g(() => K(e.rows)), s = () => K(e.loading ?? !1), l = () => K(e.selected ?? []), u = e.sortKey !== void 0 || e.sortDirection !== void 0, [y, x] = _(e.defaultSort), S = () => u ? K(e.sortKey ?? void 0) : y()?.key, C = () => u ? K(e.sortDirection ?? "asc") : y()?.direction ?? "asc", w = () => K(e.showColumnCustomizer ?? !1), T = m(() => e.toolbar), E = () => e.selected !== void 0 && e.onSelectionChange !== void 0, te = () => {
|
|
241
241
|
let t = l();
|
|
242
242
|
return r().length > 0 && r().every((n) => t.includes(e.getRowId(n)));
|
|
243
|
-
},
|
|
244
|
-
function
|
|
243
|
+
}, D = g(() => e.defaultVisibleColumns ?? e.columns.filter((e) => e.defaultVisible !== !1).map((e) => e.key)), [ne, re] = _(void 0), O = () => e.visibleColumns === void 0 ? ne() ?? D() : K(e.visibleColumns), k = g(() => new Set(O())), [ie, A] = _(void 0);
|
|
244
|
+
function j(t) {
|
|
245
245
|
let n = new Map(e.columns.map((e) => [e.key, e])), r = [...new Set(t)].flatMap((e) => n.get(e) ?? []), i = new Set(r);
|
|
246
246
|
return [...r, ...e.columns.filter((e) => !i.has(e))];
|
|
247
247
|
}
|
|
248
|
-
let
|
|
248
|
+
let M = g(() => j(e.columnOrder === void 0 ? ie() ?? e.defaultColumnOrder ?? [] : K(e.columnOrder))), N = g(() => M().filter((e) => e.toggleable === !1 || k().has(e.key))), ue = g(() => e.columns.filter((e) => e.toggleable !== !1)), de = g(() => ue().map((e) => e.key));
|
|
249
249
|
function q(e, t) {
|
|
250
250
|
return t.sortValue ? t.sortValue(e) : e[t.key];
|
|
251
251
|
}
|
|
@@ -283,19 +283,19 @@ function ue(e) {
|
|
|
283
283
|
he(de());
|
|
284
284
|
}
|
|
285
285
|
function ve(t) {
|
|
286
|
-
e.columnOrder === void 0 &&
|
|
286
|
+
e.columnOrder === void 0 && A(t), e.onColumnOrderChange?.(t);
|
|
287
287
|
}
|
|
288
288
|
function ye(e, t) {
|
|
289
|
-
let n =
|
|
289
|
+
let n = M().map((e) => e.key), r = n.indexOf(e);
|
|
290
290
|
r === -1 || t < 0 || t >= n.length || t === r || (n.splice(r, 1), n.splice(t, 0, e), ve(n));
|
|
291
291
|
}
|
|
292
292
|
function be(e, t, n) {
|
|
293
|
-
ye(t,
|
|
293
|
+
ye(t, M().findIndex((e) => e.key === t) + n);
|
|
294
294
|
let r = e.parentElement?.querySelectorAll(".data-table-customizer-move");
|
|
295
295
|
(e.disabled ? [...r ?? []].find((e) => !e.disabled) : e)?.focus();
|
|
296
296
|
}
|
|
297
297
|
function xe() {
|
|
298
|
-
he(
|
|
298
|
+
he(D()), ve(j(e.defaultColumnOrder ?? []).map((e) => e.key));
|
|
299
299
|
}
|
|
300
300
|
let [Se, Ce] = _(), we = `${v()}-panel`, [Te, Ee] = _(!1), Y;
|
|
301
301
|
h(() => {
|
|
@@ -312,7 +312,7 @@ function ue(e) {
|
|
|
312
312
|
});
|
|
313
313
|
let X;
|
|
314
314
|
h(() => {
|
|
315
|
-
X && (X.indeterminate = l().length > 0 && !
|
|
315
|
+
X && (X.indeterminate = l().length > 0 && !te());
|
|
316
316
|
});
|
|
317
317
|
function De(t) {
|
|
318
318
|
e.onSelectionChange?.(t ? r().map(e.getRowId) : []);
|
|
@@ -343,7 +343,7 @@ function ue(e) {
|
|
|
343
343
|
return T.toArray().length > 0;
|
|
344
344
|
},
|
|
345
345
|
get children() {
|
|
346
|
-
var e =
|
|
346
|
+
var e = I();
|
|
347
347
|
return a(e, T), e;
|
|
348
348
|
}
|
|
349
349
|
}), null), a(t, n(p, {
|
|
@@ -359,10 +359,10 @@ function ue(e) {
|
|
|
359
359
|
return Te();
|
|
360
360
|
},
|
|
361
361
|
get children() {
|
|
362
|
-
var t =
|
|
362
|
+
var t = ae(), r = t.firstChild, o = r.nextSibling, s = o.nextSibling.firstChild, l = s.nextSibling;
|
|
363
363
|
return c(t, "id", we), a(r, () => e.columnCustomizerTitle ?? "Shown columns"), a(o, n(f, {
|
|
364
364
|
get each() {
|
|
365
|
-
return
|
|
365
|
+
return M();
|
|
366
366
|
},
|
|
367
367
|
children: (t, r) => (() => {
|
|
368
368
|
var o = B(), s = o.firstChild, l = s.firstChild, u = s.nextSibling, d = u.nextSibling;
|
|
@@ -371,18 +371,18 @@ function ue(e) {
|
|
|
371
371
|
t !== void 0 && (e.preventDefault(), ye(t, r()));
|
|
372
372
|
}), o.addEventListener("dragstart", (e) => {
|
|
373
373
|
Ce(t.key), e.dataTransfer?.setData("text/plain", t.key), e.dataTransfer && (e.dataTransfer.effectAllowed = "move");
|
|
374
|
-
}), a(o, n(
|
|
374
|
+
}), a(o, n(F, {
|
|
375
375
|
class: "data-table-customizer-grip",
|
|
376
376
|
size: 14,
|
|
377
377
|
"aria-hidden": "true"
|
|
378
|
-
}), s), l.addEventListener("change", (e) => ge(t.key, e.currentTarget.checked)), a(s, () => t.ariaLabel ?? t.label, null), u.$$click = (e) => be(e.currentTarget, t.key, -1), a(u, n(
|
|
378
|
+
}), s), l.addEventListener("change", (e) => ge(t.key, e.currentTarget.checked)), a(s, () => t.ariaLabel ?? t.label, null), u.$$click = (e) => be(e.currentTarget, t.key, -1), a(u, n(P, {
|
|
379
379
|
size: 14,
|
|
380
380
|
"aria-hidden": "true"
|
|
381
381
|
})), d.$$click = (e) => be(e.currentTarget, t.key, 1), a(d, n(ee, {
|
|
382
382
|
size: 14,
|
|
383
383
|
"aria-hidden": "true"
|
|
384
384
|
})), i((n) => {
|
|
385
|
-
var i = Se() === t.key, a = t.toggleable === !1, s = `${e.columnCustomizerMoveUpLabel ?? "Move up"}: ${t.ariaLabel ?? t.label}`, f = r() === 0, p = `${e.columnCustomizerMoveDownLabel ?? "Move down"}: ${t.ariaLabel ?? t.label}`, m = r() ===
|
|
385
|
+
var i = Se() === t.key, a = t.toggleable === !1, s = `${e.columnCustomizerMoveUpLabel ?? "Move up"}: ${t.ariaLabel ?? t.label}`, f = r() === 0, p = `${e.columnCustomizerMoveDownLabel ?? "Move down"}: ${t.ariaLabel ?? t.label}`, m = r() === M().length - 1;
|
|
386
386
|
return i !== n.e && o.classList.toggle("data-table-customizer-item-dragging", n.e = i), a !== n.t && (l.disabled = n.t = a), s !== n.a && c(u, "aria-label", n.a = s), f !== n.o && (u.disabled = n.o = f), p !== n.i && c(d, "aria-label", n.i = p), m !== n.n && (d.disabled = n.n = m), n;
|
|
387
387
|
}, {
|
|
388
388
|
e: void 0,
|
|
@@ -407,14 +407,14 @@ function ue(e) {
|
|
|
407
407
|
var t = se(), n = t.firstChild.nextSibling;
|
|
408
408
|
n.addEventListener("change", (e) => De(e.currentTarget.checked));
|
|
409
409
|
var r = X;
|
|
410
|
-
return typeof r == "function" ? d(r, n) : X = n, i(() => c(n, "aria-label", e.selectionLabel ?? "Select all rows")), i(() => n.checked =
|
|
410
|
+
return typeof r == "function" ? d(r, n) : X = n, i(() => c(n, "aria-label", e.selectionLabel ?? "Select all rows")), i(() => n.checked = te()), t;
|
|
411
411
|
}
|
|
412
412
|
}), null), a(g, n(f, {
|
|
413
413
|
get each() {
|
|
414
|
-
return
|
|
414
|
+
return N();
|
|
415
415
|
},
|
|
416
416
|
children: (r) => (() => {
|
|
417
|
-
var s =
|
|
417
|
+
var s = ce();
|
|
418
418
|
return a(s, n(p, {
|
|
419
419
|
get when() {
|
|
420
420
|
return o(() => !!r.sortable)() && (!u || e.onSort || e.onSortChange);
|
|
@@ -449,21 +449,21 @@ function ue(e) {
|
|
|
449
449
|
return fe();
|
|
450
450
|
},
|
|
451
451
|
children: (r) => (() => {
|
|
452
|
-
var o =
|
|
452
|
+
var o = U();
|
|
453
453
|
return a(o, n(p, {
|
|
454
454
|
get when() {
|
|
455
455
|
return E();
|
|
456
456
|
},
|
|
457
457
|
get children() {
|
|
458
|
-
var t =
|
|
458
|
+
var t = le(), n = t.firstChild;
|
|
459
459
|
return n.addEventListener("change", (e) => Oe(r, e.currentTarget.checked)), i(() => c(n, "aria-label", `Select row ${e.getRowId(r)}`)), i(() => n.checked = ke(r)), t;
|
|
460
460
|
}
|
|
461
461
|
}), null), a(o, n(f, {
|
|
462
462
|
get each() {
|
|
463
|
-
return
|
|
463
|
+
return N();
|
|
464
464
|
},
|
|
465
465
|
children: (e) => (() => {
|
|
466
|
-
var n =
|
|
466
|
+
var n = H();
|
|
467
467
|
return a(n, () => Z(r, e)), i(() => t(n, e.class)), n;
|
|
468
468
|
})()
|
|
469
469
|
}), null), a(o, n(p, {
|
|
@@ -471,7 +471,7 @@ function ue(e) {
|
|
|
471
471
|
return e.rowActions;
|
|
472
472
|
},
|
|
473
473
|
get children() {
|
|
474
|
-
var t =
|
|
474
|
+
var t = H();
|
|
475
475
|
return a(t, () => e.rowActions?.(r)), t;
|
|
476
476
|
}
|
|
477
477
|
}), null), o;
|
|
@@ -481,14 +481,14 @@ function ue(e) {
|
|
|
481
481
|
return s();
|
|
482
482
|
},
|
|
483
483
|
get children() {
|
|
484
|
-
return e.loadingContent ??
|
|
484
|
+
return e.loadingContent ?? W();
|
|
485
485
|
}
|
|
486
486
|
}), null), a(l, n(p, {
|
|
487
487
|
get when() {
|
|
488
488
|
return o(() => !s())() && (e.empty === void 0 ? r().length === 0 : K(e.empty));
|
|
489
489
|
},
|
|
490
490
|
get children() {
|
|
491
|
-
return e.emptyContent ??
|
|
491
|
+
return e.emptyContent ?? G();
|
|
492
492
|
}
|
|
493
493
|
}), null), i(() => t(l, `data-table-wrap${e.class ? ` ${e.class}` : ""}`)), l;
|
|
494
494
|
})();
|
|
@@ -522,7 +522,7 @@ function je(e, t) {
|
|
|
522
522
|
function Q(e) {
|
|
523
523
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function $(e) {
|
|
526
526
|
let [r, l] = S(e, [
|
|
527
527
|
"rows",
|
|
528
528
|
"filters",
|
|
@@ -547,7 +547,7 @@ function Me(e) {
|
|
|
547
547
|
"saveLabel",
|
|
548
548
|
"saveNameLabel",
|
|
549
549
|
"cancelLabel",
|
|
550
|
-
"
|
|
550
|
+
"clearSavedFilterLabel",
|
|
551
551
|
"class"
|
|
552
552
|
]), u = g(() => ke(r.rows)), [m, b] = _(Z(r.defaultFilterValues ?? {})), x = g(() => r.filterValues === void 0 ? m() : Z(ke(r.filterValues)));
|
|
553
553
|
function C(e) {
|
|
@@ -564,7 +564,7 @@ function Me(e) {
|
|
|
564
564
|
function ee(e, t) {
|
|
565
565
|
return t.getValue ? t.getValue(e) : e[t.key];
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function te(e, t, n) {
|
|
568
568
|
if (t.match) return t.match(e, n);
|
|
569
569
|
let r = ee(e, t);
|
|
570
570
|
if (t.type === "select") {
|
|
@@ -573,13 +573,13 @@ function Me(e) {
|
|
|
573
573
|
}
|
|
574
574
|
return t.type === "boolean" ? !!r == (n === "true") : Q(r).toLowerCase().includes(Q(n).toLowerCase());
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function D(e) {
|
|
577
577
|
return r.getSearchText ? r.getSearchText(e) : l.columns.map((t) => Q(t.sortValue?.(e) ?? e[t.key])).join(" ");
|
|
578
578
|
}
|
|
579
579
|
let ne = g(() => {
|
|
580
580
|
if (r.manualFiltering) return u();
|
|
581
581
|
let e = T().toLowerCase(), t = E();
|
|
582
|
-
return u().filter((n) => (e === "" ||
|
|
582
|
+
return u().filter((n) => (e === "" || D(n).toLowerCase().includes(e)) && t.every((e) => te(n, e, x()[e.key])));
|
|
583
583
|
});
|
|
584
584
|
function re(e) {
|
|
585
585
|
if (e.options) return e.options;
|
|
@@ -611,37 +611,34 @@ function Me(e) {
|
|
|
611
611
|
let n = x()[e.key];
|
|
612
612
|
w(e.key, Array.isArray(n) ? n.filter((e) => e !== t) : "");
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function A() {
|
|
615
615
|
C({ [Oe]: T() });
|
|
616
616
|
}
|
|
617
|
-
let
|
|
617
|
+
let j = g(() => r.savedFilters === void 0 ? void 0 : ke(r.savedFilters)), M = g(() => j()?.find((e) => je(Z(e.values), x()))), [P, F] = _(!1), [I, ae] = _("");
|
|
618
618
|
function L(e) {
|
|
619
|
-
let t =
|
|
619
|
+
let t = j()?.find((t) => t.name === e);
|
|
620
620
|
t && C(t.values);
|
|
621
621
|
}
|
|
622
622
|
function oe() {
|
|
623
|
-
|
|
623
|
+
ae(M()?.name ?? ""), F(!0);
|
|
624
624
|
}
|
|
625
625
|
function se(e) {
|
|
626
626
|
e.preventDefault();
|
|
627
|
-
let t =
|
|
627
|
+
let t = I().trim();
|
|
628
628
|
if (t === "") return;
|
|
629
|
-
let n = (
|
|
629
|
+
let n = (j() ?? []).filter((e) => e.name !== t);
|
|
630
630
|
r.onSavedFiltersChange?.([...n, {
|
|
631
631
|
name: t,
|
|
632
632
|
values: x()
|
|
633
|
-
}]),
|
|
634
|
-
}
|
|
635
|
-
function R(e) {
|
|
636
|
-
r.onSavedFiltersChange?.((A() ?? []).filter((t) => t.name !== e));
|
|
633
|
+
}]), F(!1);
|
|
637
634
|
}
|
|
638
|
-
let [
|
|
639
|
-
h(y(x, (e) =>
|
|
640
|
-
function
|
|
641
|
-
return
|
|
635
|
+
let [R, z] = _(x());
|
|
636
|
+
h(y(x, (e) => z(e)));
|
|
637
|
+
function B(e) {
|
|
638
|
+
return R()[e];
|
|
642
639
|
}
|
|
643
|
-
function
|
|
644
|
-
|
|
640
|
+
function V(e, t) {
|
|
641
|
+
z((n) => ({
|
|
645
642
|
...n,
|
|
646
643
|
[e]: t
|
|
647
644
|
}));
|
|
@@ -653,42 +650,42 @@ function Me(e) {
|
|
|
653
650
|
name: e,
|
|
654
651
|
filters: t
|
|
655
652
|
}));
|
|
656
|
-
}),
|
|
657
|
-
function
|
|
658
|
-
e === "filters" &&
|
|
653
|
+
}), le = v(), H = ["results", "filters"], [U, W] = _("results"), G = (e) => `${le}-tab-${e}`, K = (e) => `${le}-panel-${e}`, $ = (e) => `${le}-filter-${e}`;
|
|
654
|
+
function Me(e) {
|
|
655
|
+
e === "filters" && z(x()), W(e);
|
|
659
656
|
}
|
|
660
|
-
function
|
|
657
|
+
function Ne(e) {
|
|
661
658
|
let t = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
662
659
|
if (t === 0) return;
|
|
663
660
|
e.preventDefault();
|
|
664
|
-
let n =
|
|
665
|
-
|
|
661
|
+
let n = H[(H.indexOf(U()) + t + H.length) % H.length];
|
|
662
|
+
Me(n), document.getElementById(G(n))?.focus();
|
|
666
663
|
}
|
|
667
|
-
function
|
|
668
|
-
e.preventDefault(), C(
|
|
664
|
+
function Pe(e) {
|
|
665
|
+
e.preventDefault(), C(R()), W("results");
|
|
669
666
|
}
|
|
670
|
-
function
|
|
671
|
-
|
|
667
|
+
function Fe() {
|
|
668
|
+
A(), W("results");
|
|
672
669
|
}
|
|
673
|
-
function
|
|
670
|
+
function Ie(e) {
|
|
674
671
|
if (e.type === "text") return (() => {
|
|
675
672
|
var t = fe();
|
|
676
|
-
return t.$$input = (t) =>
|
|
673
|
+
return t.$$input = (t) => V(e.key, t.currentTarget.value), i((n) => {
|
|
677
674
|
var r = $(e.key), i = e.placeholder;
|
|
678
675
|
return r !== n.e && c(t, "id", n.e = r), i !== n.t && c(t, "placeholder", n.t = i), n;
|
|
679
676
|
}, {
|
|
680
677
|
e: void 0,
|
|
681
678
|
t: void 0
|
|
682
|
-
}), i(() => t.value = Q(
|
|
679
|
+
}), i(() => t.value = Q(B(e.key))), t;
|
|
683
680
|
})();
|
|
684
|
-
if (e.type === "boolean") return n(
|
|
681
|
+
if (e.type === "boolean") return n(N, {
|
|
685
682
|
get id() {
|
|
686
683
|
return $(e.key);
|
|
687
684
|
},
|
|
688
685
|
get value() {
|
|
689
|
-
return Q(
|
|
686
|
+
return Q(B(e.key));
|
|
690
687
|
},
|
|
691
|
-
onChange: (t) =>
|
|
688
|
+
onChange: (t) => V(e.key, t),
|
|
692
689
|
get emptyLabel() {
|
|
693
690
|
return r.anyLabel ?? "Any";
|
|
694
691
|
},
|
|
@@ -703,17 +700,17 @@ function Me(e) {
|
|
|
703
700
|
}
|
|
704
701
|
});
|
|
705
702
|
let t = () => {
|
|
706
|
-
let t =
|
|
703
|
+
let t = B(e.key);
|
|
707
704
|
return Array.isArray(t) ? t : [];
|
|
708
705
|
};
|
|
709
706
|
return (() => {
|
|
710
707
|
var o = me();
|
|
711
|
-
return a(o, n(
|
|
708
|
+
return a(o, n(N, {
|
|
712
709
|
get id() {
|
|
713
710
|
return $(e.key);
|
|
714
711
|
},
|
|
715
712
|
value: "",
|
|
716
|
-
onChange: (n) =>
|
|
713
|
+
onChange: (n) => V(e.key, [...t(), n]),
|
|
717
714
|
get options() {
|
|
718
715
|
return re(e).filter((e) => !t().includes(String(e.value)));
|
|
719
716
|
},
|
|
@@ -732,7 +729,7 @@ function Me(e) {
|
|
|
732
729
|
},
|
|
733
730
|
children: (r) => (() => {
|
|
734
731
|
var o = he(), s = o.firstChild;
|
|
735
|
-
return a(o, () => O(e, r), s), s.$$click = () =>
|
|
732
|
+
return a(o, () => O(e, r), s), s.$$click = () => V(e.key, t().filter((e) => e !== r)), a(s, n(J, {
|
|
736
733
|
size: 12,
|
|
737
734
|
"aria-hidden": "true"
|
|
738
735
|
})), i(() => c(s, "aria-label", `Remove ${O(e, r)}`)), o;
|
|
@@ -742,7 +739,7 @@ function Me(e) {
|
|
|
742
739
|
}), null), o;
|
|
743
740
|
})();
|
|
744
741
|
}
|
|
745
|
-
let
|
|
742
|
+
let Le = (() => {
|
|
746
743
|
var e = xe();
|
|
747
744
|
return a(e, n(p, {
|
|
748
745
|
get when() {
|
|
@@ -764,17 +761,17 @@ function Me(e) {
|
|
|
764
761
|
}
|
|
765
762
|
}), null), a(e, n(p, {
|
|
766
763
|
get when() {
|
|
767
|
-
return (
|
|
764
|
+
return (j()?.length ?? 0) > 0;
|
|
768
765
|
},
|
|
769
766
|
get children() {
|
|
770
767
|
var e = _e();
|
|
771
|
-
return a(e, n(
|
|
768
|
+
return a(e, n(N, {
|
|
772
769
|
get value() {
|
|
773
|
-
return
|
|
770
|
+
return M()?.name ?? "";
|
|
774
771
|
},
|
|
775
772
|
onChange: L,
|
|
776
773
|
get options() {
|
|
777
|
-
return (
|
|
774
|
+
return (j() ?? []).map((e) => ({
|
|
778
775
|
value: e.name,
|
|
779
776
|
label: e.name
|
|
780
777
|
}));
|
|
@@ -787,14 +784,14 @@ function Me(e) {
|
|
|
787
784
|
}
|
|
788
785
|
}), null), a(e, n(p, {
|
|
789
786
|
get when() {
|
|
790
|
-
return
|
|
787
|
+
return M();
|
|
791
788
|
},
|
|
792
789
|
children: (e) => (() => {
|
|
793
790
|
var t = Se();
|
|
794
|
-
return t.$$click =
|
|
791
|
+
return t.$$click = A, a(t, n(J, {
|
|
795
792
|
size: 14,
|
|
796
793
|
"aria-hidden": "true"
|
|
797
|
-
})), i(() => c(t, "aria-label", `${r.
|
|
794
|
+
})), i(() => c(t, "aria-label", `${r.clearSavedFilterLabel ?? "Clear saved filter"} ${e().name}`)), t;
|
|
798
795
|
})()
|
|
799
796
|
}), null), e;
|
|
800
797
|
}
|
|
@@ -815,9 +812,9 @@ function Me(e) {
|
|
|
815
812
|
"aria-hidden": "true"
|
|
816
813
|
}), null), i(() => c(r, "aria-label", `Remove filter ${e.text}`)), t;
|
|
817
814
|
})()
|
|
818
|
-
}), t), s.$$click =
|
|
815
|
+
}), t), s.$$click = A, a(s, () => r.clearAllLabel ?? "Clear all"), a(e, n(p, {
|
|
819
816
|
get when() {
|
|
820
|
-
return o(() =>
|
|
817
|
+
return o(() => j() !== void 0)() && !P();
|
|
821
818
|
},
|
|
822
819
|
get children() {
|
|
823
820
|
var e = ve(), t = e.firstChild;
|
|
@@ -830,32 +827,32 @@ function Me(e) {
|
|
|
830
827
|
}
|
|
831
828
|
}), null), a(e, n(p, {
|
|
832
829
|
get when() {
|
|
833
|
-
return o(() => !!
|
|
830
|
+
return o(() => !!P())() && k().length > 0;
|
|
834
831
|
},
|
|
835
832
|
get children() {
|
|
836
833
|
var e = be(), t = e.firstChild, o = t.nextSibling, s = o.nextSibling;
|
|
837
834
|
return e.$$keydown = (e) => {
|
|
838
|
-
e.key === "Escape" &&
|
|
839
|
-
}, e.addEventListener("submit", se), t.$$input = (e) =>
|
|
835
|
+
e.key === "Escape" && F(!1);
|
|
836
|
+
}, e.addEventListener("submit", se), t.$$input = (e) => ae(e.currentTarget.value), d((e) => queueMicrotask(() => e.focus()), t), a(o, n(de, {
|
|
840
837
|
size: 16,
|
|
841
838
|
"aria-hidden": "true"
|
|
842
|
-
}), null), a(o, () => r.saveLabel ?? "Save", null), s.$$click = () =>
|
|
839
|
+
}), null), a(o, () => r.saveLabel ?? "Save", null), s.$$click = () => F(!1), a(s, () => r.cancelLabel ?? "Cancel"), i((e) => {
|
|
843
840
|
var n = r.saveNameLabel ?? "Filter name", i = r.saveNameLabel ?? "Filter name";
|
|
844
841
|
return n !== e.e && c(t, "aria-label", e.e = n), i !== e.t && c(t, "placeholder", e.t = i), e;
|
|
845
842
|
}, {
|
|
846
843
|
e: void 0,
|
|
847
844
|
t: void 0
|
|
848
|
-
}), i(() => t.value =
|
|
845
|
+
}), i(() => t.value = I()), e;
|
|
849
846
|
}
|
|
850
847
|
}), null), e;
|
|
851
848
|
})();
|
|
852
849
|
return (() => {
|
|
853
850
|
var e = we(), o = e.firstChild, u = o.nextSibling, d = u.nextSibling, m = d.firstChild, h = m.firstChild, g = h.firstChild, _ = g.nextSibling;
|
|
854
851
|
return a(o, n(f, {
|
|
855
|
-
each:
|
|
852
|
+
each: H,
|
|
856
853
|
children: (e) => (() => {
|
|
857
854
|
var t = Ee();
|
|
858
|
-
return t.$$keydown =
|
|
855
|
+
return t.$$keydown = Ne, t.$$click = () => Me(e), a(t, () => e === "results" ? r.resultsLabel ?? "Results" : r.filtersLabel ?? "Filters", null), a(t, n(p, {
|
|
859
856
|
get when() {
|
|
860
857
|
return e === "results" || E().length > 0;
|
|
861
858
|
},
|
|
@@ -864,7 +861,7 @@ function Me(e) {
|
|
|
864
861
|
return a(t, () => e === "results" ? ne().length : E().length), t;
|
|
865
862
|
}
|
|
866
863
|
}), null), i((n) => {
|
|
867
|
-
var r =
|
|
864
|
+
var r = G(e), i = U() === e, a = K(e), o = U() === e ? 0 : -1;
|
|
868
865
|
return r !== n.e && c(t, "id", n.e = r), i !== n.t && c(t, "aria-selected", n.t = i), a !== n.a && c(t, "aria-controls", n.a = a), o !== n.o && c(t, "tabindex", n.o = o), n;
|
|
869
866
|
}, {
|
|
870
867
|
e: void 0,
|
|
@@ -875,8 +872,8 @@ function Me(e) {
|
|
|
875
872
|
})()
|
|
876
873
|
})), a(u, n(ue, s(l, {
|
|
877
874
|
rows: ne,
|
|
878
|
-
toolbar:
|
|
879
|
-
}))), m.addEventListener("submit",
|
|
875
|
+
toolbar: Le
|
|
876
|
+
}))), m.addEventListener("submit", Pe), a(m, n(f, {
|
|
880
877
|
get each() {
|
|
881
878
|
return ce();
|
|
882
879
|
},
|
|
@@ -896,18 +893,18 @@ function Me(e) {
|
|
|
896
893
|
},
|
|
897
894
|
children: (e) => (() => {
|
|
898
895
|
var t = De(), n = t.firstChild;
|
|
899
|
-
return a(n, () => e.label), a(t, () =>
|
|
896
|
+
return a(n, () => e.label), a(t, () => Ie(e), null), i(() => c(n, "for", $(e.key))), t;
|
|
900
897
|
})()
|
|
901
898
|
}), null), t;
|
|
902
899
|
})()
|
|
903
|
-
}), h), g.$$click =
|
|
900
|
+
}), h), g.$$click = Fe, a(g, n(J, {
|
|
904
901
|
size: 16,
|
|
905
902
|
"aria-hidden": "true"
|
|
906
903
|
}), null), a(g, () => r.resetLabel ?? "Reset", null), a(_, n(q, {
|
|
907
904
|
size: 16,
|
|
908
905
|
"aria-hidden": "true"
|
|
909
906
|
}), null), a(_, () => r.applyLabel ?? "Search", null), i((n) => {
|
|
910
|
-
var i = `filter-table${r.class ? ` ${r.class}` : ""}`, a =
|
|
907
|
+
var i = `filter-table${r.class ? ` ${r.class}` : ""}`, a = K("results"), o = G("results"), s = U() !== "results", l = K("filters"), f = G("filters"), p = U() !== "filters";
|
|
911
908
|
return i !== n.e && t(e, n.e = i), a !== n.t && c(u, "id", n.t = a), o !== n.a && c(u, "aria-labelledby", n.a = o), s !== n.o && (u.hidden = n.o = s), l !== n.i && c(d, "id", n.i = l), f !== n.n && c(d, "aria-labelledby", n.n = f), p !== n.s && (d.hidden = n.s = p), n;
|
|
912
909
|
}, {
|
|
913
910
|
e: void 0,
|
|
@@ -927,7 +924,7 @@ r([
|
|
|
927
924
|
]);
|
|
928
925
|
//#endregion
|
|
929
926
|
//#region src/search-bar.tsx
|
|
930
|
-
var
|
|
927
|
+
var Me = /*#__PURE__*/ u("<kbd class=search-bar-shortcut>"), Ne = /*#__PURE__*/ u("<button type=button class=search-bar-clear>"), Pe = /*#__PURE__*/ u("<div><input class=search-bar-input>");
|
|
931
928
|
function Fe(e) {
|
|
932
929
|
let r, s = () => e.shortcutKey ?? "k", l = () => e.shortcutLabel ?? `Ctrl ${String(s()).toUpperCase()}`;
|
|
933
930
|
return x(() => {
|
|
@@ -949,7 +946,7 @@ function Fe(e) {
|
|
|
949
946
|
return o(() => !e.value)() && s() !== !1;
|
|
950
947
|
},
|
|
951
948
|
get children() {
|
|
952
|
-
var e =
|
|
949
|
+
var e = Me();
|
|
953
950
|
return a(e, l), e;
|
|
954
951
|
}
|
|
955
952
|
}), null), a(u, n(p, {
|
|
@@ -976,4 +973,4 @@ function Fe(e) {
|
|
|
976
973
|
}
|
|
977
974
|
r(["input", "click"]);
|
|
978
975
|
//#endregion
|
|
979
|
-
export {
|
|
976
|
+
export { N as Combobox, ue as DataTable, $ as FilterTable, Fe as SearchBar };
|