@umriss-ui/table 0.2.0-rc.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/CHANGELOG.md +247 -0
- package/LICENSE +20 -0
- package/README.md +108 -0
- package/dist/index.d.ts +842 -0
- package/dist/table.css +1 -0
- package/dist/table.js +2184 -0
- package/package.json +77 -0
package/dist/table.js
ADDED
|
@@ -0,0 +1,2184 @@
|
|
|
1
|
+
var vt = Object.defineProperty;
|
|
2
|
+
var wt = (e, t, n) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var L = (e, t, n) => wt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { useState as E, useCallback as B, useMemo as V, useRef as oe, useId as Z, useContext as xe, useSyncExternalStore as pe, createContext as Ge, useLayoutEffect as J } from "react";
|
|
5
|
+
import { DEFAULT_FORMATS as _t, useVirtual as kt, useFormats as te, useWording as $, Checkbox as ge, DateRangePicker as yt, FormField as Ee, NumberInput as Pe, Popover as qe, Button as G, TagGroup as Ct, Tag as St, useDensityFor as Ue, VisuallyHidden as be, Menu as Nt, MenuItem as At, assess as xt, verdictWeight as Tt, Select as Ot, Input as Rt, DEFAULT_WORDING as It, Badge as Ce, useFreshness as Ft } from "@umriss-ui/core";
|
|
6
|
+
import { jsx as c, jsxs as T, Fragment as Q } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as Lt } from "react-dom";
|
|
8
|
+
function zt(e) {
|
|
9
|
+
const [t, n] = E(/* @__PURE__ */ new Set()), o = B((u) => t.has(u), [t]), r = B((u) => {
|
|
10
|
+
n((d) => {
|
|
11
|
+
const h = new Set(d);
|
|
12
|
+
return h.has(u) ? h.delete(u) : h.add(u), h;
|
|
13
|
+
});
|
|
14
|
+
}, []), i = V(
|
|
15
|
+
() => e.length > 0 && e.every((u) => t.has(u)),
|
|
16
|
+
[e, t]
|
|
17
|
+
), s = V(
|
|
18
|
+
() => !i && e.some((u) => t.has(u)),
|
|
19
|
+
[e, t, i]
|
|
20
|
+
), l = B(() => {
|
|
21
|
+
n((u) => {
|
|
22
|
+
const d = new Set(u);
|
|
23
|
+
return e.length > 0 && e.every((v) => d.has(v)) ? e.forEach((v) => d.delete(v)) : e.forEach((v) => d.add(v)), d;
|
|
24
|
+
});
|
|
25
|
+
}, [e]), a = B(() => n(/* @__PURE__ */ new Set()), []);
|
|
26
|
+
return { selected: t, isSelected: o, toggle: r, toggleAll: l, clear: a, allSelected: i, someSelected: s, count: t.size };
|
|
27
|
+
}
|
|
28
|
+
function Te(e, t) {
|
|
29
|
+
return t != null && t.length ? [
|
|
30
|
+
...t.map((n) => e.find((o) => o.id === n)).filter((n) => n !== void 0),
|
|
31
|
+
...e.filter((n) => !t.includes(n.id))
|
|
32
|
+
] : e;
|
|
33
|
+
}
|
|
34
|
+
const ie = (e) => e == null || typeof e == "number" && Number.isNaN(e), jt = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : _t.compareText(String(e), String(t));
|
|
35
|
+
function Oe(e, t, n) {
|
|
36
|
+
const {
|
|
37
|
+
search: o = "",
|
|
38
|
+
filter: r,
|
|
39
|
+
sort: i = null,
|
|
40
|
+
page: s = 1,
|
|
41
|
+
pageSize: l,
|
|
42
|
+
hidden: a,
|
|
43
|
+
order: u
|
|
44
|
+
} = n, d = Te(t, u), h = a != null && a.length ? d.filter((w) => w.hideable === !1 || !a.includes(w.id)) : d, v = o.trim().toLowerCase(), g = t.filter((w) => w.searchable && w.value), p = (w) => !v || g.some((S) => {
|
|
45
|
+
const I = S.value(w);
|
|
46
|
+
return !ie(I) && String(I).toLowerCase().includes(v);
|
|
47
|
+
}), b = e.filter((w) => p(w) && (r ? r(w) : !0)), m = (Array.isArray(i) ? i : i ? [i] : []).map((w) => {
|
|
48
|
+
const S = t.find((x) => x.id === w.column);
|
|
49
|
+
if (!S || !S.compare && !S.value) return null;
|
|
50
|
+
const I = w.direction === "asc" ? 1 : -1, A = S.compare, C = S.value;
|
|
51
|
+
return C ? (x, z) => {
|
|
52
|
+
const F = C(x), D = C(z);
|
|
53
|
+
return ie(F) || ie(D) ? ie(F) === ie(D) ? 0 : ie(F) ? 1 : -1 : (A ? A(x, z) : jt(F, D)) * I;
|
|
54
|
+
} : (x, z) => A(x, z) * I;
|
|
55
|
+
}).filter((w) => w !== null);
|
|
56
|
+
m.length > 0 && b.sort((w, S) => {
|
|
57
|
+
for (const I of m) {
|
|
58
|
+
const A = I(w, S);
|
|
59
|
+
if (A !== 0) return A;
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
});
|
|
63
|
+
const y = l && l > 0 ? l : b.length || 1, O = Math.max(1, Math.ceil(b.length / y)), N = Math.min(Math.max(1, s), O), P = b.slice((N - 1) * y, N * y);
|
|
64
|
+
return {
|
|
65
|
+
columns: h,
|
|
66
|
+
filtered: b,
|
|
67
|
+
visible: P,
|
|
68
|
+
page: N,
|
|
69
|
+
pageCount: O,
|
|
70
|
+
columnCount: h.length
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function Et(e, t, n) {
|
|
74
|
+
const { rowKey: o, filter: r, defaultSort: i = null, initialView: s, virtual: l } = n, [a, u] = E((s == null ? void 0 : s.search) ?? ""), [d, h] = E(() => {
|
|
75
|
+
var k;
|
|
76
|
+
return (k = s == null ? void 0 : s.sort) != null && k.length ? [...s.sort] : i ? Array.isArray(i) ? [...i] : [i] : [];
|
|
77
|
+
}), [v, g] = E((s == null ? void 0 : s.page) ?? 1), [p, b] = E(
|
|
78
|
+
(s == null ? void 0 : s.pageSize) ?? n.pageSize ?? 10
|
|
79
|
+
), [_, m] = E([]), [y, O] = E((s == null ? void 0 : s.hidden) ?? []), [N, P] = E((s == null ? void 0 : s.order) ?? []), [w, S] = E(() => {
|
|
80
|
+
if (s != null && s.widths) return { ...s.widths };
|
|
81
|
+
const k = {};
|
|
82
|
+
for (const R of t)
|
|
83
|
+
R.width !== void 0 && (k[R.id] = R.width);
|
|
84
|
+
return k;
|
|
85
|
+
}), I = l ? 0 : p, A = V(
|
|
86
|
+
() => Oe(e, t, {
|
|
87
|
+
search: a,
|
|
88
|
+
filter: r,
|
|
89
|
+
sort: d,
|
|
90
|
+
page: v,
|
|
91
|
+
pageSize: I,
|
|
92
|
+
hidden: y,
|
|
93
|
+
order: N
|
|
94
|
+
}),
|
|
95
|
+
[e, t, a, r, d, v, I, y, N]
|
|
96
|
+
), C = kt(l ? A.filtered.length : 0, {
|
|
97
|
+
rowHeight: (l == null ? void 0 : l.rowHeight) ?? 0,
|
|
98
|
+
overscan: l == null ? void 0 : l.overscan
|
|
99
|
+
}), x = V(
|
|
100
|
+
() => l ? A.filtered.slice(C.from, C.to) : A.visible,
|
|
101
|
+
[l, A.filtered, A.visible, C.from, C.to]
|
|
102
|
+
), z = V(() => A.filtered.map(o), [A.filtered, o]), F = zt(z), D = B((k) => {
|
|
103
|
+
u(k), g(1);
|
|
104
|
+
}, []), W = B((k) => {
|
|
105
|
+
b(k), g(1);
|
|
106
|
+
}, []), U = B((k, R = !1) => {
|
|
107
|
+
h((j) => {
|
|
108
|
+
const Y = j.find((ne) => ne.column === k);
|
|
109
|
+
if (!R) {
|
|
110
|
+
const ne = j.length === 1 && (Y == null ? void 0 : Y.direction) === "asc" ? "desc" : "asc";
|
|
111
|
+
return [{ column: k, direction: ne }];
|
|
112
|
+
}
|
|
113
|
+
return Y ? Y.direction === "asc" ? j.map(
|
|
114
|
+
(ne) => ne.column === k ? { column: k, direction: "desc" } : ne
|
|
115
|
+
) : j.filter((ne) => ne.column !== k) : [...j, { column: k, direction: "asc" }];
|
|
116
|
+
}), g(1);
|
|
117
|
+
}, []), M = B((k) => {
|
|
118
|
+
m(
|
|
119
|
+
(R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
|
|
120
|
+
);
|
|
121
|
+
}, []), K = B(
|
|
122
|
+
(k) => _.includes(k),
|
|
123
|
+
[_]
|
|
124
|
+
), _e = B((k) => {
|
|
125
|
+
O(
|
|
126
|
+
(R) => R.includes(k) ? R.filter((j) => j !== k) : [...R, k]
|
|
127
|
+
);
|
|
128
|
+
}, []), ht = B((k, R) => {
|
|
129
|
+
S((j) => {
|
|
130
|
+
if (R === void 0) {
|
|
131
|
+
if (!(k in j)) return j;
|
|
132
|
+
const Y = { ...j };
|
|
133
|
+
return delete Y[k], Y;
|
|
134
|
+
}
|
|
135
|
+
return { ...j, [k]: R };
|
|
136
|
+
});
|
|
137
|
+
}, []), mt = B(
|
|
138
|
+
(k) => {
|
|
139
|
+
var R;
|
|
140
|
+
return (R = d.find((j) => j.column === k)) == null ? void 0 : R.direction;
|
|
141
|
+
},
|
|
142
|
+
[d]
|
|
143
|
+
), pt = B(
|
|
144
|
+
(k) => {
|
|
145
|
+
if (d.length < 2) return;
|
|
146
|
+
const R = d.findIndex((j) => j.column === k);
|
|
147
|
+
return R === -1 ? void 0 : R + 1;
|
|
148
|
+
},
|
|
149
|
+
[d]
|
|
150
|
+
), gt = V(
|
|
151
|
+
() => Te(t, N).filter((k) => k.label !== void 0 && k.hideable !== !1).map((k) => ({ id: k.id, label: k.label, visible: !y.includes(k.id) })),
|
|
152
|
+
[t, N, y]
|
|
153
|
+
), Le = n.pageSize ?? 10, ze = V(() => {
|
|
154
|
+
const k = {};
|
|
155
|
+
for (const R of t)
|
|
156
|
+
R.width !== void 0 && (k[R.id] = R.width);
|
|
157
|
+
return k;
|
|
158
|
+
}, [t]), ke = V(() => {
|
|
159
|
+
const k = {};
|
|
160
|
+
for (const [R, j] of Object.entries(w))
|
|
161
|
+
ze[R] !== j && (k[R] = j);
|
|
162
|
+
return k;
|
|
163
|
+
}, [w, ze]), ye = V(
|
|
164
|
+
() => i ? Array.isArray(i) ? i : [i] : [],
|
|
165
|
+
[i]
|
|
166
|
+
), je = d.length === ye.length && d.every(
|
|
167
|
+
(k, R) => {
|
|
168
|
+
var j, Y;
|
|
169
|
+
return k.column === ((j = ye[R]) == null ? void 0 : j.column) && k.direction === ((Y = ye[R]) == null ? void 0 : Y.direction);
|
|
170
|
+
}
|
|
171
|
+
), bt = V(
|
|
172
|
+
() => ({
|
|
173
|
+
...a ? { search: a } : {},
|
|
174
|
+
...d.length && !je ? { sort: d } : {},
|
|
175
|
+
/* Without paging there is no page a view could carry - a page three in
|
|
176
|
+
the view of a virtualised table would be a promise nobody redeems on
|
|
177
|
+
opening. */
|
|
178
|
+
...!l && A.page > 1 ? { page: A.page } : {},
|
|
179
|
+
...!l && p !== Le ? { pageSize: p } : {},
|
|
180
|
+
...y.length ? { hidden: y } : {},
|
|
181
|
+
...N.length ? { order: N } : {},
|
|
182
|
+
...Object.keys(ke).length ? { widths: ke } : {}
|
|
183
|
+
}),
|
|
184
|
+
[
|
|
185
|
+
l,
|
|
186
|
+
a,
|
|
187
|
+
d,
|
|
188
|
+
je,
|
|
189
|
+
A.page,
|
|
190
|
+
p,
|
|
191
|
+
Le,
|
|
192
|
+
y,
|
|
193
|
+
N,
|
|
194
|
+
ke
|
|
195
|
+
]
|
|
196
|
+
);
|
|
197
|
+
return {
|
|
198
|
+
...A,
|
|
199
|
+
visible: x,
|
|
200
|
+
virtual: l ? C : void 0,
|
|
201
|
+
view: bt,
|
|
202
|
+
search: a,
|
|
203
|
+
setSearch: D,
|
|
204
|
+
sort: d,
|
|
205
|
+
toggleSort: U,
|
|
206
|
+
sortDirectionOf: mt,
|
|
207
|
+
sortRankOf: pt,
|
|
208
|
+
setPage: g,
|
|
209
|
+
pageSize: p,
|
|
210
|
+
setPageSize: W,
|
|
211
|
+
expanded: _,
|
|
212
|
+
toggleRow: M,
|
|
213
|
+
isExpanded: K,
|
|
214
|
+
hidden: y,
|
|
215
|
+
toggleColumn: _e,
|
|
216
|
+
columnChoices: gt,
|
|
217
|
+
order: N,
|
|
218
|
+
setOrder: P,
|
|
219
|
+
widths: w,
|
|
220
|
+
setWidth: ht,
|
|
221
|
+
selection: F
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function Pt() {
|
|
225
|
+
var t;
|
|
226
|
+
const e = import.meta;
|
|
227
|
+
return typeof ((t = e.env) == null ? void 0 : t.DEV) == "boolean" ? e.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
|
|
228
|
+
}
|
|
229
|
+
const Ye = Pt(), Me = /* @__PURE__ */ new Set();
|
|
230
|
+
function re(e, t) {
|
|
231
|
+
!Ye || Me.has(e) || (Me.add(e), console.warn(`@umriss-ui/table: ${t}`));
|
|
232
|
+
}
|
|
233
|
+
const q = (e) => e == null || typeof e == "number" && Number.isNaN(e);
|
|
234
|
+
function ve(e) {
|
|
235
|
+
return q(e) ? "empty" : typeof e == "string" ? "text" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : e instanceof Date ? Number.isNaN(e.getTime()) ? "empty" : "date" : "other";
|
|
236
|
+
}
|
|
237
|
+
function Mt(e, t) {
|
|
238
|
+
for (const n of e) {
|
|
239
|
+
const o = ve(t(n));
|
|
240
|
+
if (o !== "empty") return o;
|
|
241
|
+
}
|
|
242
|
+
return "empty";
|
|
243
|
+
}
|
|
244
|
+
const Xe = (e, t) => t ?? e === "number";
|
|
245
|
+
function ae(e, t, n, o) {
|
|
246
|
+
switch (ve(e)) {
|
|
247
|
+
case "text":
|
|
248
|
+
return e;
|
|
249
|
+
case "number": {
|
|
250
|
+
const r = e;
|
|
251
|
+
return t === "percent" ? n.percent(r) : t === "count" ? n.count(r) : typeof t == "object" ? n.number(r, t.decimals) : n.number(r);
|
|
252
|
+
}
|
|
253
|
+
case "date": {
|
|
254
|
+
const r = e;
|
|
255
|
+
return t === "date" ? n.date(r) : t === "time" ? n.time(r, !1) : n.dateTime(r, !1);
|
|
256
|
+
}
|
|
257
|
+
case "boolean":
|
|
258
|
+
return e ? o.booleanYes : o.booleanNo;
|
|
259
|
+
default:
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function Je(e, t) {
|
|
264
|
+
if (!q(e)) {
|
|
265
|
+
if (t) return Je(t(e));
|
|
266
|
+
switch (ve(e)) {
|
|
267
|
+
case "text":
|
|
268
|
+
return e;
|
|
269
|
+
case "number":
|
|
270
|
+
return e;
|
|
271
|
+
case "date":
|
|
272
|
+
return e.getTime();
|
|
273
|
+
case "boolean":
|
|
274
|
+
return e ? 1 : 0;
|
|
275
|
+
default:
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const Dt = "ja", Vt = "nein";
|
|
281
|
+
function Qe(e, t) {
|
|
282
|
+
if (!q(e)) {
|
|
283
|
+
if (t) return Qe(t(e));
|
|
284
|
+
switch (ve(e)) {
|
|
285
|
+
case "text":
|
|
286
|
+
return e;
|
|
287
|
+
case "number":
|
|
288
|
+
return e;
|
|
289
|
+
case "date":
|
|
290
|
+
return e.toISOString();
|
|
291
|
+
case "boolean":
|
|
292
|
+
return e ? Dt : Vt;
|
|
293
|
+
default:
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function Ht(e, t, n) {
|
|
299
|
+
let o = 0, r = 0;
|
|
300
|
+
for (const i of e) {
|
|
301
|
+
const s = t(i);
|
|
302
|
+
typeof s != "number" || Number.isNaN(s) || (o += s, r += 1);
|
|
303
|
+
}
|
|
304
|
+
if (r !== 0)
|
|
305
|
+
return n === "sum" ? o : o / r;
|
|
306
|
+
}
|
|
307
|
+
const Re = "absent", le = (e) => q(e) ? Re : e instanceof Date ? `value:${e.getTime()}` : `value:${String(e)}`, Bt = "_frame_17mg8_8", $t = "_children_17mg8_19", Wt = "_scroll_17mg8_23", Kt = "_footerTarget_17mg8_28", Gt = "_table_17mg8_32", qt = "_th_17mg8_40", Ut = "_sticky_17mg8_54", Yt = "_td_17mg8_62", Xt = "_rowHeader_17mg8_74", Jt = "_compact_17mg8_90", Qt = "_numeric_17mg8_105", Zt = "_absent_17mg8_117", en = "_striped_17mg8_121", tn = "_control_17mg8_136", nn = "_stickyCell_17mg8_145", on = "_sortButton_17mg8_157", rn = "_sortIndicator_17mg8_181", sn = "_sortArrow_17mg8_188", ln = "_sortArrowDesc_17mg8_192", cn = "_sortActive_17mg8_200", an = "_sortRank_17mg8_206", dn = "_thFlex_17mg8_214", un = "_footerKind_17mg8_235", fn = "_emptyCell_17mg8_243", hn = "_empty_17mg8_243", mn = "_emptyTitle_17mg8_259", pn = "_skeleton_17mg8_266", gn = "_toolbar_17mg8_294", bn = "_toolbarGroup_17mg8_307", vn = "_toolbarInfo_17mg8_315", wn = "_pagination_17mg8_321", _n = "_paginationControls_17mg8_332", kn = "_pageSize_17mg8_338", yn = "_paginationStatus_17mg8_350", Cn = "_filterButton_17mg8_359", Sn = "_filterActive_17mg8_381", Nn = "_filterPanel_17mg8_386", An = "_filterContent_17mg8_399", xn = "_filterFooter_17mg8_409", Tn = "_filterLabel_17mg8_423", On = "_filterValue_17mg8_433", Rn = "_filteredCount_17mg8_439", In = "_rangeFields_17mg8_450", Fn = "_rangePeriod_17mg8_460", Ln = "_conditions_17mg8_466", zn = "_conditionButton_17mg8_472", jn = "_condition_17mg8_466", En = "_columnsPanel_17mg8_496", Pn = "_columnsList_17mg8_504", Mn = "_columnsEntry_17mg8_513", Dn = "_move_17mg8_525", Vn = "_expander_17mg8_560", Hn = "_expanderOpen_17mg8_591", Bn = "_detailRow_17mg8_595", $n = "_detailCell_17mg8_595", Wn = "_actionsCell_17mg8_603", Kn = "_actions_17mg8_603", Gn = "_grip_17mg8_631", qn = "_virtualBody_17mg8_661", Un = "_virtualRow_17mg8_669", Yn = "_fillerRow_17mg8_674", f = {
|
|
308
|
+
frame: Bt,
|
|
309
|
+
children: $t,
|
|
310
|
+
scroll: Wt,
|
|
311
|
+
footerTarget: Kt,
|
|
312
|
+
table: Gt,
|
|
313
|
+
th: qt,
|
|
314
|
+
sticky: Ut,
|
|
315
|
+
td: Yt,
|
|
316
|
+
rowHeader: Xt,
|
|
317
|
+
compact: Jt,
|
|
318
|
+
numeric: Qt,
|
|
319
|
+
absent: Zt,
|
|
320
|
+
striped: en,
|
|
321
|
+
control: tn,
|
|
322
|
+
stickyCell: nn,
|
|
323
|
+
sortButton: on,
|
|
324
|
+
sortIndicator: rn,
|
|
325
|
+
sortArrow: sn,
|
|
326
|
+
sortArrowDesc: ln,
|
|
327
|
+
sortActive: cn,
|
|
328
|
+
sortRank: an,
|
|
329
|
+
thFlex: dn,
|
|
330
|
+
footerKind: un,
|
|
331
|
+
emptyCell: fn,
|
|
332
|
+
empty: hn,
|
|
333
|
+
emptyTitle: mn,
|
|
334
|
+
skeleton: pn,
|
|
335
|
+
toolbar: gn,
|
|
336
|
+
toolbarGroup: bn,
|
|
337
|
+
toolbarInfo: vn,
|
|
338
|
+
pagination: wn,
|
|
339
|
+
paginationControls: _n,
|
|
340
|
+
pageSize: kn,
|
|
341
|
+
paginationStatus: yn,
|
|
342
|
+
filterButton: Cn,
|
|
343
|
+
filterActive: Sn,
|
|
344
|
+
filterPanel: Nn,
|
|
345
|
+
filterContent: An,
|
|
346
|
+
filterFooter: xn,
|
|
347
|
+
filterLabel: Tn,
|
|
348
|
+
filterValue: On,
|
|
349
|
+
filteredCount: Rn,
|
|
350
|
+
rangeFields: In,
|
|
351
|
+
rangePeriod: Fn,
|
|
352
|
+
conditions: Ln,
|
|
353
|
+
conditionButton: zn,
|
|
354
|
+
condition: jn,
|
|
355
|
+
columnsPanel: En,
|
|
356
|
+
columnsList: Pn,
|
|
357
|
+
columnsEntry: Mn,
|
|
358
|
+
move: Dn,
|
|
359
|
+
expander: Vn,
|
|
360
|
+
expanderOpen: Hn,
|
|
361
|
+
detailRow: Bn,
|
|
362
|
+
detailCell: $n,
|
|
363
|
+
actionsCell: Wn,
|
|
364
|
+
actions: Kn,
|
|
365
|
+
grip: Gn,
|
|
366
|
+
virtualBody: qn,
|
|
367
|
+
virtualRow: Un,
|
|
368
|
+
fillerRow: Yn
|
|
369
|
+
};
|
|
370
|
+
function jr(e) {
|
|
371
|
+
return e;
|
|
372
|
+
}
|
|
373
|
+
const de = /* @__PURE__ */ new WeakMap();
|
|
374
|
+
function Ze(e, t) {
|
|
375
|
+
return de.set(e, t), e;
|
|
376
|
+
}
|
|
377
|
+
const Xn = (e) => de.has(e);
|
|
378
|
+
function se(e) {
|
|
379
|
+
return e === "list" ? to : e === "range" ? ao : typeof e == "object" && e !== null ? e : void 0;
|
|
380
|
+
}
|
|
381
|
+
function et(e, t) {
|
|
382
|
+
if (t == null) return "empty";
|
|
383
|
+
const n = de.get(e);
|
|
384
|
+
return n ? n.isCondition(t) ? n.isEmpty(t) ? "empty" : "effective" : "foreign" : "effective";
|
|
385
|
+
}
|
|
386
|
+
function Jn(e, t, n) {
|
|
387
|
+
var o;
|
|
388
|
+
return q(t) ? ((o = de.get(e)) == null ? void 0 : o.absentMatches(n)) ?? !1 : e.matches(t, n);
|
|
389
|
+
}
|
|
390
|
+
function Qn(e, t, n) {
|
|
391
|
+
const o = de.get(e);
|
|
392
|
+
return o ? o.describeIn(t, n) : e.describe(t);
|
|
393
|
+
}
|
|
394
|
+
const De = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : void 0, tt = (e) => (t, n) => {
|
|
395
|
+
const o = De(t.value), r = De(n.value);
|
|
396
|
+
return o !== void 0 && r !== void 0 ? o - r : e.compareText(t.text, n.text);
|
|
397
|
+
};
|
|
398
|
+
function Zn(e, t, n) {
|
|
399
|
+
const o = /* @__PURE__ */ new Map();
|
|
400
|
+
let r = !1;
|
|
401
|
+
for (const s of e) {
|
|
402
|
+
const l = t(s);
|
|
403
|
+
if (q(l)) {
|
|
404
|
+
r = !0;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const a = l instanceof Date ? `date:${l.getTime()}` : typeof l == "object" || typeof l == "function" ? l : `${typeof l}:${String(l)}`;
|
|
408
|
+
o.has(a) || o.set(a, l);
|
|
409
|
+
}
|
|
410
|
+
return { values: [...o.values()].map((s) => ({ value: s, text: String(s) })).sort(tt(n)).map(({ value: s }) => s), absent: r };
|
|
411
|
+
}
|
|
412
|
+
const Ve = /* @__PURE__ */ new WeakMap();
|
|
413
|
+
function Se(e) {
|
|
414
|
+
let t = Ve.get(e);
|
|
415
|
+
return t || (t = new Set(e.map(le)), Ve.set(e, t)), t;
|
|
416
|
+
}
|
|
417
|
+
const Ne = (e, t) => q(e) ? t.wording.cellAbsentValue : ae(e, t.format, t.formats, t.wording) ?? String(e);
|
|
418
|
+
function eo({
|
|
419
|
+
condition: e,
|
|
420
|
+
setCondition: t,
|
|
421
|
+
values: n,
|
|
422
|
+
absentOccurs: o = !1,
|
|
423
|
+
format: r
|
|
424
|
+
}) {
|
|
425
|
+
const i = te(), s = $(), l = V(() => e ?? [], [e]), a = V(() => {
|
|
426
|
+
const h = { formats: i, wording: s, format: r }, v = n.map((_) => ({ key: le(_), text: Ne(_, h), value: _ }));
|
|
427
|
+
v.sort(tt(i));
|
|
428
|
+
const g = new Set(v.map((_) => _.key)), p = l.filter((_) => !q(_) && !g.has(le(_))).map((_) => ({ key: le(_), text: Ne(_, h), value: _ })), b = o || l.some(q) ? [{ key: Re, text: s.cellAbsentValue, value: null }] : [];
|
|
429
|
+
return [...v, ...p, ...b];
|
|
430
|
+
}, [n, l, o, r, i, s]), u = Se(l), d = (h) => {
|
|
431
|
+
const v = u.has(h.key) ? l.filter((g) => le(g) !== h.key) : [...l, h.value];
|
|
432
|
+
t(v.length > 0 ? v : null);
|
|
433
|
+
};
|
|
434
|
+
return /* @__PURE__ */ c("div", { className: f.filterContent, children: a.map((h) => /* @__PURE__ */ c(
|
|
435
|
+
ge,
|
|
436
|
+
{
|
|
437
|
+
label: h.text,
|
|
438
|
+
checked: u.has(h.key),
|
|
439
|
+
onChange: () => d(h)
|
|
440
|
+
},
|
|
441
|
+
h.key
|
|
442
|
+
)) });
|
|
443
|
+
}
|
|
444
|
+
const to = Ze(
|
|
445
|
+
{
|
|
446
|
+
matches: (e, t) => Se(t).has(le(e)),
|
|
447
|
+
Input: eo,
|
|
448
|
+
describe: (e) => e.map((t) => q(t) ? "–" : String(t)).join(", ")
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
isCondition: (e) => Array.isArray(e),
|
|
452
|
+
isEmpty: (e) => e.length === 0,
|
|
453
|
+
absentMatches: (e) => Se(e).has(Re),
|
|
454
|
+
/* From three values on the first two and how many more: a condition is one
|
|
455
|
+
line in the table toolbar, not a list. */
|
|
456
|
+
describeIn: (e, t) => {
|
|
457
|
+
const n = e.map((r) => Ne(r, t));
|
|
458
|
+
if (n.length <= 2) return n.join(", ");
|
|
459
|
+
const o = n.length - 2;
|
|
460
|
+
return `${n.slice(0, 2).join(", ")} ${t.wording.moreValues(o, t.formats.count(o))}`;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
), no = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), oo = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime(), ce = (e) => typeof e == "number" && Number.isFinite(e), ee = (e) => e instanceof Date && !Number.isNaN(e.getTime()), ro = (e) => ee(e) ? no(e) : ce(e) ? e : void 0, so = (e) => ee(e) ? { value: oo(e), open: !0 } : ce(e) ? { value: e, open: !1 } : void 0, fe = (e, t) => ee(e) ? t.formats.date(e) : ae(e, t.format, t.formats, t.wording) ?? String(e);
|
|
464
|
+
function io({ condition: e, setCondition: t }) {
|
|
465
|
+
const n = $(), [o, r] = E(null), i = o !== null, s = o ? o.from : ce(e == null ? void 0 : e.from) ? e.from : null, l = o ? o.to : ce(e == null ? void 0 : e.to) ? e.to : null, a = (u, d) => {
|
|
466
|
+
const h = { from: s, to: l, [u]: d };
|
|
467
|
+
if (h.from !== null && h.to !== null && h.from > h.to) {
|
|
468
|
+
r(h);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (r(null), h.from === null && h.to === null) {
|
|
472
|
+
t(null);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
t({
|
|
476
|
+
...h.from !== null ? { from: h.from } : {},
|
|
477
|
+
...h.to !== null ? { to: h.to } : {}
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
return /* @__PURE__ */ T("div", { className: f.rangeFields, children: [
|
|
481
|
+
/* @__PURE__ */ c(Ee, { label: n.filterFrom, children: /* @__PURE__ */ c(Pe, { size: "sm", value: s, invalid: i, onChange: (u) => a("from", u) }) }),
|
|
482
|
+
/* @__PURE__ */ c(Ee, { label: n.filterTo, error: i ? n.rangeInvalid : void 0, children: /* @__PURE__ */ c(Pe, { size: "sm", value: l, onChange: (u) => a("to", u) }) })
|
|
483
|
+
] });
|
|
484
|
+
}
|
|
485
|
+
function lo({ condition: e, setCondition: t }) {
|
|
486
|
+
const n = ee(e == null ? void 0 : e.from) && ee(e == null ? void 0 : e.to) ? { from: e.from, to: e.to } : null;
|
|
487
|
+
return /* @__PURE__ */ c("div", { className: f.rangePeriod, children: /* @__PURE__ */ c(
|
|
488
|
+
yt,
|
|
489
|
+
{
|
|
490
|
+
size: "sm",
|
|
491
|
+
clearable: !0,
|
|
492
|
+
value: n,
|
|
493
|
+
onChange: (o) => t(o ? { from: o.from, to: o.to } : null)
|
|
494
|
+
}
|
|
495
|
+
) });
|
|
496
|
+
}
|
|
497
|
+
function co(e) {
|
|
498
|
+
return e.kind === "date" ? /* @__PURE__ */ c(lo, { ...e }) : /* @__PURE__ */ c(io, { ...e });
|
|
499
|
+
}
|
|
500
|
+
const ao = Ze(
|
|
501
|
+
{
|
|
502
|
+
matches: (e, t) => {
|
|
503
|
+
const n = ee(e) ? e.getTime() : ce(e) ? e : void 0;
|
|
504
|
+
if (n === void 0) return !1;
|
|
505
|
+
const o = ro(t.from), r = so(t.to);
|
|
506
|
+
return !(o !== void 0 && n < o || r !== void 0 && (r.open ? n >= r.value : n > r.value));
|
|
507
|
+
},
|
|
508
|
+
Input: co,
|
|
509
|
+
describe: (e) => [e.from, e.to].map((t) => t === void 0 ? "" : String(t)).join("–")
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
isCondition: (e) => typeof e != "object" || e === null || Array.isArray(e) || e instanceof Date ? !1 : Object.entries(e).every(
|
|
513
|
+
([n, o]) => (n === "from" || n === "to") && (o === void 0 || ce(o) || ee(o))
|
|
514
|
+
),
|
|
515
|
+
isEmpty: (e) => e.from === void 0 && e.to === void 0,
|
|
516
|
+
absentMatches: () => !1,
|
|
517
|
+
describeIn: (e, t) => {
|
|
518
|
+
const { from: n, to: o } = e;
|
|
519
|
+
if (n !== void 0 && o !== void 0) {
|
|
520
|
+
const r = ee(n) && ee(o) && n.getFullYear() === o.getFullYear();
|
|
521
|
+
return t.wording.rangeFromTo(
|
|
522
|
+
r ? t.formats.dateShort(n) : fe(n, t),
|
|
523
|
+
fe(o, t)
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
return n !== void 0 ? t.wording.rangeFrom(fe(n, t)) : o === void 0 ? "" : t.wording.rangeTo(fe(o, t));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
class He {
|
|
531
|
+
constructor(t) {
|
|
532
|
+
L(this, "entries", /* @__PURE__ */ new Map());
|
|
533
|
+
/** Keys in the order of the running pass. */
|
|
534
|
+
L(this, "pass", []);
|
|
535
|
+
/** Order from the markers in the DOM, after the last commit. */
|
|
536
|
+
L(this, "dom", []);
|
|
537
|
+
this.markerAttribute = t;
|
|
538
|
+
}
|
|
539
|
+
note(t) {
|
|
540
|
+
this.pass.includes(t) || this.pass.push(t);
|
|
541
|
+
}
|
|
542
|
+
/** The entries in JSX order, as well as it is known right now: from the pass
|
|
543
|
+
when it knows every one, otherwise from the DOM. */
|
|
544
|
+
ordered() {
|
|
545
|
+
const t = [...this.entries.keys()], n = t.every((o) => this.pass.includes(o)) ? this.pass : this.dom;
|
|
546
|
+
return [
|
|
547
|
+
...n.filter((o) => this.entries.has(o)),
|
|
548
|
+
...t.filter((o) => !n.includes(o))
|
|
549
|
+
].map((o) => this.entries.get(o));
|
|
550
|
+
}
|
|
551
|
+
/** Reads the markers; reports whether the valid order changes because of it. */
|
|
552
|
+
check(t) {
|
|
553
|
+
const n = Array.from(t.querySelectorAll(`[${this.markerAttribute}]`)).map((r) => r.getAttribute(this.markerAttribute)).filter((r) => this.entries.has(r)), o = this.ordered().map((r) => r.key).join("|");
|
|
554
|
+
return this.dom = n, this.pass = n, o !== this.ordered().map((r) => r.key).join("|");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const uo = (e) => JSON.stringify([
|
|
558
|
+
e.id,
|
|
559
|
+
e.label,
|
|
560
|
+
typeof e.value == "string" ? e.value : "ƒ",
|
|
561
|
+
e.format,
|
|
562
|
+
e.footer,
|
|
563
|
+
e.rowHeader,
|
|
564
|
+
e.rightAligned,
|
|
565
|
+
e.width,
|
|
566
|
+
e.resizable,
|
|
567
|
+
e.sortable,
|
|
568
|
+
e.searchable,
|
|
569
|
+
/* A filter of one's own counts as a kind, not as an object: written in the
|
|
570
|
+
call it is a new one on every render. */
|
|
571
|
+
typeof e.filter == "object" ? "own" : e.filter,
|
|
572
|
+
!!e.presentation,
|
|
573
|
+
!!e.ownSortValue,
|
|
574
|
+
!!e.ownExportValue
|
|
575
|
+
]), fo = (e, t) => e == null ? void 0 : e[t];
|
|
576
|
+
class ho {
|
|
577
|
+
constructor() {
|
|
578
|
+
L(this, "columns", new He("data-umriss-column"));
|
|
579
|
+
L(this, "actions", new He("data-umriss-action"));
|
|
580
|
+
L(this, "signatures", /* @__PURE__ */ new Map());
|
|
581
|
+
/** The row detail: the presentation of the `RowDetail` that registered last. */
|
|
582
|
+
L(this, "detail", null);
|
|
583
|
+
/** How many `RowActions` stand right now. */
|
|
584
|
+
L(this, "actionGroups", /* @__PURE__ */ new Set());
|
|
585
|
+
/** Whether the row header column sticks - it then stands first, on screen, in
|
|
586
|
+
the column menu and in the export alike. */
|
|
587
|
+
L(this, "stickyRowHeader", !1);
|
|
588
|
+
/* Without a pagination bar the table does not page: one that stops quietly at
|
|
589
|
+
the tenth row because nobody put one there is a trap (found at the alarm
|
|
590
|
+
list, umriss-table 13). Without a table toolbar, but with a search or a
|
|
591
|
+
column filter, the table puts one there itself (table-filters 04):
|
|
592
|
+
conditions and the ratio need a place, and a place that came into being
|
|
593
|
+
only with the first condition would shift the table. */
|
|
594
|
+
L(this, "parts", /* @__PURE__ */ new Map());
|
|
595
|
+
/** The element the table's children stand in - for the markers. */
|
|
596
|
+
L(this, "children", null);
|
|
597
|
+
L(this, "hook", null);
|
|
598
|
+
L(this, "structure", 0);
|
|
599
|
+
L(this, "values", 0);
|
|
600
|
+
L(this, "presentation", 0);
|
|
601
|
+
L(this, "hookVersion", 0);
|
|
602
|
+
L(this, "reported", "");
|
|
603
|
+
L(this, "listeners", /* @__PURE__ */ new Set());
|
|
604
|
+
/* --- Subscription ------------------------------------------------------------- */
|
|
605
|
+
L(this, "subscribe", (t) => (this.listeners.add(t), () => {
|
|
606
|
+
this.listeners.delete(t);
|
|
607
|
+
}));
|
|
608
|
+
/** What the hook reads. */
|
|
609
|
+
L(this, "structureVersion", () => this.structure);
|
|
610
|
+
/** What body and unbound parts read. Every counter only rises, so the sum
|
|
611
|
+
rises exactly when one of them rises. */
|
|
612
|
+
L(this, "bodyVersion", () => this.structure + this.values + this.presentation + this.hookVersion);
|
|
613
|
+
/* --- The kind of a column ------------------------------------------------------- */
|
|
614
|
+
L(this, "kinds", /* @__PURE__ */ new Map());
|
|
615
|
+
/* --- The model ------------------------------------------------------------------ */
|
|
616
|
+
L(this, "modelCache", null);
|
|
617
|
+
L(this, "projectionCache", null);
|
|
618
|
+
L(this, "unpaged", null);
|
|
619
|
+
}
|
|
620
|
+
/** Reports from a layout effect what has changed since the last report.
|
|
621
|
+
Without a change nothing happens. */
|
|
622
|
+
commit() {
|
|
623
|
+
const t = `${this.structure}:${this.values}:${this.presentation}:${this.hookVersion}`;
|
|
624
|
+
if (t !== this.reported) {
|
|
625
|
+
this.reported = t;
|
|
626
|
+
for (const n of [...this.listeners]) n();
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/* --- The pass ----------------------------------------------------------------- */
|
|
630
|
+
/** The table renders: a new pass begins. Idempotent - a second call within
|
|
631
|
+
the same pass clears what is empty anyway. */
|
|
632
|
+
beginPass() {
|
|
633
|
+
this.columns.pass = [], this.actions.pass = [];
|
|
634
|
+
}
|
|
635
|
+
/** After the commit: check the order against the DOM. */
|
|
636
|
+
checkOrder() {
|
|
637
|
+
this.children && (this.columns.check(this.children) && this.structure++, this.actions.check(this.children) && this.structure++);
|
|
638
|
+
}
|
|
639
|
+
/* --- Columns ------------------------------------------------------------------ */
|
|
640
|
+
/** A column registers during the render. Idempotent: the same spec changes no
|
|
641
|
+
version. */
|
|
642
|
+
registerColumn(t, n) {
|
|
643
|
+
const o = this.columns.entries.get(t), r = uo(n);
|
|
644
|
+
if (o) {
|
|
645
|
+
const i = o.spec;
|
|
646
|
+
this.signatures.get(t) !== r && this.structure++, (i.value !== n.value || i.ownSortValue !== n.ownSortValue) && this.values++, (i.presentation !== n.presentation || i.ownExportValue !== n.ownExportValue) && this.presentation++, o.spec = n;
|
|
647
|
+
} else {
|
|
648
|
+
const i = {
|
|
649
|
+
key: t,
|
|
650
|
+
spec: n,
|
|
651
|
+
read: (s) => {
|
|
652
|
+
const l = i.spec.value;
|
|
653
|
+
return typeof l == "string" ? fo(s, l) : l(s);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
this.columns.entries.set(t, i), this.structure++;
|
|
657
|
+
}
|
|
658
|
+
this.signatures.set(t, r), this.columns.note(t), this.checkUniqueness();
|
|
659
|
+
}
|
|
660
|
+
/** After mounting - including after the Strict Mode's second mount, whose
|
|
661
|
+
cleanup removed the entry in between. */
|
|
662
|
+
ensureColumn(t, n) {
|
|
663
|
+
this.columns.entries.has(t) || this.registerColumn(t, n);
|
|
664
|
+
}
|
|
665
|
+
removeColumn(t) {
|
|
666
|
+
this.columns.entries.delete(t) && (this.signatures.delete(t), this.structure++);
|
|
667
|
+
}
|
|
668
|
+
checkUniqueness() {
|
|
669
|
+
const t = /* @__PURE__ */ new Set();
|
|
670
|
+
let n = 0;
|
|
671
|
+
for (const { spec: o } of this.columns.entries.values())
|
|
672
|
+
t.has(o.id) && re(`id:${o.id}`, `Two columns carry the id "${o.id}". The second one is passed over.`), t.add(o.id), o.rowHeader && n++;
|
|
673
|
+
n > 1 && re("rowHeader", "More than one column is `rowHeader`. A table has at most one row header; the first one holds.");
|
|
674
|
+
}
|
|
675
|
+
/** The table says during the render whether its row header sticks. Idempotent. */
|
|
676
|
+
setStickyRowHeader(t) {
|
|
677
|
+
this.stickyRowHeader !== t && (this.stickyRowHeader = t, this.structure++);
|
|
678
|
+
}
|
|
679
|
+
/** Puts the row header first when it sticks - the one place where that is
|
|
680
|
+
decided, for screen, column menu and export. */
|
|
681
|
+
withStickyHeaderFirst(t) {
|
|
682
|
+
const n = this.rowHeader();
|
|
683
|
+
if (!this.stickyRowHeader || !n) return [...t];
|
|
684
|
+
const o = t.find((r) => r.id === n.spec.id);
|
|
685
|
+
return o ? [o, ...t.filter((r) => r !== o)] : [...t];
|
|
686
|
+
}
|
|
687
|
+
/** The columns in JSX order, the first one per id. */
|
|
688
|
+
orderedColumns() {
|
|
689
|
+
const t = /* @__PURE__ */ new Set();
|
|
690
|
+
return this.columns.ordered().filter((n) => t.has(n.spec.id) ? !1 : (t.add(n.spec.id), !0));
|
|
691
|
+
}
|
|
692
|
+
columnById(t) {
|
|
693
|
+
return this.orderedColumns().find((n) => n.spec.id === t);
|
|
694
|
+
}
|
|
695
|
+
rowHeader() {
|
|
696
|
+
return this.orderedColumns().find((t) => t.spec.rowHeader);
|
|
697
|
+
}
|
|
698
|
+
/** The kind of a column, read off the rows passed in and remembered. */
|
|
699
|
+
kindOf(t, n) {
|
|
700
|
+
const o = this.kinds.get(t.key);
|
|
701
|
+
if (o && o.rows === n && o.value === t.spec.value) return o.kind;
|
|
702
|
+
const r = Mt(n, t.read);
|
|
703
|
+
return this.kinds.set(t.key, { rows: n, value: t.spec.value, kind: r }), r;
|
|
704
|
+
}
|
|
705
|
+
/** Can it be sorted by this column? Without a statement: when its value is
|
|
706
|
+
text, a number, a point in time or a boolean, or it has a sort value of its
|
|
707
|
+
own. */
|
|
708
|
+
isSortable(t, n) {
|
|
709
|
+
const { sortable: o, ownSortValue: r } = t.spec;
|
|
710
|
+
return o ?? (this.kindOf(t, n) !== "other" || !!r);
|
|
711
|
+
}
|
|
712
|
+
/** The columns for tableModel. The same identity as long as nothing changed
|
|
713
|
+
that the model reads - that is how the body recognises whether it may take
|
|
714
|
+
over the hook's calculation. */
|
|
715
|
+
modelColumns(t, n) {
|
|
716
|
+
var s;
|
|
717
|
+
const o = this.orderedColumns(), r = [this.structure, this.values, o.map((l) => l.key).join("|")].join(":");
|
|
718
|
+
if (((s = this.modelCache) == null ? void 0 : s.key) === r && this.modelCache.rows === t && this.modelCache.formats === n)
|
|
719
|
+
return this.modelCache.columns;
|
|
720
|
+
const i = o.map((l) => {
|
|
721
|
+
const { spec: a } = l, u = this.kindOf(l, t), d = this.isSortable(l, t), h = a.searchable ?? u === "text", v = (g) => Je(l.read(g), a.ownSortValue);
|
|
722
|
+
return {
|
|
723
|
+
id: a.id,
|
|
724
|
+
label: a.label,
|
|
725
|
+
value: d || h ? v : void 0,
|
|
726
|
+
/* Text sorts with the provider's comparison, not with the built-in
|
|
727
|
+
German one (spec, the table of defaults). */
|
|
728
|
+
compare: u === "text" && !a.ownSortValue ? (g, p) => n.compareText(String(v(g)), String(v(p))) : void 0,
|
|
729
|
+
searchable: h,
|
|
730
|
+
hideable: !a.rowHeader,
|
|
731
|
+
resizable: a.resizable,
|
|
732
|
+
width: a.width
|
|
733
|
+
};
|
|
734
|
+
});
|
|
735
|
+
return this.modelCache = { key: r, rows: t, formats: n, columns: i }, i;
|
|
736
|
+
}
|
|
737
|
+
/** The projection for the body. Without a pagination bar it is a single page
|
|
738
|
+
holding all the filtered rows. */
|
|
739
|
+
projection() {
|
|
740
|
+
var n;
|
|
741
|
+
const t = this.computedProjection();
|
|
742
|
+
return this.paginates() || this.hook.companion.virtual ? t : (((n = this.unpaged) == null ? void 0 : n.from) !== t && (this.unpaged = { from: t, projection: { ...t, visible: t.filtered, page: 1, pageCount: 1 } }), this.unpaged.projection);
|
|
743
|
+
}
|
|
744
|
+
/** The hook's projection when it calculated with the same columns - otherwise
|
|
745
|
+
a new one, with the columns of this pass. */
|
|
746
|
+
computedProjection() {
|
|
747
|
+
var l;
|
|
748
|
+
const t = this.hook, n = this.modelColumns(t.rows, t.formats), o = t.companion;
|
|
749
|
+
if (n === t.modelColumns)
|
|
750
|
+
return o;
|
|
751
|
+
if (((l = this.projectionCache) == null ? void 0 : l.hook) === t && this.projectionCache.columns === n) return this.projectionCache.projection;
|
|
752
|
+
const r = {
|
|
753
|
+
search: o.search,
|
|
754
|
+
filter: t.filter,
|
|
755
|
+
sort: o.sort,
|
|
756
|
+
page: o.page,
|
|
757
|
+
pageSize: o.virtual ? 0 : o.pageSize,
|
|
758
|
+
hidden: o.hidden,
|
|
759
|
+
order: o.order
|
|
760
|
+
}, i = Oe(t.admitted, n, r), s = o.virtual ? { ...i, visible: i.filtered.slice(o.virtual.from, o.virtual.to) } : i;
|
|
761
|
+
return this.projectionCache = { hook: t, columns: n, projection: s }, s;
|
|
762
|
+
}
|
|
763
|
+
/* --- The hook's snapshot ---------------------------------------------------------- */
|
|
764
|
+
/** The hook deposits its snapshot during the render. Idempotent for the same
|
|
765
|
+
snapshot; a new one counts for the body. */
|
|
766
|
+
setHook(t) {
|
|
767
|
+
this.hook !== t && (this.hook = t, this.hookVersion++);
|
|
768
|
+
}
|
|
769
|
+
/* --- Pagination bar, table toolbar, search ---------------------------------------- */
|
|
770
|
+
set(t) {
|
|
771
|
+
const n = this.parts.get(t);
|
|
772
|
+
if (n) return n;
|
|
773
|
+
const o = /* @__PURE__ */ new Set();
|
|
774
|
+
return this.parts.set(t, o), o;
|
|
775
|
+
}
|
|
776
|
+
/** A part registers during the render. Idempotent (guarantee 1). */
|
|
777
|
+
register(t, n) {
|
|
778
|
+
const o = this.set(t);
|
|
779
|
+
o.has(n) || (o.add(n), this.structure++);
|
|
780
|
+
}
|
|
781
|
+
remove(t, n) {
|
|
782
|
+
this.set(t).delete(n) && this.structure++;
|
|
783
|
+
}
|
|
784
|
+
count(t) {
|
|
785
|
+
return this.set(t).size;
|
|
786
|
+
}
|
|
787
|
+
paginates() {
|
|
788
|
+
return this.count("pagination") > 0;
|
|
789
|
+
}
|
|
790
|
+
/** Whether the table puts up a table toolbar of its own. */
|
|
791
|
+
needsOwnToolbar() {
|
|
792
|
+
return this.count("toolbar") > 0 ? !1 : this.count("search") > 0 || this.orderedColumns().some((t) => se(t.spec.filter) !== void 0);
|
|
793
|
+
}
|
|
794
|
+
/* --- Row detail ------------------------------------------------------------------- */
|
|
795
|
+
registerDetail(t, n) {
|
|
796
|
+
!this.detail || this.detail.key !== t ? (this.detail = { key: t, presentation: n }, this.structure++) : this.detail.presentation !== n && (this.detail = { key: t, presentation: n }, this.presentation++);
|
|
797
|
+
}
|
|
798
|
+
removeDetail(t) {
|
|
799
|
+
var n;
|
|
800
|
+
((n = this.detail) == null ? void 0 : n.key) === t && (this.detail = null, this.structure++);
|
|
801
|
+
}
|
|
802
|
+
/* --- Actions ---------------------------------------------------------------------- */
|
|
803
|
+
registerActionGroup(t) {
|
|
804
|
+
this.actionGroups.has(t) || (this.actionGroups.add(t), this.structure++);
|
|
805
|
+
}
|
|
806
|
+
removeActionGroup(t) {
|
|
807
|
+
this.actionGroups.delete(t) && this.structure++;
|
|
808
|
+
}
|
|
809
|
+
hasRowActions() {
|
|
810
|
+
return this.actionGroups.size > 0 && this.actions.entries.size > 0;
|
|
811
|
+
}
|
|
812
|
+
registerAction(t, n) {
|
|
813
|
+
const o = this.actions.entries.get(t);
|
|
814
|
+
if (!o)
|
|
815
|
+
this.actions.entries.set(t, { key: t, spec: n }), this.structure++;
|
|
816
|
+
else {
|
|
817
|
+
const r = o.spec;
|
|
818
|
+
r.label !== n.label || r.bulk !== n.bulk || r.tone !== n.tone ? this.structure++ : r.onSelect !== n.onSelect && this.presentation++, o.spec = n;
|
|
819
|
+
}
|
|
820
|
+
this.actions.note(t);
|
|
821
|
+
}
|
|
822
|
+
ensureAction(t, n) {
|
|
823
|
+
this.actions.entries.has(t) || this.registerAction(t, n);
|
|
824
|
+
}
|
|
825
|
+
removeAction(t) {
|
|
826
|
+
this.actions.entries.delete(t) && this.structure++;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
const nt = /* @__PURE__ */ new WeakMap(), mo = (e, t) => {
|
|
830
|
+
nt.set(e, t);
|
|
831
|
+
}, po = (e) => typeof e == "function" || typeof e == "object" && e !== null ? nt.get(e) : void 0, H = (...e) => e.filter(Boolean).join(" ");
|
|
832
|
+
function ot({
|
|
833
|
+
entry: e,
|
|
834
|
+
registry: t,
|
|
835
|
+
hook: n,
|
|
836
|
+
anchor: o,
|
|
837
|
+
focus: r,
|
|
838
|
+
open: i,
|
|
839
|
+
setOpen: s,
|
|
840
|
+
panelId: l
|
|
841
|
+
}) {
|
|
842
|
+
const a = $(), u = te(), { id: d, label: h, format: v } = e.spec, { values: g, absent: p } = V(() => Zn(n.admitted, e.read, u), [n.admitted, e, u]), b = se(e.spec.filter);
|
|
843
|
+
if (!b) return null;
|
|
844
|
+
const _ = n.publicSnapshot, m = b.Input, y = Xn(b) ? { absentOccurs: p, format: v, kind: t.kindOf(e, n.rows) } : {}, O = () => {
|
|
845
|
+
var N;
|
|
846
|
+
s(!1), (N = (r ?? o).current) == null || N.focus();
|
|
847
|
+
};
|
|
848
|
+
return /* @__PURE__ */ T(
|
|
849
|
+
qe,
|
|
850
|
+
{
|
|
851
|
+
open: i,
|
|
852
|
+
onOpenChange: s,
|
|
853
|
+
anchorRef: o,
|
|
854
|
+
align: "end",
|
|
855
|
+
role: "dialog",
|
|
856
|
+
ariaLabel: a.filterColumn(h),
|
|
857
|
+
id: l,
|
|
858
|
+
className: f.filterPanel,
|
|
859
|
+
children: [
|
|
860
|
+
/* @__PURE__ */ c(
|
|
861
|
+
m,
|
|
862
|
+
{
|
|
863
|
+
condition: _.filter[d] ?? null,
|
|
864
|
+
setCondition: (N) => _.setFilter(d, N),
|
|
865
|
+
values: g,
|
|
866
|
+
column: { id: d, label: h },
|
|
867
|
+
...y
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
/* @__PURE__ */ T("div", { className: f.filterFooter, children: [
|
|
871
|
+
/* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => _.setFilter(d, null), children: a.filterReset }),
|
|
872
|
+
/* @__PURE__ */ c(G, { size: "sm", onClick: O, children: a.filterDone })
|
|
873
|
+
] })
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
function go({
|
|
879
|
+
entry: e,
|
|
880
|
+
registry: t,
|
|
881
|
+
hook: n
|
|
882
|
+
}) {
|
|
883
|
+
const o = $(), [r, i] = E(!1), s = oe(null), l = Z(), { id: a, label: u } = e.spec, d = a in n.publicSnapshot.filter;
|
|
884
|
+
return /* @__PURE__ */ T(Q, { children: [
|
|
885
|
+
/* @__PURE__ */ c(
|
|
886
|
+
"button",
|
|
887
|
+
{
|
|
888
|
+
ref: s,
|
|
889
|
+
type: "button",
|
|
890
|
+
className: H(f.filterButton, d && f.filterActive),
|
|
891
|
+
"aria-label": o.filterColumn(u),
|
|
892
|
+
"aria-haspopup": "dialog",
|
|
893
|
+
"aria-expanded": r,
|
|
894
|
+
"aria-controls": r ? l : void 0,
|
|
895
|
+
onClick: () => i(!r),
|
|
896
|
+
children: /* @__PURE__ */ c("svg", { viewBox: "0 0 14 14", width: "13", height: "13", "aria-hidden": "true", children: /* @__PURE__ */ c(
|
|
897
|
+
"path",
|
|
898
|
+
{
|
|
899
|
+
d: "M1.8 2.6h10.4L8.3 7.5v3.4l-2.6 1.1V7.5L1.8 2.6z",
|
|
900
|
+
fill: d ? "currentColor" : "none",
|
|
901
|
+
stroke: "currentColor",
|
|
902
|
+
strokeWidth: "1.4",
|
|
903
|
+
strokeLinecap: "round",
|
|
904
|
+
strokeLinejoin: "round"
|
|
905
|
+
}
|
|
906
|
+
) })
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ c(
|
|
910
|
+
ot,
|
|
911
|
+
{
|
|
912
|
+
entry: e,
|
|
913
|
+
registry: t,
|
|
914
|
+
hook: n,
|
|
915
|
+
anchor: s,
|
|
916
|
+
open: r,
|
|
917
|
+
setOpen: i,
|
|
918
|
+
panelId: l
|
|
919
|
+
}
|
|
920
|
+
)
|
|
921
|
+
] });
|
|
922
|
+
}
|
|
923
|
+
function bo({ registry: e, hook: t }) {
|
|
924
|
+
const n = $(), o = te(), r = Object.entries(t.publicSnapshot.filter).flatMap(([i, s]) => {
|
|
925
|
+
const l = e.columnById(i), a = l ? se(l.spec.filter) : void 0;
|
|
926
|
+
if (!l || !a) return [];
|
|
927
|
+
const u = { formats: o, wording: n, format: l.spec.format, kind: e.kindOf(l, t.rows) };
|
|
928
|
+
return [{ entry: l, text: Qn(a, s, u) }];
|
|
929
|
+
});
|
|
930
|
+
return r.length === 0 ? null : /* @__PURE__ */ c(Ct, { "aria-label": n.conditions, className: f.conditions, children: r.map(({ entry: i, text: s }) => /* @__PURE__ */ c(vo, { entry: i, text: s, registry: e, hook: t }, i.spec.id)) });
|
|
931
|
+
}
|
|
932
|
+
function vo({
|
|
933
|
+
entry: e,
|
|
934
|
+
text: t,
|
|
935
|
+
registry: n,
|
|
936
|
+
hook: o
|
|
937
|
+
}) {
|
|
938
|
+
const r = $(), [i, s] = E(!1), l = oe(null), a = oe(null), u = Z(), { id: d, label: h } = e.spec;
|
|
939
|
+
return /* @__PURE__ */ T(Q, { children: [
|
|
940
|
+
/* @__PURE__ */ c(
|
|
941
|
+
St,
|
|
942
|
+
{
|
|
943
|
+
ref: l,
|
|
944
|
+
className: f.condition,
|
|
945
|
+
onRemove: () => o.publicSnapshot.setFilter(d, null),
|
|
946
|
+
removeLabel: r.removeConditionNamed(h, t),
|
|
947
|
+
children: /* @__PURE__ */ T(
|
|
948
|
+
"button",
|
|
949
|
+
{
|
|
950
|
+
ref: a,
|
|
951
|
+
type: "button",
|
|
952
|
+
className: f.conditionButton,
|
|
953
|
+
"aria-label": r.editConditionNamed(h, t),
|
|
954
|
+
"aria-haspopup": "dialog",
|
|
955
|
+
"aria-expanded": i,
|
|
956
|
+
"aria-controls": i ? u : void 0,
|
|
957
|
+
onClick: () => s(!i),
|
|
958
|
+
children: [
|
|
959
|
+
/* @__PURE__ */ c("span", { className: f.filterLabel, children: h }),
|
|
960
|
+
/* @__PURE__ */ c("span", { className: f.filterValue, children: t })
|
|
961
|
+
]
|
|
962
|
+
}
|
|
963
|
+
)
|
|
964
|
+
}
|
|
965
|
+
),
|
|
966
|
+
/* @__PURE__ */ c(
|
|
967
|
+
ot,
|
|
968
|
+
{
|
|
969
|
+
entry: e,
|
|
970
|
+
registry: n,
|
|
971
|
+
hook: o,
|
|
972
|
+
anchor: l,
|
|
973
|
+
focus: a,
|
|
974
|
+
open: i,
|
|
975
|
+
setOpen: s,
|
|
976
|
+
panelId: u
|
|
977
|
+
}
|
|
978
|
+
)
|
|
979
|
+
] });
|
|
980
|
+
}
|
|
981
|
+
const Be = ";", wo = `\r
|
|
982
|
+
`, _o = "\uFEFF", ko = (e) => String(e).replace(".", ","), rt = (e) => /[";\r\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e, yo = (e, t) => {
|
|
983
|
+
var o;
|
|
984
|
+
const n = (o = t.value) == null ? void 0 : o.call(t, e);
|
|
985
|
+
return n == null ? "" : rt(typeof n == "number" ? ko(n) : String(n));
|
|
986
|
+
};
|
|
987
|
+
function Co(e, t) {
|
|
988
|
+
const n = t.map((r) => rt(r.label ?? r.id)).join(Be), o = e.map((r) => t.map((i) => yo(r, i)).join(Be));
|
|
989
|
+
return _o + [n, ...o].join(wo);
|
|
990
|
+
}
|
|
991
|
+
function st(e) {
|
|
992
|
+
const t = new Map(e.orderedColumns().map((o) => [o.spec.id, o])), n = e.projection().columns.map((o) => t.get(o.id)).filter((o) => o !== void 0);
|
|
993
|
+
return e.withStickyHeaderFirst(n.map((o) => ({ id: o.spec.id, e: o }))).map(({ e: o }) => o);
|
|
994
|
+
}
|
|
995
|
+
function it(e) {
|
|
996
|
+
e.setSearch("");
|
|
997
|
+
for (const t of Object.keys(e.filter)) e.setFilter(t, null);
|
|
998
|
+
}
|
|
999
|
+
function So(e) {
|
|
1000
|
+
const t = e.hook;
|
|
1001
|
+
if (!t) return "";
|
|
1002
|
+
const n = st(e).filter((o) => e.kindOf(o, t.rows) !== "other" || o.spec.ownExportValue).map(
|
|
1003
|
+
(o) => ({
|
|
1004
|
+
id: o.spec.id,
|
|
1005
|
+
label: o.spec.label,
|
|
1006
|
+
value: (r) => Qe(o.read(r), o.spec.ownExportValue)
|
|
1007
|
+
})
|
|
1008
|
+
);
|
|
1009
|
+
return Co(e.projection().filtered, n);
|
|
1010
|
+
}
|
|
1011
|
+
function lt({
|
|
1012
|
+
registry: e,
|
|
1013
|
+
className: t,
|
|
1014
|
+
children: n,
|
|
1015
|
+
own: o = !1
|
|
1016
|
+
}) {
|
|
1017
|
+
const r = $(), i = te(), s = (e == null ? void 0 : e.hook) ?? null;
|
|
1018
|
+
let l = null, a = null;
|
|
1019
|
+
if (e && s) {
|
|
1020
|
+
const u = s.publicSnapshot, d = u.search !== "" || Object.keys(u.filter).length > 0, h = o ? [] : u.filtered.filter((g) => u.selection.isSelected(s.rowKey(g))), v = e.hasRowActions() ? e.actions.ordered().filter((g) => g.spec.bulk) : [];
|
|
1021
|
+
l = /* @__PURE__ */ c(bo, { registry: e, hook: s }), a = /* @__PURE__ */ T("div", { className: f.toolbarGroup, children: [
|
|
1022
|
+
/* @__PURE__ */ c("span", { role: "status", className: f.filteredCount, children: d ? r.filteredOfTotal(i.count(u.filtered.length), i.count(s.admitted.length)) : "" }),
|
|
1023
|
+
d && /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(u), children: r.resetAll }),
|
|
1024
|
+
h.length > 0 && /* @__PURE__ */ T(Q, { children: [
|
|
1025
|
+
/* @__PURE__ */ c("span", { className: f.toolbarInfo, children: r.selectedCount(h.length, i.count(h.length)) }),
|
|
1026
|
+
v.map(({ key: g, spec: p }) => /* @__PURE__ */ c(
|
|
1027
|
+
G,
|
|
1028
|
+
{
|
|
1029
|
+
size: "sm",
|
|
1030
|
+
variant: p.tone === "danger" ? "danger" : "secondary",
|
|
1031
|
+
onClick: () => p.onSelect(h),
|
|
1032
|
+
children: p.label
|
|
1033
|
+
},
|
|
1034
|
+
g
|
|
1035
|
+
))
|
|
1036
|
+
] })
|
|
1037
|
+
] });
|
|
1038
|
+
}
|
|
1039
|
+
return /* @__PURE__ */ T("div", { className: H(f.toolbar, t), children: [
|
|
1040
|
+
/* @__PURE__ */ T("div", { className: f.toolbarGroup, children: [
|
|
1041
|
+
n,
|
|
1042
|
+
l
|
|
1043
|
+
] }),
|
|
1044
|
+
a
|
|
1045
|
+
] });
|
|
1046
|
+
}
|
|
1047
|
+
const Ae = Ge(null), No = () => () => {
|
|
1048
|
+
}, $e = () => 0;
|
|
1049
|
+
function ue(e) {
|
|
1050
|
+
var r;
|
|
1051
|
+
const t = xe(Ae), n = e ? po(e.Table) ?? null : (t == null ? void 0 : t.registry) ?? null;
|
|
1052
|
+
pe(
|
|
1053
|
+
n ? n.subscribe : No,
|
|
1054
|
+
n ? n.bodyVersion : $e,
|
|
1055
|
+
n ? n.bodyVersion : $e
|
|
1056
|
+
);
|
|
1057
|
+
const o = (r = n == null ? void 0 : n.hook) == null ? void 0 : r.publicSnapshot;
|
|
1058
|
+
return !n || !o ? null : { registry: n, snapshot: o, inside: !e && t !== null, footerTarget: e ? null : (t == null ? void 0 : t.footerTarget) ?? null };
|
|
1059
|
+
}
|
|
1060
|
+
function Ao(e) {
|
|
1061
|
+
const t = typeof e.value == "string" ? e.value : void 0;
|
|
1062
|
+
let n = e.id ?? t;
|
|
1063
|
+
return n === void 0 && (re(`without-id:${e.label}`, `The column "${e.label}" has a computed value but no id. Its label serves as the id.`), n = e.label), e.children !== void 0 && typeof e.children != "function" && re(`children:${n}`, `The children of the column "${n}" are not a function and are passed over.`), {
|
|
1064
|
+
id: n,
|
|
1065
|
+
label: e.label,
|
|
1066
|
+
value: e.value,
|
|
1067
|
+
presentation: typeof e.children == "function" ? e.children : void 0,
|
|
1068
|
+
format: e.format,
|
|
1069
|
+
footer: e.footer,
|
|
1070
|
+
rowHeader: e.rowHeader === !0,
|
|
1071
|
+
rightAligned: e.numeric,
|
|
1072
|
+
width: e.width,
|
|
1073
|
+
resizable: e.resizable === !0,
|
|
1074
|
+
sortable: e.sortable,
|
|
1075
|
+
searchable: e.searchable,
|
|
1076
|
+
filter: e.filter,
|
|
1077
|
+
ownSortValue: e.sortValue,
|
|
1078
|
+
ownExportValue: e.exportValue
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
function ct({ wording: e }) {
|
|
1082
|
+
return /* @__PURE__ */ T(Q, { children: [
|
|
1083
|
+
/* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.absent, children: "—" }),
|
|
1084
|
+
/* @__PURE__ */ c(be, { children: e.cellAbsentValue })
|
|
1085
|
+
] });
|
|
1086
|
+
}
|
|
1087
|
+
function xo(e, t, n, o, r) {
|
|
1088
|
+
if (!t) return n.rowKey(e);
|
|
1089
|
+
const i = t.read(e);
|
|
1090
|
+
return q(i) ? r.cellAbsentValue : ae(i, t.spec.format, o, r) ?? n.rowKey(e);
|
|
1091
|
+
}
|
|
1092
|
+
const me = 34;
|
|
1093
|
+
function To(e) {
|
|
1094
|
+
function t(l) {
|
|
1095
|
+
const a = Z(), u = xe(Ae), d = Ao(l);
|
|
1096
|
+
return e.registerColumn(a, d), J(
|
|
1097
|
+
() => () => {
|
|
1098
|
+
e.removeColumn(a), e.commit();
|
|
1099
|
+
},
|
|
1100
|
+
[a]
|
|
1101
|
+
), J(() => {
|
|
1102
|
+
e.ensureColumn(a, d), e.checkOrder(), e.commit();
|
|
1103
|
+
}), Ye && u && u.registry !== e && re(
|
|
1104
|
+
`foreign:${d.id}`,
|
|
1105
|
+
`The column "${d.id}" comes from a different useTable call than the table it stands in. It reads the rows of its own hook.`
|
|
1106
|
+
), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-column": a });
|
|
1107
|
+
}
|
|
1108
|
+
function n({ children: l }) {
|
|
1109
|
+
const a = Z();
|
|
1110
|
+
return e.registerDetail(a, l), J(
|
|
1111
|
+
() => () => {
|
|
1112
|
+
e.removeDetail(a), e.commit();
|
|
1113
|
+
},
|
|
1114
|
+
[a]
|
|
1115
|
+
), J(() => {
|
|
1116
|
+
e.detail || e.registerDetail(a, l), e.commit();
|
|
1117
|
+
}), null;
|
|
1118
|
+
}
|
|
1119
|
+
function o({ children: l }) {
|
|
1120
|
+
const a = Z();
|
|
1121
|
+
return e.registerActionGroup(a), J(
|
|
1122
|
+
() => () => {
|
|
1123
|
+
e.removeActionGroup(a), e.commit();
|
|
1124
|
+
},
|
|
1125
|
+
[a]
|
|
1126
|
+
), J(() => {
|
|
1127
|
+
e.registerActionGroup(a), e.commit();
|
|
1128
|
+
}), /* @__PURE__ */ c(Q, { children: l });
|
|
1129
|
+
}
|
|
1130
|
+
function r(l) {
|
|
1131
|
+
const a = Z(), u = {
|
|
1132
|
+
label: l.children,
|
|
1133
|
+
bulk: l.bulk === !0,
|
|
1134
|
+
tone: l.tone ?? "default",
|
|
1135
|
+
onSelect: l.onSelect
|
|
1136
|
+
};
|
|
1137
|
+
return e.registerAction(a, u), J(
|
|
1138
|
+
() => () => {
|
|
1139
|
+
e.removeAction(a), e.commit();
|
|
1140
|
+
},
|
|
1141
|
+
[a]
|
|
1142
|
+
), J(() => {
|
|
1143
|
+
e.ensureAction(a, u), e.checkOrder(), e.commit();
|
|
1144
|
+
}), /* @__PURE__ */ c("span", { hidden: !0, "data-umriss-action": a });
|
|
1145
|
+
}
|
|
1146
|
+
function i(l) {
|
|
1147
|
+
e.beginPass(), e.setStickyRowHeader(l.stickyRowHeader === !0);
|
|
1148
|
+
const a = oe(null), [u, d] = E(null);
|
|
1149
|
+
J(() => {
|
|
1150
|
+
e.children = a.current, e.checkOrder(), e.commit();
|
|
1151
|
+
});
|
|
1152
|
+
const h = V(() => ({ registry: e, footerTarget: u }), [u]);
|
|
1153
|
+
return /* @__PURE__ */ c(Ae.Provider, { value: h, children: /* @__PURE__ */ T("div", { className: H(f.frame, l.className), children: [
|
|
1154
|
+
/* @__PURE__ */ c("div", { ref: a, className: f.children, children: l.children }),
|
|
1155
|
+
/* @__PURE__ */ c(Oo, { registry: e }),
|
|
1156
|
+
/* @__PURE__ */ c(Ro, { registry: e, props: l }),
|
|
1157
|
+
/* @__PURE__ */ c("div", { ref: d, className: f.footerTarget })
|
|
1158
|
+
] }) });
|
|
1159
|
+
}
|
|
1160
|
+
const s = { Table: i, Column: t, RowDetail: n, RowActions: o, Action: r };
|
|
1161
|
+
return mo(i, e), s;
|
|
1162
|
+
}
|
|
1163
|
+
function Oo({ registry: e }) {
|
|
1164
|
+
return pe(e.subscribe, e.bodyVersion, e.bodyVersion), !e.hook || !e.needsOwnToolbar() ? null : /* @__PURE__ */ c(lt, { registry: e, own: !0 });
|
|
1165
|
+
}
|
|
1166
|
+
function Ro({ registry: e, props: t }) {
|
|
1167
|
+
const {
|
|
1168
|
+
selectable: n = !1,
|
|
1169
|
+
stickyHeader: o = !1,
|
|
1170
|
+
stickyRowHeader: r = !1,
|
|
1171
|
+
striped: i = !1,
|
|
1172
|
+
density: s,
|
|
1173
|
+
maxHeight: l,
|
|
1174
|
+
empty: a,
|
|
1175
|
+
loading: u = !1,
|
|
1176
|
+
rowProps: d,
|
|
1177
|
+
ariaLabel: h
|
|
1178
|
+
} = t;
|
|
1179
|
+
pe(e.subscribe, e.bodyVersion, e.bodyVersion);
|
|
1180
|
+
const v = $(), g = te(), p = Ue(s, "regular"), b = Z(), _ = e.hook;
|
|
1181
|
+
if (!_) return null;
|
|
1182
|
+
const m = _.publicSnapshot, y = e.projection(), O = e.rowHeader(), N = st(e), P = e.detail, w = e.hasRowActions() ? e.actions.ordered() : [], S = _.companion.virtual, I = (n ? 1 : 0) + (P ? 1 : 0), A = I + N.length + (w.length > 0 ? 1 : 0), C = I * me, x = (M) => r && M === O, z = y.visible, F = N.some((M) => M.spec.footer), D = m.search !== "" || Object.keys(m.filter).length > 0, W = (M, K, _e) => /* @__PURE__ */ c(
|
|
1183
|
+
Fo,
|
|
1184
|
+
{
|
|
1185
|
+
row: M,
|
|
1186
|
+
index: K,
|
|
1187
|
+
absolute: S ? _e : void 0,
|
|
1188
|
+
registry: e,
|
|
1189
|
+
hook: _,
|
|
1190
|
+
columns: N,
|
|
1191
|
+
header: O,
|
|
1192
|
+
selectable: n,
|
|
1193
|
+
actions: w,
|
|
1194
|
+
stickyRowHeader: r,
|
|
1195
|
+
rowHeaderLeft: C,
|
|
1196
|
+
columnCount: A,
|
|
1197
|
+
rowProps: d,
|
|
1198
|
+
baseId: b,
|
|
1199
|
+
formats: g,
|
|
1200
|
+
wording: v
|
|
1201
|
+
},
|
|
1202
|
+
_.rowKey(M)
|
|
1203
|
+
);
|
|
1204
|
+
let U;
|
|
1205
|
+
return u ? U = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c(Po, { columns: A }) }) : y.filtered.length === 0 ? U = /* @__PURE__ */ c("tbody", { children: /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c("td", { colSpan: A, className: f.emptyCell, children: /* @__PURE__ */ c("div", { className: f.empty, children: _.admitted.length > 0 && D ? /* @__PURE__ */ T(Q, { children: [
|
|
1206
|
+
/* @__PURE__ */ c("p", { className: f.emptyTitle, children: v.nothingMatchesFilters }),
|
|
1207
|
+
/* @__PURE__ */ c(G, { size: "sm", variant: "ghost", onClick: () => it(m), children: v.resetAll })
|
|
1208
|
+
] }) : a ?? /* @__PURE__ */ c("p", { className: f.emptyTitle, children: v.noEntries }) }) }) }) }) : S ? U = /* @__PURE__ */ c(Mo, { virtual: S, colSpan: A, children: z.map((M, K) => W(M, K, S.from + K)) }) : U = /* @__PURE__ */ c("tbody", { children: z.map((M, K) => W(M, K, K)) }), /* @__PURE__ */ c(
|
|
1209
|
+
"div",
|
|
1210
|
+
{
|
|
1211
|
+
ref: S == null ? void 0 : S.scrollRef,
|
|
1212
|
+
onScroll: S == null ? void 0 : S.onScroll,
|
|
1213
|
+
className: f.scroll,
|
|
1214
|
+
style: l ? { maxHeight: l } : void 0,
|
|
1215
|
+
children: /* @__PURE__ */ T(
|
|
1216
|
+
"table",
|
|
1217
|
+
{
|
|
1218
|
+
"aria-label": h,
|
|
1219
|
+
"aria-rowcount": S ? y.filtered.length + 1 : void 0,
|
|
1220
|
+
className: H(
|
|
1221
|
+
f.table,
|
|
1222
|
+
p === "compact" && f.compact,
|
|
1223
|
+
o && f.sticky,
|
|
1224
|
+
i && f.striped
|
|
1225
|
+
),
|
|
1226
|
+
children: [
|
|
1227
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ T("tr", { children: [
|
|
1228
|
+
n && /* @__PURE__ */ c(
|
|
1229
|
+
"th",
|
|
1230
|
+
{
|
|
1231
|
+
scope: "col",
|
|
1232
|
+
className: H(f.th, f.control, r && f.stickyCell),
|
|
1233
|
+
style: r ? { left: 0 } : void 0,
|
|
1234
|
+
children: /* @__PURE__ */ c(
|
|
1235
|
+
ge,
|
|
1236
|
+
{
|
|
1237
|
+
"aria-label": v.selectAllRows,
|
|
1238
|
+
checked: m.selection.allSelected,
|
|
1239
|
+
indeterminate: m.selection.someSelected,
|
|
1240
|
+
onChange: m.selection.toggleAll
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1243
|
+
}
|
|
1244
|
+
),
|
|
1245
|
+
P && /* @__PURE__ */ c(
|
|
1246
|
+
"td",
|
|
1247
|
+
{
|
|
1248
|
+
className: H(f.th, f.control, r && f.stickyCell),
|
|
1249
|
+
style: r ? { left: (n ? 1 : 0) * me } : void 0
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
N.map((M) => /* @__PURE__ */ c(
|
|
1253
|
+
Io,
|
|
1254
|
+
{
|
|
1255
|
+
entry: M,
|
|
1256
|
+
registry: e,
|
|
1257
|
+
hook: _,
|
|
1258
|
+
sticky: x(M),
|
|
1259
|
+
left: C
|
|
1260
|
+
},
|
|
1261
|
+
M.key
|
|
1262
|
+
)),
|
|
1263
|
+
w.length > 0 && /* @__PURE__ */ c("th", { scope: "col", className: H(f.th, f.actionsCell), children: /* @__PURE__ */ c(be, { children: v.rowActions }) })
|
|
1264
|
+
] }) }),
|
|
1265
|
+
U,
|
|
1266
|
+
F && !u && /* @__PURE__ */ c("tfoot", { children: /* @__PURE__ */ T("tr", { children: [
|
|
1267
|
+
Array.from({ length: I }, (M, K) => /* @__PURE__ */ c(
|
|
1268
|
+
"td",
|
|
1269
|
+
{
|
|
1270
|
+
className: H(f.td, f.control, r && f.stickyCell),
|
|
1271
|
+
style: r ? { left: K * me } : void 0
|
|
1272
|
+
},
|
|
1273
|
+
K
|
|
1274
|
+
)),
|
|
1275
|
+
N.map((M) => /* @__PURE__ */ c(
|
|
1276
|
+
zo,
|
|
1277
|
+
{
|
|
1278
|
+
entry: M,
|
|
1279
|
+
rows: y.filtered,
|
|
1280
|
+
formats: g,
|
|
1281
|
+
wording: v,
|
|
1282
|
+
sticky: x(M),
|
|
1283
|
+
left: C
|
|
1284
|
+
},
|
|
1285
|
+
M.key
|
|
1286
|
+
)),
|
|
1287
|
+
w.length > 0 && /* @__PURE__ */ c("td", { className: f.td })
|
|
1288
|
+
] }) })
|
|
1289
|
+
]
|
|
1290
|
+
}
|
|
1291
|
+
)
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
}
|
|
1295
|
+
function Io({
|
|
1296
|
+
entry: e,
|
|
1297
|
+
registry: t,
|
|
1298
|
+
hook: n,
|
|
1299
|
+
sticky: o,
|
|
1300
|
+
left: r
|
|
1301
|
+
}) {
|
|
1302
|
+
const { spec: i } = e, s = n.publicSnapshot, l = t.kindOf(e, n.rows), a = Xe(l, i.rightAligned), u = t.isSortable(e, n.rows), d = i.id, h = s.sort.findIndex((w) => w.column === d), v = h === -1 ? void 0 : s.sort[h].direction, g = s.sort.length > 1 && h !== -1 ? h + 1 : void 0, p = s.widths[d], b = 48, _ = (w) => {
|
|
1303
|
+
w.stopPropagation(), w.preventDefault();
|
|
1304
|
+
const S = w.currentTarget, I = S.closest("th");
|
|
1305
|
+
if (!I) return;
|
|
1306
|
+
const A = w.clientX, C = I.getBoundingClientRect().width, x = w.pointerId;
|
|
1307
|
+
S.setPointerCapture(x);
|
|
1308
|
+
const z = (D) => {
|
|
1309
|
+
D.pointerId === x && s.setWidth(d, Math.max(b, C + (D.clientX - A)));
|
|
1310
|
+
}, F = (D) => {
|
|
1311
|
+
D.pointerId === x && (S.removeEventListener("pointermove", z), S.removeEventListener("pointerup", F), S.removeEventListener("pointercancel", F), S.hasPointerCapture(x) && S.releasePointerCapture(x));
|
|
1312
|
+
};
|
|
1313
|
+
S.addEventListener("pointermove", z), S.addEventListener("pointerup", F), S.addEventListener("pointercancel", F);
|
|
1314
|
+
}, m = (w) => {
|
|
1315
|
+
const S = w == null ? void 0 : w.parentElement, I = w == null ? void 0 : w.closest("table");
|
|
1316
|
+
if (!w || !S || !I) return;
|
|
1317
|
+
const A = Array.from(S.children).indexOf(w), C = S.children.length;
|
|
1318
|
+
let x = 0;
|
|
1319
|
+
for (const z of Array.from(I.rows)) {
|
|
1320
|
+
if (z.cells.length !== C) continue;
|
|
1321
|
+
const F = z.cells[A];
|
|
1322
|
+
F && (x = Math.max(x, F.scrollWidth));
|
|
1323
|
+
}
|
|
1324
|
+
x > 0 && s.setWidth(d, Math.max(b, x + 1));
|
|
1325
|
+
}, y = (w) => {
|
|
1326
|
+
if (!i.resizable || !w.altKey) return;
|
|
1327
|
+
const S = w.key === "ArrowRight", I = w.key === "ArrowLeft", A = w.key === "Home";
|
|
1328
|
+
if (!S && !I && !A) return;
|
|
1329
|
+
w.preventDefault();
|
|
1330
|
+
const C = w.currentTarget;
|
|
1331
|
+
if (A) {
|
|
1332
|
+
m(C);
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
const x = C.getBoundingClientRect().width, z = w.shiftKey ? 32 : 8;
|
|
1336
|
+
s.setWidth(d, Math.max(b, x + (S ? z : -z)));
|
|
1337
|
+
}, O = u ? /* @__PURE__ */ T(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
type: "button",
|
|
1341
|
+
className: f.sortButton,
|
|
1342
|
+
onClick: (w) => s.toggleSort(d, w.shiftKey || w.metaKey),
|
|
1343
|
+
children: [
|
|
1344
|
+
/* @__PURE__ */ c("span", { children: i.label }),
|
|
1345
|
+
g !== void 0 && /* @__PURE__ */ c("span", { className: f.sortRank, "aria-hidden": "true", children: g }),
|
|
1346
|
+
/* @__PURE__ */ c("span", { className: H(f.sortIndicator, v && f.sortActive), "aria-hidden": "true", children: v ? /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", className: H(f.sortArrow, v === "desc" && f.sortArrowDesc), children: /* @__PURE__ */ c("path", { d: "M2.2 6.2 5 3.4l2.8 2.8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ T("svg", { viewBox: "0 0 10 12", width: "10", height: "12", children: [
|
|
1347
|
+
/* @__PURE__ */ c("path", { d: "M2.4 4.4 5 1.8l2.6 2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
1348
|
+
/* @__PURE__ */ c("path", { d: "M2.4 7.6 5 10.2l2.6-2.6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1349
|
+
] }) })
|
|
1350
|
+
]
|
|
1351
|
+
}
|
|
1352
|
+
) : i.label, N = v === "asc" ? "ascending" : v === "desc" ? "descending" : "none", P = se(i.filter) !== void 0 && !(i.filter === "list" && l === "other");
|
|
1353
|
+
return /* @__PURE__ */ T(
|
|
1354
|
+
"th",
|
|
1355
|
+
{
|
|
1356
|
+
scope: "col",
|
|
1357
|
+
"data-column": d,
|
|
1358
|
+
"aria-sort": u ? N : void 0,
|
|
1359
|
+
tabIndex: i.resizable && !u ? 0 : void 0,
|
|
1360
|
+
onKeyDown: y,
|
|
1361
|
+
className: H(f.th, a && f.numeric, o && f.stickyCell),
|
|
1362
|
+
style: {
|
|
1363
|
+
...p !== void 0 ? { width: p } : {},
|
|
1364
|
+
...o ? { left: r } : {}
|
|
1365
|
+
},
|
|
1366
|
+
children: [
|
|
1367
|
+
P ? /* @__PURE__ */ T("span", { className: f.thFlex, children: [
|
|
1368
|
+
O,
|
|
1369
|
+
/* @__PURE__ */ c(go, { entry: e, registry: t, hook: n })
|
|
1370
|
+
] }) : O,
|
|
1371
|
+
i.resizable && /* @__PURE__ */ c(
|
|
1372
|
+
"span",
|
|
1373
|
+
{
|
|
1374
|
+
role: "presentation",
|
|
1375
|
+
className: f.grip,
|
|
1376
|
+
onPointerDown: _,
|
|
1377
|
+
onClick: (w) => w.stopPropagation(),
|
|
1378
|
+
onDoubleClick: (w) => {
|
|
1379
|
+
w.stopPropagation(), m(w.currentTarget.closest("th"));
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
)
|
|
1383
|
+
]
|
|
1384
|
+
}
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1387
|
+
function Fo({
|
|
1388
|
+
row: e,
|
|
1389
|
+
index: t,
|
|
1390
|
+
absolute: n,
|
|
1391
|
+
registry: o,
|
|
1392
|
+
hook: r,
|
|
1393
|
+
columns: i,
|
|
1394
|
+
header: s,
|
|
1395
|
+
selectable: l,
|
|
1396
|
+
actions: a,
|
|
1397
|
+
stickyRowHeader: u,
|
|
1398
|
+
rowHeaderLeft: d,
|
|
1399
|
+
columnCount: h,
|
|
1400
|
+
rowProps: v,
|
|
1401
|
+
baseId: g,
|
|
1402
|
+
formats: p,
|
|
1403
|
+
wording: b
|
|
1404
|
+
}) {
|
|
1405
|
+
const _ = xe(at), m = r.publicSnapshot, y = r.rowKey(e), O = xo(e, s, r, p, b), N = o.detail, P = N !== null && m.expanded.includes(y), w = `${g}-detail-${t}`, { className: S, ...I } = (v == null ? void 0 : v(e)) ?? {}, A = n !== void 0;
|
|
1406
|
+
return /* @__PURE__ */ T(Q, { children: [
|
|
1407
|
+
/* @__PURE__ */ T(
|
|
1408
|
+
"tr",
|
|
1409
|
+
{
|
|
1410
|
+
...I,
|
|
1411
|
+
className: H(S, A && f.virtualRow),
|
|
1412
|
+
"data-row": A ? n : void 0,
|
|
1413
|
+
tabIndex: A ? n === _ ? 0 : -1 : void 0,
|
|
1414
|
+
"data-even": A && n % 2 === 1 ? "" : void 0,
|
|
1415
|
+
"aria-rowindex": A ? n + 2 : void 0,
|
|
1416
|
+
children: [
|
|
1417
|
+
l && /* @__PURE__ */ c(
|
|
1418
|
+
"td",
|
|
1419
|
+
{
|
|
1420
|
+
className: H(f.td, f.control, u && f.stickyCell),
|
|
1421
|
+
style: u ? { left: 0 } : void 0,
|
|
1422
|
+
children: /* @__PURE__ */ c(
|
|
1423
|
+
ge,
|
|
1424
|
+
{
|
|
1425
|
+
"aria-label": b.selectRow(O),
|
|
1426
|
+
checked: m.selection.isSelected(y),
|
|
1427
|
+
onChange: () => m.selection.toggle(y)
|
|
1428
|
+
}
|
|
1429
|
+
)
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
N && /* @__PURE__ */ c(
|
|
1433
|
+
"td",
|
|
1434
|
+
{
|
|
1435
|
+
className: H(f.td, f.control, u && f.stickyCell),
|
|
1436
|
+
style: u ? { left: (l ? 1 : 0) * me } : void 0,
|
|
1437
|
+
children: /* @__PURE__ */ c(
|
|
1438
|
+
"button",
|
|
1439
|
+
{
|
|
1440
|
+
type: "button",
|
|
1441
|
+
"aria-expanded": P,
|
|
1442
|
+
"aria-controls": P ? w : void 0,
|
|
1443
|
+
"aria-label": P ? b.collapseRowNamed(O) : b.expandRowNamed(O),
|
|
1444
|
+
className: H(f.expander, P && f.expanderOpen),
|
|
1445
|
+
onClick: () => m.toggleRow(y),
|
|
1446
|
+
children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M3.5 1.5 7 5l-3.5 3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
i.map((C) => /* @__PURE__ */ c(
|
|
1452
|
+
Lo,
|
|
1453
|
+
{
|
|
1454
|
+
entry: C,
|
|
1455
|
+
row: e,
|
|
1456
|
+
kind: o.kindOf(C, r.rows),
|
|
1457
|
+
sticky: u && C === s,
|
|
1458
|
+
left: d,
|
|
1459
|
+
formats: p,
|
|
1460
|
+
wording: b
|
|
1461
|
+
},
|
|
1462
|
+
C.key
|
|
1463
|
+
)),
|
|
1464
|
+
a.length > 0 && /* @__PURE__ */ c("td", { className: H(f.td, f.actionsCell), children: /* @__PURE__ */ c(Eo, { actions: a, row: e, name: O, wording: b }) })
|
|
1465
|
+
]
|
|
1466
|
+
}
|
|
1467
|
+
),
|
|
1468
|
+
P && N && /* @__PURE__ */ c("tr", { id: w, className: f.detailRow, children: /* @__PURE__ */ c("td", { colSpan: h, className: f.detailCell, children: N.presentation(e) }) })
|
|
1469
|
+
] });
|
|
1470
|
+
}
|
|
1471
|
+
function Lo({
|
|
1472
|
+
entry: e,
|
|
1473
|
+
row: t,
|
|
1474
|
+
kind: n,
|
|
1475
|
+
sticky: o,
|
|
1476
|
+
left: r,
|
|
1477
|
+
formats: i,
|
|
1478
|
+
wording: s
|
|
1479
|
+
}) {
|
|
1480
|
+
const { spec: l } = e, a = e.read(t), u = Xe(n, l.rightAligned);
|
|
1481
|
+
let d;
|
|
1482
|
+
q(a) ? d = /* @__PURE__ */ c(ct, { wording: s }) : l.presentation ? d = l.presentation(a, t) : d = ae(a, l.format, i, s);
|
|
1483
|
+
const h = l.rowHeader ? "th" : "td";
|
|
1484
|
+
return /* @__PURE__ */ c(
|
|
1485
|
+
h,
|
|
1486
|
+
{
|
|
1487
|
+
scope: l.rowHeader ? "row" : void 0,
|
|
1488
|
+
className: H(f.td, u && f.numeric, l.rowHeader && f.rowHeader, o && f.stickyCell),
|
|
1489
|
+
style: o ? { left: r } : void 0,
|
|
1490
|
+
children: d
|
|
1491
|
+
}
|
|
1492
|
+
);
|
|
1493
|
+
}
|
|
1494
|
+
function zo({
|
|
1495
|
+
entry: e,
|
|
1496
|
+
rows: t,
|
|
1497
|
+
formats: n,
|
|
1498
|
+
wording: o,
|
|
1499
|
+
sticky: r,
|
|
1500
|
+
left: i
|
|
1501
|
+
}) {
|
|
1502
|
+
const { footer: s, format: l } = e.spec, a = H(f.td, f.numeric, r && f.stickyCell), u = r ? { left: i } : void 0;
|
|
1503
|
+
if (!s) return /* @__PURE__ */ c("td", { className: H(f.td, r && f.stickyCell), style: u });
|
|
1504
|
+
const d = Ht(t, e.read, s);
|
|
1505
|
+
return /* @__PURE__ */ T("td", { className: a, style: u, "data-footer": s, children: [
|
|
1506
|
+
/* @__PURE__ */ c("span", { "aria-hidden": "true", className: f.footerKind, children: s === "sum" ? "Σ" : "⌀" }),
|
|
1507
|
+
/* @__PURE__ */ T(be, { children: [
|
|
1508
|
+
s === "sum" ? o.footerSum : o.footerAverage,
|
|
1509
|
+
" "
|
|
1510
|
+
] }),
|
|
1511
|
+
d === void 0 ? /* @__PURE__ */ c(ct, { wording: o }) : ae(d, l, n, o)
|
|
1512
|
+
] });
|
|
1513
|
+
}
|
|
1514
|
+
const jo = 2;
|
|
1515
|
+
function Eo({
|
|
1516
|
+
actions: e,
|
|
1517
|
+
row: t,
|
|
1518
|
+
name: n,
|
|
1519
|
+
wording: o
|
|
1520
|
+
}) {
|
|
1521
|
+
const r = (i) => {
|
|
1522
|
+
const s = i.onSelect;
|
|
1523
|
+
s(i.bulk ? [t] : t);
|
|
1524
|
+
};
|
|
1525
|
+
return e.length <= jo ? /* @__PURE__ */ c("div", { className: f.actions, children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(
|
|
1526
|
+
G,
|
|
1527
|
+
{
|
|
1528
|
+
size: "sm",
|
|
1529
|
+
variant: "ghost",
|
|
1530
|
+
"aria-label": o.rowAction(s.label, n),
|
|
1531
|
+
onClick: () => r(s),
|
|
1532
|
+
children: s.label
|
|
1533
|
+
},
|
|
1534
|
+
i
|
|
1535
|
+
)) }) : /* @__PURE__ */ c("div", { className: f.actions, children: /* @__PURE__ */ c(
|
|
1536
|
+
Nt,
|
|
1537
|
+
{
|
|
1538
|
+
align: "end",
|
|
1539
|
+
trigger: /* @__PURE__ */ c(G, { size: "sm", variant: "ghost", "aria-label": o.rowActionsMenu(n), children: "⋯" }),
|
|
1540
|
+
children: e.map(({ key: i, spec: s }) => /* @__PURE__ */ c(At, { tone: s.tone, onSelect: () => r(s), children: s.label }, i))
|
|
1541
|
+
}
|
|
1542
|
+
) });
|
|
1543
|
+
}
|
|
1544
|
+
function Po({ columns: e, rows: t = 4 }) {
|
|
1545
|
+
const n = [72, 48, 60, 40, 56, 64];
|
|
1546
|
+
return /* @__PURE__ */ c(Q, { children: Array.from({ length: t }, (o, r) => /* @__PURE__ */ c("tr", { "aria-hidden": "true", children: Array.from({ length: e }, (i, s) => /* @__PURE__ */ c("td", { className: f.td, children: /* @__PURE__ */ c("span", { className: f.skeleton, style: { width: `${n[(r + s) % n.length]}%` } }) }, s)) }, r)) });
|
|
1547
|
+
}
|
|
1548
|
+
const at = Ge(0);
|
|
1549
|
+
function We({ height: e, colSpan: t }) {
|
|
1550
|
+
return e <= 0 ? null : /* @__PURE__ */ c("tr", { "aria-hidden": "true", "data-filler": "", className: f.fillerRow, children: /* @__PURE__ */ c("td", { colSpan: t, style: { height: e } }) });
|
|
1551
|
+
}
|
|
1552
|
+
function Mo({
|
|
1553
|
+
virtual: e,
|
|
1554
|
+
colSpan: t,
|
|
1555
|
+
children: n
|
|
1556
|
+
}) {
|
|
1557
|
+
const { count: o, fillerBefore: r, fillerAfter: i, showRow: s } = e, l = oe(null), [a, u] = E(0), d = (g, p) => {
|
|
1558
|
+
l.current = p, u(p), s(p), requestAnimationFrame(() => {
|
|
1559
|
+
var b;
|
|
1560
|
+
(b = g.querySelector(`[data-row="${p}"]`)) == null || b.focus();
|
|
1561
|
+
});
|
|
1562
|
+
}, h = a >= e.from && a < e.to ? a : e.from, v = (g) => {
|
|
1563
|
+
if (g.defaultPrevented || o === 0) return;
|
|
1564
|
+
const p = g.target, b = p.closest("[data-row]");
|
|
1565
|
+
if (b && p !== b) return;
|
|
1566
|
+
const _ = b ? Number(b.dataset.row) : l.current ?? -1;
|
|
1567
|
+
let m = null;
|
|
1568
|
+
g.key === "ArrowDown" ? m = Math.min(o - 1, _ + 1) : g.key === "ArrowUp" ? m = Math.max(0, _ - 1) : g.key === "Home" ? m = 0 : g.key === "End" && (m = o - 1), !(m === null || m === _) && (g.preventDefault(), d(g.currentTarget, m));
|
|
1569
|
+
};
|
|
1570
|
+
return /* @__PURE__ */ c(
|
|
1571
|
+
"tbody",
|
|
1572
|
+
{
|
|
1573
|
+
className: f.virtualBody,
|
|
1574
|
+
onKeyDown: v,
|
|
1575
|
+
onFocus: (g) => {
|
|
1576
|
+
const p = g.target.closest("[data-row]");
|
|
1577
|
+
p && u(Number(p.dataset.row));
|
|
1578
|
+
},
|
|
1579
|
+
children: /* @__PURE__ */ T(at.Provider, { value: h, children: [
|
|
1580
|
+
/* @__PURE__ */ c(We, { height: r, colSpan: t }),
|
|
1581
|
+
n,
|
|
1582
|
+
/* @__PURE__ */ c(We, { height: i, colSpan: t })
|
|
1583
|
+
] })
|
|
1584
|
+
}
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
const Do = "_verdict_1qt54_3", Vo = "_glyph_1qt54_10", Ho = "_value_1qt54_20", Bo = "_excess_1qt54_25", he = {
|
|
1588
|
+
verdict: Do,
|
|
1589
|
+
glyph: Vo,
|
|
1590
|
+
value: Ho,
|
|
1591
|
+
excess: Bo
|
|
1592
|
+
}, Ke = (e, t, n) => t === "percent" ? n.percent(e) : t === "count" ? n.count(e) : n.number(e, typeof t == "object" ? t.decimals : void 0), $o = (e, t) => e === "alarm" ? t.verdictAlarm : e === "warning" ? t.verdictWarning : e === "unknown" ? t.verdictUnknown : t.verdictOk, Wo = {
|
|
1593
|
+
ok: "✓",
|
|
1594
|
+
unknown: "?",
|
|
1595
|
+
warning: "▲",
|
|
1596
|
+
alarm: "■"
|
|
1597
|
+
};
|
|
1598
|
+
function Ko({ reading: e, format: t }) {
|
|
1599
|
+
const n = te(), o = $(), { measured: r, assessment: i } = e, s = $o(i.verdict, o);
|
|
1600
|
+
return /* @__PURE__ */ T("span", { className: he.verdict, "data-verdict": i.verdict, title: s, children: [
|
|
1601
|
+
/* @__PURE__ */ c("span", { "aria-hidden": "true", className: he.glyph, children: Wo[i.verdict] }),
|
|
1602
|
+
/* @__PURE__ */ c("span", { className: he.value, children: r === null ? o.statAbsentValue : Ke(r, t, n) }),
|
|
1603
|
+
i.excess !== void 0 && /* @__PURE__ */ T("span", { className: he.excess, children: [
|
|
1604
|
+
"+",
|
|
1605
|
+
Ke(i.excess, t, n)
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ c(be, { children: s })
|
|
1608
|
+
] });
|
|
1609
|
+
}
|
|
1610
|
+
const Go = (e) => e.measured;
|
|
1611
|
+
function qo(e) {
|
|
1612
|
+
return function({ id: n, value: o, label: r, limits: i, format: s, sortBy: l = "verdict", width: a, resizable: u }) {
|
|
1613
|
+
const d = JSON.stringify(i), h = V(() => {
|
|
1614
|
+
const g = JSON.parse(d);
|
|
1615
|
+
return (p) => {
|
|
1616
|
+
const b = typeof o == "string" ? p == null ? void 0 : p[o] : o(p);
|
|
1617
|
+
return {
|
|
1618
|
+
measured: typeof b == "number" && Number.isFinite(b) ? b : null,
|
|
1619
|
+
assessment: xt(b, g)
|
|
1620
|
+
};
|
|
1621
|
+
};
|
|
1622
|
+
}, [o, d]), v = B(
|
|
1623
|
+
(g) => l === "value" ? g.measured : Tt(g.assessment.verdict),
|
|
1624
|
+
[l]
|
|
1625
|
+
);
|
|
1626
|
+
return /* @__PURE__ */ c(
|
|
1627
|
+
e,
|
|
1628
|
+
{
|
|
1629
|
+
id: n ?? (typeof o == "string" ? o : void 0),
|
|
1630
|
+
label: r,
|
|
1631
|
+
numeric: !0,
|
|
1632
|
+
width: a,
|
|
1633
|
+
resizable: u,
|
|
1634
|
+
value: h,
|
|
1635
|
+
sortValue: v,
|
|
1636
|
+
exportValue: Go,
|
|
1637
|
+
children: (g) => /* @__PURE__ */ c(Ko, { reading: g, format: s })
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
const dt = (e) => re(
|
|
1643
|
+
`condition-foreign:${e}`,
|
|
1644
|
+
`The condition for "${e}" is not of the kind of its filter and is passed over.`
|
|
1645
|
+
);
|
|
1646
|
+
function ut(e, t, n) {
|
|
1647
|
+
const o = e.columnById(t), r = o ? se(o.spec.filter) : void 0;
|
|
1648
|
+
if (!r) return !1;
|
|
1649
|
+
const i = et(r, n);
|
|
1650
|
+
return i === "foreign" && dt(t), i === "effective";
|
|
1651
|
+
}
|
|
1652
|
+
function Uo(e, t) {
|
|
1653
|
+
if (e.length === 0) return;
|
|
1654
|
+
let n = -1, o = [];
|
|
1655
|
+
return (r) => {
|
|
1656
|
+
if (n !== t.structureVersion()) {
|
|
1657
|
+
n = t.structureVersion(), o = [];
|
|
1658
|
+
for (const [i, s] of e) {
|
|
1659
|
+
const l = t.columnById(i);
|
|
1660
|
+
l && ut(t, i, s) && o.push({ entry: l, condition: s });
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
return o.every(({ entry: i, condition: s }) => {
|
|
1664
|
+
const l = se(i.spec.filter);
|
|
1665
|
+
return !l || Jn(l, i.read(r), s);
|
|
1666
|
+
});
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
function Yo(e, t) {
|
|
1670
|
+
const n = V(() => t ? e.filter((s) => t(s)) : e, [e, t]), [o, r] = E(() => ({ source: e, result: n }));
|
|
1671
|
+
if (!t) return e;
|
|
1672
|
+
const i = o.source === e && (o.result === n || o.result.length === n.length && o.result.every((s, l) => s === n[l]));
|
|
1673
|
+
return i || r({ source: e, result: n }), i ? o.result : n;
|
|
1674
|
+
}
|
|
1675
|
+
function Xo(e, t) {
|
|
1676
|
+
var l, a, u, d, h, v;
|
|
1677
|
+
if (t.size === 0) return e;
|
|
1678
|
+
const n = (l = e.sort) == null ? void 0 : l.filter((g) => t.has(g.column)), o = (a = e.hidden) == null ? void 0 : a.filter((g) => t.has(g)), r = (u = e.order) == null ? void 0 : u.filter((g) => t.has(g)), i = e.widths ? Object.fromEntries(Object.entries(e.widths).filter(([g]) => t.has(g))) : void 0;
|
|
1679
|
+
return (n == null ? void 0 : n.length) === ((d = e.sort) == null ? void 0 : d.length) && (o == null ? void 0 : o.length) === ((h = e.hidden) == null ? void 0 : h.length) && (r == null ? void 0 : r.length) === ((v = e.order) == null ? void 0 : v.length) && Object.keys(i ?? {}).length === Object.keys(e.widths ?? {}).length ? e : {
|
|
1680
|
+
...e.search ? { search: e.search } : {},
|
|
1681
|
+
...e.page ? { page: e.page } : {},
|
|
1682
|
+
...e.pageSize ? { pageSize: e.pageSize } : {},
|
|
1683
|
+
...n != null && n.length ? { sort: n } : {},
|
|
1684
|
+
...o != null && o.length ? { hidden: o } : {},
|
|
1685
|
+
...r != null && r.length ? { order: r } : {},
|
|
1686
|
+
...i && Object.keys(i).length ? { widths: i } : {}
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
const Jo = (e, t) => e.size === t.size && [...e].every((n) => t.has(n));
|
|
1690
|
+
function Qo(e, t) {
|
|
1691
|
+
const n = {};
|
|
1692
|
+
for (const o of e) o.width !== void 0 && (n[o.id] = o.width);
|
|
1693
|
+
return { ...n, ...t };
|
|
1694
|
+
}
|
|
1695
|
+
function Zo(e, t) {
|
|
1696
|
+
const [n] = E(() => new ho()), [o] = E(() => {
|
|
1697
|
+
const C = To(n);
|
|
1698
|
+
return { ...C, VerdictColumn: qo(C.Column) };
|
|
1699
|
+
});
|
|
1700
|
+
pe(n.subscribe, n.structureVersion, n.structureVersion);
|
|
1701
|
+
const r = te(), i = e, s = n.modelColumns(i, r), [l] = E(() => t.initialView), [a, u] = E(() => Object.entries((l == null ? void 0 : l.conditions) ?? {})), d = V(() => Uo(a, n), [a, n]), h = t.preFilter ?? t.filter, v = Yo(i, h), g = t.rowKey, p = Et(v, s, {
|
|
1702
|
+
rowKey: g,
|
|
1703
|
+
pageSize: t.pageSize,
|
|
1704
|
+
defaultSort: t.defaultSort,
|
|
1705
|
+
filter: d,
|
|
1706
|
+
initialView: l,
|
|
1707
|
+
virtual: t.virtual
|
|
1708
|
+
}), { setPage: b } = p, _ = B(
|
|
1709
|
+
(C, x) => {
|
|
1710
|
+
let z = x == null;
|
|
1711
|
+
if (!z && n.orderedColumns().length > 0) {
|
|
1712
|
+
const F = n.columnById(C), D = F ? se(F.spec.filter) : void 0;
|
|
1713
|
+
if (!D) {
|
|
1714
|
+
re(
|
|
1715
|
+
`condition-without-filter:${C}`,
|
|
1716
|
+
F ? `The column "${C}" has no filter; its condition is passed over.` : `No column is called "${C}"; its condition is passed over.`
|
|
1717
|
+
);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
const W = et(D, x);
|
|
1721
|
+
if (W === "foreign") {
|
|
1722
|
+
dt(C);
|
|
1723
|
+
return;
|
|
1724
|
+
}
|
|
1725
|
+
z = W === "empty";
|
|
1726
|
+
}
|
|
1727
|
+
u((F) => {
|
|
1728
|
+
const D = F.findIndex(([W]) => W === C);
|
|
1729
|
+
return z ? D === -1 ? F : F.filter((W, U) => U !== D) : D === -1 ? [...F, [C, x]] : F.map((W, U) => U === D ? [C, x] : W);
|
|
1730
|
+
}), b(1);
|
|
1731
|
+
},
|
|
1732
|
+
[n, b]
|
|
1733
|
+
), m = new Set(n.orderedColumns().map((C) => C.spec.id)), [y, O] = E(() => /* @__PURE__ */ new Set());
|
|
1734
|
+
if (!Jo(y, m)) {
|
|
1735
|
+
const C = new Set([...y].filter((x) => !m.has(x)));
|
|
1736
|
+
O(m), a.some(([x]) => C.has(x)) && u((x) => x.filter(([z]) => !C.has(z)));
|
|
1737
|
+
}
|
|
1738
|
+
const N = m.size === 0 ? a : a.filter(([C, x]) => ut(n, C, x)), P = Xo(p.view, m), w = N.length > 0 ? { ...P, conditions: Object.fromEntries(N) } : P, S = m.size === 0 ? p.sort : p.sort.filter((C) => m.has(C.column)), I = n.paginates() || t.virtual !== void 0, A = {
|
|
1739
|
+
rows: e,
|
|
1740
|
+
filtered: p.filtered,
|
|
1741
|
+
visible: I ? p.visible : p.filtered,
|
|
1742
|
+
page: I ? p.page : 1,
|
|
1743
|
+
pageCount: I ? p.pageCount : 1,
|
|
1744
|
+
pageSize: p.pageSize,
|
|
1745
|
+
setPage: p.setPage,
|
|
1746
|
+
setPageSize: p.setPageSize,
|
|
1747
|
+
search: p.search,
|
|
1748
|
+
setSearch: p.setSearch,
|
|
1749
|
+
sort: S,
|
|
1750
|
+
toggleSort: p.toggleSort,
|
|
1751
|
+
hidden: p.hidden,
|
|
1752
|
+
toggleColumn: p.toggleColumn,
|
|
1753
|
+
order: p.order,
|
|
1754
|
+
setOrder: p.setOrder,
|
|
1755
|
+
widths: Qo(s, p.widths),
|
|
1756
|
+
setWidth: p.setWidth,
|
|
1757
|
+
expanded: p.expanded,
|
|
1758
|
+
toggleRow: p.toggleRow,
|
|
1759
|
+
filter: Object.fromEntries(N),
|
|
1760
|
+
setFilter: _,
|
|
1761
|
+
selection: t.selection ?? p.selection,
|
|
1762
|
+
view: w,
|
|
1763
|
+
asCsv: () => So(n),
|
|
1764
|
+
virtual: t.virtual !== void 0
|
|
1765
|
+
};
|
|
1766
|
+
return n.setHook({
|
|
1767
|
+
rows: i,
|
|
1768
|
+
admitted: v,
|
|
1769
|
+
modelColumns: s,
|
|
1770
|
+
companion: p,
|
|
1771
|
+
filter: d,
|
|
1772
|
+
publicSnapshot: A,
|
|
1773
|
+
rowKey: g,
|
|
1774
|
+
formats: r
|
|
1775
|
+
}), { ...A, ...o };
|
|
1776
|
+
}
|
|
1777
|
+
function Er(e) {
|
|
1778
|
+
return e;
|
|
1779
|
+
}
|
|
1780
|
+
function Ie(e, t) {
|
|
1781
|
+
const n = Z();
|
|
1782
|
+
e == null || e.register(t, n), J(() => {
|
|
1783
|
+
if (e)
|
|
1784
|
+
return e.register(t, n), e.commit(), () => {
|
|
1785
|
+
e.remove(t, n), e.commit();
|
|
1786
|
+
};
|
|
1787
|
+
}, [e, t, n]);
|
|
1788
|
+
}
|
|
1789
|
+
function Pr({ children: e, className: t, of: n }) {
|
|
1790
|
+
const o = ue(n);
|
|
1791
|
+
Ie(o == null ? void 0 : o.registry, "toolbar");
|
|
1792
|
+
const r = o == null ? void 0 : o.registry;
|
|
1793
|
+
return /* @__PURE__ */ c(lt, { registry: r ?? null, className: t, children: e });
|
|
1794
|
+
}
|
|
1795
|
+
function Mr({ placeholder: e, "aria-label": t, className: n, of: o }) {
|
|
1796
|
+
const r = ue(o), i = $();
|
|
1797
|
+
if (Ie(r == null ? void 0 : r.registry, "search"), !r) return null;
|
|
1798
|
+
const { snapshot: s } = r;
|
|
1799
|
+
return /* @__PURE__ */ c(
|
|
1800
|
+
Rt,
|
|
1801
|
+
{
|
|
1802
|
+
size: "sm",
|
|
1803
|
+
type: "search",
|
|
1804
|
+
className: n,
|
|
1805
|
+
value: s.search,
|
|
1806
|
+
onChange: (l) => s.setSearch(l.target.value),
|
|
1807
|
+
clearable: !0,
|
|
1808
|
+
onClear: () => s.setSearch(""),
|
|
1809
|
+
placeholder: e ?? i.tableSearchPlaceholder,
|
|
1810
|
+
"aria-label": t ?? i.tableSearchLabel
|
|
1811
|
+
}
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
function Dr({ of: e }) {
|
|
1815
|
+
var _;
|
|
1816
|
+
const t = ue(e), n = $(), [o, r] = E(!1), i = oe(null), s = oe(null), l = Z(), [a, u] = E(null);
|
|
1817
|
+
if (J(() => {
|
|
1818
|
+
var N;
|
|
1819
|
+
if (!a || !s.current) return;
|
|
1820
|
+
const m = Array.from(s.current.children).find(
|
|
1821
|
+
(P) => P.dataset.column === a.id
|
|
1822
|
+
), y = m == null ? void 0 : m.querySelector(`[data-direction="${a.direction}"]`), O = m == null ? void 0 : m.querySelector(
|
|
1823
|
+
`[data-direction="${a.direction === "forward" ? "backward" : "forward"}"]`
|
|
1824
|
+
);
|
|
1825
|
+
(N = y && !y.disabled ? y : O) == null || N.focus();
|
|
1826
|
+
}, [a]), !t) return null;
|
|
1827
|
+
const { registry: d, snapshot: h } = t, v = d.hook, g = d.withStickyHeaderFirst(
|
|
1828
|
+
Te(d.modelColumns(v.rows, v.formats), h.order)
|
|
1829
|
+
), p = d.stickyRowHeader ? ((_ = g[0]) == null ? void 0 : _.hideable) === !1 : !1, b = (m, y) => {
|
|
1830
|
+
const O = g.map((P) => P.id), N = m + y;
|
|
1831
|
+
N < 0 || N >= O.length || ([O[m], O[N]] = [O[N], O[m]], h.setOrder(O), u({ id: g[m].id, direction: y < 0 ? "forward" : "backward" }));
|
|
1832
|
+
};
|
|
1833
|
+
return /* @__PURE__ */ T(Q, { children: [
|
|
1834
|
+
/* @__PURE__ */ c(
|
|
1835
|
+
G,
|
|
1836
|
+
{
|
|
1837
|
+
ref: i,
|
|
1838
|
+
size: "sm",
|
|
1839
|
+
"aria-haspopup": "dialog",
|
|
1840
|
+
"aria-expanded": o,
|
|
1841
|
+
"aria-controls": o ? l : void 0,
|
|
1842
|
+
onClick: () => r(!o),
|
|
1843
|
+
children: n.columns
|
|
1844
|
+
}
|
|
1845
|
+
),
|
|
1846
|
+
/* @__PURE__ */ c(
|
|
1847
|
+
qe,
|
|
1848
|
+
{
|
|
1849
|
+
open: o,
|
|
1850
|
+
onOpenChange: r,
|
|
1851
|
+
anchorRef: i,
|
|
1852
|
+
align: "end",
|
|
1853
|
+
role: "dialog",
|
|
1854
|
+
ariaLabel: n.arrangeColumns,
|
|
1855
|
+
id: l,
|
|
1856
|
+
className: f.columnsPanel,
|
|
1857
|
+
children: /* @__PURE__ */ c("ul", { ref: s, className: f.columnsList, "aria-label": n.arrangeColumns, children: g.map((m, y) => {
|
|
1858
|
+
const O = m.label ?? m.id;
|
|
1859
|
+
return /* @__PURE__ */ T("li", { className: f.columnsEntry, "data-column": m.id, children: [
|
|
1860
|
+
/* @__PURE__ */ c(
|
|
1861
|
+
ge,
|
|
1862
|
+
{
|
|
1863
|
+
label: O,
|
|
1864
|
+
checked: !h.hidden.includes(m.id),
|
|
1865
|
+
disabled: m.hideable === !1,
|
|
1866
|
+
onChange: () => h.toggleColumn(m.id)
|
|
1867
|
+
}
|
|
1868
|
+
),
|
|
1869
|
+
/* @__PURE__ */ c(
|
|
1870
|
+
"button",
|
|
1871
|
+
{
|
|
1872
|
+
type: "button",
|
|
1873
|
+
className: f.move,
|
|
1874
|
+
"data-direction": "forward",
|
|
1875
|
+
"aria-label": n.columnForward(O),
|
|
1876
|
+
disabled: y === 0 || p && y <= 1,
|
|
1877
|
+
onClick: () => b(y, -1),
|
|
1878
|
+
children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 6.5 5 3.5l3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1879
|
+
}
|
|
1880
|
+
),
|
|
1881
|
+
/* @__PURE__ */ c(
|
|
1882
|
+
"button",
|
|
1883
|
+
{
|
|
1884
|
+
type: "button",
|
|
1885
|
+
className: f.move,
|
|
1886
|
+
"data-direction": "backward",
|
|
1887
|
+
"aria-label": n.columnBackward(O),
|
|
1888
|
+
disabled: y === g.length - 1 || p && y === 0,
|
|
1889
|
+
onClick: () => b(y, 1),
|
|
1890
|
+
children: /* @__PURE__ */ c("svg", { viewBox: "0 0 10 10", width: "10", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M2 3.5 5 6.5l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1891
|
+
}
|
|
1892
|
+
)
|
|
1893
|
+
] }, m.id);
|
|
1894
|
+
}) })
|
|
1895
|
+
}
|
|
1896
|
+
)
|
|
1897
|
+
] });
|
|
1898
|
+
}
|
|
1899
|
+
function Vr({ filename: e, onExport: t, of: n }) {
|
|
1900
|
+
const o = ue(n), r = $();
|
|
1901
|
+
if (!o) return null;
|
|
1902
|
+
const { snapshot: i } = o;
|
|
1903
|
+
return /* @__PURE__ */ c(G, { size: "sm", onClick: () => {
|
|
1904
|
+
const l = i.asCsv();
|
|
1905
|
+
if (t) {
|
|
1906
|
+
t(l);
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
const a = URL.createObjectURL(new Blob([l], { type: "text/csv;charset=utf-8" })), u = document.createElement("a");
|
|
1910
|
+
u.href = a, u.download = e ?? r.exportFileName, u.click(), setTimeout(() => URL.revokeObjectURL(a), 0);
|
|
1911
|
+
}, children: r.exportLabel });
|
|
1912
|
+
}
|
|
1913
|
+
function Hr({ pageSizes: e = [10, 25, 50], className: t, of: n }) {
|
|
1914
|
+
const o = ue(n), r = $(), i = te();
|
|
1915
|
+
if (Ie(o == null ? void 0 : o.registry, "pagination"), !o || o.snapshot.virtual) return null;
|
|
1916
|
+
const { snapshot: s } = o, l = s.filtered.length, a = e.includes(s.pageSize) ? e : [...e, s.pageSize].sort((d, h) => d - h), u = /* @__PURE__ */ T("nav", { "aria-label": r.pagination, className: H(f.pagination, t), children: [
|
|
1917
|
+
/* @__PURE__ */ c("span", { children: r.entries(l, i.count(l)) }),
|
|
1918
|
+
/* @__PURE__ */ T("div", { className: f.paginationControls, children: [
|
|
1919
|
+
/* @__PURE__ */ T("label", { className: f.pageSize, children: [
|
|
1920
|
+
r.rows,
|
|
1921
|
+
/* @__PURE__ */ c(
|
|
1922
|
+
Ot,
|
|
1923
|
+
{
|
|
1924
|
+
selectSize: "sm",
|
|
1925
|
+
value: s.pageSize,
|
|
1926
|
+
onChange: (d) => s.setPageSize(Number(d.target.value)),
|
|
1927
|
+
"aria-label": r.rowsPerPage,
|
|
1928
|
+
children: a.map((d) => /* @__PURE__ */ c("option", { value: d, children: d }, d))
|
|
1929
|
+
}
|
|
1930
|
+
)
|
|
1931
|
+
] }),
|
|
1932
|
+
/* @__PURE__ */ c("span", { className: f.paginationStatus, children: r.pageOfPages(s.page, s.pageCount) }),
|
|
1933
|
+
/* @__PURE__ */ c(G, { size: "sm", disabled: s.page <= 1, onClick: () => s.setPage(s.page - 1), children: r.previousPage }),
|
|
1934
|
+
/* @__PURE__ */ c(G, { size: "sm", disabled: s.page >= s.pageCount, onClick: () => s.setPage(s.page + 1), children: r.nextPage })
|
|
1935
|
+
] })
|
|
1936
|
+
] });
|
|
1937
|
+
return o.inside ? o.footerTarget ? Lt(u, o.footerTarget) : null : u;
|
|
1938
|
+
}
|
|
1939
|
+
const er = ["high", "medium", "low"], tr = (e) => er.indexOf(e), nr = (e) => e === "standing-unacknowledged" || e === "standing-acknowledged", we = (e) => e === "standing-acknowledged" || e === "cleared-acknowledged", or = (e) => e === "cleared-acknowledged";
|
|
1940
|
+
function rr(e, t) {
|
|
1941
|
+
switch (t) {
|
|
1942
|
+
case "raised":
|
|
1943
|
+
return "standing-unacknowledged";
|
|
1944
|
+
case "acknowledged":
|
|
1945
|
+
return nr(e) ? "standing-acknowledged" : "cleared-acknowledged";
|
|
1946
|
+
case "cleared":
|
|
1947
|
+
return we(e) ? "cleared-acknowledged" : "cleared-unacknowledged";
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
const Br = (e, t) => e.direction === "obere" ? t <= e.returnTo : t >= e.returnTo, Fe = (e, t, n) => e > n - t && e <= n, $r = (e, t, n) => e.reduce((o, r) => o + (Fe(r, t, n) ? 1 : 0), 0);
|
|
1951
|
+
function sr(e, t, n) {
|
|
1952
|
+
const o = /* @__PURE__ */ new Map();
|
|
1953
|
+
for (const r of e)
|
|
1954
|
+
Fe(r.raised, t, n) && o.set(r.type, (o.get(r.type) ?? 0) + 1);
|
|
1955
|
+
return o;
|
|
1956
|
+
}
|
|
1957
|
+
function ir(e) {
|
|
1958
|
+
let t = Number.POSITIVE_INFINITY;
|
|
1959
|
+
for (const n of e) n < t && (t = n);
|
|
1960
|
+
return t;
|
|
1961
|
+
}
|
|
1962
|
+
function lr(e) {
|
|
1963
|
+
let t = Number.NEGATIVE_INFINITY;
|
|
1964
|
+
for (const n of e) n > t && (t = n);
|
|
1965
|
+
return t;
|
|
1966
|
+
}
|
|
1967
|
+
function cr(e, t, n) {
|
|
1968
|
+
const o = e.filter((i) => Fe(i.raised, t.windowMs, n));
|
|
1969
|
+
if (o.length < t.atLeast) return null;
|
|
1970
|
+
const r = o.map((i) => i.raised);
|
|
1971
|
+
return {
|
|
1972
|
+
// No spread: a flood is the case with many elements, and an argument list
|
|
1973
|
+
// of that size blows the call stack at some point. A loop cannot.
|
|
1974
|
+
from: ir(r),
|
|
1975
|
+
to: lr(r),
|
|
1976
|
+
count: o.length,
|
|
1977
|
+
alarms: o.map((i) => i.id)
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
function ar(e, t) {
|
|
1981
|
+
const n = new Set(t);
|
|
1982
|
+
return e.reduce(
|
|
1983
|
+
(o, r) => o + (n.has(r.id) && !we(r.lifecycle) ? 1 : 0),
|
|
1984
|
+
0
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
function Wr(e, t, n) {
|
|
1988
|
+
const o = new Set(t);
|
|
1989
|
+
let r = 0;
|
|
1990
|
+
return { alarms: e.map((s) => !o.has(s.id) || we(s.lifecycle) ? s : (r += 1, { ...s, lifecycle: rr(s.lifecycle, "acknowledged"), acknowledgedAt: n })), count: r };
|
|
1991
|
+
}
|
|
1992
|
+
const dr = (e) => [
|
|
1993
|
+
{
|
|
1994
|
+
id: "type",
|
|
1995
|
+
label: e.columnAlarm,
|
|
1996
|
+
value: (t) => t.type.label,
|
|
1997
|
+
searchable: !0,
|
|
1998
|
+
hideable: !1
|
|
1999
|
+
},
|
|
2000
|
+
{ id: "lifecycle", label: e.columnLifecycleState, value: (t) => t.lifecycle, searchable: !0 },
|
|
2001
|
+
{ id: "priority", label: e.columnPriority, value: (t) => t.rank },
|
|
2002
|
+
/* A column of its own instead of a glance at the lifecycle state: the second
|
|
2003
|
+
level of the order asks only about the acknowledgement and expressly not
|
|
2004
|
+
about whether the alarm is still standing. Otherwise the fleeting alarm
|
|
2005
|
+
falls back down again. */
|
|
2006
|
+
{ id: "acknowledgement", label: e.columnAcknowledgement, value: (t) => we(t.lifecycle) ? 1 : 0 },
|
|
2007
|
+
{ id: "raised", label: e.columnRaised, value: (t) => t.alarm.raised },
|
|
2008
|
+
{ id: "age", label: e.columnAge, value: (t) => t.age },
|
|
2009
|
+
{ id: "frequency", label: e.columnFrequency, value: (t) => t.frequency }
|
|
2010
|
+
], ur = dr(It), fr = [
|
|
2011
|
+
{ column: "priority", direction: "asc" },
|
|
2012
|
+
{ column: "acknowledgement", direction: "asc" },
|
|
2013
|
+
{ column: "raised", direction: "desc" }
|
|
2014
|
+
], hr = (e) => ({
|
|
2015
|
+
id: e,
|
|
2016
|
+
label: e,
|
|
2017
|
+
priority: "high"
|
|
2018
|
+
});
|
|
2019
|
+
function Kr(e, t = {}) {
|
|
2020
|
+
const {
|
|
2021
|
+
alarms: n,
|
|
2022
|
+
types: o,
|
|
2023
|
+
asOf: r,
|
|
2024
|
+
chatter: i,
|
|
2025
|
+
flood: s,
|
|
2026
|
+
keepDone: l = !1,
|
|
2027
|
+
columns: a = ur
|
|
2028
|
+
} = e, u = new Map(o.map((b) => [b.id, b])), d = sr(n, (i == null ? void 0 : i.windowMs) ?? 1 / 0, r), h = s ? cr(n, s, r) : null, v = new Set((h == null ? void 0 : h.alarms) ?? []), g = n.filter((b) => l || !or(b.lifecycle)).map((b) => {
|
|
2029
|
+
const _ = u.get(b.type) ?? hr(b.type), m = d.get(b.type) ?? 0;
|
|
2030
|
+
return {
|
|
2031
|
+
id: b.id,
|
|
2032
|
+
alarm: b,
|
|
2033
|
+
type: _,
|
|
2034
|
+
lifecycle: b.lifecycle,
|
|
2035
|
+
priority: _.priority,
|
|
2036
|
+
rank: tr(_.priority),
|
|
2037
|
+
age: r - b.raised,
|
|
2038
|
+
duration: (b.cleared ?? r) - b.raised,
|
|
2039
|
+
frequency: m,
|
|
2040
|
+
chatters: i !== void 0 && m >= i.atLeast,
|
|
2041
|
+
inFlood: v.has(b.id)
|
|
2042
|
+
};
|
|
2043
|
+
}), p = Oe(g, a, {
|
|
2044
|
+
...t,
|
|
2045
|
+
sort: t.sort === void 0 ? fr : t.sort
|
|
2046
|
+
});
|
|
2047
|
+
return {
|
|
2048
|
+
...p,
|
|
2049
|
+
flood: h,
|
|
2050
|
+
standingUnacknowledged: p.filtered.reduce(
|
|
2051
|
+
(b, _) => b + (_.lifecycle === "standing-unacknowledged" ? 1 : 0),
|
|
2052
|
+
0
|
|
2053
|
+
)
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
const mr = "_list_93k56_1", pr = "_bar_93k56_8", gr = "_heading_93k56_15", br = "_filler_93k56_21", vr = "_asOf_93k56_25", wr = "_live_93k56_42", _r = "_label_93k56_47", kr = "_counter_93k56_51", yr = "_lifecycle_93k56_55", Cr = "_empty_93k56_59", Sr = "_row_93k56_66", X = {
|
|
2057
|
+
list: mr,
|
|
2058
|
+
bar: pr,
|
|
2059
|
+
heading: gr,
|
|
2060
|
+
filler: br,
|
|
2061
|
+
asOf: vr,
|
|
2062
|
+
live: wr,
|
|
2063
|
+
label: _r,
|
|
2064
|
+
counter: kr,
|
|
2065
|
+
lifecycle: yr,
|
|
2066
|
+
empty: Cr,
|
|
2067
|
+
row: Sr
|
|
2068
|
+
};
|
|
2069
|
+
function Nr(e, t) {
|
|
2070
|
+
switch (e) {
|
|
2071
|
+
case "standing-unacknowledged":
|
|
2072
|
+
return t.lifecycleStandingUnacknowledged;
|
|
2073
|
+
case "standing-acknowledged":
|
|
2074
|
+
return t.lifecycleStandingAcknowledged;
|
|
2075
|
+
case "cleared-unacknowledged":
|
|
2076
|
+
return t.lifecycleClearedUnacknowledged;
|
|
2077
|
+
default:
|
|
2078
|
+
return t.lifecycleClearedAcknowledged;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
function Ar(e, t) {
|
|
2082
|
+
return e === "high" ? t.priorityHigh : e === "medium" ? t.priorityMedium : t.priorityLow;
|
|
2083
|
+
}
|
|
2084
|
+
function xr(e) {
|
|
2085
|
+
return e === "high" ? "danger" : e === "medium" ? "warning" : "neutral";
|
|
2086
|
+
}
|
|
2087
|
+
function Tr(e, t) {
|
|
2088
|
+
const n = Math.max(0, Math.floor(e / 6e4)), o = Math.floor(n / 60), r = n % 60, i = [];
|
|
2089
|
+
return o > 0 && i.push(t.hoursShort(o)), (o === 0 || r > 0) && i.push(t.minutesShort(r)), i.join(" ");
|
|
2090
|
+
}
|
|
2091
|
+
function Gr(e) {
|
|
2092
|
+
const { asOf: t, freshness: n, ...o } = e;
|
|
2093
|
+
return t === void 0 || n === void 0 ? /* @__PURE__ */ c(ft, { ...o, freshness: null }) : /* @__PURE__ */ c(Or, { ...o, asOf: t, ages: n });
|
|
2094
|
+
}
|
|
2095
|
+
function Or({
|
|
2096
|
+
asOf: e,
|
|
2097
|
+
ages: t,
|
|
2098
|
+
...n
|
|
2099
|
+
}) {
|
|
2100
|
+
const o = Ft(e, t);
|
|
2101
|
+
return /* @__PURE__ */ c(ft, { ...n, freshness: o });
|
|
2102
|
+
}
|
|
2103
|
+
function ft({
|
|
2104
|
+
view: e,
|
|
2105
|
+
selection: t,
|
|
2106
|
+
onAcknowledge: n,
|
|
2107
|
+
density: o,
|
|
2108
|
+
className: r,
|
|
2109
|
+
freshness: i,
|
|
2110
|
+
...s
|
|
2111
|
+
}) {
|
|
2112
|
+
const l = $(), a = te(), u = i !== null, d = (i == null ? void 0 : i.freshness) === "lost", { Table: h, Column: v } = Zo(e.visible, { rowKey: (m) => m.id, selection: t }), g = V(() => e.filtered.map((m) => m.alarm), [e.filtered]), p = V(() => t === void 0 ? [] : e.filtered.map((m) => m.id).filter((m) => t.selected.has(m)), [e.filtered, t]), b = V(() => ar(g, p), [g, p]), _ = Ue(o, "compact");
|
|
2113
|
+
return /* @__PURE__ */ T("div", { className: [X.list, r].filter(Boolean).join(" "), ...s, children: [
|
|
2114
|
+
/* @__PURE__ */ T("div", { className: X.bar, children: [
|
|
2115
|
+
/* @__PURE__ */ c("span", { className: X.heading, children: l.alarms }),
|
|
2116
|
+
e.flood !== null && /* @__PURE__ */ c(Ce, { tone: "warning", children: l.floodHint(e.flood.count) }),
|
|
2117
|
+
u && i !== null && /* @__PURE__ */ T("span", { className: X.asOf, "data-freshness": i.freshness, children: [
|
|
2118
|
+
i.freshness === "lost" ? l.freshnessDisconnected : i.freshness === "stale" ? l.freshnessStale : l.freshnessFresh,
|
|
2119
|
+
i.age !== null && ` · ${a.relative(i.age)}`
|
|
2120
|
+
] }),
|
|
2121
|
+
/* @__PURE__ */ c("span", { className: X.filler }),
|
|
2122
|
+
t !== void 0 && n !== void 0 && /* @__PURE__ */ c(G, { variant: "primary", size: "sm", disabled: b === 0, onClick: () => n(p), children: b === 0 ? l.acknowledgeAlarm : l.acknowledgeAlarms(b) })
|
|
2123
|
+
] }),
|
|
2124
|
+
/* @__PURE__ */ c("div", { "aria-live": "polite", "aria-atomic": "true", className: X.live, children: l.standingUnacknowledged(e.standingUnacknowledged) }),
|
|
2125
|
+
/* @__PURE__ */ T(
|
|
2126
|
+
h,
|
|
2127
|
+
{
|
|
2128
|
+
selectable: t !== void 0,
|
|
2129
|
+
density: _,
|
|
2130
|
+
stickyHeader: !0,
|
|
2131
|
+
rowProps: (m) => ({ className: X.row, "data-lifecycle": m.lifecycle, "data-priority": m.priority }),
|
|
2132
|
+
empty: /* @__PURE__ */ c("span", { className: X.empty, children: d ? l.noAlarmsDisconnected : l.noAlarms }),
|
|
2133
|
+
children: [
|
|
2134
|
+
/* @__PURE__ */ c(v, { id: "type", label: l.columnAlarm, value: (m) => m.type.label, rowHeader: !0, sortable: !1, children: (m, y) => /* @__PURE__ */ T(Q, { children: [
|
|
2135
|
+
/* @__PURE__ */ c("span", { className: X.label, children: m }),
|
|
2136
|
+
y.chatters && /* @__PURE__ */ c(Ce, { tone: "warning", pill: !0, className: X.counter, children: l.chatterHint(y.frequency) })
|
|
2137
|
+
] }) }),
|
|
2138
|
+
/* @__PURE__ */ c(v, { value: "lifecycle", label: l.columnLifecycleState, sortable: !1, children: (m) => /* @__PURE__ */ c("span", { className: X.lifecycle, children: Nr(m, l) }) }),
|
|
2139
|
+
/* @__PURE__ */ c(v, { value: "priority", label: l.columnPriority, sortable: !1, children: (m) => /* @__PURE__ */ c(Ce, { tone: xr(m), children: Ar(m, l) }) }),
|
|
2140
|
+
/* @__PURE__ */ c(
|
|
2141
|
+
v,
|
|
2142
|
+
{
|
|
2143
|
+
id: "raised",
|
|
2144
|
+
label: l.columnRaised,
|
|
2145
|
+
value: (m) => new Date(m.alarm.raised),
|
|
2146
|
+
numeric: !0,
|
|
2147
|
+
sortable: !1
|
|
2148
|
+
}
|
|
2149
|
+
),
|
|
2150
|
+
/* @__PURE__ */ c(v, { value: "duration", label: l.columnDuration, sortable: !1, children: (m) => Tr(m, l) }),
|
|
2151
|
+
/* @__PURE__ */ c(v, { value: "frequency", label: l.columnFrequency, format: "count", sortable: !1 })
|
|
2152
|
+
]
|
|
2153
|
+
}
|
|
2154
|
+
)
|
|
2155
|
+
] });
|
|
2156
|
+
}
|
|
2157
|
+
export {
|
|
2158
|
+
ur as ALARM_COLUMNS,
|
|
2159
|
+
Gr as AlarmList,
|
|
2160
|
+
Dr as ColumnMenu,
|
|
2161
|
+
fr as DEFAULT_ORDER,
|
|
2162
|
+
Vr as Export,
|
|
2163
|
+
er as PRIORITIES,
|
|
2164
|
+
Hr as Pagination,
|
|
2165
|
+
Mr as Search,
|
|
2166
|
+
Pr as Toolbar,
|
|
2167
|
+
Wr as acknowledge,
|
|
2168
|
+
dr as alarmColumns,
|
|
2169
|
+
Kr as alarmModel,
|
|
2170
|
+
Er as column,
|
|
2171
|
+
jr as columnFilter,
|
|
2172
|
+
ar as countAcknowledgeable,
|
|
2173
|
+
$r as countInWindow,
|
|
2174
|
+
cr as detectFlood,
|
|
2175
|
+
sr as frequencyByType,
|
|
2176
|
+
Br as hasReturned,
|
|
2177
|
+
we as isAcknowledged,
|
|
2178
|
+
or as isDone,
|
|
2179
|
+
nr as isStanding,
|
|
2180
|
+
rr as nextLifecycleState,
|
|
2181
|
+
tr as priorityRank,
|
|
2182
|
+
Zo as useTable,
|
|
2183
|
+
zt as useTableSelection
|
|
2184
|
+
};
|