@serkonda7/solid-components 0.0.8 → 0.2.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/README.md +11 -0
- package/dist/combobox.d.ts +2 -0
- package/dist/data-table.d.ts +8 -0
- package/dist/filter-table.d.ts +70 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +675 -140
- package/dist/search-bar.d.ts +25 -0
- package/dist/styles.css +440 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +2 -0
- package/package.json +24 -14
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dynamic as e, className as t, createComponent as n, delegateEvents as r, effect as i, insert as a, memo as o, mergeProps as s, setAttribute as c, spread as l, template as u, use as d } from "solid-js/web";
|
|
2
|
-
import { For as f, Show as p,
|
|
2
|
+
import { For as f, Show as p, children as m, createEffect as h, createMemo as g, createSignal as _, createUniqueId as v, on as y, onCleanup as b, onMount as x, splitProps as S } from "solid-js";
|
|
3
3
|
//#region node_modules/@tabler/icons-solidjs/dist/source/defaultAttributes.js
|
|
4
|
-
var
|
|
4
|
+
var C = {
|
|
5
5
|
outline: {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: 24,
|
|
@@ -21,9 +21,9 @@ var x = {
|
|
|
21
21
|
fill: "currentColor",
|
|
22
22
|
stroke: "none"
|
|
23
23
|
}
|
|
24
|
-
},
|
|
24
|
+
}, w = /*#__PURE__*/ u("<svg>"), T = /*#__PURE__*/ u("<title>"), E = (t, r, i, c) => {
|
|
25
25
|
let u = (i) => {
|
|
26
|
-
let [u, d] =
|
|
26
|
+
let [u, d] = S(i, [
|
|
27
27
|
"color",
|
|
28
28
|
"size",
|
|
29
29
|
"stroke",
|
|
@@ -31,9 +31,9 @@ var x = {
|
|
|
31
31
|
"title",
|
|
32
32
|
"children",
|
|
33
33
|
"class"
|
|
34
|
-
]), f =
|
|
34
|
+
]), f = C[t], p = u.stroke ?? u.strokeWidth;
|
|
35
35
|
return (() => {
|
|
36
|
-
var i =
|
|
36
|
+
var i = w();
|
|
37
37
|
return l(i, s(f, d, {
|
|
38
38
|
get width() {
|
|
39
39
|
return o(() => u.size != null)() ? u.size : f.width;
|
|
@@ -50,66 +50,62 @@ var x = {
|
|
|
50
50
|
}), !0, !0), a(i, (() => {
|
|
51
51
|
var e = o(() => u.title != null);
|
|
52
52
|
return () => e() && (() => {
|
|
53
|
-
var e =
|
|
53
|
+
var e = T();
|
|
54
54
|
return a(e, () => u.title), e;
|
|
55
55
|
})();
|
|
56
56
|
})(), null), a(i, () => c.map(([t, r]) => n(e, s({ component: t }, r))), null), a(i, () => u.children, null), i;
|
|
57
57
|
})();
|
|
58
58
|
};
|
|
59
59
|
return u.displayName = `${i}`, u;
|
|
60
|
-
},
|
|
61
|
-
function
|
|
62
|
-
let s, l, u =
|
|
60
|
+
}, ee = E("outline", "chevron-down", "ChevronDown", [["path", { d: "M6 9l6 6l6 -6" }]]), D = E("outline", "plus", "Plus", [["path", { d: "M12 5l0 14" }], ["path", { d: "M5 12l14 0" }]]), te = /*#__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>"), ae = /*#__PURE__*/ u("<span class=combobox-detail>"), A = /*#__PURE__*/ u("<div role=option class=combobox-option><span class=combobox-option-label>"), j = /*#__PURE__*/ u("<span class=combobox-option-icon aria-hidden=true>");
|
|
61
|
+
function M(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, M] = _(0), N = g(() => r.emptyLabel === void 0 ? r.options : [{
|
|
63
63
|
value: "",
|
|
64
64
|
label: r.emptyLabel
|
|
65
|
-
}, ...r.options]),
|
|
65
|
+
}, ...r.options]), P = g(() => r.value === "" ? void 0 : N().find((e) => String(e.value) === r.value)), F = g(() => {
|
|
66
66
|
let e = w().trim().toLowerCase();
|
|
67
|
-
return e === "" ?
|
|
68
|
-
}),
|
|
69
|
-
|
|
67
|
+
return e === "" ? N() : N().filter((t) => t.label.toLowerCase().includes(e) || (t.detail?.toLowerCase().includes(e) ?? !1));
|
|
68
|
+
}), I = () => r.options.some((e) => e.detail !== void 0), L = () => F().length, oe = () => F().length + +!!r.onAdd, se = () => !r.disabled && r.onChange !== void 0;
|
|
69
|
+
x(() => {
|
|
70
70
|
r.autofocus === !0 && s?.focus();
|
|
71
|
-
}),
|
|
72
|
-
S() && l?.querySelector(`[data-index="${
|
|
71
|
+
}), h(() => {
|
|
72
|
+
S() && l?.querySelector(`[data-index="${E()}"]`)?.scrollIntoView({ block: "nearest" });
|
|
73
73
|
});
|
|
74
|
-
function
|
|
75
|
-
if (S() || !
|
|
76
|
-
|
|
77
|
-
let e =
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
function
|
|
81
|
-
if (C(!1), r.onAdd && e ===
|
|
74
|
+
function R() {
|
|
75
|
+
if (S() || !se()) return;
|
|
76
|
+
T("");
|
|
77
|
+
let e = N().findIndex((e) => String(e.value) === r.value);
|
|
78
|
+
M(Math.max(e, 0)), C(!0), r.onOpen?.();
|
|
79
|
+
}
|
|
80
|
+
function z(e) {
|
|
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 = F()[e];
|
|
86
86
|
t && String(t.value) !== r.value && r.onChange?.(String(t.value));
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let t =
|
|
90
|
-
S() ? t > 0 &&
|
|
88
|
+
function B(e) {
|
|
89
|
+
let t = oe();
|
|
90
|
+
S() ? t > 0 && M((E() + e + t) % t) : R();
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
e.preventDefault(), W(e.key === "ArrowDown" ? 1 : -1);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
S() && (e.key === "Enter" ? (e.preventDefault(), U(F())) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), C(!1)));
|
|
92
|
+
function V(e) {
|
|
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)));
|
|
98
94
|
}
|
|
99
|
-
let
|
|
95
|
+
let H = () => S() ? P()?.label ?? r.emptyLabel ?? r.searchLabel ?? "Search" : r.emptyLabel ?? r.placeholder;
|
|
100
96
|
return (() => {
|
|
101
|
-
var u =
|
|
102
|
-
|
|
97
|
+
var u = O(), h = u.firstChild;
|
|
98
|
+
h.addEventListener("blur", () => C(!1)), h.$$keydown = V, h.$$input = (e) => {
|
|
103
99
|
let t = e.currentTarget.value;
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
var
|
|
107
|
-
return typeof
|
|
100
|
+
R(), T(t), M(0);
|
|
101
|
+
}, h.$$click = R;
|
|
102
|
+
var g = s;
|
|
103
|
+
return typeof g == "function" ? d(g, h) : s = h, a(u, n(p, {
|
|
108
104
|
get when() {
|
|
109
|
-
return o(() => !S())() &&
|
|
105
|
+
return o(() => !S())() && P()?.icon;
|
|
110
106
|
},
|
|
111
107
|
children: (t) => (() => {
|
|
112
|
-
var r =
|
|
108
|
+
var r = k();
|
|
113
109
|
return a(r, n(e, {
|
|
114
110
|
get component() {
|
|
115
111
|
return t();
|
|
@@ -119,13 +115,13 @@ function P(r) {
|
|
|
119
115
|
})()
|
|
120
116
|
}), null), a(u, n(p, {
|
|
121
117
|
get when() {
|
|
122
|
-
return o(() => !S())() &&
|
|
118
|
+
return o(() => !S())() && P()?.detail;
|
|
123
119
|
},
|
|
124
120
|
get children() {
|
|
125
|
-
var e =
|
|
126
|
-
return a(t, () =>
|
|
121
|
+
var e = te(), t = e.firstChild, n = t.nextSibling;
|
|
122
|
+
return a(t, () => P()?.label), a(n, () => P()?.detail), e;
|
|
127
123
|
}
|
|
128
|
-
}), null), a(u, n(
|
|
124
|
+
}), null), a(u, n(ee, {
|
|
129
125
|
class: "combobox-chevron",
|
|
130
126
|
size: 16,
|
|
131
127
|
"aria-hidden": "true"
|
|
@@ -134,25 +130,25 @@ function P(r) {
|
|
|
134
130
|
return S();
|
|
135
131
|
},
|
|
136
132
|
get children() {
|
|
137
|
-
var t =
|
|
133
|
+
var t = re(), o = l;
|
|
138
134
|
return typeof o == "function" ? d(o, t) : l = t, a(t, n(f, {
|
|
139
135
|
get each() {
|
|
140
|
-
return
|
|
136
|
+
return F();
|
|
141
137
|
},
|
|
142
138
|
get fallback() {
|
|
143
139
|
return (() => {
|
|
144
|
-
var e =
|
|
140
|
+
var e = ie();
|
|
145
141
|
return a(e, () => r.noMatchesLabel ?? "No matching objects"), e;
|
|
146
142
|
})();
|
|
147
143
|
},
|
|
148
144
|
children: (t, o) => (() => {
|
|
149
|
-
var s =
|
|
150
|
-
return s.$$click = () =>
|
|
145
|
+
var s = A(), l = s.firstChild;
|
|
146
|
+
return s.$$click = () => z(o()), s.$$mousemove = () => M(o()), s.$$mousedown = (e) => e.preventDefault(), a(l, n(p, {
|
|
151
147
|
get when() {
|
|
152
148
|
return t.icon;
|
|
153
149
|
},
|
|
154
150
|
children: (t) => (() => {
|
|
155
|
-
var r =
|
|
151
|
+
var r = j();
|
|
156
152
|
return a(r, n(e, {
|
|
157
153
|
get component() {
|
|
158
154
|
return t();
|
|
@@ -165,11 +161,11 @@ function P(r) {
|
|
|
165
161
|
return t.detail;
|
|
166
162
|
},
|
|
167
163
|
get children() {
|
|
168
|
-
var e =
|
|
164
|
+
var e = ae();
|
|
169
165
|
return a(e, () => t.detail), e;
|
|
170
166
|
}
|
|
171
167
|
}), null), i((e) => {
|
|
172
|
-
var n =
|
|
168
|
+
var n = b(o()), i = o(), a = String(t.value) === r.value, l = o() === E(), u = t.value === "";
|
|
173
169
|
return n !== e.e && c(s, "id", e.e = n), i !== e.t && c(s, "data-index", e.t = i), a !== e.a && c(s, "aria-selected", e.a = a), l !== e.o && s.classList.toggle("combobox-option-active", e.o = l), u !== e.i && s.classList.toggle("combobox-option-empty", e.i = u), e;
|
|
174
170
|
}, {
|
|
175
171
|
e: void 0,
|
|
@@ -184,12 +180,12 @@ function P(r) {
|
|
|
184
180
|
return r.onAdd;
|
|
185
181
|
},
|
|
186
182
|
get children() {
|
|
187
|
-
var e =
|
|
188
|
-
return e.$$click = () =>
|
|
183
|
+
var e = ne();
|
|
184
|
+
return e.$$click = () => z(L()), e.$$mousemove = () => M(L()), e.$$mousedown = (e) => e.preventDefault(), c(e, "aria-selected", !1), a(e, n(D, {
|
|
189
185
|
size: 14,
|
|
190
186
|
"aria-hidden": "true"
|
|
191
187
|
}), null), a(e, () => r.addLabel ?? "Add", null), i((t) => {
|
|
192
|
-
var n =
|
|
188
|
+
var n = b(L()), r = L(), i = L() === E();
|
|
193
189
|
return n !== t.e && c(e, "id", t.e = n), r !== t.t && c(e, "data-index", t.t = r), i !== t.a && e.classList.toggle("combobox-option-active", t.a = i), t;
|
|
194
190
|
}, {
|
|
195
191
|
e: void 0,
|
|
@@ -198,7 +194,7 @@ function P(r) {
|
|
|
198
194
|
}), e;
|
|
199
195
|
}
|
|
200
196
|
}), null), i((e) => {
|
|
201
|
-
var n = !!
|
|
197
|
+
var n = !!I(), r = y();
|
|
202
198
|
return n !== e.e && t.classList.toggle("combobox-list-detail", e.e = n), r !== e.t && c(t, "id", e.t = r), e;
|
|
203
199
|
}, {
|
|
204
200
|
e: void 0,
|
|
@@ -206,8 +202,8 @@ function P(r) {
|
|
|
206
202
|
}), t;
|
|
207
203
|
}
|
|
208
204
|
}), null), i((e) => {
|
|
209
|
-
var n = r.class ? `combobox ${r.class}` : "combobox", i = !!S(), a = !(S() || !
|
|
210
|
-
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(
|
|
205
|
+
var n = r.class ? `combobox ${r.class}` : "combobox", i = !!S(), a = !(S() || !P()?.detail), o = !(S() || P()?.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 = H();
|
|
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;
|
|
211
207
|
}, {
|
|
212
208
|
e: void 0,
|
|
213
209
|
t: void 0,
|
|
@@ -224,7 +220,7 @@ function P(r) {
|
|
|
224
220
|
c: void 0,
|
|
225
221
|
w: void 0,
|
|
226
222
|
m: void 0
|
|
227
|
-
}), i(() =>
|
|
223
|
+
}), i(() => h.value = S() ? w() : P()?.label ?? ""), u;
|
|
228
224
|
})();
|
|
229
225
|
}
|
|
230
226
|
r([
|
|
@@ -235,132 +231,190 @@ r([
|
|
|
235
231
|
"mousemove"
|
|
236
232
|
]);
|
|
237
233
|
//#endregion
|
|
238
|
-
//#region
|
|
239
|
-
var F = /*#__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>"),
|
|
234
|
+
//#region node_modules/@tabler/icons-solidjs/dist/source/icons/IconChevronUp.js
|
|
235
|
+
var N = E("outline", "chevron-up", "ChevronUp", [["path", { d: "M6 15l6 -6l6 6" }]]), P = E("outline", "menu", "Menu", [["path", { d: "M4 8l16 0" }], ["path", { d: "M4 16l16 0" }]]), F = /*#__PURE__*/ u("<div class=data-table-toolbar-start>"), I = /*#__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>"), H = /*#__PURE__*/ u("<th>"), ce = /*#__PURE__*/ u("<td class=data-table-checkbox><input type=checkbox>"), U = /*#__PURE__*/ u("<td>"), W = /*#__PURE__*/ u("<tr>"), G = /*#__PURE__*/ u("<p class=data-table-status>Loading…"), le = /*#__PURE__*/ u("<p class=data-table-status>No results.");
|
|
240
236
|
function K(e) {
|
|
241
237
|
return typeof e == "function" ? e() : e;
|
|
242
238
|
}
|
|
243
|
-
function
|
|
244
|
-
let r =
|
|
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, D = () => {
|
|
245
241
|
let t = l();
|
|
246
242
|
return r().length > 0 && r().every((n) => t.includes(e.getRowId(n)));
|
|
247
|
-
},
|
|
248
|
-
function
|
|
243
|
+
}, te = g(() => e.defaultVisibleColumns ?? e.columns.filter((e) => e.defaultVisible !== !1).map((e) => e.key)), [ne, re] = _(void 0), O = () => e.visibleColumns === void 0 ? ne() ?? te() : K(e.visibleColumns), k = g(() => new Set(O())), [ie, ae] = _(void 0);
|
|
244
|
+
function A(t) {
|
|
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
|
+
return [...r, ...e.columns.filter((e) => !i.has(e))];
|
|
247
|
+
}
|
|
248
|
+
let j = g(() => A(e.columnOrder === void 0 ? ie() ?? e.defaultColumnOrder ?? [] : K(e.columnOrder))), M = g(() => j().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
|
+
function q(e, t) {
|
|
249
250
|
return t.sortValue ? t.sortValue(e) : e[t.key];
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
+
function J(e, t) {
|
|
252
253
|
return e === t ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t), void 0, { numeric: !0 });
|
|
253
254
|
}
|
|
254
|
-
let
|
|
255
|
-
let t = r(), n =
|
|
255
|
+
let fe = g(() => {
|
|
256
|
+
let t = r(), n = S();
|
|
256
257
|
if (u || !n) return t;
|
|
257
258
|
let i = e.columns.find((e) => e.key === n);
|
|
258
259
|
if (!i) return t;
|
|
259
|
-
let a =
|
|
260
|
-
return [...t].sort((e, t) => a *
|
|
260
|
+
let a = C() === "asc" ? 1 : -1;
|
|
261
|
+
return [...t].sort((e, t) => a * J(q(e, i), q(t, i)));
|
|
261
262
|
});
|
|
262
|
-
function
|
|
263
|
-
let n =
|
|
263
|
+
function pe(t) {
|
|
264
|
+
let n = S() === t, r = n && C() === "desc" ? void 0 : {
|
|
264
265
|
key: t,
|
|
265
266
|
direction: n ? "desc" : "asc"
|
|
266
267
|
};
|
|
267
|
-
u ||
|
|
268
|
+
u || x(r), e.onSort?.(t), r || e.onSortClear?.(), e.onSortChange?.(r);
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
+
function me(t) {
|
|
270
271
|
let n = new Map(e.columns.map((e, t) => [e.key, t]));
|
|
271
272
|
return [...t].sort((e, t) => (n.get(e) ?? 0) - (n.get(t) ?? 0));
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
-
let n =
|
|
275
|
-
e.visibleColumns === void 0 &&
|
|
274
|
+
function he(t) {
|
|
275
|
+
let n = me(t);
|
|
276
|
+
e.visibleColumns === void 0 && re(n), e.onVisibleColumnsChange?.(n);
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
+
function ge(e, t) {
|
|
278
279
|
let n = new Set(O());
|
|
279
|
-
t ? n.add(e) : n.delete(e),
|
|
280
|
+
t ? n.add(e) : n.delete(e), he(de().filter((e) => n.has(e)));
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
-
|
|
282
|
+
function _e() {
|
|
283
|
+
he(de());
|
|
284
|
+
}
|
|
285
|
+
function ve(t) {
|
|
286
|
+
e.columnOrder === void 0 && ae(t), e.onColumnOrderChange?.(t);
|
|
283
287
|
}
|
|
284
|
-
function
|
|
285
|
-
|
|
288
|
+
function ye(e, t) {
|
|
289
|
+
let n = j().map((e) => e.key), r = n.indexOf(e);
|
|
290
|
+
r === -1 || t < 0 || t >= n.length || t === r || (n.splice(r, 1), n.splice(t, 0, e), ve(n));
|
|
286
291
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
292
|
+
function be(e, t, n) {
|
|
293
|
+
ye(t, j().findIndex((e) => e.key === t) + n);
|
|
294
|
+
let r = e.parentElement?.querySelectorAll(".data-table-customizer-move");
|
|
295
|
+
(e.disabled ? [...r ?? []].find((e) => !e.disabled) : e)?.focus();
|
|
296
|
+
}
|
|
297
|
+
function xe() {
|
|
298
|
+
he(te()), ve(A(e.defaultColumnOrder ?? []).map((e) => e.key));
|
|
299
|
+
}
|
|
300
|
+
let [Se, Ce] = _(), we = `${v()}-panel`, [Te, Ee] = _(!1), Y;
|
|
301
|
+
h(() => {
|
|
302
|
+
if (!Te() || !w()) return;
|
|
290
303
|
function e(e) {
|
|
291
|
-
|
|
304
|
+
Y && !Y.contains(e.target) && Ee(!1);
|
|
292
305
|
}
|
|
293
306
|
function t(e) {
|
|
294
|
-
e.key === "Escape" &&
|
|
307
|
+
e.key === "Escape" && Ee(!1);
|
|
295
308
|
}
|
|
296
|
-
document.addEventListener("pointerdown", e), document.addEventListener("keydown", t),
|
|
309
|
+
document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), b(() => {
|
|
297
310
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
298
311
|
});
|
|
299
312
|
});
|
|
300
|
-
let
|
|
301
|
-
|
|
302
|
-
|
|
313
|
+
let X;
|
|
314
|
+
h(() => {
|
|
315
|
+
X && (X.indeterminate = l().length > 0 && !D());
|
|
303
316
|
});
|
|
304
|
-
function
|
|
317
|
+
function De(t) {
|
|
305
318
|
e.onSelectionChange?.(t ? r().map(e.getRowId) : []);
|
|
306
319
|
}
|
|
307
|
-
function
|
|
320
|
+
function Oe(t, n) {
|
|
308
321
|
let r = e.getRowId(t), i = l(), a = n ? [...i, r] : i.filter((e) => e !== r);
|
|
309
322
|
e.onSelectionChange?.(a);
|
|
310
323
|
}
|
|
311
|
-
function
|
|
324
|
+
function ke(t) {
|
|
312
325
|
return l().includes(e.getRowId(t));
|
|
313
326
|
}
|
|
314
|
-
function
|
|
327
|
+
function Ae(e) {
|
|
315
328
|
return e.toggleable === !1 || k().has(e.key);
|
|
316
329
|
}
|
|
317
|
-
function
|
|
330
|
+
function Z(t, n) {
|
|
318
331
|
return e.getCell?.(t, n) ?? n.getValue?.(t) ?? null;
|
|
319
332
|
}
|
|
320
333
|
return (() => {
|
|
321
334
|
var l = z(), m = l.firstChild, h = m.firstChild.firstChild, g = h.firstChild, _ = h.nextSibling;
|
|
322
335
|
return a(l, n(p, {
|
|
323
336
|
get when() {
|
|
324
|
-
return
|
|
337
|
+
return w() || T.toArray().length > 0;
|
|
325
338
|
},
|
|
326
339
|
get children() {
|
|
327
|
-
var t =
|
|
328
|
-
|
|
329
|
-
var s = Q;
|
|
330
|
-
return typeof s == "function" ? d(s, r) : Q = r, o.$$click = () => Z((e) => !e), c(o, "aria-controls", Y), a(o, () => e.columnCustomizerLabel ?? "Columns", null), a(r, n(p, {
|
|
340
|
+
var t = oe();
|
|
341
|
+
return a(t, n(p, {
|
|
331
342
|
get when() {
|
|
332
|
-
return
|
|
343
|
+
return T.toArray().length > 0;
|
|
333
344
|
},
|
|
334
345
|
get children() {
|
|
335
|
-
var
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
|
|
346
|
+
var e = F();
|
|
347
|
+
return a(e, T), e;
|
|
348
|
+
}
|
|
349
|
+
}), null), a(t, n(p, {
|
|
350
|
+
get when() {
|
|
351
|
+
return w();
|
|
352
|
+
},
|
|
353
|
+
get children() {
|
|
354
|
+
var t = L(), r = t.firstChild;
|
|
355
|
+
r.firstChild.nextSibling;
|
|
356
|
+
var o = Y;
|
|
357
|
+
return typeof o == "function" ? d(o, t) : Y = t, r.$$click = () => Ee((e) => !e), c(r, "aria-controls", we), a(r, () => e.columnCustomizerLabel ?? "Columns", null), a(t, n(p, {
|
|
358
|
+
get when() {
|
|
359
|
+
return Te();
|
|
339
360
|
},
|
|
340
|
-
children
|
|
341
|
-
var t =
|
|
342
|
-
return
|
|
343
|
-
|
|
344
|
-
|
|
361
|
+
get children() {
|
|
362
|
+
var t = I(), r = t.firstChild, o = r.nextSibling, s = o.nextSibling.firstChild, l = s.nextSibling;
|
|
363
|
+
return c(t, "id", we), a(r, () => e.columnCustomizerTitle ?? "Shown columns"), a(o, n(f, {
|
|
364
|
+
get each() {
|
|
365
|
+
return j();
|
|
366
|
+
},
|
|
367
|
+
children: (t, r) => (() => {
|
|
368
|
+
var o = B(), s = o.firstChild, l = s.firstChild, u = s.nextSibling, d = u.nextSibling;
|
|
369
|
+
return o.addEventListener("dragend", () => Ce(void 0)), o.addEventListener("drop", (e) => e.preventDefault()), o.addEventListener("dragover", (e) => {
|
|
370
|
+
let t = Se();
|
|
371
|
+
t !== void 0 && (e.preventDefault(), ye(t, r()));
|
|
372
|
+
}), o.addEventListener("dragstart", (e) => {
|
|
373
|
+
Ce(t.key), e.dataTransfer?.setData("text/plain", t.key), e.dataTransfer && (e.dataTransfer.effectAllowed = "move");
|
|
374
|
+
}), a(o, n(P, {
|
|
375
|
+
class: "data-table-customizer-grip",
|
|
376
|
+
size: 14,
|
|
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(N, {
|
|
379
|
+
size: 14,
|
|
380
|
+
"aria-hidden": "true"
|
|
381
|
+
})), d.$$click = (e) => be(e.currentTarget, t.key, 1), a(d, n(ee, {
|
|
382
|
+
size: 14,
|
|
383
|
+
"aria-hidden": "true"
|
|
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() === j().length - 1;
|
|
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
|
+
}, {
|
|
388
|
+
e: void 0,
|
|
389
|
+
t: void 0,
|
|
390
|
+
a: void 0,
|
|
391
|
+
o: void 0,
|
|
392
|
+
i: void 0,
|
|
393
|
+
n: void 0
|
|
394
|
+
}), i(() => l.checked = Ae(t)), o;
|
|
395
|
+
})()
|
|
396
|
+
})), s.$$click = _e, a(s, () => e.columnCustomizerShowAllLabel ?? "Show all"), l.$$click = xe, a(l, () => e.columnCustomizerResetLabel ?? "Reset"), i(() => c(t, "aria-label", e.columnCustomizerTitle ?? "Customize columns")), t;
|
|
397
|
+
}
|
|
398
|
+
}), null), i(() => c(r, "aria-expanded", Te())), t;
|
|
345
399
|
}
|
|
346
|
-
}), null),
|
|
400
|
+
}), null), t;
|
|
347
401
|
}
|
|
348
402
|
}), m), a(g, n(p, {
|
|
349
403
|
get when() {
|
|
350
|
-
return
|
|
404
|
+
return E();
|
|
351
405
|
},
|
|
352
406
|
get children() {
|
|
353
|
-
var t =
|
|
354
|
-
n.addEventListener("change", (e) =>
|
|
355
|
-
var r =
|
|
356
|
-
return typeof r == "function" ? d(r, n) :
|
|
407
|
+
var t = se(), n = t.firstChild.nextSibling;
|
|
408
|
+
n.addEventListener("change", (e) => De(e.currentTarget.checked));
|
|
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 = D()), t;
|
|
357
411
|
}
|
|
358
412
|
}), null), a(g, n(f, {
|
|
359
413
|
get each() {
|
|
360
|
-
return
|
|
414
|
+
return M();
|
|
361
415
|
},
|
|
362
416
|
children: (r) => (() => {
|
|
363
|
-
var s =
|
|
417
|
+
var s = H();
|
|
364
418
|
return a(s, n(p, {
|
|
365
419
|
get when() {
|
|
366
420
|
return o(() => !!r.sortable)() && (!u || e.onSort || e.onSortChange);
|
|
@@ -369,14 +423,14 @@ function q(e) {
|
|
|
369
423
|
return r.label;
|
|
370
424
|
},
|
|
371
425
|
get children() {
|
|
372
|
-
var e =
|
|
373
|
-
return e.$$click = () =>
|
|
374
|
-
var e = o(() =>
|
|
375
|
-
return () => e() ?
|
|
426
|
+
var e = V(), t = e.firstChild;
|
|
427
|
+
return e.$$click = () => pe(r.key), a(e, () => r.label, t), a(t, (() => {
|
|
428
|
+
var e = o(() => S() === r.key);
|
|
429
|
+
return () => e() ? C() === "asc" ? "▲" : "▼" : "";
|
|
376
430
|
})()), e;
|
|
377
431
|
}
|
|
378
432
|
})), i((e) => {
|
|
379
|
-
var n = r.class, i = r.sortable ?
|
|
433
|
+
var n = r.class, i = r.sortable ? S() === r.key ? C() === "asc" ? "ascending" : "descending" : "none" : void 0;
|
|
380
434
|
return n !== e.e && t(s, e.e = n), i !== e.t && c(s, "aria-sort", e.t = i), e;
|
|
381
435
|
}, {
|
|
382
436
|
e: void 0,
|
|
@@ -392,32 +446,32 @@ function q(e) {
|
|
|
392
446
|
}
|
|
393
447
|
}), null), a(_, n(f, {
|
|
394
448
|
get each() {
|
|
395
|
-
return
|
|
449
|
+
return fe();
|
|
396
450
|
},
|
|
397
451
|
children: (r) => (() => {
|
|
398
|
-
var o =
|
|
452
|
+
var o = W();
|
|
399
453
|
return a(o, n(p, {
|
|
400
454
|
get when() {
|
|
401
|
-
return
|
|
455
|
+
return E();
|
|
402
456
|
},
|
|
403
457
|
get children() {
|
|
404
|
-
var t =
|
|
405
|
-
return n.addEventListener("change", (e) =>
|
|
458
|
+
var t = ce(), n = t.firstChild;
|
|
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;
|
|
406
460
|
}
|
|
407
461
|
}), null), a(o, n(f, {
|
|
408
462
|
get each() {
|
|
409
|
-
return
|
|
463
|
+
return M();
|
|
410
464
|
},
|
|
411
465
|
children: (e) => (() => {
|
|
412
|
-
var n =
|
|
413
|
-
return a(n, () =>
|
|
466
|
+
var n = U();
|
|
467
|
+
return a(n, () => Z(r, e)), i(() => t(n, e.class)), n;
|
|
414
468
|
})()
|
|
415
469
|
}), null), a(o, n(p, {
|
|
416
470
|
get when() {
|
|
417
471
|
return e.rowActions;
|
|
418
472
|
},
|
|
419
473
|
get children() {
|
|
420
|
-
var t =
|
|
474
|
+
var t = U();
|
|
421
475
|
return a(t, () => e.rowActions?.(r)), t;
|
|
422
476
|
}
|
|
423
477
|
}), null), o;
|
|
@@ -427,18 +481,499 @@ function q(e) {
|
|
|
427
481
|
return s();
|
|
428
482
|
},
|
|
429
483
|
get children() {
|
|
430
|
-
return e.loadingContent ??
|
|
484
|
+
return e.loadingContent ?? G();
|
|
431
485
|
}
|
|
432
486
|
}), null), a(l, n(p, {
|
|
433
487
|
get when() {
|
|
434
488
|
return o(() => !s())() && (e.empty === void 0 ? r().length === 0 : K(e.empty));
|
|
435
489
|
},
|
|
436
490
|
get children() {
|
|
437
|
-
return e.emptyContent ??
|
|
491
|
+
return e.emptyContent ?? le();
|
|
438
492
|
}
|
|
439
493
|
}), null), i(() => t(l, `data-table-wrap${e.class ? ` ${e.class}` : ""}`)), l;
|
|
440
494
|
})();
|
|
441
495
|
}
|
|
442
496
|
r(["click"]);
|
|
443
497
|
//#endregion
|
|
444
|
-
|
|
498
|
+
//#region node_modules/@tabler/icons-solidjs/dist/source/icons/IconDeviceFloppy.js
|
|
499
|
+
var de = E("outline", "device-floppy", "DeviceFloppy", [
|
|
500
|
+
["path", { d: "M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2" }],
|
|
501
|
+
["path", { d: "M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" }],
|
|
502
|
+
["path", { d: "M14 4l0 4l-6 0l0 -4" }]
|
|
503
|
+
]), q = E("outline", "search", "Search", [["path", { d: "M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" }], ["path", { d: "M21 21l-6 -6" }]]), J = E("outline", "x", "X", [["path", { d: "M18 6l-12 12" }], ["path", { d: "M6 6l12 12" }]]), fe = /*#__PURE__*/ u("<input class=filter-table-input type=text>"), pe = /*#__PURE__*/ u("<ul class=filter-table-chips>"), me = /*#__PURE__*/ u("<div class=filter-table-multi>"), he = /*#__PURE__*/ u("<li class=filter-table-chip><button type=button class=filter-table-chip-remove>"), ge = /*#__PURE__*/ u("<div class=filter-table-search><input type=search class=filter-table-input>"), _e = /*#__PURE__*/ u("<div class=filter-table-saved>"), ve = /*#__PURE__*/ u("<li><button type=button class=\"filter-table-pill filter-table-pill-save\">"), ye = /*#__PURE__*/ u("<ul class=filter-table-pills aria-label=\"Applied filters\"><li><button type=button class=\"filter-table-pill filter-table-pill-clear\">"), be = /*#__PURE__*/ u("<form class=filter-table-save><input type=text class=filter-table-input><button type=submit class=\"filter-table-button filter-table-button-primary\"></button><button type=button class=filter-table-button>"), xe = /*#__PURE__*/ u("<div class=filter-table-toolbar>"), Se = /*#__PURE__*/ u("<button type=button class=filter-table-chip-remove>"), Ce = /*#__PURE__*/ u("<li><button type=button class=filter-table-pill>"), we = /*#__PURE__*/ u("<div><div class=filter-table-tabs role=tablist></div><div role=tabpanel></div><div role=tabpanel><form class=filter-table-form><div class=filter-table-form-actions><button type=button class=filter-table-button></button><button type=submit class=\"filter-table-button filter-table-button-primary\">"), Te = /*#__PURE__*/ u("<span class=filter-table-badge>"), Ee = /*#__PURE__*/ u("<button type=button role=tab class=filter-table-tab>"), Y = /*#__PURE__*/ u("<legend class=filter-table-legend>"), X = /*#__PURE__*/ u("<fieldset class=filter-table-fieldset>"), De = /*#__PURE__*/ u("<div class=filter-table-field><label class=filter-table-label>"), Oe = "q";
|
|
504
|
+
function ke(e) {
|
|
505
|
+
return typeof e == "function" ? e() : e;
|
|
506
|
+
}
|
|
507
|
+
function Ae(e) {
|
|
508
|
+
return Array.isArray(e) ? e.length > 0 : (e ?? "").trim() !== "";
|
|
509
|
+
}
|
|
510
|
+
function Z(e) {
|
|
511
|
+
let t = {};
|
|
512
|
+
for (let [n, r] of Object.entries(e)) Ae(r) && (t[n] = Array.isArray(r) ? r : r.trim());
|
|
513
|
+
return t;
|
|
514
|
+
}
|
|
515
|
+
function je(e, t) {
|
|
516
|
+
let n = Object.keys(e);
|
|
517
|
+
return n.length === Object.keys(t).length && n.every((n) => {
|
|
518
|
+
let r = e[n], i = t[n];
|
|
519
|
+
return Array.isArray(r) && Array.isArray(i) ? r.length === i.length && r.every((e) => i.includes(e)) : r === i;
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function Q(e) {
|
|
523
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
524
|
+
}
|
|
525
|
+
function Me(e) {
|
|
526
|
+
let [r, l] = S(e, [
|
|
527
|
+
"rows",
|
|
528
|
+
"filters",
|
|
529
|
+
"filterValues",
|
|
530
|
+
"defaultFilterValues",
|
|
531
|
+
"onFilterValuesChange",
|
|
532
|
+
"savedFilters",
|
|
533
|
+
"onSavedFiltersChange",
|
|
534
|
+
"manualFiltering",
|
|
535
|
+
"quickSearch",
|
|
536
|
+
"getSearchText",
|
|
537
|
+
"quickSearchLabel",
|
|
538
|
+
"resultsLabel",
|
|
539
|
+
"filtersLabel",
|
|
540
|
+
"applyLabel",
|
|
541
|
+
"resetLabel",
|
|
542
|
+
"clearAllLabel",
|
|
543
|
+
"anyLabel",
|
|
544
|
+
"yesLabel",
|
|
545
|
+
"noLabel",
|
|
546
|
+
"savedFiltersLabel",
|
|
547
|
+
"saveLabel",
|
|
548
|
+
"saveNameLabel",
|
|
549
|
+
"cancelLabel",
|
|
550
|
+
"deleteSavedFilterLabel",
|
|
551
|
+
"class"
|
|
552
|
+
]), u = g(() => ke(r.rows)), [m, b] = _(Z(r.defaultFilterValues ?? {})), x = g(() => r.filterValues === void 0 ? m() : Z(ke(r.filterValues)));
|
|
553
|
+
function C(e) {
|
|
554
|
+
let t = Z(e);
|
|
555
|
+
r.filterValues === void 0 && b(t), r.onFilterValuesChange?.(t);
|
|
556
|
+
}
|
|
557
|
+
function w(e, t) {
|
|
558
|
+
C({
|
|
559
|
+
...x(),
|
|
560
|
+
[e]: t
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
let T = () => Q(x()[Oe]), E = g(() => r.filters.filter((e) => Ae(x()[e.key])));
|
|
564
|
+
function ee(e, t) {
|
|
565
|
+
return t.getValue ? t.getValue(e) : e[t.key];
|
|
566
|
+
}
|
|
567
|
+
function D(e, t, n) {
|
|
568
|
+
if (t.match) return t.match(e, n);
|
|
569
|
+
let r = ee(e, t);
|
|
570
|
+
if (t.type === "select") {
|
|
571
|
+
let e = Array.isArray(n) ? n : [n];
|
|
572
|
+
return (Array.isArray(r) ? r : [r]).some((t) => e.includes(Q(t)));
|
|
573
|
+
}
|
|
574
|
+
return t.type === "boolean" ? !!r == (n === "true") : Q(r).toLowerCase().includes(Q(n).toLowerCase());
|
|
575
|
+
}
|
|
576
|
+
function te(e) {
|
|
577
|
+
return r.getSearchText ? r.getSearchText(e) : l.columns.map((t) => Q(t.sortValue?.(e) ?? e[t.key])).join(" ");
|
|
578
|
+
}
|
|
579
|
+
let ne = g(() => {
|
|
580
|
+
if (r.manualFiltering) return u();
|
|
581
|
+
let e = T().toLowerCase(), t = E();
|
|
582
|
+
return u().filter((n) => (e === "" || te(n).toLowerCase().includes(e)) && t.every((e) => D(n, e, x()[e.key])));
|
|
583
|
+
});
|
|
584
|
+
function re(e) {
|
|
585
|
+
if (e.options) return e.options;
|
|
586
|
+
let t = /* @__PURE__ */ new Set();
|
|
587
|
+
for (let n of u()) {
|
|
588
|
+
let r = ee(n, e);
|
|
589
|
+
for (let e of Array.isArray(r) ? r : [r]) {
|
|
590
|
+
let n = Q(e);
|
|
591
|
+
n !== "" && t.add(n);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return [...t].sort((e, t) => e.localeCompare(t, void 0, { numeric: !0 })).map((e) => ({
|
|
595
|
+
value: e,
|
|
596
|
+
label: e
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
599
|
+
function O(e, t) {
|
|
600
|
+
return e.type === "boolean" ? t === "true" ? r.yesLabel ?? "Yes" : r.noLabel ?? "No" : e.type === "select" ? re(e).find((e) => String(e.value) === t)?.label ?? t : t;
|
|
601
|
+
}
|
|
602
|
+
let k = g(() => E().flatMap((e) => {
|
|
603
|
+
let t = x()[e.key];
|
|
604
|
+
return (Array.isArray(t) ? t : [t]).map((t) => ({
|
|
605
|
+
filter: e,
|
|
606
|
+
item: t,
|
|
607
|
+
text: `${e.label}: ${O(e, t)}`
|
|
608
|
+
}));
|
|
609
|
+
}));
|
|
610
|
+
function ie(e, t) {
|
|
611
|
+
let n = x()[e.key];
|
|
612
|
+
w(e.key, Array.isArray(n) ? n.filter((e) => e !== t) : "");
|
|
613
|
+
}
|
|
614
|
+
function ae() {
|
|
615
|
+
C({ [Oe]: T() });
|
|
616
|
+
}
|
|
617
|
+
let A = g(() => r.savedFilters === void 0 ? void 0 : ke(r.savedFilters)), j = g(() => A()?.find((e) => je(Z(e.values), x()))), [N, P] = _(!1), [F, I] = _("");
|
|
618
|
+
function L(e) {
|
|
619
|
+
let t = A()?.find((t) => t.name === e);
|
|
620
|
+
t && C(t.values);
|
|
621
|
+
}
|
|
622
|
+
function oe() {
|
|
623
|
+
I(j()?.name ?? ""), P(!0);
|
|
624
|
+
}
|
|
625
|
+
function se(e) {
|
|
626
|
+
e.preventDefault();
|
|
627
|
+
let t = F().trim();
|
|
628
|
+
if (t === "") return;
|
|
629
|
+
let n = (A() ?? []).filter((e) => e.name !== t);
|
|
630
|
+
r.onSavedFiltersChange?.([...n, {
|
|
631
|
+
name: t,
|
|
632
|
+
values: x()
|
|
633
|
+
}]), P(!1);
|
|
634
|
+
}
|
|
635
|
+
function R(e) {
|
|
636
|
+
r.onSavedFiltersChange?.((A() ?? []).filter((t) => t.name !== e));
|
|
637
|
+
}
|
|
638
|
+
let [z, B] = _(x());
|
|
639
|
+
h(y(x, (e) => B(e)));
|
|
640
|
+
function V(e) {
|
|
641
|
+
return z()[e];
|
|
642
|
+
}
|
|
643
|
+
function H(e, t) {
|
|
644
|
+
B((n) => ({
|
|
645
|
+
...n,
|
|
646
|
+
[e]: t
|
|
647
|
+
}));
|
|
648
|
+
}
|
|
649
|
+
let ce = g(() => {
|
|
650
|
+
let e = /* @__PURE__ */ new Map([[void 0, []]]);
|
|
651
|
+
for (let t of r.filters) e.set(t.group, [...e.get(t.group) ?? [], t]);
|
|
652
|
+
return [...e.entries()].filter(([, e]) => e.length > 0).map(([e, t]) => ({
|
|
653
|
+
name: e,
|
|
654
|
+
filters: t
|
|
655
|
+
}));
|
|
656
|
+
}), U = v(), W = ["results", "filters"], [G, le] = _("results"), K = (e) => `${U}-tab-${e}`, Me = (e) => `${U}-panel-${e}`, $ = (e) => `${U}-filter-${e}`;
|
|
657
|
+
function Ne(e) {
|
|
658
|
+
e === "filters" && B(x()), le(e);
|
|
659
|
+
}
|
|
660
|
+
function Pe(e) {
|
|
661
|
+
let t = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
662
|
+
if (t === 0) return;
|
|
663
|
+
e.preventDefault();
|
|
664
|
+
let n = W[(W.indexOf(G()) + t + W.length) % W.length];
|
|
665
|
+
Ne(n), document.getElementById(K(n))?.focus();
|
|
666
|
+
}
|
|
667
|
+
function Fe(e) {
|
|
668
|
+
e.preventDefault(), C(z()), le("results");
|
|
669
|
+
}
|
|
670
|
+
function Ie() {
|
|
671
|
+
ae(), le("results");
|
|
672
|
+
}
|
|
673
|
+
function Le(e) {
|
|
674
|
+
if (e.type === "text") return (() => {
|
|
675
|
+
var t = fe();
|
|
676
|
+
return t.$$input = (t) => H(e.key, t.currentTarget.value), i((n) => {
|
|
677
|
+
var r = $(e.key), i = e.placeholder;
|
|
678
|
+
return r !== n.e && c(t, "id", n.e = r), i !== n.t && c(t, "placeholder", n.t = i), n;
|
|
679
|
+
}, {
|
|
680
|
+
e: void 0,
|
|
681
|
+
t: void 0
|
|
682
|
+
}), i(() => t.value = Q(V(e.key))), t;
|
|
683
|
+
})();
|
|
684
|
+
if (e.type === "boolean") return n(M, {
|
|
685
|
+
get id() {
|
|
686
|
+
return $(e.key);
|
|
687
|
+
},
|
|
688
|
+
get value() {
|
|
689
|
+
return Q(V(e.key));
|
|
690
|
+
},
|
|
691
|
+
onChange: (t) => H(e.key, t),
|
|
692
|
+
get emptyLabel() {
|
|
693
|
+
return r.anyLabel ?? "Any";
|
|
694
|
+
},
|
|
695
|
+
get options() {
|
|
696
|
+
return [{
|
|
697
|
+
value: "true",
|
|
698
|
+
label: r.yesLabel ?? "Yes"
|
|
699
|
+
}, {
|
|
700
|
+
value: "false",
|
|
701
|
+
label: r.noLabel ?? "No"
|
|
702
|
+
}];
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
let t = () => {
|
|
706
|
+
let t = V(e.key);
|
|
707
|
+
return Array.isArray(t) ? t : [];
|
|
708
|
+
};
|
|
709
|
+
return (() => {
|
|
710
|
+
var o = me();
|
|
711
|
+
return a(o, n(M, {
|
|
712
|
+
get id() {
|
|
713
|
+
return $(e.key);
|
|
714
|
+
},
|
|
715
|
+
value: "",
|
|
716
|
+
onChange: (n) => H(e.key, [...t(), n]),
|
|
717
|
+
get options() {
|
|
718
|
+
return re(e).filter((e) => !t().includes(String(e.value)));
|
|
719
|
+
},
|
|
720
|
+
get placeholder() {
|
|
721
|
+
return e.placeholder ?? r.anyLabel ?? "Any";
|
|
722
|
+
}
|
|
723
|
+
}), null), a(o, n(p, {
|
|
724
|
+
get when() {
|
|
725
|
+
return t().length > 0;
|
|
726
|
+
},
|
|
727
|
+
get children() {
|
|
728
|
+
var r = pe();
|
|
729
|
+
return a(r, n(f, {
|
|
730
|
+
get each() {
|
|
731
|
+
return t();
|
|
732
|
+
},
|
|
733
|
+
children: (r) => (() => {
|
|
734
|
+
var o = he(), s = o.firstChild;
|
|
735
|
+
return a(o, () => O(e, r), s), s.$$click = () => H(e.key, t().filter((e) => e !== r)), a(s, n(J, {
|
|
736
|
+
size: 12,
|
|
737
|
+
"aria-hidden": "true"
|
|
738
|
+
})), i(() => c(s, "aria-label", `Remove ${O(e, r)}`)), o;
|
|
739
|
+
})()
|
|
740
|
+
})), r;
|
|
741
|
+
}
|
|
742
|
+
}), null), o;
|
|
743
|
+
})();
|
|
744
|
+
}
|
|
745
|
+
let Re = (() => {
|
|
746
|
+
var e = xe();
|
|
747
|
+
return a(e, n(p, {
|
|
748
|
+
get when() {
|
|
749
|
+
return r.quickSearch !== !1;
|
|
750
|
+
},
|
|
751
|
+
get children() {
|
|
752
|
+
var e = ge(), t = e.firstChild;
|
|
753
|
+
return a(e, n(q, {
|
|
754
|
+
class: "filter-table-search-icon",
|
|
755
|
+
size: 16,
|
|
756
|
+
"aria-hidden": "true"
|
|
757
|
+
}), t), t.$$input = (e) => w(Oe, e.currentTarget.value), i((e) => {
|
|
758
|
+
var n = r.quickSearchLabel ?? "Quick search", i = r.quickSearchLabel ?? "Quick search";
|
|
759
|
+
return n !== e.e && c(t, "aria-label", e.e = n), i !== e.t && c(t, "placeholder", e.t = i), e;
|
|
760
|
+
}, {
|
|
761
|
+
e: void 0,
|
|
762
|
+
t: void 0
|
|
763
|
+
}), i(() => t.value = T()), e;
|
|
764
|
+
}
|
|
765
|
+
}), null), a(e, n(p, {
|
|
766
|
+
get when() {
|
|
767
|
+
return (A()?.length ?? 0) > 0;
|
|
768
|
+
},
|
|
769
|
+
get children() {
|
|
770
|
+
var e = _e();
|
|
771
|
+
return a(e, n(M, {
|
|
772
|
+
get value() {
|
|
773
|
+
return j()?.name ?? "";
|
|
774
|
+
},
|
|
775
|
+
onChange: L,
|
|
776
|
+
get options() {
|
|
777
|
+
return (A() ?? []).map((e) => ({
|
|
778
|
+
value: e.name,
|
|
779
|
+
label: e.name
|
|
780
|
+
}));
|
|
781
|
+
},
|
|
782
|
+
get ariaLabel() {
|
|
783
|
+
return r.savedFiltersLabel ?? "Saved filters";
|
|
784
|
+
},
|
|
785
|
+
get placeholder() {
|
|
786
|
+
return r.savedFiltersLabel ?? "Saved filters";
|
|
787
|
+
}
|
|
788
|
+
}), null), a(e, n(p, {
|
|
789
|
+
get when() {
|
|
790
|
+
return j();
|
|
791
|
+
},
|
|
792
|
+
children: (e) => (() => {
|
|
793
|
+
var t = Se();
|
|
794
|
+
return t.$$click = () => R(e().name), a(t, n(J, {
|
|
795
|
+
size: 14,
|
|
796
|
+
"aria-hidden": "true"
|
|
797
|
+
})), i(() => c(t, "aria-label", `${r.deleteSavedFilterLabel ?? "Delete saved filter"} ${e().name}`)), t;
|
|
798
|
+
})()
|
|
799
|
+
}), null), e;
|
|
800
|
+
}
|
|
801
|
+
}), null), a(e, n(p, {
|
|
802
|
+
get when() {
|
|
803
|
+
return k().length > 0;
|
|
804
|
+
},
|
|
805
|
+
get children() {
|
|
806
|
+
var e = ye(), t = e.firstChild, s = t.firstChild;
|
|
807
|
+
return a(e, n(f, {
|
|
808
|
+
get each() {
|
|
809
|
+
return k();
|
|
810
|
+
},
|
|
811
|
+
children: (e) => (() => {
|
|
812
|
+
var t = Ce(), r = t.firstChild;
|
|
813
|
+
return r.$$click = () => ie(e.filter, e.item), a(r, () => e.text, null), a(r, n(J, {
|
|
814
|
+
size: 12,
|
|
815
|
+
"aria-hidden": "true"
|
|
816
|
+
}), null), i(() => c(r, "aria-label", `Remove filter ${e.text}`)), t;
|
|
817
|
+
})()
|
|
818
|
+
}), t), s.$$click = ae, a(s, () => r.clearAllLabel ?? "Clear all"), a(e, n(p, {
|
|
819
|
+
get when() {
|
|
820
|
+
return o(() => A() !== void 0)() && !N();
|
|
821
|
+
},
|
|
822
|
+
get children() {
|
|
823
|
+
var e = ve(), t = e.firstChild;
|
|
824
|
+
return t.$$click = oe, a(t, n(de, {
|
|
825
|
+
size: 12,
|
|
826
|
+
"aria-hidden": "true"
|
|
827
|
+
}), null), a(t, () => r.saveLabel ?? "Save", null), e;
|
|
828
|
+
}
|
|
829
|
+
}), null), e;
|
|
830
|
+
}
|
|
831
|
+
}), null), a(e, n(p, {
|
|
832
|
+
get when() {
|
|
833
|
+
return o(() => !!N())() && k().length > 0;
|
|
834
|
+
},
|
|
835
|
+
get children() {
|
|
836
|
+
var e = be(), t = e.firstChild, o = t.nextSibling, s = o.nextSibling;
|
|
837
|
+
return e.$$keydown = (e) => {
|
|
838
|
+
e.key === "Escape" && P(!1);
|
|
839
|
+
}, e.addEventListener("submit", se), t.$$input = (e) => I(e.currentTarget.value), d((e) => queueMicrotask(() => e.focus()), t), a(o, n(de, {
|
|
840
|
+
size: 16,
|
|
841
|
+
"aria-hidden": "true"
|
|
842
|
+
}), null), a(o, () => r.saveLabel ?? "Save", null), s.$$click = () => P(!1), a(s, () => r.cancelLabel ?? "Cancel"), i((e) => {
|
|
843
|
+
var n = r.saveNameLabel ?? "Filter name", i = r.saveNameLabel ?? "Filter name";
|
|
844
|
+
return n !== e.e && c(t, "aria-label", e.e = n), i !== e.t && c(t, "placeholder", e.t = i), e;
|
|
845
|
+
}, {
|
|
846
|
+
e: void 0,
|
|
847
|
+
t: void 0
|
|
848
|
+
}), i(() => t.value = F()), e;
|
|
849
|
+
}
|
|
850
|
+
}), null), e;
|
|
851
|
+
})();
|
|
852
|
+
return (() => {
|
|
853
|
+
var e = we(), o = e.firstChild, u = o.nextSibling, d = u.nextSibling, m = d.firstChild, h = m.firstChild, g = h.firstChild, _ = g.nextSibling;
|
|
854
|
+
return a(o, n(f, {
|
|
855
|
+
each: W,
|
|
856
|
+
children: (e) => (() => {
|
|
857
|
+
var t = Ee();
|
|
858
|
+
return t.$$keydown = Pe, t.$$click = () => Ne(e), a(t, () => e === "results" ? r.resultsLabel ?? "Results" : r.filtersLabel ?? "Filters", null), a(t, n(p, {
|
|
859
|
+
get when() {
|
|
860
|
+
return e === "results" || E().length > 0;
|
|
861
|
+
},
|
|
862
|
+
get children() {
|
|
863
|
+
var t = Te();
|
|
864
|
+
return a(t, () => e === "results" ? ne().length : E().length), t;
|
|
865
|
+
}
|
|
866
|
+
}), null), i((n) => {
|
|
867
|
+
var r = K(e), i = G() === e, a = Me(e), o = G() === e ? 0 : -1;
|
|
868
|
+
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
|
+
}, {
|
|
870
|
+
e: void 0,
|
|
871
|
+
t: void 0,
|
|
872
|
+
a: void 0,
|
|
873
|
+
o: void 0
|
|
874
|
+
}), t;
|
|
875
|
+
})()
|
|
876
|
+
})), a(u, n(ue, s(l, {
|
|
877
|
+
rows: ne,
|
|
878
|
+
toolbar: Re
|
|
879
|
+
}))), m.addEventListener("submit", Fe), a(m, n(f, {
|
|
880
|
+
get each() {
|
|
881
|
+
return ce();
|
|
882
|
+
},
|
|
883
|
+
children: (e) => (() => {
|
|
884
|
+
var t = X();
|
|
885
|
+
return a(t, n(p, {
|
|
886
|
+
get when() {
|
|
887
|
+
return e.name;
|
|
888
|
+
},
|
|
889
|
+
get children() {
|
|
890
|
+
var t = Y();
|
|
891
|
+
return a(t, () => e.name), t;
|
|
892
|
+
}
|
|
893
|
+
}), null), a(t, n(f, {
|
|
894
|
+
get each() {
|
|
895
|
+
return e.filters;
|
|
896
|
+
},
|
|
897
|
+
children: (e) => (() => {
|
|
898
|
+
var t = De(), n = t.firstChild;
|
|
899
|
+
return a(n, () => e.label), a(t, () => Le(e), null), i(() => c(n, "for", $(e.key))), t;
|
|
900
|
+
})()
|
|
901
|
+
}), null), t;
|
|
902
|
+
})()
|
|
903
|
+
}), h), g.$$click = Ie, a(g, n(J, {
|
|
904
|
+
size: 16,
|
|
905
|
+
"aria-hidden": "true"
|
|
906
|
+
}), null), a(g, () => r.resetLabel ?? "Reset", null), a(_, n(q, {
|
|
907
|
+
size: 16,
|
|
908
|
+
"aria-hidden": "true"
|
|
909
|
+
}), null), a(_, () => r.applyLabel ?? "Search", null), i((n) => {
|
|
910
|
+
var i = `filter-table${r.class ? ` ${r.class}` : ""}`, a = Me("results"), o = K("results"), s = G() !== "results", l = Me("filters"), f = K("filters"), p = G() !== "filters";
|
|
911
|
+
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
|
+
}, {
|
|
913
|
+
e: void 0,
|
|
914
|
+
t: void 0,
|
|
915
|
+
a: void 0,
|
|
916
|
+
o: void 0,
|
|
917
|
+
i: void 0,
|
|
918
|
+
n: void 0,
|
|
919
|
+
s: void 0
|
|
920
|
+
}), e;
|
|
921
|
+
})();
|
|
922
|
+
}
|
|
923
|
+
r([
|
|
924
|
+
"input",
|
|
925
|
+
"click",
|
|
926
|
+
"keydown"
|
|
927
|
+
]);
|
|
928
|
+
//#endregion
|
|
929
|
+
//#region src/search-bar.tsx
|
|
930
|
+
var $ = /*#__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
|
+
function Fe(e) {
|
|
932
|
+
let r, s = () => e.shortcutKey ?? "k", l = () => e.shortcutLabel ?? `Ctrl ${String(s()).toUpperCase()}`;
|
|
933
|
+
return x(() => {
|
|
934
|
+
let e = (e) => {
|
|
935
|
+
let t = s();
|
|
936
|
+
t !== !1 && r && (!(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey || e.key.toLowerCase() === t.toLowerCase() && (e.preventDefault(), r.focus(), r.select()));
|
|
937
|
+
};
|
|
938
|
+
document.addEventListener("keydown", e), b(() => document.removeEventListener("keydown", e));
|
|
939
|
+
}), (() => {
|
|
940
|
+
var u = Pe(), f = u.firstChild;
|
|
941
|
+
a(u, n(q, {
|
|
942
|
+
size: 17,
|
|
943
|
+
class: "search-bar-icon",
|
|
944
|
+
"aria-hidden": "true"
|
|
945
|
+
}), f), f.$$input = (t) => e.onInput(t.currentTarget.value);
|
|
946
|
+
var m = r;
|
|
947
|
+
return typeof m == "function" ? d(m, f) : r = f, a(u, n(p, {
|
|
948
|
+
get when() {
|
|
949
|
+
return o(() => !e.value)() && s() !== !1;
|
|
950
|
+
},
|
|
951
|
+
get children() {
|
|
952
|
+
var e = $();
|
|
953
|
+
return a(e, l), e;
|
|
954
|
+
}
|
|
955
|
+
}), null), a(u, n(p, {
|
|
956
|
+
get when() {
|
|
957
|
+
return e.value;
|
|
958
|
+
},
|
|
959
|
+
get children() {
|
|
960
|
+
var t = Ne();
|
|
961
|
+
return t.$$click = () => e.onInput(""), a(t, n(J, {
|
|
962
|
+
size: 15,
|
|
963
|
+
"aria-hidden": "true"
|
|
964
|
+
})), i(() => c(t, "aria-label", e.clearLabel ?? "Clear search")), t;
|
|
965
|
+
}
|
|
966
|
+
}), null), i((n) => {
|
|
967
|
+
var r = e.class ? `search-bar ${e.class}` : "search-bar", i = e.placeholder ?? "Search…", a = e.ariaLabel ?? "Search", o = s() === !1 ? void 0 : `Control+${String(s()).toUpperCase()} Meta+${String(s()).toUpperCase()}`;
|
|
968
|
+
return r !== n.e && t(u, n.e = r), i !== n.t && c(f, "placeholder", n.t = i), a !== n.a && c(f, "aria-label", n.a = a), o !== n.o && c(f, "aria-keyshortcuts", n.o = o), n;
|
|
969
|
+
}, {
|
|
970
|
+
e: void 0,
|
|
971
|
+
t: void 0,
|
|
972
|
+
a: void 0,
|
|
973
|
+
o: void 0
|
|
974
|
+
}), i(() => f.value = e.value), u;
|
|
975
|
+
})();
|
|
976
|
+
}
|
|
977
|
+
r(["input", "click"]);
|
|
978
|
+
//#endregion
|
|
979
|
+
export { M as Combobox, ue as DataTable, Me as FilterTable, Fe as SearchBar };
|