@gemologic/sheen-table 0.1.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/LICENSE +19 -0
- package/README.md +19 -0
- package/dist/DataTable.d.ts +159 -0
- package/dist/DataTable.js +2724 -0
- package/dist/DataTableToolbar.d.ts +28 -0
- package/dist/DataTableToolbar.js +132 -0
- package/dist/FilterBar.d.ts +24 -0
- package/dist/FilterBar.js +681 -0
- package/dist/QueryBuilder.d.ts +11 -0
- package/dist/QueryBuilder.js +693 -0
- package/dist/cell-edit.d.ts +50 -0
- package/dist/cell-edit.js +178 -0
- package/dist/client-state.d.ts +28 -0
- package/dist/client-state.js +57 -0
- package/dist/client-view.d.ts +31 -0
- package/dist/client-view.js +30 -0
- package/dist/column-layout.d.ts +10 -0
- package/dist/column-layout.js +34 -0
- package/dist/columns.d.ts +108 -0
- package/dist/columns.js +217 -0
- package/dist/core.d.ts +54 -0
- package/dist/core.js +28 -0
- package/dist/export.d.ts +14 -0
- package/dist/export.js +27 -0
- package/dist/facets.d.ts +15 -0
- package/dist/facets.js +41 -0
- package/dist/filter-bar-state.d.ts +22 -0
- package/dist/filter-bar-state.js +128 -0
- package/dist/filter-client.d.ts +9 -0
- package/dist/filter-client.js +69 -0
- package/dist/filter.d.ts +64 -0
- package/dist/filter.js +132 -0
- package/dist/grouping.d.ts +37 -0
- package/dist/grouping.js +126 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +31 -0
- package/dist/messages.d.ts +115 -0
- package/dist/messages.js +121 -0
- package/dist/pagination.d.ts +36 -0
- package/dist/pagination.js +102 -0
- package/dist/query-builder-state.d.ts +28 -0
- package/dist/query-builder-state.js +128 -0
- package/dist/requests.d.ts +26 -0
- package/dist/requests.js +106 -0
- package/dist/row-hierarchy.d.ts +32 -0
- package/dist/row-hierarchy.js +170 -0
- package/dist/row-identity.d.ts +11 -0
- package/dist/row-identity.js +36 -0
- package/dist/saved-views.d.ts +52 -0
- package/dist/saved-views.js +153 -0
- package/dist/search-controller.d.ts +22 -0
- package/dist/search-controller.js +75 -0
- package/dist/search.d.ts +28 -0
- package/dist/search.js +111 -0
- package/dist/selection-client.d.ts +9 -0
- package/dist/selection-client.js +14 -0
- package/dist/selection.d.ts +25 -0
- package/dist/selection.js +60 -0
- package/dist/server-export.d.ts +27 -0
- package/dist/server-export.js +105 -0
- package/dist/sorting.d.ts +17 -0
- package/dist/sorting.js +58 -0
- package/dist/table-state-changes.d.ts +27 -0
- package/dist/table-state-changes.js +67 -0
- package/dist/table-state.d.ts +20 -0
- package/dist/table-state.js +77 -0
- package/dist/text-normalization.d.ts +2 -0
- package/dist/text-normalization.js +12 -0
- package/dist/url-state.d.ts +39 -0
- package/dist/url-state.js +75 -0
- package/package.json +66 -0
- package/src/DataTable.tsx +2322 -0
- package/src/DataTableToolbar.tsx +69 -0
- package/src/FilterBar.tsx +396 -0
- package/src/QueryBuilder.tsx +274 -0
- package/src/cell-edit.ts +187 -0
- package/src/client-state.ts +52 -0
- package/src/client-view.ts +61 -0
- package/src/column-layout.ts +47 -0
- package/src/columns.ts +271 -0
- package/src/core.ts +54 -0
- package/src/export.ts +39 -0
- package/src/facets.ts +46 -0
- package/src/filter-bar-state.ts +118 -0
- package/src/filter-client.ts +79 -0
- package/src/filter.ts +113 -0
- package/src/grouping.ts +185 -0
- package/src/index.ts +7 -0
- package/src/messages.ts +29 -0
- package/src/pagination.ts +81 -0
- package/src/query-builder-state.ts +105 -0
- package/src/requests.ts +85 -0
- package/src/row-hierarchy.ts +280 -0
- package/src/row-identity.ts +39 -0
- package/src/saved-views.ts +143 -0
- package/src/search-controller.ts +61 -0
- package/src/search.ts +137 -0
- package/src/selection-client.ts +23 -0
- package/src/selection.ts +62 -0
- package/src/server-export.ts +89 -0
- package/src/sorting.ts +63 -0
- package/src/styles.css +197 -0
- package/src/table-state-changes.ts +51 -0
- package/src/table-state.ts +72 -0
- package/src/text-normalization.ts +14 -0
- package/src/url-state.ts +62 -0
|
@@ -0,0 +1,2724 @@
|
|
|
1
|
+
import { getPageRange as e, resolvePagination as t } from "./pagination.js";
|
|
2
|
+
import { createTableRequests as n } from "./requests.js";
|
|
3
|
+
import { parseFilter as r, serializeFilter as i } from "./filter.js";
|
|
4
|
+
import { formatSearchQuery as a, parseSearchQuery as o } from "./search.js";
|
|
5
|
+
import { createClientView as s } from "./client-view.js";
|
|
6
|
+
import { parseTableState as c, serializeState as l } from "./table-state.js";
|
|
7
|
+
import { changeTableState as u } from "./table-state-changes.js";
|
|
8
|
+
import { canMoveColumn as d, moveColumn as f, orderColumnStates as p, placeColumn as m } from "./column-layout.js";
|
|
9
|
+
import { createTableSelection as h } from "./selection.js";
|
|
10
|
+
import { createClientExport as g } from "./export.js";
|
|
11
|
+
import { selectClientRows as _ } from "./selection-client.js";
|
|
12
|
+
import { createServerExport as ee } from "./server-export.js";
|
|
13
|
+
import { createCellEdit as te } from "./cell-edit.js";
|
|
14
|
+
import { columnStateSchema as v, readColumnDefinitions as y } from "./columns.js";
|
|
15
|
+
import { createRowIdentity as ne } from "./row-identity.js";
|
|
16
|
+
import { groupClientRows as re, normalizeServerGroups as ie } from "./grouping.js";
|
|
17
|
+
import { createRowHierarchy as ae } from "./row-hierarchy.js";
|
|
18
|
+
import { resolveTableMessages as oe } from "./messages.js";
|
|
19
|
+
import { FilterBar as se } from "./FilterBar.js";
|
|
20
|
+
import { DataTableToolbar as ce } from "./DataTableToolbar.js";
|
|
21
|
+
import { className as le, createComponent as b, delegateEvents as ue, effect as x, insert as S, memo as C, mergeProps as de, setAttribute as w, setStyleProperty as T, style as fe, template as E, use as D } from "solid-js/web";
|
|
22
|
+
import { Button as pe, Checkbox as me, ContextMenu as he, DropdownMenu as ge, EmptyState as _e, Pagination as ve, SearchInput as ye, Skeleton as be, Toaster as xe, createToaster as Se, useTheme as Ce } from "@gemologic/sheen";
|
|
23
|
+
import { createVirtualizer as we } from "@tanstack/solid-virtual";
|
|
24
|
+
import { For as O, Index as Te, Show as k, createEffect as A, createMemo as j, createSignal as M, createUniqueId as Ee, on as De, onCleanup as Oe, onMount as ke } from "solid-js";
|
|
25
|
+
//#region src/DataTable.tsx
|
|
26
|
+
var Ae = /*#__PURE__*/ E("<td class=sheen-data-table-selection-cell aria-colindex=1>"), je = /*#__PURE__*/ E("<input class=\"sheen-data-table-editor sheen-data-table-editor-boolean\"type=checkbox>"), Me = /*#__PURE__*/ E("<option value>"), Ne = /*#__PURE__*/ E("<select class=sheen-data-table-editor>"), Pe = /*#__PURE__*/ E("<option>"), Fe = /*#__PURE__*/ E("<input class=sheen-data-table-editor type=number inputmode=decimal>"), Ie = /*#__PURE__*/ E("<input class=sheen-data-table-editor type=text>"), Le = /*#__PURE__*/ E("<span class=sheen-data-table-edit-value>"), Re = /*#__PURE__*/ E("<span class=sheen-data-table-edit-rest tabindex=0 aria-keyshortcuts=Enter>"), ze = /*#__PURE__*/ E("<span class=sheen-data-table-edit-message>"), Be = /*#__PURE__*/ E("<button type=button class=sheen-data-table-expander>"), Ve = /*#__PURE__*/ E("<span class=sheen-data-table-row-status role=status>"), He = /*#__PURE__*/ E("<span class=sheen-data-table-row-status role=alert> <button type=button>"), Ue = /*#__PURE__*/ E("<div class=sheen-data-table-tree-cell><span class=sheen-data-table-tree-value>"), We = /*#__PURE__*/ E("<span class=sheen-data-table-expander-space aria-hidden=true>"), Ge = /*#__PURE__*/ E("<div class=sheen-data-table-tree-cell style=--sheen-table-depth:0><span class=sheen-data-table-group-label> <span class=sheen-data-table-group-count>(<!>)"), Ke = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-value>"), qe = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-card-header><div class=sheen-data-table-mobile-title>"), Je = /*#__PURE__*/ E("<dl class=sheen-data-table-mobile-fields>"), Ye = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-field><dt></dt><dd>"), Xe = /*#__PURE__*/ E("<div class=sheen-data-table-error role=alert><span>"), Ze = /*#__PURE__*/ E("<div class=sheen-data-table-refresh role=status><span>"), Qe = /*#__PURE__*/ E("<th class=sheen-data-table-selection-cell scope=col aria-colindex=1>"), $e = /*#__PURE__*/ E("<tbody>"), et = /*#__PURE__*/ E("<td class=sheen-data-table-selection-cell aria-colindex=1 aria-hidden=true>"), tt = /*#__PURE__*/ E("<tfoot><tr>"), nt = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-controls>"), rt = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-list role=list>"), it = /*#__PURE__*/ E("<dl class=sheen-data-table-mobile-footer>"), at = /*#__PURE__*/ E("<div class=sheen-data-table-mobile tabindex=-1>"), ot = /*#__PURE__*/ E("<div class=sheen-data-table-selection-actions role=toolbar><strong>"), st = /*#__PURE__*/ E("<section><div class=sheen-data-table-frame><div class=sheen-data-table-viewport tabindex=-1><table><caption></caption><thead><tr aria-rowindex=1>"), ct = /*#__PURE__*/ E("<div class=sheen-data-table-search-field>"), lt = /*#__PURE__*/ E("<span>"), ut = /*#__PURE__*/ E("<span class=sheen-data-table-export-status role=status>"), dt = /*#__PURE__*/ E("<button class=sheen-data-table-sort type=button><span class=sheen-data-table-sort-label>"), ft = /*#__PURE__*/ E("<span class=sheen-data-table-state-label>"), pt = /*#__PURE__*/ E("<th scope=col><div class=sheen-data-table-header-content><button class=sheen-data-table-reorder type=button aria-keyshortcuts=\"ArrowLeft ArrowRight\"><span class=sheen-data-table-reorder-grip aria-hidden=true></span></button></div><button class=sheen-data-table-resizer type=button role=separator aria-orientation=vertical>"), mt = /*#__PURE__*/ E("<span class=sheen-data-table-header-label>"), ht = /*#__PURE__*/ E("<span class=sheen-data-table-sort-priority>"), gt = /*#__PURE__*/ E("<span class=sheen-data-table-sort-indicator aria-hidden=true><span class=sheen-data-table-sort-direction>"), _t = /*#__PURE__*/ E("<div class=sheen-data-table-cold><span class=sheen-data-table-state-label>"), vt = /*#__PURE__*/ E("<div class=sheen-data-table-state role=alert><strong></strong><span>"), yt = /*#__PURE__*/ E("<tbody><tr class=sheen-data-table-empty><td aria-colindex=1>"), bt = /*#__PURE__*/ E("<div class=sheen-data-table-skeleton-row>"), xt = /*#__PURE__*/ E("<td>"), St = /*#__PURE__*/ E("<tr>"), Ct = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-cold><span class=sheen-data-table-state-label>"), wt = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-state>"), Tt = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-skeleton>"), Et = /*#__PURE__*/ E("<div class=sheen-data-table-mobile-card role=listitem>");
|
|
27
|
+
function Dt(e) {
|
|
28
|
+
return e.kind === "data" ? e : void 0;
|
|
29
|
+
}
|
|
30
|
+
function Ot(e) {
|
|
31
|
+
return e.kind === "group" ? e : void 0;
|
|
32
|
+
}
|
|
33
|
+
function kt(e) {
|
|
34
|
+
let t = ne(e), n = /* @__PURE__ */ new Map(), [r, i] = M(0);
|
|
35
|
+
return (e) => {
|
|
36
|
+
let a = t.resolveIds(e), o = /* @__PURE__ */ new Set(), s = [], c = !1;
|
|
37
|
+
for (let t = 0; t < e.length; t++) {
|
|
38
|
+
let i = e[t], l = a[t];
|
|
39
|
+
o.add(l);
|
|
40
|
+
let u = n.get(l);
|
|
41
|
+
if (u) {
|
|
42
|
+
c = u.update(i) || c, s.push(u);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
let d = i, f = Object.freeze({
|
|
46
|
+
id: l,
|
|
47
|
+
value: () => (r(), d),
|
|
48
|
+
update: (e) => !Object.is(d, e) && (d = e, !0)
|
|
49
|
+
});
|
|
50
|
+
n.set(l, f), s.push(f);
|
|
51
|
+
}
|
|
52
|
+
for (let e of n.keys()) o.has(e) || n.delete(e);
|
|
53
|
+
return c && i((e) => e + 1), Object.freeze(s);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function At(e) {
|
|
57
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new WeakMap(), [i, a] = M(0);
|
|
58
|
+
function o(e, n) {
|
|
59
|
+
let a = n, o = Object.freeze({
|
|
60
|
+
id: e,
|
|
61
|
+
value: () => (i(), a),
|
|
62
|
+
update: (e) => !Object.is(a, e) && (a = e, !0)
|
|
63
|
+
});
|
|
64
|
+
return t.set(e, o), r.set(n, e), o;
|
|
65
|
+
}
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
update(i) {
|
|
68
|
+
if (!Array.isArray(i)) throw Error("Table rows must be an array");
|
|
69
|
+
let o = /* @__PURE__ */ new Set(), s = !1;
|
|
70
|
+
for (let n = 0; n < i.length; n++) {
|
|
71
|
+
let a = i[n];
|
|
72
|
+
if (typeof a != "object" || !a) throw Error(`rows[${n}] must be an object`);
|
|
73
|
+
let c = e(a);
|
|
74
|
+
if (typeof c != "string" || !c || c.trim() !== c) throw Error(`rows[${n}] has an invalid stable ID`);
|
|
75
|
+
if (o.has(c)) throw Error(`rows[${n}] duplicates row ID ${c}`);
|
|
76
|
+
let l = r.get(a);
|
|
77
|
+
if (l !== void 0 && l !== c) throw Error(`rows[${n}] changed stable ID from ${l} to ${c}`);
|
|
78
|
+
o.add(c);
|
|
79
|
+
let u = t.get(c);
|
|
80
|
+
u && (r.set(a, c), s = u.update(a) || s);
|
|
81
|
+
}
|
|
82
|
+
for (let e of t.keys()) o.has(e) || t.delete(e);
|
|
83
|
+
n = o, s && a((e) => e + 1);
|
|
84
|
+
},
|
|
85
|
+
resolve(r, i) {
|
|
86
|
+
let a = e(r);
|
|
87
|
+
if (!n.has(a)) throw Error(`Client result row at index ${i} is not part of the supplied data`);
|
|
88
|
+
return t.get(a) ?? o(a, r);
|
|
89
|
+
},
|
|
90
|
+
has: (e) => n.has(e)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function jt(e) {
|
|
94
|
+
return e === null ? "" : typeof e == "boolean" ? e ? "Yes" : "No" : String(e);
|
|
95
|
+
}
|
|
96
|
+
function Mt(e) {
|
|
97
|
+
return e instanceof Error ? e.message : "Table request failed";
|
|
98
|
+
}
|
|
99
|
+
function Nt(e) {
|
|
100
|
+
if (e === !1) return Object.freeze([]);
|
|
101
|
+
let t = e?.formats ?? ["csv", "json"];
|
|
102
|
+
if (!Array.isArray(t) || t.length === 0) throw Error("DataTable export formats must be a nonempty array");
|
|
103
|
+
let n = /* @__PURE__ */ new Set();
|
|
104
|
+
for (let e of t) {
|
|
105
|
+
if (e !== "csv" && e !== "json") throw Error("DataTable export formats must contain only csv or json");
|
|
106
|
+
if (n.has(e)) throw Error("DataTable export formats must be unique");
|
|
107
|
+
n.add(e);
|
|
108
|
+
}
|
|
109
|
+
return Object.freeze([...n]);
|
|
110
|
+
}
|
|
111
|
+
function Pt(e, t) {
|
|
112
|
+
let n = t === !1 ? void 0 : t?.filename;
|
|
113
|
+
if (n !== void 0) {
|
|
114
|
+
if (typeof n != "string" || !n.trim() || /[/\\]/u.test(n)) throw Error("DataTable export filename must be nonempty and cannot contain path separators");
|
|
115
|
+
return n.trim();
|
|
116
|
+
}
|
|
117
|
+
return e.normalize("NFKD").replaceAll(/[^\p{Letter}\p{Number}]+/gu, "-").replaceAll(/^-|-$/g, "").toLocaleLowerCase() || "table";
|
|
118
|
+
}
|
|
119
|
+
function Ft(e) {
|
|
120
|
+
if (e === !1) return;
|
|
121
|
+
let t = e?.resetKey;
|
|
122
|
+
if (typeof t == "number" && !Number.isFinite(t)) throw Error("DataTable export resetKey must be a finite number or string");
|
|
123
|
+
return t;
|
|
124
|
+
}
|
|
125
|
+
function It(e, t) {
|
|
126
|
+
return t === null ? e.nullable === !0 : e.type === "text" ? typeof t == "string" : e.type === "number" ? typeof t == "number" : e.type === "boolean" ? typeof t == "boolean" : e.type === "select" && typeof t == "string" && e.options.includes(t);
|
|
127
|
+
}
|
|
128
|
+
function Lt(e) {
|
|
129
|
+
return e.kind === "and" || e.kind === "or" ? e.children.some(Lt) : !0;
|
|
130
|
+
}
|
|
131
|
+
function Rt(e) {
|
|
132
|
+
if (!Array.isArray(e)) throw Error("DataTable actions must be an array");
|
|
133
|
+
let t = /* @__PURE__ */ new Set();
|
|
134
|
+
for (let n of e) {
|
|
135
|
+
if (typeof n.id != "string" || !n.id.trim() || t.has(n.id)) throw Error("DataTable action IDs must be unique nonempty strings");
|
|
136
|
+
if (t.add(n.id), typeof n.label != "string" || !n.label.trim()) throw Error(`DataTable action ${n.id} requires a nonempty label`);
|
|
137
|
+
if (typeof n.onSelect != "function") throw Error(`DataTable action ${n.id} requires onSelect`);
|
|
138
|
+
if (n.shortcut !== void 0 && (typeof n.shortcut != "string" || !n.shortcut.trim())) throw Error(`DataTable action ${n.id} has an invalid shortcut`);
|
|
139
|
+
if (n.disabled !== void 0 && typeof n.disabled != "boolean" && typeof n.disabled != "function") throw Error(`DataTable action ${n.id} has an invalid disabled value`);
|
|
140
|
+
if (n.tone !== void 0 && n.tone !== "neutral" && n.tone !== "accent" && n.tone !== "danger" && n.tone !== "success") throw Error(`DataTable action ${n.id} has an invalid tone`);
|
|
141
|
+
}
|
|
142
|
+
return e;
|
|
143
|
+
}
|
|
144
|
+
function zt(e, t) {
|
|
145
|
+
if (e === !1 || e === void 0 && t === 0) return null;
|
|
146
|
+
if (t === 0) throw Error("DataTable search requires at least one searchable column");
|
|
147
|
+
if (e === void 0) return Object.freeze({
|
|
148
|
+
debounce: 120,
|
|
149
|
+
exactMatch: !1
|
|
150
|
+
});
|
|
151
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw Error("DataTable search must be false or an options object");
|
|
152
|
+
let n = Object.getPrototypeOf(e);
|
|
153
|
+
if (n !== Object.prototype && n !== null) throw Error("DataTable search must be a plain options object");
|
|
154
|
+
for (let t of Object.keys(e)) if (t !== "label" && t !== "placeholder" && t !== "debounce" && t !== "shortcut" && t !== "exactMatch") throw Error(`DataTable search has unknown field ${t}`);
|
|
155
|
+
if (e.label !== void 0 && (typeof e.label != "string" || !e.label.trim())) throw Error("DataTable search label must be a nonempty string");
|
|
156
|
+
if (e.placeholder !== void 0 && (typeof e.placeholder != "string" || !e.placeholder.trim())) throw Error("DataTable search placeholder must be a nonempty string");
|
|
157
|
+
let r = e.debounce ?? 120;
|
|
158
|
+
if (!Number.isFinite(r) || r < 0 || r > 5e3) throw Error("DataTable search debounce must be from 0 to 5000 milliseconds");
|
|
159
|
+
if (e.shortcut !== void 0 && (typeof e.shortcut != "string" || !e.shortcut.trim())) throw Error("DataTable search shortcut must be a nonempty string");
|
|
160
|
+
if (e.exactMatch !== void 0 && typeof e.exactMatch != "boolean") throw Error("DataTable search exactMatch must be boolean");
|
|
161
|
+
return Object.freeze({
|
|
162
|
+
debounce: r,
|
|
163
|
+
exactMatch: e.exactMatch ?? !1,
|
|
164
|
+
...e.label === void 0 ? {} : { label: e.label },
|
|
165
|
+
...e.placeholder === void 0 ? {} : { placeholder: e.placeholder },
|
|
166
|
+
...e.shortcut === void 0 ? {} : { shortcut: e.shortcut }
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function Bt(e) {
|
|
170
|
+
if (e === void 0 || e === !1) return null;
|
|
171
|
+
if (e === !0) return Object.freeze({ pageSize: 20 });
|
|
172
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw Error("DataTable mobileLayout must be boolean or an options object");
|
|
173
|
+
for (let t of Object.keys(e)) if (t !== "pageSize" && t !== "titleColumn") throw Error(`DataTable mobileLayout has unknown field ${t}`);
|
|
174
|
+
let t = e.pageSize ?? 20;
|
|
175
|
+
if (!Number.isSafeInteger(t) || t < 1 || t > 100) throw Error("DataTable mobileLayout pageSize must be an integer from 1 to 100");
|
|
176
|
+
if (e.titleColumn !== void 0 && (typeof e.titleColumn != "string" || !e.titleColumn.trim())) throw Error("DataTable mobileLayout titleColumn must be a nonempty string");
|
|
177
|
+
return Object.freeze({
|
|
178
|
+
pageSize: t,
|
|
179
|
+
...e.titleColumn ? { titleColumn: e.titleColumn } : {}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function Vt(e) {
|
|
183
|
+
let t = {};
|
|
184
|
+
for (let n of e.facets) {
|
|
185
|
+
let e = {};
|
|
186
|
+
for (let t of n.options) e[t.value] = t.count;
|
|
187
|
+
t[n.column] = Object.freeze(e);
|
|
188
|
+
}
|
|
189
|
+
return Object.freeze(t);
|
|
190
|
+
}
|
|
191
|
+
function Ht(e) {
|
|
192
|
+
let n = v(e.columns), r = y(e.columns), i = t(e.mode ?? "client", e.pagination), a = c({
|
|
193
|
+
search: e.initialState?.search ?? "",
|
|
194
|
+
filter: e.filter ?? e.initialState?.filter ?? {
|
|
195
|
+
kind: "and",
|
|
196
|
+
children: []
|
|
197
|
+
},
|
|
198
|
+
sorting: e.initialState?.sorting ?? [],
|
|
199
|
+
pagination: i,
|
|
200
|
+
columns: e.initialState?.columns ?? r.map((e) => ({
|
|
201
|
+
id: e.id,
|
|
202
|
+
visible: e.visible,
|
|
203
|
+
width: typeof e.width == "number" ? e.width : null,
|
|
204
|
+
pin: e.pin
|
|
205
|
+
}))
|
|
206
|
+
}, n);
|
|
207
|
+
for (let e of a.columns) {
|
|
208
|
+
let t = r.find((t) => t.id === e.id);
|
|
209
|
+
if (!t) throw Error(`Unknown table column: ${e.id}`);
|
|
210
|
+
if (e.width !== null && (t.minWidth !== null && e.width < t.minWidth || t.maxWidth !== null && e.width > t.maxWidth)) throw Error(`Initial width for ${e.id} must be within its column bounds`);
|
|
211
|
+
if (e.pin !== !1 && e.width === null && typeof t.width != "number") throw Error(`Pinned column ${e.id} requires an explicit numeric width`);
|
|
212
|
+
}
|
|
213
|
+
return a;
|
|
214
|
+
}
|
|
215
|
+
function Ut(e, t) {
|
|
216
|
+
return e === !1 ? t === !1 : t !== !1 && e.pageIndex === t.pageIndex && e.pageSize === t.pageSize;
|
|
217
|
+
}
|
|
218
|
+
function Wt(e, t, n) {
|
|
219
|
+
let r = t ?? 80;
|
|
220
|
+
return typeof e == "number" ? `${e}px` : e === "content" ? `minmax(${r}px, max-content)` : `minmax(${r}px, ${n === null ? "1fr" : `min(1fr, ${n}px)`})`;
|
|
221
|
+
}
|
|
222
|
+
function Gt(e, t, n) {
|
|
223
|
+
return Math.min(n ?? 4096, Math.max(t ?? 80, Math.round(e)));
|
|
224
|
+
}
|
|
225
|
+
function Kt(t) {
|
|
226
|
+
if (t.mode === "server" && typeof t.onStateChange != "function") throw Error("Server mode requires onStateChange");
|
|
227
|
+
if (t.mode !== "server" && !Array.isArray(t.data)) throw Error("Client mode requires a complete data array");
|
|
228
|
+
if (t.mode !== "server" && t.initialResult !== void 0) throw Error("initialResult is available only in server mode");
|
|
229
|
+
if (t.selection && (t.selection.mode !== "multiple" || typeof t.selection.onChange != "function")) throw Error("DataTable selection requires multiple mode and onChange");
|
|
230
|
+
if (typeof t.selection?.resetKey == "number" && !Number.isFinite(t.selection.resetKey)) throw Error("DataTable selection resetKey must be a finite number or string");
|
|
231
|
+
if (t.grouping && t.hierarchy) throw Error("DataTable grouping and hierarchy are separate presentation modes");
|
|
232
|
+
if (t.grouping && t.mode !== "server" && t.pagination !== !1) throw Error("Client grouping requires complete continuous data with pagination=false");
|
|
233
|
+
if (t.grouping && (typeof t.grouping.by != "string" || !t.grouping.by.trim())) throw Error("DataTable grouping requires a column ID");
|
|
234
|
+
if (t.grouping?.getLabel !== void 0 && typeof t.grouping.getLabel != "function") throw Error("DataTable grouping getLabel must be a function");
|
|
235
|
+
if (t.hierarchy && !t.hierarchy.getChildren && !t.hierarchy.onLoadChildren) throw Error("DataTable hierarchy requires getChildren or onLoadChildren");
|
|
236
|
+
if (t.hierarchy?.onLoadChildren && !t.hierarchy.hasChildren) throw Error("Async DataTable hierarchy requires hasChildren");
|
|
237
|
+
if (typeof t.hierarchy?.resetKey == "number" && !Number.isFinite(t.hierarchy.resetKey)) throw Error("DataTable hierarchy resetKey must be a finite number or string");
|
|
238
|
+
if (typeof t.editResetKey == "number" && !Number.isFinite(t.editResetKey)) throw Error("DataTable editResetKey must be a finite number or string");
|
|
239
|
+
let ne = () => {
|
|
240
|
+
let e = t.variant;
|
|
241
|
+
if (e !== void 0 && e !== "integrated" && e !== "framed") throw Error("DataTable variant must be integrated or framed");
|
|
242
|
+
return e;
|
|
243
|
+
}, ue = () => {
|
|
244
|
+
let e = t.density;
|
|
245
|
+
if (e !== void 0 && e !== "compact" && e !== "comfortable" && e !== "spacious") throw Error("DataTable density must be compact, comfortable, or spacious");
|
|
246
|
+
return e;
|
|
247
|
+
}, E = j(() => Rt(t.actions ?? [])), Kt = Nt(t.export), qt = Pt(t.caption, t.export), Jt = Ft(t.export), N = v(t.columns), Yt = Ee(), Xt = Ce(), Zt = j(() => Xt.state().locale), P = j(() => oe(Xt.messages())), Qt = y(t.columns), $t = new Map(Qt.map((e) => [e.id, e])), en = Qt.filter((e) => e.search !== null), tn = new Map(en.map((e) => [e.id, e])), F = zt(t.search, en.length), I = Bt(t.mobileLayout);
|
|
248
|
+
if (I?.titleColumn && !Qt.some((e) => e.id === I.titleColumn)) throw Error(`Unknown mobileLayout title column: ${I.titleColumn}`);
|
|
249
|
+
let nn = Qt.filter((e) => e.editor !== null);
|
|
250
|
+
if (nn.length > 0 && !t.onCellCommit) throw Error("DataTable editable columns require onCellCommit");
|
|
251
|
+
if (nn.length === 0 && t.onCellCommit) throw Error("DataTable onCellCommit requires at least one editable column");
|
|
252
|
+
for (let e of nn) if (!e.accessor || !e.editor) throw Error(`Editable column ${e.id} requires an accessor and editor`);
|
|
253
|
+
let rn = t.onCellCommit ? Se() : void 0, an = Ht(t), on = t.grouping ? Qt.find((e) => e.id === t.grouping?.by) : void 0;
|
|
254
|
+
if (t.grouping && !on?.accessor) throw Error(`Grouping column ${t.grouping.by} must be an accessor column`);
|
|
255
|
+
let L = t.selection ? h(an.filter, N.filterColumns) : void 0, [sn, cn] = M(0), R, ln = an.search, un = t.selection?.resetKey, z = t.hierarchy ? ae({
|
|
256
|
+
getRowId: t.getRowId,
|
|
257
|
+
...t.hierarchy.getChildren ? { getChildren: t.hierarchy.getChildren } : {},
|
|
258
|
+
...t.hierarchy.hasChildren ? { canLoadChildren: t.hierarchy.hasChildren } : {},
|
|
259
|
+
...t.hierarchy.onLoadChildren ? { loadChildren: t.hierarchy.onLoadChildren } : {},
|
|
260
|
+
...t.hierarchy.defaultExpanded === void 0 ? {} : { defaultExpanded: t.hierarchy.defaultExpanded }
|
|
261
|
+
}) : void 0, [dn, fn] = M(0), pn = t.hierarchy?.resetKey, mn = /* @__PURE__ */ new Map(), [hn, gn] = M(0), [_n, vn] = M(an), [yn, bn] = M(an.search), [xn, Sn] = M(!1), [Cn, wn] = M(an.columns), [Tn, En] = M(0), [Dn, On] = M(0), [kn, An] = M(null), [jn, Mn] = M(), [Nn, Pn] = M(!1), [Fn, In] = M(!1), [Ln, Rn] = M(0), zn, B, Bn, V, Vn, Hn = !1, H = t.mode === "server" && t.onStateChange ? n(t.onStateChange, t.initialResult ? {
|
|
262
|
+
state: an,
|
|
263
|
+
result: t.initialResult
|
|
264
|
+
} : void 0) : void 0, U = t.mode === "server" && t.onExport ? ee(N, async (e, n) => {
|
|
265
|
+
let r = await t.onExport?.(e, n);
|
|
266
|
+
if (!(r instanceof Blob)) throw Error("DataTable onExport must resolve to a Blob");
|
|
267
|
+
return r;
|
|
268
|
+
}) : void 0, W = () => (Tn(), H?.getSnapshot()), Un = (e, t) => $t.get(t)?.accessor?.(e) ?? null, Wn = (e, t) => tn.get(t)?.search?.(e) ?? null, Gn = j(() => t.mode === "server" ? void 0 : s(t.data ?? [], _n(), {
|
|
269
|
+
locale: Zt(),
|
|
270
|
+
searchColumns: en.map((e) => e.id),
|
|
271
|
+
exactMatch: F?.exactMatch ?? !1,
|
|
272
|
+
filterColumns: N.filterColumns,
|
|
273
|
+
sortColumns: N.sortColumns,
|
|
274
|
+
getValue: Un,
|
|
275
|
+
getSearchValue: Wn
|
|
276
|
+
}));
|
|
277
|
+
A(() => {
|
|
278
|
+
let e = Gn();
|
|
279
|
+
e && !Ut(_n().pagination, e.pagination) && vn((t) => c({
|
|
280
|
+
...t,
|
|
281
|
+
pagination: e.pagination
|
|
282
|
+
}, N));
|
|
283
|
+
}), ke(() => {
|
|
284
|
+
if (!H || W()?.accepted) return;
|
|
285
|
+
let e = H.request(an);
|
|
286
|
+
En((e) => e + 1), e.finally(() => En((e) => e + 1));
|
|
287
|
+
}), A(() => {
|
|
288
|
+
let e = Ft(t.export);
|
|
289
|
+
if (Object.is(e, Jt)) return;
|
|
290
|
+
Jt = e, U?.clear(), On((e) => e + 1), An(null);
|
|
291
|
+
let n = jn();
|
|
292
|
+
n && URL.revokeObjectURL(n.href), Mn(void 0);
|
|
293
|
+
}), Oe(() => {
|
|
294
|
+
Vn !== void 0 && window.clearTimeout(Vn), H?.dispose(), z?.dispose(), U?.dispose();
|
|
295
|
+
let e = jn();
|
|
296
|
+
e && URL.revokeObjectURL(e.href);
|
|
297
|
+
});
|
|
298
|
+
let G = j(() => {
|
|
299
|
+
let e = W()?.accepted?.state ?? _n();
|
|
300
|
+
return Object.freeze({
|
|
301
|
+
...e,
|
|
302
|
+
columns: Cn()
|
|
303
|
+
});
|
|
304
|
+
}), K = () => {
|
|
305
|
+
let e = W()?.accepted?.result;
|
|
306
|
+
if (e) return e;
|
|
307
|
+
let t = Gn();
|
|
308
|
+
return t ? {
|
|
309
|
+
rows: t.rows,
|
|
310
|
+
total: t.total,
|
|
311
|
+
facets: Vt(t)
|
|
312
|
+
} : {
|
|
313
|
+
rows: [],
|
|
314
|
+
total: 0
|
|
315
|
+
};
|
|
316
|
+
}, Kn = () => t.mode !== "server" || W()?.accepted !== null, qn = () => xn() || (W()?.pending ?? !1), q = () => qn() || yn() !== G().search || !!(Kn() && W()?.requested), Jn = () => q() && Kn(), Yn = () => W()?.error;
|
|
317
|
+
ke(() => {
|
|
318
|
+
A(() => {
|
|
319
|
+
let e = qn(), t = Kn();
|
|
320
|
+
if (Pn(!1), In(!1), !e) return;
|
|
321
|
+
let n = window.setTimeout(() => {
|
|
322
|
+
t ? In(!0) : Pn(!0);
|
|
323
|
+
}, t ? 500 : 200);
|
|
324
|
+
Oe(() => window.clearTimeout(n));
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
async function Xn(e) {
|
|
328
|
+
if (!H) return vn(e), t.onAcceptedStateChange?.(Object.freeze({
|
|
329
|
+
...e,
|
|
330
|
+
columns: Cn()
|
|
331
|
+
})), "client";
|
|
332
|
+
let n = H.request(e);
|
|
333
|
+
En((e) => e + 1);
|
|
334
|
+
let r = await n;
|
|
335
|
+
En((e) => e + 1);
|
|
336
|
+
let i = H.getSnapshot().accepted;
|
|
337
|
+
return r === "accepted" && i && t.onAcceptedStateChange?.(Object.freeze({
|
|
338
|
+
...i.state,
|
|
339
|
+
columns: Cn()
|
|
340
|
+
})), r;
|
|
341
|
+
}
|
|
342
|
+
A(De(() => t.filter, (e) => {
|
|
343
|
+
if (e === void 0) return;
|
|
344
|
+
let t = r(e, N.filterColumns), n = W()?.requested ?? G();
|
|
345
|
+
if (i(t, N.filterColumns) === i(n.filter, N.filterColumns)) return;
|
|
346
|
+
let a = n.pagination !== !1 && {
|
|
347
|
+
...n.pagination,
|
|
348
|
+
pageIndex: 0
|
|
349
|
+
}, o = c({
|
|
350
|
+
...n,
|
|
351
|
+
filter: t,
|
|
352
|
+
pagination: a
|
|
353
|
+
}, N);
|
|
354
|
+
Rn(0), Xn(o).then((e) => {
|
|
355
|
+
(e === "accepted" || e === "client") && B?.scrollTo({ top: 0 });
|
|
356
|
+
});
|
|
357
|
+
}, { defer: !0 }));
|
|
358
|
+
let Zn = () => (F?.label ?? P().searchTable).replaceAll("{caption}", t.caption), Qn = () => (F?.placeholder ?? Zn()).replaceAll("{caption}", t.caption), $n = j(() => F?.shortcut ? Object.freeze({
|
|
359
|
+
keys: F.shortcut,
|
|
360
|
+
scope: "global",
|
|
361
|
+
label: Zn(),
|
|
362
|
+
group: P().tableShortcuts
|
|
363
|
+
}) : void 0), er = j(() => o(yn(), F?.exactMatch ?? !1)), tr = () => er().mode, nr = j(() => [{
|
|
364
|
+
kind: "radio",
|
|
365
|
+
id: "search-mode",
|
|
366
|
+
label: P().searchMatchMode,
|
|
367
|
+
value: tr(),
|
|
368
|
+
onValueChange: (e) => rr(e),
|
|
369
|
+
options: [{
|
|
370
|
+
id: "ranked",
|
|
371
|
+
label: P().searchRanked
|
|
372
|
+
}, {
|
|
373
|
+
id: "exact",
|
|
374
|
+
label: P().searchExact
|
|
375
|
+
}]
|
|
376
|
+
}]);
|
|
377
|
+
function rr(e) {
|
|
378
|
+
if (e !== "ranked" && e !== "exact") throw Error(`Unsupported DataTable search mode ${JSON.stringify(e)}`);
|
|
379
|
+
let t = e;
|
|
380
|
+
or(a(er().value, t));
|
|
381
|
+
}
|
|
382
|
+
function ir() {
|
|
383
|
+
Vn !== void 0 && window.clearTimeout(Vn), Vn = void 0;
|
|
384
|
+
}
|
|
385
|
+
function ar(e) {
|
|
386
|
+
if (!F) return;
|
|
387
|
+
ir();
|
|
388
|
+
let t = W();
|
|
389
|
+
if (e === G().search && (!t?.pending || t.requested?.search === e)) {
|
|
390
|
+
Sn(!1);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
Sn(!0), Vn = window.setTimeout(() => {
|
|
394
|
+
if (Vn = void 0, Hn || yn() !== e) return;
|
|
395
|
+
Sn(!1);
|
|
396
|
+
let t = W()?.requested, n = t ? Object.freeze({
|
|
397
|
+
...t,
|
|
398
|
+
columns: Cn()
|
|
399
|
+
}) : G(), r = u(n, {
|
|
400
|
+
kind: "query",
|
|
401
|
+
change: {
|
|
402
|
+
kind: "search",
|
|
403
|
+
value: e
|
|
404
|
+
}
|
|
405
|
+
}, N);
|
|
406
|
+
Rn(0), Xn(r).then((e) => {
|
|
407
|
+
(e === "accepted" || e === "client") && B?.scrollTo({ top: 0 });
|
|
408
|
+
});
|
|
409
|
+
}, F.debounce);
|
|
410
|
+
}
|
|
411
|
+
function or(e) {
|
|
412
|
+
if (bn(e), Hn) {
|
|
413
|
+
ir(), Sn(!1);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
ar(e);
|
|
417
|
+
}
|
|
418
|
+
function sr() {
|
|
419
|
+
Hn = !0, ir(), Sn(!1);
|
|
420
|
+
}
|
|
421
|
+
function cr(e) {
|
|
422
|
+
Hn = !1, bn(e), ar(e);
|
|
423
|
+
}
|
|
424
|
+
function lr(e) {
|
|
425
|
+
let t = G();
|
|
426
|
+
t.pagination === !1 || q() || Xn(u(t, {
|
|
427
|
+
kind: "query",
|
|
428
|
+
change: {
|
|
429
|
+
kind: "pagination",
|
|
430
|
+
value: {
|
|
431
|
+
...t.pagination,
|
|
432
|
+
pageIndex: e
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}, N)).then((e) => {
|
|
436
|
+
(e === "accepted" || e === "client") && (B?.scrollTo({ top: 0 }), Bn?.scrollIntoView({ block: "nearest" }));
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function ur(e, t) {
|
|
440
|
+
let n = W()?.requested, r = n ? Object.freeze({
|
|
441
|
+
...n,
|
|
442
|
+
columns: Cn()
|
|
443
|
+
}) : G(), i = u(r, {
|
|
444
|
+
kind: "sortCycle",
|
|
445
|
+
column: e,
|
|
446
|
+
multiple: t
|
|
447
|
+
}, N);
|
|
448
|
+
Rn(0), Xn(i);
|
|
449
|
+
}
|
|
450
|
+
function dr(e) {
|
|
451
|
+
if (q()) return;
|
|
452
|
+
let t = u(G(), {
|
|
453
|
+
kind: "query",
|
|
454
|
+
change: {
|
|
455
|
+
kind: "filter",
|
|
456
|
+
value: e
|
|
457
|
+
}
|
|
458
|
+
}, N);
|
|
459
|
+
Rn(0), Xn(t).then((e) => {
|
|
460
|
+
(e === "accepted" || e === "client") && B?.scrollTo({ top: 0 });
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
function fr() {
|
|
464
|
+
if (q()) return;
|
|
465
|
+
ir(), Sn(!1), bn("");
|
|
466
|
+
let e = G(), t = e.pagination !== !1 && {
|
|
467
|
+
...e.pagination,
|
|
468
|
+
pageIndex: 0
|
|
469
|
+
}, n = c({
|
|
470
|
+
...e,
|
|
471
|
+
search: "",
|
|
472
|
+
filter: {
|
|
473
|
+
kind: "and",
|
|
474
|
+
children: []
|
|
475
|
+
},
|
|
476
|
+
pagination: t
|
|
477
|
+
}, N);
|
|
478
|
+
Rn(0), Xn(n).then((e) => {
|
|
479
|
+
(e === "accepted" || e === "client") && queueMicrotask(() => {
|
|
480
|
+
((Bn && Bn.getClientRects().length > 0 ? Bn : void 0) ?? B)?.focus({ preventScroll: !0 });
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function pr() {
|
|
485
|
+
if (!H || qn()) return;
|
|
486
|
+
let e = H.retry();
|
|
487
|
+
En((e) => e + 1), e.then((e) => {
|
|
488
|
+
En((e) => e + 1);
|
|
489
|
+
let n = H.getSnapshot().accepted;
|
|
490
|
+
e === "accepted" && n && t.onAcceptedStateChange?.(Object.freeze({
|
|
491
|
+
...n.state,
|
|
492
|
+
columns: Cn()
|
|
493
|
+
}));
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
let mr = kt(t.getRowId), hr = At(t.getRowId), gr = /* @__PURE__ */ new Map(), _r = j(() => {
|
|
497
|
+
if (t.mode === "server") return;
|
|
498
|
+
let e = t.data ?? [];
|
|
499
|
+
hr.update(e);
|
|
500
|
+
for (let e of gr.keys()) hr.has(e) || gr.delete(e);
|
|
501
|
+
return hr;
|
|
502
|
+
});
|
|
503
|
+
function vr(e) {
|
|
504
|
+
let t = _r();
|
|
505
|
+
return t ? e.map((e, n) => t.resolve(e, n)) : mr(e);
|
|
506
|
+
}
|
|
507
|
+
function yr(e, t, n) {
|
|
508
|
+
let r = gr.get(e.id);
|
|
509
|
+
if (r) return r.position = t + 1, r.setSize = n, r;
|
|
510
|
+
let i = {
|
|
511
|
+
kind: "data",
|
|
512
|
+
key: `row:${e.id}`,
|
|
513
|
+
row: e,
|
|
514
|
+
parentId: null,
|
|
515
|
+
depth: 1,
|
|
516
|
+
position: t + 1,
|
|
517
|
+
setSize: n,
|
|
518
|
+
canExpand: !1,
|
|
519
|
+
expanded: !1,
|
|
520
|
+
unloaded: !1,
|
|
521
|
+
pending: !1,
|
|
522
|
+
error: null
|
|
523
|
+
};
|
|
524
|
+
return gr.set(e.id, i), i;
|
|
525
|
+
}
|
|
526
|
+
let br = j(() => new Intl.NumberFormat(Zt()));
|
|
527
|
+
function xr(e) {
|
|
528
|
+
let n = t.grouping?.getLabel?.(e.value) ?? (e.value === null ? P().groupMissing : typeof e.value == "number" ? br().format(e.value) : String(e.value));
|
|
529
|
+
if (typeof n != "string" || !n.trim()) throw Error(`Group ${e.id} requires a nonempty label`);
|
|
530
|
+
return n;
|
|
531
|
+
}
|
|
532
|
+
function Sr(e) {
|
|
533
|
+
hn();
|
|
534
|
+
let n = mn.get(e);
|
|
535
|
+
if (n !== void 0) return n;
|
|
536
|
+
let r = t.grouping?.collapsible === !1 || t.grouping?.defaultExpanded !== !1;
|
|
537
|
+
return mn.set(e, r), r;
|
|
538
|
+
}
|
|
539
|
+
function Cr(e, n) {
|
|
540
|
+
q() || t.grouping?.collapsible === !1 || Sr(e) === n || (mn.set(e, n), gn((e) => e + 1));
|
|
541
|
+
}
|
|
542
|
+
let wr = j(() => {
|
|
543
|
+
if (z) {
|
|
544
|
+
dn();
|
|
545
|
+
let e = t.hierarchy?.resetKey;
|
|
546
|
+
Object.is(e, pn) || z.reset(), pn = e, z.updateRoots(K().rows);
|
|
547
|
+
let n = z.getSnapshot(), r = mr(n.map((e) => e.row)), i = new Map(r.map((e) => [e.id, e]));
|
|
548
|
+
return Object.freeze(n.map((e) => {
|
|
549
|
+
let t = i.get(e.id);
|
|
550
|
+
if (!t) throw Error(`Missing stable hierarchy row: ${e.id}`);
|
|
551
|
+
return Object.freeze({
|
|
552
|
+
kind: "data",
|
|
553
|
+
key: `row:${e.id}`,
|
|
554
|
+
row: t,
|
|
555
|
+
parentId: e.parentId,
|
|
556
|
+
depth: e.depth,
|
|
557
|
+
position: e.position,
|
|
558
|
+
setSize: e.setSize,
|
|
559
|
+
canExpand: e.canExpand,
|
|
560
|
+
expanded: e.expanded,
|
|
561
|
+
unloaded: e.unloaded,
|
|
562
|
+
pending: e.pending,
|
|
563
|
+
error: e.error
|
|
564
|
+
});
|
|
565
|
+
}));
|
|
566
|
+
}
|
|
567
|
+
if (t.grouping && on?.accessor) {
|
|
568
|
+
if (hn(), t.mode === "server" && W()?.accepted === null) return Object.freeze([]);
|
|
569
|
+
let e = K(), n = Qt.flatMap((e) => e.aggregate && e.accessor ? [{
|
|
570
|
+
id: e.id,
|
|
571
|
+
aggregate: e.aggregate,
|
|
572
|
+
getValue: e.accessor
|
|
573
|
+
}] : []), r = t.mode === "server" ? ie(e.rows, e.groups, {
|
|
574
|
+
column: on.id,
|
|
575
|
+
aggregateColumns: n.map((e) => e.id),
|
|
576
|
+
getRowId: t.getRowId
|
|
577
|
+
}) : re(e.rows, {
|
|
578
|
+
column: on.id,
|
|
579
|
+
getValue: on.accessor,
|
|
580
|
+
aggregates: n
|
|
581
|
+
}), i = t.mode === "server" ? mr(e.rows) : vr(e.rows), a = new Map(i.map((e) => [e.id, e])), o = [];
|
|
582
|
+
for (let e = 0; e < r.length; e++) {
|
|
583
|
+
let n = r[e], i = Sr(n.id);
|
|
584
|
+
if (o.push(Object.freeze({
|
|
585
|
+
kind: "group",
|
|
586
|
+
key: n.id,
|
|
587
|
+
group: n,
|
|
588
|
+
label: xr(n),
|
|
589
|
+
position: e + 1,
|
|
590
|
+
setSize: r.length,
|
|
591
|
+
expanded: i
|
|
592
|
+
})), i) for (let e = 0; e < n.rows.length; e++) {
|
|
593
|
+
let r = t.getRowId(n.rows[e]), i = a.get(r);
|
|
594
|
+
if (!i) throw Error(`Missing stable grouped row: ${r}`);
|
|
595
|
+
o.push(Object.freeze({
|
|
596
|
+
kind: "data",
|
|
597
|
+
key: `row:${r}`,
|
|
598
|
+
row: i,
|
|
599
|
+
parentId: n.id,
|
|
600
|
+
depth: 2,
|
|
601
|
+
position: e + 1,
|
|
602
|
+
setSize: n.rows.length,
|
|
603
|
+
canExpand: !1,
|
|
604
|
+
expanded: !1,
|
|
605
|
+
unloaded: !1,
|
|
606
|
+
pending: !1,
|
|
607
|
+
error: null
|
|
608
|
+
}));
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return Object.freeze(o);
|
|
612
|
+
}
|
|
613
|
+
return Object.freeze([]);
|
|
614
|
+
}), Tr = j(() => z || t.grouping ? Object.freeze([]) : K().rows), Er = j(() => t.mode === "server" && !z && !t.grouping ? Object.freeze(vr(Tr())) : Object.freeze([]));
|
|
615
|
+
function Dr(e) {
|
|
616
|
+
let t = Tr()[e];
|
|
617
|
+
if (!t) return;
|
|
618
|
+
let n = _r();
|
|
619
|
+
return n ? n.resolve(t, e) : Er()[e];
|
|
620
|
+
}
|
|
621
|
+
let Or = () => z || t.grouping ? wr().length : Tr().length;
|
|
622
|
+
function kr(e) {
|
|
623
|
+
if (z || t.grouping) return wr()[e];
|
|
624
|
+
let n = Dr(e);
|
|
625
|
+
return n ? yr(n, e, Tr().length) : void 0;
|
|
626
|
+
}
|
|
627
|
+
function Ar(e) {
|
|
628
|
+
if (z || t.grouping) return wr().findIndex((t) => t.key === e);
|
|
629
|
+
for (let t = 0; t < Tr().length; t++) if (`row:${Dr(t)?.id ?? ""}` === e) return t;
|
|
630
|
+
return -1;
|
|
631
|
+
}
|
|
632
|
+
let jr = !1, J = j(() => {
|
|
633
|
+
let e = z || t.grouping ? wr().flatMap((e) => e.kind === "data" ? [e.row] : []) : t.mode === "server" ? Er() : L || E().length > 0 ? vr(Tr()) : Object.freeze([]);
|
|
634
|
+
if (!L) return {
|
|
635
|
+
rows: e,
|
|
636
|
+
before: "",
|
|
637
|
+
payload: void 0
|
|
638
|
+
};
|
|
639
|
+
let n = JSON.stringify(L.getPayload()), r = t.selection?.resetKey, i = G().search;
|
|
640
|
+
return (!Object.is(r, un) || i !== ln) && (L.reset(), R = void 0), un = r, ln = i, L.setFilter(G().filter), L.setLoadedIds(e.map((e) => e.id)), {
|
|
641
|
+
rows: e,
|
|
642
|
+
before: n,
|
|
643
|
+
payload: L.getPayload()
|
|
644
|
+
};
|
|
645
|
+
});
|
|
646
|
+
A(() => {
|
|
647
|
+
let e = J();
|
|
648
|
+
L && e.payload && (cn((e) => e + 1), jr && JSON.stringify(e.payload) !== e.before && t.selection?.onChange(e.payload), jr = !0);
|
|
649
|
+
});
|
|
650
|
+
function Mr() {
|
|
651
|
+
if (!L) return;
|
|
652
|
+
let e = L.getPayload();
|
|
653
|
+
cn((e) => e + 1), t.selection?.onChange(e);
|
|
654
|
+
}
|
|
655
|
+
function Y(e) {
|
|
656
|
+
return sn(), J(), L?.isSelected(e) ?? !1;
|
|
657
|
+
}
|
|
658
|
+
function Nr(e, t, n) {
|
|
659
|
+
if (!L || q()) return;
|
|
660
|
+
let r = R !== void 0 && J().rows.some((e) => e.id === R);
|
|
661
|
+
n && r && R ? L.selectRange(R, e, t) : (L.setSelected(e, t), R = e), Mr();
|
|
662
|
+
}
|
|
663
|
+
function Pr(e) {
|
|
664
|
+
L && !q() && (L.selectLoaded(e), Mr());
|
|
665
|
+
}
|
|
666
|
+
function Fr() {
|
|
667
|
+
!L || q() || G().search.length > 0 || (L.selectAllMatching(), Mr());
|
|
668
|
+
}
|
|
669
|
+
function Ir() {
|
|
670
|
+
L && (L.clear(), R = void 0, Mr());
|
|
671
|
+
}
|
|
672
|
+
let Lr = j(() => J().rows.filter((e) => Y(e.id)).length), Rr = j(() => (sn(), L?.getPayload())), zr = j(() => {
|
|
673
|
+
let e = Rr();
|
|
674
|
+
return e?.kind === "query" || !!e?.ids.length;
|
|
675
|
+
});
|
|
676
|
+
function Br(e) {
|
|
677
|
+
let t = Rr();
|
|
678
|
+
return L && t && Y(e.id) && zr() ? t : Object.freeze({
|
|
679
|
+
kind: "ids",
|
|
680
|
+
ids: Object.freeze([e.id])
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
function Vr(e) {
|
|
684
|
+
let t = e ? Br(e) : Rr();
|
|
685
|
+
if (!t) throw Error("DataTable selection actions require an active selection");
|
|
686
|
+
let n = J().rows.filter((e) => t.kind === "query" ? !t.excluded.includes(e.id) : t.ids.includes(e.id)).map((e) => e.value());
|
|
687
|
+
return Object.freeze({
|
|
688
|
+
selection: t,
|
|
689
|
+
loadedRows: Object.freeze(n),
|
|
690
|
+
...e ? { anchor: e.value() } : {}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
function Hr(e, t) {
|
|
694
|
+
return q() || (typeof e.disabled == "function" ? e.disabled(t) : e.disabled === !0);
|
|
695
|
+
}
|
|
696
|
+
function Ur(e) {
|
|
697
|
+
!L || q() || Y(e.id) || (L.clear(), L.setSelected(e.id, !0), R = e.id, Mr());
|
|
698
|
+
}
|
|
699
|
+
function Wr(e) {
|
|
700
|
+
let t = Vr(e);
|
|
701
|
+
return E().map((e) => ({
|
|
702
|
+
kind: "action",
|
|
703
|
+
id: e.id,
|
|
704
|
+
label: e.label,
|
|
705
|
+
...e.shortcut ? { shortcut: e.shortcut } : {},
|
|
706
|
+
disabled: Hr(e, t),
|
|
707
|
+
onSelect: () => e.onSelect(t)
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
710
|
+
let Gr = j(() => {
|
|
711
|
+
let e = Rr();
|
|
712
|
+
return e ? e.kind === "query" ? Math.max(0, K().total - e.excluded.length) : e.ids.length : 0;
|
|
713
|
+
}), [Kr, qr] = M(!1), [Jr, Yr] = M(!1), X;
|
|
714
|
+
A(() => {
|
|
715
|
+
let e = zr();
|
|
716
|
+
if (X !== void 0 && window.clearTimeout(X), X = void 0, e) {
|
|
717
|
+
qr(!0), Yr(!0);
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
Yr(!1), Kr() && (X = window.setTimeout(() => {
|
|
721
|
+
X = void 0, qr(!1);
|
|
722
|
+
}, 250));
|
|
723
|
+
}), Oe(() => {
|
|
724
|
+
X !== void 0 && window.clearTimeout(X);
|
|
725
|
+
});
|
|
726
|
+
function Xr(e) {
|
|
727
|
+
e.target !== e.currentTarget || Jr() || (X !== void 0 && window.clearTimeout(X), X = void 0, qr(!1));
|
|
728
|
+
}
|
|
729
|
+
function Zr(e) {
|
|
730
|
+
let n = t.selection?.getRowLabel?.(e.value()) ?? P().selectRow.replaceAll("{id}", e.id);
|
|
731
|
+
if (typeof n != "string" || !n.trim()) throw Error(`Selection label for ${e.id} must be nonempty`);
|
|
732
|
+
return n;
|
|
733
|
+
}
|
|
734
|
+
let Qr = Qt.map((e, t) => {
|
|
735
|
+
let n = an.columns.find((t) => t.id === e.id);
|
|
736
|
+
if (!n) throw Error(`Missing initial state for table column: ${e.id}`);
|
|
737
|
+
let [r, i] = M(n);
|
|
738
|
+
return Object.freeze({
|
|
739
|
+
definition: e,
|
|
740
|
+
state: r,
|
|
741
|
+
updateState: i,
|
|
742
|
+
variable: `--sheen-table-column-${t}`,
|
|
743
|
+
sortDescriptionId: Ee()
|
|
744
|
+
});
|
|
745
|
+
}), $r = new Map(Qr.map((e) => [e.definition.id, e])), ei = j(() => p(G().columns)), Z = j(() => {
|
|
746
|
+
let e = ei();
|
|
747
|
+
for (let t of e) $r.get(t.id)?.updateState(t);
|
|
748
|
+
return e.flatMap((e) => {
|
|
749
|
+
let t = $r.get(e.id);
|
|
750
|
+
return t && e.visible ? [t] : [];
|
|
751
|
+
});
|
|
752
|
+
}), ti = /* @__PURE__ */ new Map(), [ni, ri] = M(0), ii = t.editResetKey;
|
|
753
|
+
function ai(e, n) {
|
|
754
|
+
ni();
|
|
755
|
+
let r = n.definition.editor, i = n.definition.accessor, a = t.onCellCommit;
|
|
756
|
+
if (!r || !i || !a) return;
|
|
757
|
+
let o = ti.get(e.id)?.get(n.definition.id);
|
|
758
|
+
if (o) return o;
|
|
759
|
+
let s = i(e.value());
|
|
760
|
+
if (!It(r, s)) throw Error(`Initial value for editable cell ${e.id}/${n.definition.id} does not match its editor`);
|
|
761
|
+
let [c, l] = M(0), u = () => l((e) => e + 1), d = te(s, async (t, i) => {
|
|
762
|
+
let o = Object.freeze({
|
|
763
|
+
...t,
|
|
764
|
+
rowId: e.id,
|
|
765
|
+
row: e.value(),
|
|
766
|
+
column: n.definition.id
|
|
767
|
+
}), s = await a(o, i), c = s.kind === "accepted" ? s.value : s.current;
|
|
768
|
+
if (!It(r, c)) throw Error(`Committed value for ${e.id}/${n.definition.id} does not match its editor`);
|
|
769
|
+
return s;
|
|
770
|
+
}, { validate: (t) => It(r, t) ? r.validate?.(t, e.value()) ?? null : t === null ? P().cellValueRequired : P().cellValueInvalid }), f = Object.freeze({
|
|
771
|
+
controller: d,
|
|
772
|
+
revision: c,
|
|
773
|
+
publish: u
|
|
774
|
+
}), p = ti.get(e.id) ?? /* @__PURE__ */ new Map();
|
|
775
|
+
return p.set(n.definition.id, f), ti.set(e.id, p), f;
|
|
776
|
+
}
|
|
777
|
+
function oi(e) {
|
|
778
|
+
return e?.revision(), e?.controller.getSnapshot();
|
|
779
|
+
}
|
|
780
|
+
A(() => {
|
|
781
|
+
let e = t.editResetKey;
|
|
782
|
+
if (typeof e == "number" && !Number.isFinite(e)) throw Error("DataTable editResetKey must be a finite number or string");
|
|
783
|
+
if (!Object.is(e, ii)) {
|
|
784
|
+
ii = e;
|
|
785
|
+
for (let e of ti.values()) for (let t of e.values()) t.controller.dispose();
|
|
786
|
+
ti.clear(), rn?.clear(), ri((e) => e + 1);
|
|
787
|
+
}
|
|
788
|
+
}), Oe(() => {
|
|
789
|
+
for (let e of ti.values()) for (let t of e.values()) t.controller.dispose();
|
|
790
|
+
ti.clear();
|
|
791
|
+
});
|
|
792
|
+
let si = j(() => !Z().some((e) => e.definition.accessor !== null) || Kt.length === 0 || t.mode === "server" && !U ? Object.freeze([]) : Kt), ci = () => (Dn(), U?.getSnapshot()), li = () => ci()?.pending ?? !1, ui = () => ci()?.error ?? kn();
|
|
793
|
+
function di(e, t) {
|
|
794
|
+
let n = jn(), r = URL.createObjectURL(e), i = `${qt}.${t}`;
|
|
795
|
+
Mn({
|
|
796
|
+
href: r,
|
|
797
|
+
filename: i
|
|
798
|
+
}), n && URL.revokeObjectURL(n.href);
|
|
799
|
+
let a = document.createElement("a");
|
|
800
|
+
a.href = r, a.download = i, a.click();
|
|
801
|
+
}
|
|
802
|
+
function fi(e) {
|
|
803
|
+
if (t.mode !== "server") {
|
|
804
|
+
An(null);
|
|
805
|
+
try {
|
|
806
|
+
let n = Gn()?.view ?? [], r = zr() ? Rr() : void 0, i = r ? _(n, r, {
|
|
807
|
+
locale: Zt(),
|
|
808
|
+
filterColumns: N.filterColumns,
|
|
809
|
+
getRowId: t.getRowId,
|
|
810
|
+
getValue: Un
|
|
811
|
+
}) : n, a = g(i, Z().flatMap((e) => e.definition.accessor ? [{
|
|
812
|
+
id: e.definition.id,
|
|
813
|
+
header: e.definition.header,
|
|
814
|
+
value: e.definition.accessor
|
|
815
|
+
}] : [])), o = e === "csv" ? a.toCSV() : a.toJSON();
|
|
816
|
+
di(new Blob([o], { type: e === "csv" ? "text/csv;charset=utf-8" : "application/json;charset=utf-8" }), e);
|
|
817
|
+
} catch (e) {
|
|
818
|
+
An(e);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
async function pi(e) {
|
|
823
|
+
On((e) => e + 1);
|
|
824
|
+
let t = await e;
|
|
825
|
+
if (On((e) => e + 1), t !== "accepted") return;
|
|
826
|
+
let n = U?.getSnapshot().accepted;
|
|
827
|
+
n && di(n.artifact, n.request.format);
|
|
828
|
+
}
|
|
829
|
+
function mi(e) {
|
|
830
|
+
if (!U || q() || li()) return;
|
|
831
|
+
let t = zr() ? Rr() ?? null : null;
|
|
832
|
+
pi(U.request({
|
|
833
|
+
format: e,
|
|
834
|
+
state: G(),
|
|
835
|
+
selection: t
|
|
836
|
+
}));
|
|
837
|
+
}
|
|
838
|
+
function hi(e) {
|
|
839
|
+
q() || li() || (t.mode === "server" ? mi(e) : fi(e));
|
|
840
|
+
}
|
|
841
|
+
function gi() {
|
|
842
|
+
!U || q() || li() || pi(U.retry());
|
|
843
|
+
}
|
|
844
|
+
let _i = j(() => si().map((e) => ({
|
|
845
|
+
kind: "action",
|
|
846
|
+
id: e,
|
|
847
|
+
label: e === "csv" ? P().exportCSV : P().exportJSON,
|
|
848
|
+
disabled: q() || li(),
|
|
849
|
+
onSelect: () => hi(e)
|
|
850
|
+
}))), vi = j(() => new Intl.NumberFormat(Zt())), yi = () => {
|
|
851
|
+
if (!Kn()) return;
|
|
852
|
+
let e = K().total;
|
|
853
|
+
return (e === 1 ? P().resultCountOne : P().resultCount).replace("{count}", vi().format(e));
|
|
854
|
+
};
|
|
855
|
+
function bi() {
|
|
856
|
+
let e = jn();
|
|
857
|
+
if (!e) return;
|
|
858
|
+
let t = document.createElement("a");
|
|
859
|
+
t.href = e.href, t.download = e.filename, t.click();
|
|
860
|
+
}
|
|
861
|
+
let xi = (e) => `var(${e.variable}, ${Wt(e.state().width ?? e.definition.width, e.definition.minWidth, e.definition.maxWidth)})`, Si = "var(--sheen-table-selection-column, 2.75rem)", Ci = j(() => [...L ? [Si] : [], ...Z().map(xi)].join(" "));
|
|
862
|
+
function wi(e) {
|
|
863
|
+
wn(e.columns);
|
|
864
|
+
let n = W()?.accepted?.state ?? _n();
|
|
865
|
+
t.onAcceptedStateChange?.(Object.freeze({
|
|
866
|
+
...n,
|
|
867
|
+
columns: e.columns
|
|
868
|
+
}));
|
|
869
|
+
}
|
|
870
|
+
function Ti(e) {
|
|
871
|
+
wi(u(G(), e, N));
|
|
872
|
+
}
|
|
873
|
+
function Ei(e) {
|
|
874
|
+
let t = [...V?.querySelectorAll("thead th[data-column]") ?? []].find((t) => t.dataset.column === e.definition.id)?.getBoundingClientRect().width, n = e.state().width ?? (typeof e.definition.width == "number" ? e.definition.width : e.definition.minWidth ?? 160);
|
|
875
|
+
return Gt(t && t > 0 ? t : n, e.definition.minWidth, e.definition.maxWidth);
|
|
876
|
+
}
|
|
877
|
+
function Di(e, t) {
|
|
878
|
+
t === null ? V?.style.removeProperty(e.variable) : V?.style.setProperty(e.variable, `${t}px`);
|
|
879
|
+
}
|
|
880
|
+
function Oi(e, t) {
|
|
881
|
+
let n = t === null ? null : Gt(t, e.definition.minWidth, e.definition.maxWidth);
|
|
882
|
+
Di(e, n), Ti({
|
|
883
|
+
kind: "columnWidth",
|
|
884
|
+
column: e.definition.id,
|
|
885
|
+
width: n
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function ki(e) {
|
|
889
|
+
let t = [...V?.querySelectorAll("[data-column]") ?? []].filter((t) => t.dataset.column === e.definition.id).reduce((e, t) => Math.max(e, t.scrollWidth + 1), 0);
|
|
890
|
+
Oi(e, t > 0 ? t : Ei(e));
|
|
891
|
+
}
|
|
892
|
+
function Ai(e, t) {
|
|
893
|
+
let n = G();
|
|
894
|
+
t !== !1 && e.state().width === null && typeof e.definition.width != "number" && (n = u(n, {
|
|
895
|
+
kind: "columnWidth",
|
|
896
|
+
column: e.definition.id,
|
|
897
|
+
width: Ei(e)
|
|
898
|
+
}, N)), n = u(n, {
|
|
899
|
+
kind: "columnPin",
|
|
900
|
+
column: e.definition.id,
|
|
901
|
+
pin: t
|
|
902
|
+
}, N), wi(n);
|
|
903
|
+
}
|
|
904
|
+
function ji(e, t) {
|
|
905
|
+
let n = f(G().columns, e, t);
|
|
906
|
+
if (n === G().columns) return;
|
|
907
|
+
let r = V?.ownerDocument.activeElement;
|
|
908
|
+
Ti({
|
|
909
|
+
kind: "columnOrder",
|
|
910
|
+
ids: n.map((e) => e.id)
|
|
911
|
+
}), r instanceof HTMLElement && V?.contains(r) && queueMicrotask(() => {
|
|
912
|
+
r.isConnected && r.focus({ preventScroll: !0 });
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
function Mi(e, t, n) {
|
|
916
|
+
let r = m(G().columns, e, t, n), i = V?.ownerDocument.activeElement;
|
|
917
|
+
Ti({
|
|
918
|
+
kind: "columnOrder",
|
|
919
|
+
ids: r.map((e) => e.id)
|
|
920
|
+
}), i instanceof HTMLElement && V?.contains(i) && queueMicrotask(() => {
|
|
921
|
+
i.isConnected && i.focus({ preventScroll: !0 });
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
let Ni = j(() => {
|
|
925
|
+
let e = P(), t = G().columns, n = t.filter((e) => e.visible).length;
|
|
926
|
+
return t.map((r) => {
|
|
927
|
+
let i = $r.get(r.id);
|
|
928
|
+
if (!i) throw Error(`Missing table column: ${r.id}`);
|
|
929
|
+
let a = [
|
|
930
|
+
{
|
|
931
|
+
kind: "checkbox",
|
|
932
|
+
id: "visible",
|
|
933
|
+
label: e.showColumn,
|
|
934
|
+
checked: r.visible,
|
|
935
|
+
disabled: r.visible && n === 1,
|
|
936
|
+
onCheckedChange: (e) => Ti({
|
|
937
|
+
kind: "columnVisibility",
|
|
938
|
+
column: r.id,
|
|
939
|
+
visible: e
|
|
940
|
+
})
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
kind: "action",
|
|
944
|
+
id: "move-start",
|
|
945
|
+
label: e.moveColumnStart,
|
|
946
|
+
disabled: !d(t, r.id, "toward-start"),
|
|
947
|
+
onSelect: () => ji(r.id, "toward-start")
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
kind: "action",
|
|
951
|
+
id: "move-end",
|
|
952
|
+
label: e.moveColumnEnd,
|
|
953
|
+
disabled: !d(t, r.id, "toward-end"),
|
|
954
|
+
onSelect: () => ji(r.id, "toward-end")
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
kind: "radio",
|
|
958
|
+
id: "pin",
|
|
959
|
+
label: e.pinColumn,
|
|
960
|
+
value: r.pin === !1 ? "none" : r.pin,
|
|
961
|
+
onValueChange: (e) => {
|
|
962
|
+
if (e !== "none" && e !== "start" && e !== "end") throw Error("Invalid column pin action");
|
|
963
|
+
Ai(i, e !== "none" && e);
|
|
964
|
+
},
|
|
965
|
+
options: [
|
|
966
|
+
{
|
|
967
|
+
id: "none",
|
|
968
|
+
label: e.pinNone
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
id: "start",
|
|
972
|
+
label: e.pinStart
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
id: "end",
|
|
976
|
+
label: e.pinEnd
|
|
977
|
+
}
|
|
978
|
+
]
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
kind: "action",
|
|
982
|
+
id: "auto-fit",
|
|
983
|
+
label: e.autoFitColumn,
|
|
984
|
+
disabled: !r.visible,
|
|
985
|
+
onSelect: () => ki(i)
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
kind: "action",
|
|
989
|
+
id: "reset-width",
|
|
990
|
+
label: e.resetColumnWidth,
|
|
991
|
+
disabled: r.width === null || r.pin !== !1 && typeof i.definition.width != "number",
|
|
992
|
+
onSelect: () => Oi(i, null)
|
|
993
|
+
}
|
|
994
|
+
];
|
|
995
|
+
return {
|
|
996
|
+
kind: "submenu",
|
|
997
|
+
id: r.id,
|
|
998
|
+
label: i.definition.header,
|
|
999
|
+
items: a
|
|
1000
|
+
};
|
|
1001
|
+
});
|
|
1002
|
+
}), Pi = j(() => {
|
|
1003
|
+
let e = [];
|
|
1004
|
+
return L && !z && G().search.length === 0 && e.push({
|
|
1005
|
+
kind: "action",
|
|
1006
|
+
id: "select-all",
|
|
1007
|
+
label: P().selectAll,
|
|
1008
|
+
disabled: q(),
|
|
1009
|
+
onSelect: Fr
|
|
1010
|
+
}), si().length > 0 && e.push({
|
|
1011
|
+
kind: "menu",
|
|
1012
|
+
id: "export",
|
|
1013
|
+
label: P().export,
|
|
1014
|
+
disabled: q() || li(),
|
|
1015
|
+
items: _i()
|
|
1016
|
+
}), jn() && e.push({
|
|
1017
|
+
kind: "action",
|
|
1018
|
+
id: "download",
|
|
1019
|
+
label: P().downloadLastExport,
|
|
1020
|
+
onSelect: bi
|
|
1021
|
+
}), t.columnControls !== !1 && e.push({
|
|
1022
|
+
kind: "menu",
|
|
1023
|
+
id: "columns",
|
|
1024
|
+
label: P().columns,
|
|
1025
|
+
items: Ni()
|
|
1026
|
+
}), Object.freeze(e);
|
|
1027
|
+
});
|
|
1028
|
+
function Fi(e) {
|
|
1029
|
+
let t = Z(), n = t.findIndex((t) => t.definition.id === e.definition.id);
|
|
1030
|
+
if (n < 0 || e.state().pin === !1) return "0px";
|
|
1031
|
+
let r = (e.state().pin === "start" ? t.slice(0, n) : t.slice(n + 1)).filter((t) => t.state().pin === e.state().pin).map(xi);
|
|
1032
|
+
return e.state().pin === "start" && L && r.unshift(Si), r.length === 0 ? "0px" : `calc(${r.join(" + ")})`;
|
|
1033
|
+
}
|
|
1034
|
+
function Ii(e) {
|
|
1035
|
+
if (e.state().pin === "start") return { "inset-inline-start": Fi(e) };
|
|
1036
|
+
if (e.state().pin === "end") return { "inset-inline-end": Fi(e) };
|
|
1037
|
+
}
|
|
1038
|
+
function Li(e) {
|
|
1039
|
+
let t = Z();
|
|
1040
|
+
if (e.state().pin === "start" && [...t].reverse().find((e) => e.state().pin === "start") === e) return "start";
|
|
1041
|
+
if (e.state().pin === "end" && t.find((e) => e.state().pin === "end") === e) return "end";
|
|
1042
|
+
}
|
|
1043
|
+
let Ri;
|
|
1044
|
+
function zi() {
|
|
1045
|
+
let e = Ri;
|
|
1046
|
+
e && (e.frame = void 0, Di(e.column, e.nextWidth), e.handle.setAttribute("aria-valuenow", String(e.nextWidth)), e.handle.setAttribute("aria-valuetext", P().columnWidthPixels.replace("{width}", String(e.nextWidth))));
|
|
1047
|
+
}
|
|
1048
|
+
function Bi() {
|
|
1049
|
+
let e = Ri;
|
|
1050
|
+
e && (e.frame !== void 0 && cancelAnimationFrame(e.frame), Di(e.column, null), e.handle.removeAttribute("data-resizing"), zn?.removeAttribute("data-resizing"), Ri = void 0);
|
|
1051
|
+
}
|
|
1052
|
+
function Vi(e, t) {
|
|
1053
|
+
if (e.button !== 0 || !(e.currentTarget instanceof HTMLButtonElement)) return;
|
|
1054
|
+
Bi(), e.preventDefault();
|
|
1055
|
+
let n = e.currentTarget, r = Ei(t);
|
|
1056
|
+
Ri = {
|
|
1057
|
+
pointerId: e.pointerId,
|
|
1058
|
+
column: t,
|
|
1059
|
+
handle: n,
|
|
1060
|
+
startX: e.clientX,
|
|
1061
|
+
startWidth: r,
|
|
1062
|
+
direction: Xt.state().direction === "rtl" ? -1 : 1,
|
|
1063
|
+
nextWidth: r,
|
|
1064
|
+
frame: void 0
|
|
1065
|
+
}, n.setPointerCapture(e.pointerId), n.setAttribute("data-resizing", ""), zn?.setAttribute("data-resizing", t.definition.id);
|
|
1066
|
+
}
|
|
1067
|
+
function Hi(e) {
|
|
1068
|
+
let t = Ri;
|
|
1069
|
+
t && t.pointerId === e.pointerId && (t.nextWidth = Gt(t.startWidth + (e.clientX - t.startX) * t.direction, t.column.definition.minWidth, t.column.definition.maxWidth), t.frame === void 0 && (t.frame = requestAnimationFrame(zi)));
|
|
1070
|
+
}
|
|
1071
|
+
function Ui(e) {
|
|
1072
|
+
let t = Ri;
|
|
1073
|
+
t && t.pointerId === e.pointerId && (t.frame !== void 0 && cancelAnimationFrame(t.frame), Ri = void 0, Di(t.column, t.nextWidth), t.handle.setAttribute("aria-valuenow", String(t.nextWidth)), t.handle.setAttribute("aria-valuetext", P().columnWidthPixels.replace("{width}", String(t.nextWidth))), t.handle.removeAttribute("data-resizing"), zn?.removeAttribute("data-resizing"), t.handle.hasPointerCapture(e.pointerId) && t.handle.releasePointerCapture(e.pointerId), Oi(t.column, t.nextWidth));
|
|
1074
|
+
}
|
|
1075
|
+
function Wi(e, t) {
|
|
1076
|
+
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
1077
|
+
let n = t.definition.minWidth ?? 80, r = t.definition.maxWidth ?? 4096, i = Ei(t), a = e.shiftKey ? 50 : 10, o = Xt.state().direction === "rtl" ? -1 : 1, s = e.key === "ArrowRight" ? i + a * o : e.key === "ArrowLeft" ? i - a * o : e.key === "Home" ? n : e.key === "End" ? r : null;
|
|
1078
|
+
s !== null && (e.preventDefault(), Oi(t, s));
|
|
1079
|
+
}
|
|
1080
|
+
let Gi;
|
|
1081
|
+
function Ki() {
|
|
1082
|
+
Gi = void 0, zn?.removeAttribute("data-reordering");
|
|
1083
|
+
for (let e of V?.querySelectorAll("th[data-drop-placement]") ?? []) e.removeAttribute("data-drop-placement");
|
|
1084
|
+
}
|
|
1085
|
+
function qi(e, t) {
|
|
1086
|
+
if (e.button !== 0 || !(e.currentTarget instanceof HTMLButtonElement)) return;
|
|
1087
|
+
Ki();
|
|
1088
|
+
let n = e.currentTarget;
|
|
1089
|
+
Gi = {
|
|
1090
|
+
pointerId: e.pointerId,
|
|
1091
|
+
source: t,
|
|
1092
|
+
handle: n,
|
|
1093
|
+
startX: e.clientX,
|
|
1094
|
+
startY: e.clientY,
|
|
1095
|
+
target: void 0,
|
|
1096
|
+
placement: void 0,
|
|
1097
|
+
dragging: !1
|
|
1098
|
+
}, n.setPointerCapture(e.pointerId);
|
|
1099
|
+
}
|
|
1100
|
+
function Ji(e) {
|
|
1101
|
+
let t = Gi;
|
|
1102
|
+
if (!t || t.pointerId !== e.pointerId || !t.dragging && Math.hypot(e.clientX - t.startX, e.clientY - t.startY) < 5) return;
|
|
1103
|
+
t.dragging = !0, e.preventDefault(), zn?.setAttribute("data-reordering", t.source.definition.id);
|
|
1104
|
+
let n = t.handle.ownerDocument.elementFromPoint(e.clientX, e.clientY)?.closest("th[data-column]"), r = n?.dataset.column ? $r.get(n.dataset.column) : void 0;
|
|
1105
|
+
for (let e of V?.querySelectorAll("th[data-drop-placement]") ?? []) e !== n && e.removeAttribute("data-drop-placement");
|
|
1106
|
+
if (!r || r === t.source || r.state().pin !== t.source.state().pin || !n) {
|
|
1107
|
+
t.target = void 0, t.placement = void 0;
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
let i = n.getBoundingClientRect(), a = e.clientX >= i.left + i.width / 2;
|
|
1111
|
+
t.target = r, t.placement = Xt.state().direction === "rtl" ? a ? "before" : "after" : a ? "after" : "before", n.setAttribute("data-drop-placement", t.placement);
|
|
1112
|
+
}
|
|
1113
|
+
function Yi(e) {
|
|
1114
|
+
let t = Gi;
|
|
1115
|
+
if (!t || t.pointerId !== e.pointerId) return;
|
|
1116
|
+
let n = t.target, r = t.placement, i = t.source.definition.id;
|
|
1117
|
+
t.handle.hasPointerCapture(e.pointerId) && t.handle.releasePointerCapture(e.pointerId), Ki(), n && r && Mi(i, n.definition.id, r);
|
|
1118
|
+
}
|
|
1119
|
+
function Xi(e, t) {
|
|
1120
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
1121
|
+
e.preventDefault();
|
|
1122
|
+
let n = Xt.state().direction === "rtl" ? e.key === "ArrowRight" : e.key === "ArrowLeft";
|
|
1123
|
+
ji(t.definition.id, n ? "toward-start" : "toward-end");
|
|
1124
|
+
}
|
|
1125
|
+
let Zi;
|
|
1126
|
+
ke(() => {
|
|
1127
|
+
let e = () => {
|
|
1128
|
+
Zi = void 0;
|
|
1129
|
+
for (let e of Z()) [...V?.querySelectorAll("thead th[data-column]") ?? []].find((t) => t.dataset.column === e.definition.id)?.querySelector("[role=\"separator\"]")?.setAttribute("aria-valuenow", String(Ei(e)));
|
|
1130
|
+
}, t = () => {
|
|
1131
|
+
Zi === void 0 && (Zi = requestAnimationFrame(e));
|
|
1132
|
+
}, n = new ResizeObserver(t);
|
|
1133
|
+
V && n.observe(V), t(), Oe(() => {
|
|
1134
|
+
n.disconnect(), Zi !== void 0 && cancelAnimationFrame(Zi);
|
|
1135
|
+
});
|
|
1136
|
+
}), Oe(() => {
|
|
1137
|
+
Bi(), Ki();
|
|
1138
|
+
});
|
|
1139
|
+
let Qi = t.rowHeight ?? "var(--sheen-table-row-h)";
|
|
1140
|
+
if (typeof Qi != "string" || Qi.trim() === "") throw Error("rowHeight must be a nonempty CSS length");
|
|
1141
|
+
let $i = () => ue() ?? Xt.state().density, ea = () => t.estimatedRowHeight ?? ($i() === "compact" ? 28 : $i() === "spacious" ? 42 : 34);
|
|
1142
|
+
if (!Number.isFinite(ea()) || ea() <= 0) throw Error("estimatedRowHeight must be a positive finite number");
|
|
1143
|
+
let ta = t.initialViewportHeight ?? 400;
|
|
1144
|
+
if (!Number.isFinite(ta) || ta <= 0) throw Error("initialViewportHeight must be a positive finite number");
|
|
1145
|
+
let na = we({
|
|
1146
|
+
get count() {
|
|
1147
|
+
return Or();
|
|
1148
|
+
},
|
|
1149
|
+
getScrollElement: () => B ?? null,
|
|
1150
|
+
estimateSize: ea,
|
|
1151
|
+
getItemKey: (e) => t.variableRowHeight ? kr(e)?.key ?? e : e,
|
|
1152
|
+
initialRect: {
|
|
1153
|
+
width: 1024,
|
|
1154
|
+
height: ta
|
|
1155
|
+
},
|
|
1156
|
+
overscan: 8,
|
|
1157
|
+
useAnimationFrameWithResizeObserver: !0
|
|
1158
|
+
}), ra = !1;
|
|
1159
|
+
function ia(e, n) {
|
|
1160
|
+
e.setAttribute("data-index", String(n)), ra && t.variableRowHeight && na.measureElement(e);
|
|
1161
|
+
}
|
|
1162
|
+
ke(() => {
|
|
1163
|
+
if (ra = !0, t.variableRowHeight) for (let e of B?.querySelectorAll("tbody tr[data-row-key]") ?? []) na.measureElement(e);
|
|
1164
|
+
});
|
|
1165
|
+
let aa = $i();
|
|
1166
|
+
A(() => {
|
|
1167
|
+
let e = $i();
|
|
1168
|
+
ra && e !== aa && na.measure(), aa = e;
|
|
1169
|
+
});
|
|
1170
|
+
let oa = /* @__PURE__ */ new Map(), sa = j(() => {
|
|
1171
|
+
let e = /* @__PURE__ */ new Set(), t = na.getVirtualItems().flatMap((t) => {
|
|
1172
|
+
let n = kr(t.index);
|
|
1173
|
+
if (!n) return [];
|
|
1174
|
+
e.add(n.key);
|
|
1175
|
+
let r = oa.get(n.key);
|
|
1176
|
+
if (r) return r.updateRow(n), r.updateItem(t), [r];
|
|
1177
|
+
let [i, a] = M(n, { equals: !1 }), [o, s] = M(t, { equals: !1 }), c = Object.freeze({
|
|
1178
|
+
key: n.key,
|
|
1179
|
+
row: i,
|
|
1180
|
+
updateRow: (e) => {
|
|
1181
|
+
a(e);
|
|
1182
|
+
},
|
|
1183
|
+
item: o,
|
|
1184
|
+
updateItem: (e) => {
|
|
1185
|
+
s(e);
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
return oa.set(n.key, c), [c];
|
|
1189
|
+
});
|
|
1190
|
+
for (let t of oa.keys()) e.has(t) || oa.delete(t);
|
|
1191
|
+
return t;
|
|
1192
|
+
}), [ca, la] = M(null), ua = j(() => {
|
|
1193
|
+
if (!t.onRowActivate && !L && !z && !t.grouping && E().length === 0) return null;
|
|
1194
|
+
let e = ca();
|
|
1195
|
+
return e && Ar(e) >= 0 ? e : kr(0)?.key ?? null;
|
|
1196
|
+
}), da;
|
|
1197
|
+
function fa(e) {
|
|
1198
|
+
let t = kr(e);
|
|
1199
|
+
if (!t || !B) return;
|
|
1200
|
+
la(t.key), na.scrollToIndex(e, { align: "auto" });
|
|
1201
|
+
let n = 10, r = () => {
|
|
1202
|
+
da = void 0;
|
|
1203
|
+
let e = [...B?.querySelectorAll("tbody tr[data-row-key]") ?? []].find((e) => e.dataset.rowKey === t.key);
|
|
1204
|
+
if (e) {
|
|
1205
|
+
e.focus({ preventScroll: !0 });
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
n--, n > 0 && (da = requestAnimationFrame(r));
|
|
1209
|
+
};
|
|
1210
|
+
da !== void 0 && cancelAnimationFrame(da), da = requestAnimationFrame(r);
|
|
1211
|
+
}
|
|
1212
|
+
function pa(e, t) {
|
|
1213
|
+
if (!z || q()) return;
|
|
1214
|
+
let n = z.setExpanded(e.row.id, t);
|
|
1215
|
+
fn((e) => e + 1), n.finally(() => fn((e) => e + 1));
|
|
1216
|
+
}
|
|
1217
|
+
function ma(e) {
|
|
1218
|
+
if (!z || q()) return;
|
|
1219
|
+
let t = z.retry(e.row.id);
|
|
1220
|
+
fn((e) => e + 1), t.finally(() => fn((e) => e + 1));
|
|
1221
|
+
}
|
|
1222
|
+
let [ha, ga] = M(!1);
|
|
1223
|
+
ke(() => {
|
|
1224
|
+
ga(!0);
|
|
1225
|
+
}), A(() => {
|
|
1226
|
+
if (z && ha()) for (let e of wr()) e.kind === "data" && e.expanded && e.unloaded && !e.pending && e.error === null && pa(e, !0);
|
|
1227
|
+
});
|
|
1228
|
+
function _a(e, n) {
|
|
1229
|
+
if (e.target !== e.currentTarget || e.altKey) return;
|
|
1230
|
+
if (L && !q() && n.kind === "data" && (e.ctrlKey || e.metaKey) && !e.shiftKey && e.key.toLowerCase() === "a") {
|
|
1231
|
+
e.preventDefault(), Pr(!0);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
if (n.kind === "group" && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === " " || e.key === "Enter")) {
|
|
1235
|
+
e.preventDefault(), Cr(n.group.id, !n.expanded);
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
if (n.kind === "group" && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
|
|
1239
|
+
e.preventDefault(), Cr(n.group.id, e.key === "ArrowRight");
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
if (z && n.kind === "data" && n.canExpand && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "ArrowRight") {
|
|
1243
|
+
if (e.preventDefault(), !n.expanded) pa(n, !0);
|
|
1244
|
+
else {
|
|
1245
|
+
let e = Ar(n.key), t = kr(e + 1);
|
|
1246
|
+
t?.kind === "data" && t.parentId === n.row.id && fa(e + 1);
|
|
1247
|
+
}
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
if (z && n.kind === "data" && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "ArrowLeft") {
|
|
1251
|
+
if (e.preventDefault(), n.expanded) pa(n, !1);
|
|
1252
|
+
else if (n.parentId) {
|
|
1253
|
+
let e = wr().findIndex((e) => e.kind === "data" && e.row.id === n.parentId);
|
|
1254
|
+
e >= 0 && fa(e);
|
|
1255
|
+
}
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
if (L && !q() && n.kind === "data" && !e.ctrlKey && !e.metaKey && e.key === " ") {
|
|
1259
|
+
e.preventDefault(), Nr(n.row.id, !Y(n.row.id), e.shiftKey);
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
if (t.onRowActivate && !q() && n.kind === "data" && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "Enter") {
|
|
1263
|
+
e.preventDefault(), t.onRowActivate(n.row.value());
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey && !L) return;
|
|
1267
|
+
let r = Ar(n.key);
|
|
1268
|
+
if (r < 0) return;
|
|
1269
|
+
let i = Math.max(1, Math.floor((B?.clientHeight ?? ea()) / ea())), a = Math.max(0, Or() - 1), o = e.key === "ArrowDown" ? Math.min(a, r + 1) : e.key === "ArrowUp" ? Math.max(0, r - 1) : e.key === "PageDown" ? Math.min(a, r + i) : e.key === "PageUp" ? Math.max(0, r - i) : e.key === "Home" ? 0 : e.key === "End" ? a : null;
|
|
1270
|
+
if (o === null) return;
|
|
1271
|
+
e.preventDefault();
|
|
1272
|
+
let s = kr(o);
|
|
1273
|
+
L && n.kind === "data" && e.shiftKey && s?.kind === "data" && ((!R || !J().rows.some((e) => e.id === R)) && (R = n.row.id), L.selectRange(R, s.row.id, !0), Mr()), fa(o);
|
|
1274
|
+
}
|
|
1275
|
+
function va(e, t) {
|
|
1276
|
+
L && !q() && t.kind === "data" && e.target instanceof Element && !e.target.closest("button, input, select, textarea, a, [data-sheen-selection-control]") && (e.shiftKey ? Nr(t.row.id, !0, !0) : e.ctrlKey || e.metaKey ? Nr(t.row.id, !Y(t.row.id), !1) : (L.clear(), L.setSelected(t.row.id, !0), R = t.row.id, Mr()), e.currentTarget instanceof HTMLElement && e.currentTarget.focus({ preventScroll: !0 }));
|
|
1277
|
+
}
|
|
1278
|
+
Oe(() => {
|
|
1279
|
+
da !== void 0 && cancelAnimationFrame(da);
|
|
1280
|
+
});
|
|
1281
|
+
let ya, ba;
|
|
1282
|
+
function xa() {
|
|
1283
|
+
if (!B) return;
|
|
1284
|
+
let e = B.getBoundingClientRect(), t = B.querySelector("thead")?.getBoundingClientRect().bottom ?? e.top, n = [...B.querySelectorAll("tbody tr[data-row-key]")].find((e) => e.getBoundingClientRect().bottom > t);
|
|
1285
|
+
if (!n?.dataset.rowKey) return;
|
|
1286
|
+
let r = Number(n.dataset.index), i = na.getVirtualItems().find((e) => e.index === r);
|
|
1287
|
+
i && (ya = {
|
|
1288
|
+
id: n.dataset.rowKey,
|
|
1289
|
+
offset: B.scrollTop - i.start
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
function Sa() {
|
|
1293
|
+
ba !== void 0 && cancelAnimationFrame(ba), ba = requestAnimationFrame(() => {
|
|
1294
|
+
ba = void 0, xa();
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
Oe(() => {
|
|
1298
|
+
ba !== void 0 && cancelAnimationFrame(ba);
|
|
1299
|
+
});
|
|
1300
|
+
let Ca = () => z || t.grouping ? wr() : Tr(), wa = Ca(), Ta = l(G(), N);
|
|
1301
|
+
A(() => {
|
|
1302
|
+
let e = Ca(), t = l(G(), N), n = ya;
|
|
1303
|
+
if (B && n && e !== wa && t === Ta) {
|
|
1304
|
+
let e = Ar(n.id), t = e < 0 ? void 0 : na.getOffsetForIndex(e, "start")?.[0];
|
|
1305
|
+
t !== void 0 && (B.scrollTop = Math.max(0, t + n.offset));
|
|
1306
|
+
}
|
|
1307
|
+
wa = e, Ta = t;
|
|
1308
|
+
});
|
|
1309
|
+
let Ea = j(() => {
|
|
1310
|
+
let t = G().pagination;
|
|
1311
|
+
return t === !1 ? void 0 : e(t, K().total);
|
|
1312
|
+
}), Da = j(() => {
|
|
1313
|
+
if (I && G().pagination === !1) return e({
|
|
1314
|
+
pageIndex: Ln(),
|
|
1315
|
+
pageSize: I.pageSize
|
|
1316
|
+
}, Or());
|
|
1317
|
+
});
|
|
1318
|
+
A(() => {
|
|
1319
|
+
let e = Da();
|
|
1320
|
+
e && e.pageIndex !== Ln() && Rn(e.pageIndex);
|
|
1321
|
+
});
|
|
1322
|
+
let Oa = j(() => {
|
|
1323
|
+
if (!I) return Object.freeze([]);
|
|
1324
|
+
let e = Da(), t = e?.start ?? 0, n = e?.end ?? Or(), r = [];
|
|
1325
|
+
for (let e = t; e < n; e++) {
|
|
1326
|
+
let t = kr(e);
|
|
1327
|
+
t && r.push(t);
|
|
1328
|
+
}
|
|
1329
|
+
return Object.freeze(r);
|
|
1330
|
+
}), ka = j(() => {
|
|
1331
|
+
let e = Z();
|
|
1332
|
+
return e.find((e) => e.definition.id === I?.titleColumn) ?? e[0];
|
|
1333
|
+
}), Aa = j(() => Oa().flatMap((e) => e.kind === "data" ? [e.row] : [])), ja = j(() => Aa().filter((e) => Y(e.id)).length), Ma = j(() => Z().flatMap((e) => {
|
|
1334
|
+
if (!e.definition.sort) return [];
|
|
1335
|
+
let t = G().sorting.find((t) => t.column === e.definition.id)?.direction, n = t === "asc" ? P().sortedAscending : t === "desc" ? P().sortedDescending : P().notSorted;
|
|
1336
|
+
return [{
|
|
1337
|
+
kind: "action",
|
|
1338
|
+
id: `sort:${e.definition.id}`,
|
|
1339
|
+
label: `${P().sortColumn.replaceAll("{column}", e.definition.header)}, ${n}`,
|
|
1340
|
+
disabled: q(),
|
|
1341
|
+
onSelect: () => ur(e.definition.id, !1)
|
|
1342
|
+
}];
|
|
1343
|
+
})), Na = j(() => {
|
|
1344
|
+
let e = ca();
|
|
1345
|
+
return e && Oa().some((t) => t.key === e) ? e : Oa()[0]?.key ?? null;
|
|
1346
|
+
}), Pa = j(() => G().search.length > 0 || Lt(G().filter)), Fa = () => G().search.length > 0 ? P().clearSearchAndFilters : P().clearFilters, Q = j(() => Kn() ? Pa() ? "no-results" : "empty" : Yn() ? "error" : "cold"), Ia = j(() => t.mode === "server" ? K().rows : Gn()?.view ?? []), La = j(() => Z().some((e) => e.definition.footer !== null)), Ra = () => Math.max(1, Z().length + +!!L), za = () => Qt.length + +!!L, Ba = Object.freeze([
|
|
1347
|
+
0,
|
|
1348
|
+
1,
|
|
1349
|
+
2,
|
|
1350
|
+
3,
|
|
1351
|
+
4,
|
|
1352
|
+
5
|
|
1353
|
+
]), Va = () => `sheen-data-table${t.class ? ` ${t.class}` : ""}`;
|
|
1354
|
+
function Ha(e) {
|
|
1355
|
+
let t = Da();
|
|
1356
|
+
!t || q() || e < 0 || e >= t.pageCount || e === t.pageIndex || (Rn(e), Bn?.scrollIntoView({ block: "nearest" }));
|
|
1357
|
+
}
|
|
1358
|
+
function Ua(e) {
|
|
1359
|
+
if (L && !q()) {
|
|
1360
|
+
for (let t of Aa()) L.setSelected(t.id, e);
|
|
1361
|
+
Mr();
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
function Wa(e) {
|
|
1365
|
+
let t = Oa()[e];
|
|
1366
|
+
t && Bn && (la(t.key), [...Bn.querySelectorAll("[data-mobile-row-key]")].find((e) => e.dataset.mobileRowKey === t.key)?.focus({ preventScroll: !0 }));
|
|
1367
|
+
}
|
|
1368
|
+
function Ga(e, n) {
|
|
1369
|
+
if (e.target !== e.currentTarget || e.altKey) return;
|
|
1370
|
+
if (L && !q() && n.kind === "data" && (e.ctrlKey || e.metaKey) && !e.shiftKey && e.key.toLowerCase() === "a") {
|
|
1371
|
+
e.preventDefault(), Ua(!0);
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
if (n.kind === "group" && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === " " || e.key === "Enter" || e.key === "ArrowRight" || e.key === "ArrowLeft")) {
|
|
1375
|
+
e.preventDefault(), Cr(n.group.id, e.key === "ArrowRight" || e.key !== "ArrowLeft" && !n.expanded);
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1378
|
+
if (z && n.kind === "data" && n.canExpand && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
|
|
1379
|
+
e.preventDefault(), pa(n, e.key === "ArrowRight");
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
if (L && !q() && n.kind === "data" && !e.ctrlKey && !e.metaKey && e.key === " ") {
|
|
1383
|
+
e.preventDefault(), Nr(n.row.id, !Y(n.row.id), e.shiftKey);
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
if (t.onRowActivate && !q() && n.kind === "data" && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.key === "Enter") {
|
|
1387
|
+
e.preventDefault(), t.onRowActivate(n.row.value());
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
1391
|
+
let r = Oa().findIndex((e) => e.key === n.key), i = Math.max(0, Oa().length - 1), a = e.key === "ArrowDown" ? Math.min(i, r + 1) : e.key === "ArrowUp" ? Math.max(0, r - 1) : e.key === "Home" ? 0 : e.key === "End" ? i : null;
|
|
1392
|
+
a === null || r < 0 || (e.preventDefault(), Wa(a));
|
|
1393
|
+
}
|
|
1394
|
+
function Ka(e) {
|
|
1395
|
+
let t = !1;
|
|
1396
|
+
return (() => {
|
|
1397
|
+
var n = Ae();
|
|
1398
|
+
return w(n, "role", $ ? "gridcell" : void 0), S(n, b(me, {
|
|
1399
|
+
"data-sheen-selection-control": "",
|
|
1400
|
+
class: "sheen-data-table-selection-control",
|
|
1401
|
+
get label() {
|
|
1402
|
+
return Zr(e.row);
|
|
1403
|
+
},
|
|
1404
|
+
get checked() {
|
|
1405
|
+
return Y(e.row.id);
|
|
1406
|
+
},
|
|
1407
|
+
get disabled() {
|
|
1408
|
+
return q();
|
|
1409
|
+
},
|
|
1410
|
+
onPointerDown: (e) => {
|
|
1411
|
+
t = e.shiftKey;
|
|
1412
|
+
},
|
|
1413
|
+
onKeyDown: (e) => {
|
|
1414
|
+
e.key === " " && (t = e.shiftKey);
|
|
1415
|
+
},
|
|
1416
|
+
onCheckedChange: (n) => {
|
|
1417
|
+
Nr(e.row.id, n, t), t = !1;
|
|
1418
|
+
}
|
|
1419
|
+
})), n;
|
|
1420
|
+
})();
|
|
1421
|
+
}
|
|
1422
|
+
let $ = !!(z || t.grouping);
|
|
1423
|
+
function qa(e) {
|
|
1424
|
+
let t = ei().findIndex((t) => t.id === e);
|
|
1425
|
+
if (t < 0) throw Error(`Missing accepted state for table column: ${e}`);
|
|
1426
|
+
return t + 1 + +!!L;
|
|
1427
|
+
}
|
|
1428
|
+
function Ja(t) {
|
|
1429
|
+
let n = G().pagination;
|
|
1430
|
+
return $ || n === !1 ? t + 2 : e(n, K().total).start + t + 2;
|
|
1431
|
+
}
|
|
1432
|
+
let Ya = () => Or() === 0 ? void 0 : $ ? -1 : K().total + 1 + +!!La(), Xa = () => $ ? Or() + 2 : K().total + 2;
|
|
1433
|
+
function Za(e) {
|
|
1434
|
+
return `${e.expanded ? P().collapse : P().expand} ${e.row.id}`;
|
|
1435
|
+
}
|
|
1436
|
+
function Qa(e) {
|
|
1437
|
+
let t = e.column.definition.editor, n = e.column.definition.accessor;
|
|
1438
|
+
if (!t || !n) throw Error(`Editable cell ${e.row.row.id}/${e.column.definition.id} is missing its editor`);
|
|
1439
|
+
let r = t, i = Ee(), a, o, s = !1, c = n(e.row.row.value()), l = () => (e.record.revision(), e.record.controller.getSnapshot()), u = () => l().draft?.value ?? l().committed, d = () => P().editCell.replaceAll("{column}", e.column.definition.header).replaceAll("{id}", e.row.row.id), f = () => {
|
|
1440
|
+
let e = l();
|
|
1441
|
+
return e.invalid ? e.invalid : e.conflict ? P().cellConflict.replaceAll("{value}", e.conflict.current === null ? P().noValue : String(e.conflict.current)) : e.error ? P().cellUpdateFailedDescription : null;
|
|
1442
|
+
}, p = () => e.column.definition.cell?.(l().committed, e.row.row.value()) ?? jt(l().committed);
|
|
1443
|
+
A(() => {
|
|
1444
|
+
let t = n(e.row.row.value());
|
|
1445
|
+
Object.is(t, c) || (c = t, e.record.controller.acceptRefetch(t), e.record.publish());
|
|
1446
|
+
});
|
|
1447
|
+
function m() {
|
|
1448
|
+
queueMicrotask(() => a?.focus({ preventScroll: !0 }));
|
|
1449
|
+
}
|
|
1450
|
+
function h() {
|
|
1451
|
+
queueMicrotask(() => {
|
|
1452
|
+
s = !0;
|
|
1453
|
+
try {
|
|
1454
|
+
o?.focus({ preventScroll: !0 });
|
|
1455
|
+
} finally {
|
|
1456
|
+
s = !1;
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
function g() {
|
|
1461
|
+
s || q() || e.record.controller.begin() && (e.record.publish(), m());
|
|
1462
|
+
}
|
|
1463
|
+
function _(t) {
|
|
1464
|
+
e.record.controller.setDraft(t), e.record.publish();
|
|
1465
|
+
}
|
|
1466
|
+
async function ee(t, n, r = !0) {
|
|
1467
|
+
e.record.publish();
|
|
1468
|
+
let i = await t;
|
|
1469
|
+
e.record.publish();
|
|
1470
|
+
let a = l();
|
|
1471
|
+
return i === "accepted" && !a.editing && n && h(), (i === "invalid" || i === "conflict") && n && m(), i === "failed" && r && rn && rn.show({
|
|
1472
|
+
title: P().cellUpdateFailed,
|
|
1473
|
+
description: P().cellUpdateFailedDescription,
|
|
1474
|
+
tone: "danger",
|
|
1475
|
+
priority: "assertive",
|
|
1476
|
+
duration: null,
|
|
1477
|
+
action: {
|
|
1478
|
+
label: P().retry,
|
|
1479
|
+
retryLabel: P().retry,
|
|
1480
|
+
errorMessage: P().retryFailed,
|
|
1481
|
+
run: async () => {
|
|
1482
|
+
let t = await ee(e.record.controller.retry(), !1, !1);
|
|
1483
|
+
if (t !== "accepted") throw Error(`Cell retry was not accepted: ${t}`);
|
|
1484
|
+
h();
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}), i;
|
|
1488
|
+
}
|
|
1489
|
+
function te(t) {
|
|
1490
|
+
ee(e.record.controller.commit(), t);
|
|
1491
|
+
}
|
|
1492
|
+
function v() {
|
|
1493
|
+
let e = l();
|
|
1494
|
+
(e.error === null && e.conflict === null || e.attempt === null || e.draft === null || !Object.is(e.attempt.value, e.draft.value)) && te(!1);
|
|
1495
|
+
}
|
|
1496
|
+
function y(t) {
|
|
1497
|
+
t.key === "Enter" ? (t.preventDefault(), te(!0)) : t.key === "Escape" && (t.preventDefault(), e.record.controller.discard(), e.record.publish(), h());
|
|
1498
|
+
}
|
|
1499
|
+
function ne() {
|
|
1500
|
+
let e = () => l().invalid !== null || l().error !== null || void 0, t = () => f() ? `${i}-message` : void 0;
|
|
1501
|
+
return r.type === "boolean" ? (() => {
|
|
1502
|
+
var n = je();
|
|
1503
|
+
return n.addEventListener("change", (e) => _(e.currentTarget.checked)), n.$$keydown = y, n.addEventListener("blur", v), D((e) => {
|
|
1504
|
+
a = e, e.checked = u() === !0;
|
|
1505
|
+
}, n), x((r) => {
|
|
1506
|
+
var i = d(), a = t(), o = e(), s = l().pending || void 0;
|
|
1507
|
+
return i !== r.e && w(n, "aria-label", r.e = i), a !== r.t && w(n, "aria-describedby", r.t = a), o !== r.a && w(n, "aria-invalid", r.a = o), s !== r.o && w(n, "aria-busy", r.o = s), r;
|
|
1508
|
+
}, {
|
|
1509
|
+
e: void 0,
|
|
1510
|
+
t: void 0,
|
|
1511
|
+
a: void 0,
|
|
1512
|
+
o: void 0
|
|
1513
|
+
}), n;
|
|
1514
|
+
})() : r.type === "select" ? (() => {
|
|
1515
|
+
var n = Ne();
|
|
1516
|
+
return n.addEventListener("change", (e) => _(e.currentTarget.value === "" && r.nullable ? null : e.currentTarget.value)), n.$$keydown = y, n.addEventListener("blur", v), D((e) => {
|
|
1517
|
+
a = e, e.value = u() === null ? "" : String(u());
|
|
1518
|
+
}, n), S(n, b(k, {
|
|
1519
|
+
get when() {
|
|
1520
|
+
return r.nullable;
|
|
1521
|
+
},
|
|
1522
|
+
get children() {
|
|
1523
|
+
var e = Me();
|
|
1524
|
+
return S(e, () => P().noValue), e;
|
|
1525
|
+
}
|
|
1526
|
+
}), null), S(n, b(O, {
|
|
1527
|
+
get each() {
|
|
1528
|
+
return r.options;
|
|
1529
|
+
},
|
|
1530
|
+
children: (e) => (() => {
|
|
1531
|
+
var t = Pe();
|
|
1532
|
+
return t.value = e, S(t, e), t;
|
|
1533
|
+
})()
|
|
1534
|
+
}), null), x((r) => {
|
|
1535
|
+
var i = d(), a = t(), o = e(), s = l().pending || void 0;
|
|
1536
|
+
return i !== r.e && w(n, "aria-label", r.e = i), a !== r.t && w(n, "aria-describedby", r.t = a), o !== r.a && w(n, "aria-invalid", r.a = o), s !== r.o && w(n, "aria-busy", r.o = s), r;
|
|
1537
|
+
}, {
|
|
1538
|
+
e: void 0,
|
|
1539
|
+
t: void 0,
|
|
1540
|
+
a: void 0,
|
|
1541
|
+
o: void 0
|
|
1542
|
+
}), n;
|
|
1543
|
+
})() : r.type === "number" ? (() => {
|
|
1544
|
+
var n = Fe();
|
|
1545
|
+
return n.$$input = (e) => _(e.currentTarget.value === "" ? null : e.currentTarget.valueAsNumber), n.$$keydown = y, n.addEventListener("blur", v), D((e) => {
|
|
1546
|
+
a = e, e.value = u() === null ? "" : String(u());
|
|
1547
|
+
}, n), x((r) => {
|
|
1548
|
+
var i = d(), a = t(), o = e(), s = l().pending || void 0;
|
|
1549
|
+
return i !== r.e && w(n, "aria-label", r.e = i), a !== r.t && w(n, "aria-describedby", r.t = a), o !== r.a && w(n, "aria-invalid", r.a = o), s !== r.o && w(n, "aria-busy", r.o = s), r;
|
|
1550
|
+
}, {
|
|
1551
|
+
e: void 0,
|
|
1552
|
+
t: void 0,
|
|
1553
|
+
a: void 0,
|
|
1554
|
+
o: void 0
|
|
1555
|
+
}), n;
|
|
1556
|
+
})() : (() => {
|
|
1557
|
+
var n = Ie();
|
|
1558
|
+
return n.$$input = (e) => _(e.currentTarget.value === "" && r.nullable ? null : e.currentTarget.value), n.$$keydown = y, n.addEventListener("blur", v), D((e) => {
|
|
1559
|
+
a = e, e.value = u() === null ? "" : String(u());
|
|
1560
|
+
}, n), x((r) => {
|
|
1561
|
+
var i = d(), a = t(), o = e(), s = l().pending || void 0;
|
|
1562
|
+
return i !== r.e && w(n, "aria-label", r.e = i), a !== r.t && w(n, "aria-describedby", r.t = a), o !== r.a && w(n, "aria-invalid", r.a = o), s !== r.o && w(n, "aria-busy", r.o = s), r;
|
|
1563
|
+
}, {
|
|
1564
|
+
e: void 0,
|
|
1565
|
+
t: void 0,
|
|
1566
|
+
a: void 0,
|
|
1567
|
+
o: void 0
|
|
1568
|
+
}), n;
|
|
1569
|
+
})();
|
|
1570
|
+
}
|
|
1571
|
+
return (() => {
|
|
1572
|
+
var e = Le();
|
|
1573
|
+
return S(e, b(k, {
|
|
1574
|
+
get when() {
|
|
1575
|
+
return l().editing;
|
|
1576
|
+
},
|
|
1577
|
+
get fallback() {
|
|
1578
|
+
return (() => {
|
|
1579
|
+
var e = Re();
|
|
1580
|
+
return e.$$keydown = (e) => {
|
|
1581
|
+
e.key === "Enter" && (e.preventDefault(), g());
|
|
1582
|
+
}, e.$$click = g, D((e) => {
|
|
1583
|
+
o = e, e.addEventListener("focus", g), e.ownerDocument.activeElement === e && queueMicrotask(g);
|
|
1584
|
+
}, e), S(e, p), e;
|
|
1585
|
+
})();
|
|
1586
|
+
},
|
|
1587
|
+
get children() {
|
|
1588
|
+
return b(ne, {});
|
|
1589
|
+
}
|
|
1590
|
+
}), null), S(e, b(k, {
|
|
1591
|
+
get when() {
|
|
1592
|
+
return f();
|
|
1593
|
+
},
|
|
1594
|
+
children: (e) => (() => {
|
|
1595
|
+
var t = ze();
|
|
1596
|
+
return w(t, "id", `${i}-message`), S(t, e), x(() => w(t, "role", l().invalid !== null || l().conflict !== null ? "alert" : void 0)), t;
|
|
1597
|
+
})()
|
|
1598
|
+
}), null), e;
|
|
1599
|
+
})();
|
|
1600
|
+
}
|
|
1601
|
+
function $a(e) {
|
|
1602
|
+
let t = () => e.column.definition.accessor?.(e.row.row.value()) ?? null, n = () => e.edit ? b(Qa, {
|
|
1603
|
+
get row() {
|
|
1604
|
+
return e.row;
|
|
1605
|
+
},
|
|
1606
|
+
get column() {
|
|
1607
|
+
return e.column;
|
|
1608
|
+
},
|
|
1609
|
+
get record() {
|
|
1610
|
+
return e.edit;
|
|
1611
|
+
}
|
|
1612
|
+
}) : e.column.definition.cell?.(t(), e.row.row.value()) ?? jt(t());
|
|
1613
|
+
return !$ || !e.first ? C(n) : (() => {
|
|
1614
|
+
var t = Ue(), r = t.firstChild;
|
|
1615
|
+
return S(t, b(k, {
|
|
1616
|
+
get when() {
|
|
1617
|
+
return e.row.canExpand;
|
|
1618
|
+
},
|
|
1619
|
+
get fallback() {
|
|
1620
|
+
return We();
|
|
1621
|
+
},
|
|
1622
|
+
get children() {
|
|
1623
|
+
var t = Be();
|
|
1624
|
+
return t.$$click = () => pa(e.row, !e.row.expanded), S(t, () => e.row.expanded ? "▾" : "▸"), x((n) => {
|
|
1625
|
+
var r = Za(e.row), i = e.row.expanded, a = q();
|
|
1626
|
+
return r !== n.e && w(t, "aria-label", n.e = r), i !== n.t && w(t, "aria-expanded", n.t = i), a !== n.a && (t.disabled = n.a = a), n;
|
|
1627
|
+
}, {
|
|
1628
|
+
e: void 0,
|
|
1629
|
+
t: void 0,
|
|
1630
|
+
a: void 0
|
|
1631
|
+
}), t;
|
|
1632
|
+
}
|
|
1633
|
+
}), r), S(r, n), S(t, b(k, {
|
|
1634
|
+
get when() {
|
|
1635
|
+
return e.row.pending;
|
|
1636
|
+
},
|
|
1637
|
+
get children() {
|
|
1638
|
+
var e = Ve();
|
|
1639
|
+
return S(e, () => P().loadingChildren), e;
|
|
1640
|
+
}
|
|
1641
|
+
}), null), S(t, b(k, {
|
|
1642
|
+
get when() {
|
|
1643
|
+
return e.row.error !== null;
|
|
1644
|
+
},
|
|
1645
|
+
get children() {
|
|
1646
|
+
var t = He(), n = t.firstChild, r = n.nextSibling;
|
|
1647
|
+
return S(t, () => P().serverError, n), r.$$click = () => ma(e.row), S(r, () => P().retry), t;
|
|
1648
|
+
}
|
|
1649
|
+
}), null), x((n) => T(t, "--sheen-table-depth", Math.max(0, e.row.depth - 1))), t;
|
|
1650
|
+
})();
|
|
1651
|
+
}
|
|
1652
|
+
function eo(e) {
|
|
1653
|
+
return e.labelColumn ? (() => {
|
|
1654
|
+
var n = Ge(), r = n.firstChild, i = r.firstChild, a = i.nextSibling, o = a.firstChild.nextSibling;
|
|
1655
|
+
return o.nextSibling, S(n, b(k, {
|
|
1656
|
+
get when() {
|
|
1657
|
+
return t.grouping?.collapsible !== !1;
|
|
1658
|
+
},
|
|
1659
|
+
get fallback() {
|
|
1660
|
+
return We();
|
|
1661
|
+
},
|
|
1662
|
+
get children() {
|
|
1663
|
+
var t = Be();
|
|
1664
|
+
return t.$$click = () => Cr(e.row.group.id, !e.row.expanded), S(t, () => e.row.expanded ? "▾" : "▸"), x((n) => {
|
|
1665
|
+
var r = q(), i = `${e.row.expanded ? P().collapse : P().expand} ${e.row.label}`, a = e.row.expanded;
|
|
1666
|
+
return r !== n.e && (t.disabled = n.e = r), i !== n.t && w(t, "aria-label", n.t = i), a !== n.a && w(t, "aria-expanded", n.a = a), n;
|
|
1667
|
+
}, {
|
|
1668
|
+
e: void 0,
|
|
1669
|
+
t: void 0,
|
|
1670
|
+
a: void 0
|
|
1671
|
+
}), t;
|
|
1672
|
+
}
|
|
1673
|
+
}), r), S(r, () => e.row.label, i), S(a, () => br().format(e.row.group.count), o), n;
|
|
1674
|
+
})() : jt(e.row.group.aggregates.find((t) => t.column === e.column.definition.id)?.value ?? null);
|
|
1675
|
+
}
|
|
1676
|
+
function to(e) {
|
|
1677
|
+
let t = !1;
|
|
1678
|
+
return b(me, {
|
|
1679
|
+
"data-sheen-selection-control": "",
|
|
1680
|
+
class: "sheen-data-table-selection-control",
|
|
1681
|
+
get label() {
|
|
1682
|
+
return Zr(e.row);
|
|
1683
|
+
},
|
|
1684
|
+
get checked() {
|
|
1685
|
+
return Y(e.row.id);
|
|
1686
|
+
},
|
|
1687
|
+
get disabled() {
|
|
1688
|
+
return q();
|
|
1689
|
+
},
|
|
1690
|
+
onPointerDown: (e) => {
|
|
1691
|
+
t = e.shiftKey;
|
|
1692
|
+
},
|
|
1693
|
+
onKeyDown: (e) => {
|
|
1694
|
+
e.key === " " && (t = e.shiftKey);
|
|
1695
|
+
},
|
|
1696
|
+
onCheckedChange: (n) => {
|
|
1697
|
+
Nr(e.row.id, n, t), t = !1;
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
function no(e) {
|
|
1702
|
+
let t = () => Dt(e.row), n = j(() => {
|
|
1703
|
+
let n = t();
|
|
1704
|
+
return n ? ai(n.row, e.column) : void 0;
|
|
1705
|
+
}), r = () => oi(n()), i = () => {
|
|
1706
|
+
let e = r();
|
|
1707
|
+
return !(!e || e.invalid === null && e.error === null);
|
|
1708
|
+
};
|
|
1709
|
+
return b(k, {
|
|
1710
|
+
get when() {
|
|
1711
|
+
return t();
|
|
1712
|
+
},
|
|
1713
|
+
get fallback() {
|
|
1714
|
+
return b(k, {
|
|
1715
|
+
get when() {
|
|
1716
|
+
return Ot(e.row);
|
|
1717
|
+
},
|
|
1718
|
+
children: (t) => (() => {
|
|
1719
|
+
var n = Ke();
|
|
1720
|
+
return S(n, b(eo, {
|
|
1721
|
+
get row() {
|
|
1722
|
+
return t();
|
|
1723
|
+
},
|
|
1724
|
+
get column() {
|
|
1725
|
+
return e.column;
|
|
1726
|
+
},
|
|
1727
|
+
get labelColumn() {
|
|
1728
|
+
return e.title;
|
|
1729
|
+
}
|
|
1730
|
+
})), x((t) => {
|
|
1731
|
+
var r = e.column.definition.id, i = e.column.definition.align, a = e.column.definition.numeric || void 0;
|
|
1732
|
+
return r !== t.e && w(n, "data-column", t.e = r), i !== t.t && w(n, "data-align", t.t = i), a !== t.a && w(n, "data-numeric", t.a = a), t;
|
|
1733
|
+
}, {
|
|
1734
|
+
e: void 0,
|
|
1735
|
+
t: void 0,
|
|
1736
|
+
a: void 0
|
|
1737
|
+
}), n;
|
|
1738
|
+
})()
|
|
1739
|
+
});
|
|
1740
|
+
},
|
|
1741
|
+
children: (t) => (() => {
|
|
1742
|
+
var a = Ke();
|
|
1743
|
+
return S(a, b($a, {
|
|
1744
|
+
get row() {
|
|
1745
|
+
return t();
|
|
1746
|
+
},
|
|
1747
|
+
get column() {
|
|
1748
|
+
return e.column;
|
|
1749
|
+
},
|
|
1750
|
+
get first() {
|
|
1751
|
+
return e.title;
|
|
1752
|
+
},
|
|
1753
|
+
get edit() {
|
|
1754
|
+
return n();
|
|
1755
|
+
}
|
|
1756
|
+
})), x((t) => {
|
|
1757
|
+
var o = e.column.definition.id, s = e.column.definition.align, c = e.column.definition.numeric || void 0, l = n() ? "" : void 0, u = i() ? "" : void 0, d = r()?.stale ? "" : void 0, f = r()?.pending ? "" : void 0, p = r()?.conflict ? "" : void 0;
|
|
1758
|
+
return o !== t.e && w(a, "data-column", t.e = o), s !== t.t && w(a, "data-align", t.t = s), c !== t.a && w(a, "data-numeric", t.a = c), l !== t.o && w(a, "data-editable", t.o = l), u !== t.i && w(a, "data-invalid", t.i = u), d !== t.n && w(a, "data-stale", t.n = d), f !== t.s && w(a, "data-pending", t.s = f), p !== t.h && w(a, "data-conflict", t.h = p), t;
|
|
1759
|
+
}, {
|
|
1760
|
+
e: void 0,
|
|
1761
|
+
t: void 0,
|
|
1762
|
+
a: void 0,
|
|
1763
|
+
o: void 0,
|
|
1764
|
+
i: void 0,
|
|
1765
|
+
n: void 0,
|
|
1766
|
+
s: void 0,
|
|
1767
|
+
h: void 0
|
|
1768
|
+
}), a;
|
|
1769
|
+
})()
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
function ro(e) {
|
|
1773
|
+
let t = () => Dt(e.row), n = ka, r = () => Z().filter((e) => e !== n());
|
|
1774
|
+
return [(() => {
|
|
1775
|
+
var r = qe(), i = r.firstChild;
|
|
1776
|
+
return S(r, b(k, {
|
|
1777
|
+
get when() {
|
|
1778
|
+
return t();
|
|
1779
|
+
},
|
|
1780
|
+
children: (e) => b(k, {
|
|
1781
|
+
when: L,
|
|
1782
|
+
get children() {
|
|
1783
|
+
return b(to, { get row() {
|
|
1784
|
+
return e().row;
|
|
1785
|
+
} });
|
|
1786
|
+
}
|
|
1787
|
+
})
|
|
1788
|
+
}), i), S(i, b(k, {
|
|
1789
|
+
get when() {
|
|
1790
|
+
return n();
|
|
1791
|
+
},
|
|
1792
|
+
get fallback() {
|
|
1793
|
+
return t()?.row.id ?? Ot(e.row)?.label ?? "";
|
|
1794
|
+
},
|
|
1795
|
+
children: (t) => b(no, {
|
|
1796
|
+
get row() {
|
|
1797
|
+
return e.row;
|
|
1798
|
+
},
|
|
1799
|
+
get column() {
|
|
1800
|
+
return t();
|
|
1801
|
+
},
|
|
1802
|
+
title: !0
|
|
1803
|
+
})
|
|
1804
|
+
})), S(r, b(k, {
|
|
1805
|
+
get when() {
|
|
1806
|
+
return t();
|
|
1807
|
+
},
|
|
1808
|
+
children: (e) => b(k, {
|
|
1809
|
+
get when() {
|
|
1810
|
+
return E().length > 0;
|
|
1811
|
+
},
|
|
1812
|
+
get children() {
|
|
1813
|
+
return b(ge, {
|
|
1814
|
+
get trigger() {
|
|
1815
|
+
return P().rowActions.replaceAll("{id}", e().row.id);
|
|
1816
|
+
},
|
|
1817
|
+
get items() {
|
|
1818
|
+
return Wr(e().row);
|
|
1819
|
+
},
|
|
1820
|
+
get disabled() {
|
|
1821
|
+
return q();
|
|
1822
|
+
}
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
})
|
|
1826
|
+
}), null), r;
|
|
1827
|
+
})(), b(k, {
|
|
1828
|
+
get when() {
|
|
1829
|
+
return r().length > 0;
|
|
1830
|
+
},
|
|
1831
|
+
get children() {
|
|
1832
|
+
var t = Je();
|
|
1833
|
+
return S(t, b(O, {
|
|
1834
|
+
get each() {
|
|
1835
|
+
return r();
|
|
1836
|
+
},
|
|
1837
|
+
children: (t) => (() => {
|
|
1838
|
+
var n = Ye(), r = n.firstChild, i = r.nextSibling;
|
|
1839
|
+
return S(r, () => t.definition.header), S(i, b(no, {
|
|
1840
|
+
get row() {
|
|
1841
|
+
return e.row;
|
|
1842
|
+
},
|
|
1843
|
+
column: t,
|
|
1844
|
+
title: !1
|
|
1845
|
+
})), n;
|
|
1846
|
+
})()
|
|
1847
|
+
})), t;
|
|
1848
|
+
}
|
|
1849
|
+
})];
|
|
1850
|
+
}
|
|
1851
|
+
return (() => {
|
|
1852
|
+
var e = st(), n = e.firstChild, r = n.firstChild, i = r.firstChild, a = i.firstChild, o = a.nextSibling.firstChild, s = zn;
|
|
1853
|
+
typeof s == "function" ? D(s, e) : zn = e, w(e, "data-mobile-layout", I ? "" : void 0), w(e, "data-selection", L ? "multiple" : void 0), T(e, "--sheen-data-table-initial-viewport-height", `${ta}px`), S(e, b(k, {
|
|
1854
|
+
get when() {
|
|
1855
|
+
return C(() => !!Kn())() ? Yn() : null;
|
|
1856
|
+
},
|
|
1857
|
+
children: (e) => (() => {
|
|
1858
|
+
var t = Xe(), n = t.firstChild;
|
|
1859
|
+
return S(n, () => Mt(e())), S(t, b(pe, {
|
|
1860
|
+
onClick: pr,
|
|
1861
|
+
get children() {
|
|
1862
|
+
return P().retry;
|
|
1863
|
+
}
|
|
1864
|
+
}), null), t;
|
|
1865
|
+
})()
|
|
1866
|
+
}), n), S(e, b(k, {
|
|
1867
|
+
get when() {
|
|
1868
|
+
return ui();
|
|
1869
|
+
},
|
|
1870
|
+
get children() {
|
|
1871
|
+
var e = Xe(), t = e.firstChild;
|
|
1872
|
+
return S(t, () => P().exportFailed), S(e, b(k, {
|
|
1873
|
+
when: U,
|
|
1874
|
+
get children() {
|
|
1875
|
+
return b(pe, {
|
|
1876
|
+
onClick: gi,
|
|
1877
|
+
get children() {
|
|
1878
|
+
return P().retryExport;
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
}), null), e;
|
|
1883
|
+
}
|
|
1884
|
+
}), n), S(e, b(ce, {
|
|
1885
|
+
get label() {
|
|
1886
|
+
return P().tableControls.replace("{caption}", t.caption);
|
|
1887
|
+
},
|
|
1888
|
+
get result() {
|
|
1889
|
+
return yi();
|
|
1890
|
+
},
|
|
1891
|
+
get resultPrevious() {
|
|
1892
|
+
return C(() => !!Jn())() ? P().previousResults : void 0;
|
|
1893
|
+
},
|
|
1894
|
+
get actions() {
|
|
1895
|
+
return Pi();
|
|
1896
|
+
},
|
|
1897
|
+
get query() {
|
|
1898
|
+
return C(() => !!(F || t.filterBar !== !1 && N.filterColumns.length > 0))() ? [b(k, {
|
|
1899
|
+
when: F,
|
|
1900
|
+
get children() {
|
|
1901
|
+
var e = ct();
|
|
1902
|
+
return S(e, b(ye, {
|
|
1903
|
+
class: "sheen-data-table-search",
|
|
1904
|
+
get label() {
|
|
1905
|
+
return Zn();
|
|
1906
|
+
},
|
|
1907
|
+
get placeholder() {
|
|
1908
|
+
return Qn();
|
|
1909
|
+
},
|
|
1910
|
+
get value() {
|
|
1911
|
+
return yn();
|
|
1912
|
+
},
|
|
1913
|
+
get shortcut() {
|
|
1914
|
+
return $n();
|
|
1915
|
+
},
|
|
1916
|
+
get "aria-busy"() {
|
|
1917
|
+
return qn() || void 0;
|
|
1918
|
+
},
|
|
1919
|
+
onValueChange: or,
|
|
1920
|
+
onCompositionStart: sr,
|
|
1921
|
+
onCompositionEnd: (e) => cr(e.currentTarget.value)
|
|
1922
|
+
}), null), S(e, b(k, {
|
|
1923
|
+
get when() {
|
|
1924
|
+
return F?.exactMatch;
|
|
1925
|
+
},
|
|
1926
|
+
get children() {
|
|
1927
|
+
return b(ge, {
|
|
1928
|
+
class: "sheen-data-table-search-mode-menu",
|
|
1929
|
+
get trigger() {
|
|
1930
|
+
return (() => {
|
|
1931
|
+
var e = lt();
|
|
1932
|
+
return S(e, (() => {
|
|
1933
|
+
var e = C(() => tr() === "exact");
|
|
1934
|
+
return () => e() ? P().searchExact : P().searchRanked;
|
|
1935
|
+
})()), e;
|
|
1936
|
+
})();
|
|
1937
|
+
},
|
|
1938
|
+
get triggerLabel() {
|
|
1939
|
+
return `${P().searchMatchMode}: ${tr() === "exact" ? P().searchExact : P().searchRanked}`;
|
|
1940
|
+
},
|
|
1941
|
+
get items() {
|
|
1942
|
+
return nr();
|
|
1943
|
+
},
|
|
1944
|
+
get disabled() {
|
|
1945
|
+
return q();
|
|
1946
|
+
}
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
}), null), x(() => w(e, "data-search-mode", tr())), e;
|
|
1950
|
+
}
|
|
1951
|
+
}), b(k, {
|
|
1952
|
+
get when() {
|
|
1953
|
+
return C(() => t.filterBar !== !1)() && N.filterColumns.length > 0;
|
|
1954
|
+
},
|
|
1955
|
+
get children() {
|
|
1956
|
+
return b(se, de({
|
|
1957
|
+
get columns() {
|
|
1958
|
+
return t.columns;
|
|
1959
|
+
},
|
|
1960
|
+
get value() {
|
|
1961
|
+
return G().filter;
|
|
1962
|
+
},
|
|
1963
|
+
get facets() {
|
|
1964
|
+
return K().facets;
|
|
1965
|
+
},
|
|
1966
|
+
get disabled() {
|
|
1967
|
+
return q();
|
|
1968
|
+
},
|
|
1969
|
+
onChange: dr
|
|
1970
|
+
}, () => typeof t.filterBar == "object" && t.filterBar.dateEditor ? { dateEditor: t.filterBar.dateEditor } : {}));
|
|
1971
|
+
}
|
|
1972
|
+
})] : void 0;
|
|
1973
|
+
},
|
|
1974
|
+
get status() {
|
|
1975
|
+
return b(k, {
|
|
1976
|
+
get when() {
|
|
1977
|
+
return li();
|
|
1978
|
+
},
|
|
1979
|
+
get children() {
|
|
1980
|
+
var e = ut();
|
|
1981
|
+
return S(e, () => P().preparingExport), e;
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
}), n), S(n, b(k, {
|
|
1986
|
+
get when() {
|
|
1987
|
+
return Fn();
|
|
1988
|
+
},
|
|
1989
|
+
get children() {
|
|
1990
|
+
var e = Ze(), t = e.firstChild;
|
|
1991
|
+
return S(t, () => P().refreshing), e;
|
|
1992
|
+
}
|
|
1993
|
+
}), r), r.addEventListener("scroll", Sa), D((e) => {
|
|
1994
|
+
B = e;
|
|
1995
|
+
}, r);
|
|
1996
|
+
var c = V;
|
|
1997
|
+
return typeof c == "function" ? D(c, i) : V = i, w(i, "id", Yt), w(i, "role", $ ? "treegrid" : void 0), w(i, "aria-multiselectable", $ && L ? !0 : void 0), S(a, () => t.caption), S(o, b(k, {
|
|
1998
|
+
when: L,
|
|
1999
|
+
get children() {
|
|
2000
|
+
var e = Qe();
|
|
2001
|
+
return w(e, "role", $ ? "columnheader" : void 0), S(e, b(me, {
|
|
2002
|
+
"data-sheen-selection-control": "",
|
|
2003
|
+
class: "sheen-data-table-selection-control",
|
|
2004
|
+
get label() {
|
|
2005
|
+
return P().selectPage;
|
|
2006
|
+
},
|
|
2007
|
+
get checked() {
|
|
2008
|
+
return C(() => J().rows.length > 0)() && Lr() === J().rows.length;
|
|
2009
|
+
},
|
|
2010
|
+
get indeterminate() {
|
|
2011
|
+
return C(() => Lr() > 0)() && Lr() < J().rows.length;
|
|
2012
|
+
},
|
|
2013
|
+
get disabled() {
|
|
2014
|
+
return q() || J().rows.length === 0;
|
|
2015
|
+
},
|
|
2016
|
+
onCheckedChange: Pr
|
|
2017
|
+
})), e;
|
|
2018
|
+
}
|
|
2019
|
+
}), null), S(o, b(O, {
|
|
2020
|
+
get each() {
|
|
2021
|
+
return Z();
|
|
2022
|
+
},
|
|
2023
|
+
children: (e) => {
|
|
2024
|
+
let t = () => G().sorting.find((t) => t.column === e.definition.id), n = () => G().sorting.findIndex((t) => t.column === e.definition.id) + 1, r = () => {
|
|
2025
|
+
let e = t()?.direction, r = e === "asc" ? P().sortedAscending : e === "desc" ? P().sortedDescending : P().notSorted, i = G().sorting.length;
|
|
2026
|
+
return e && i > 1 ? `${r}, ${P().sortPriority.replace("{position}", String(n())).replace("{count}", String(i))}` : r;
|
|
2027
|
+
}, i = () => P().resizeColumn.replaceAll("{column}", e.definition.header), a = () => P().reorderColumn.replaceAll("{column}", e.definition.header), o = () => e.state().width ?? (typeof e.definition.width == "number" ? e.definition.width : e.definition.minWidth ?? 160);
|
|
2028
|
+
return (() => {
|
|
2029
|
+
var s = pt(), c = s.firstChild, l = c.firstChild, u = c.nextSibling;
|
|
2030
|
+
return w(s, "role", $ ? "columnheader" : void 0), S(c, b(k, {
|
|
2031
|
+
get when() {
|
|
2032
|
+
return e.definition.sort;
|
|
2033
|
+
},
|
|
2034
|
+
get fallback() {
|
|
2035
|
+
return (() => {
|
|
2036
|
+
var t = mt();
|
|
2037
|
+
return S(t, () => e.definition.header), t;
|
|
2038
|
+
})();
|
|
2039
|
+
},
|
|
2040
|
+
get children() {
|
|
2041
|
+
return [(() => {
|
|
2042
|
+
var r = dt(), i = r.firstChild;
|
|
2043
|
+
return r.$$click = (t) => ur(e.definition.id, t.shiftKey), S(i, () => e.definition.header), S(r, b(k, {
|
|
2044
|
+
get when() {
|
|
2045
|
+
return t();
|
|
2046
|
+
},
|
|
2047
|
+
children: (e) => (() => {
|
|
2048
|
+
var t = gt(), r = t.firstChild;
|
|
2049
|
+
return S(r, () => e().direction === "asc" ? "↑" : "↓"), S(t, b(k, {
|
|
2050
|
+
get when() {
|
|
2051
|
+
return G().sorting.length > 1;
|
|
2052
|
+
},
|
|
2053
|
+
get children() {
|
|
2054
|
+
var e = ht();
|
|
2055
|
+
return S(e, n), e;
|
|
2056
|
+
}
|
|
2057
|
+
}), null), t;
|
|
2058
|
+
})()
|
|
2059
|
+
}), null), x((t) => {
|
|
2060
|
+
var n = q(), i = e.sortDescriptionId;
|
|
2061
|
+
return n !== t.e && (r.disabled = t.e = n), i !== t.t && w(r, "aria-describedby", t.t = i), t;
|
|
2062
|
+
}, {
|
|
2063
|
+
e: void 0,
|
|
2064
|
+
t: void 0
|
|
2065
|
+
}), r;
|
|
2066
|
+
})(), (() => {
|
|
2067
|
+
var t = ft();
|
|
2068
|
+
return S(t, r), x(() => w(t, "id", e.sortDescriptionId)), t;
|
|
2069
|
+
})()];
|
|
2070
|
+
}
|
|
2071
|
+
}), l), l.addEventListener("lostpointercapture", () => {
|
|
2072
|
+
Gi?.source === e && Ki();
|
|
2073
|
+
}), l.addEventListener("pointercancel", Ki), l.$$pointerup = Yi, l.$$pointermove = Ji, l.$$pointerdown = (t) => qi(t, e), l.$$keydown = (t) => Xi(t, e), u.$$dblclick = () => ki(e), u.$$keydown = (t) => Wi(t, e), u.addEventListener("lostpointercapture", () => {
|
|
2074
|
+
Ri?.column === e && Bi();
|
|
2075
|
+
}), u.addEventListener("pointercancel", Bi), u.$$pointerup = Ui, u.$$pointermove = Hi, u.$$pointerdown = (t) => Vi(t, e), w(u, "aria-controls", Yt), x((r) => {
|
|
2076
|
+
var c = qa(e.definition.id), d = e.definition.id, f = e.state().pin || void 0, p = Li(e), m = t()?.direction, h = t() ? n() : void 0, g = Ii(e), _ = n() === 1 ? t()?.direction === "asc" ? "ascending" : t()?.direction === "desc" ? "descending" : void 0 : void 0, ee = a(), te = i(), v = e.definition.minWidth ?? 80, y = e.definition.maxWidth ?? 4096, ne = o(), re = P().columnWidthPixels.replace("{width}", String(o()));
|
|
2077
|
+
return c !== r.e && w(s, "aria-colindex", r.e = c), d !== r.t && w(s, "data-column", r.t = d), f !== r.a && w(s, "data-pin", r.a = f), p !== r.o && w(s, "data-pin-edge", r.o = p), m !== r.i && w(s, "data-sort-direction", r.i = m), h !== r.n && w(s, "data-sort-priority", r.n = h), r.s = fe(s, g, r.s), _ !== r.h && w(s, "aria-sort", r.h = _), ee !== r.r && w(l, "aria-label", r.r = ee), te !== r.d && w(u, "aria-label", r.d = te), v !== r.l && w(u, "aria-valuemin", r.l = v), y !== r.u && w(u, "aria-valuemax", r.u = y), ne !== r.c && w(u, "aria-valuenow", r.c = ne), re !== r.w && w(u, "aria-valuetext", r.w = re), r;
|
|
2078
|
+
}, {
|
|
2079
|
+
e: void 0,
|
|
2080
|
+
t: void 0,
|
|
2081
|
+
a: void 0,
|
|
2082
|
+
o: void 0,
|
|
2083
|
+
i: void 0,
|
|
2084
|
+
n: void 0,
|
|
2085
|
+
s: void 0,
|
|
2086
|
+
h: void 0,
|
|
2087
|
+
r: void 0,
|
|
2088
|
+
d: void 0,
|
|
2089
|
+
l: void 0,
|
|
2090
|
+
u: void 0,
|
|
2091
|
+
c: void 0,
|
|
2092
|
+
w: void 0
|
|
2093
|
+
}), s;
|
|
2094
|
+
})();
|
|
2095
|
+
}
|
|
2096
|
+
}), null), S(i, b(k, {
|
|
2097
|
+
get when() {
|
|
2098
|
+
return Or() > 0;
|
|
2099
|
+
},
|
|
2100
|
+
get fallback() {
|
|
2101
|
+
return (() => {
|
|
2102
|
+
var e = yt(), t = e.firstChild, n = t.firstChild;
|
|
2103
|
+
return S(n, b(k, {
|
|
2104
|
+
get when() {
|
|
2105
|
+
return Q() === "cold";
|
|
2106
|
+
},
|
|
2107
|
+
get children() {
|
|
2108
|
+
var e = _t(), t = e.firstChild;
|
|
2109
|
+
return S(t, () => P().loading), S(e, b(O, {
|
|
2110
|
+
each: Ba,
|
|
2111
|
+
children: () => (() => {
|
|
2112
|
+
var e = bt();
|
|
2113
|
+
return S(e, b(O, {
|
|
2114
|
+
get each() {
|
|
2115
|
+
return Array.from({ length: Ra() });
|
|
2116
|
+
},
|
|
2117
|
+
children: () => b(be, {})
|
|
2118
|
+
})), x((t) => T(e, "grid-template-columns", Ci())), e;
|
|
2119
|
+
})()
|
|
2120
|
+
}), null), x((t) => {
|
|
2121
|
+
var n = Nn() ? "" : void 0, r = Nn() ? "status" : void 0;
|
|
2122
|
+
return n !== t.e && w(e, "data-visible", t.e = n), r !== t.t && w(e, "role", t.t = r), t;
|
|
2123
|
+
}, {
|
|
2124
|
+
e: void 0,
|
|
2125
|
+
t: void 0
|
|
2126
|
+
}), e;
|
|
2127
|
+
}
|
|
2128
|
+
}), null), S(n, b(k, {
|
|
2129
|
+
get when() {
|
|
2130
|
+
return Q() === "error";
|
|
2131
|
+
},
|
|
2132
|
+
get children() {
|
|
2133
|
+
var e = vt(), t = e.firstChild, n = t.nextSibling;
|
|
2134
|
+
return S(t, () => P().serverError), S(n, () => Mt(Yn())), S(e, b(pe, {
|
|
2135
|
+
onClick: pr,
|
|
2136
|
+
get children() {
|
|
2137
|
+
return P().retry;
|
|
2138
|
+
}
|
|
2139
|
+
}), null), e;
|
|
2140
|
+
}
|
|
2141
|
+
}), null), S(n, b(k, {
|
|
2142
|
+
get when() {
|
|
2143
|
+
return Q() === "no-results";
|
|
2144
|
+
},
|
|
2145
|
+
get children() {
|
|
2146
|
+
return b(_e, {
|
|
2147
|
+
kind: "no-results",
|
|
2148
|
+
get children() {
|
|
2149
|
+
return b(pe, {
|
|
2150
|
+
onClick: fr,
|
|
2151
|
+
get children() {
|
|
2152
|
+
return Fa();
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
}), null), S(n, b(k, {
|
|
2159
|
+
get when() {
|
|
2160
|
+
return Q() === "empty";
|
|
2161
|
+
},
|
|
2162
|
+
get children() {
|
|
2163
|
+
return b(_e, { kind: "empty" });
|
|
2164
|
+
}
|
|
2165
|
+
}), null), x((r) => {
|
|
2166
|
+
var i = Q(), a = Ci(), o = Ra(), s = za();
|
|
2167
|
+
return i !== r.e && w(e, "data-state", r.e = i), a !== r.t && T(t, "grid-template-columns", r.t = a), o !== r.a && w(n, "colspan", r.a = o), s !== r.o && w(n, "aria-colspan", r.o = s), r;
|
|
2168
|
+
}, {
|
|
2169
|
+
e: void 0,
|
|
2170
|
+
t: void 0,
|
|
2171
|
+
a: void 0,
|
|
2172
|
+
o: void 0
|
|
2173
|
+
}), e;
|
|
2174
|
+
})();
|
|
2175
|
+
},
|
|
2176
|
+
get children() {
|
|
2177
|
+
var e = $e();
|
|
2178
|
+
return S(e, b(O, {
|
|
2179
|
+
get each() {
|
|
2180
|
+
return sa();
|
|
2181
|
+
},
|
|
2182
|
+
children: (e) => {
|
|
2183
|
+
let n = () => e.row(), r = () => Dt(n()), i = () => Ot(n()), a = () => {
|
|
2184
|
+
let e = Z();
|
|
2185
|
+
return e.some((e) => e.definition.id === t.grouping?.by) ? t.grouping?.by : e[0]?.definition.id;
|
|
2186
|
+
};
|
|
2187
|
+
function o() {
|
|
2188
|
+
return [b(k, {
|
|
2189
|
+
when: L,
|
|
2190
|
+
get children() {
|
|
2191
|
+
return b(k, {
|
|
2192
|
+
get when() {
|
|
2193
|
+
return r();
|
|
2194
|
+
},
|
|
2195
|
+
get fallback() {
|
|
2196
|
+
return (() => {
|
|
2197
|
+
var e = et();
|
|
2198
|
+
return w(e, "role", $ ? "gridcell" : void 0), e;
|
|
2199
|
+
})();
|
|
2200
|
+
},
|
|
2201
|
+
children: (e) => b(Ka, { get row() {
|
|
2202
|
+
return e().row;
|
|
2203
|
+
} })
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
}), b(O, {
|
|
2207
|
+
get each() {
|
|
2208
|
+
return Z();
|
|
2209
|
+
},
|
|
2210
|
+
children: (e) => {
|
|
2211
|
+
let t = j(() => {
|
|
2212
|
+
let t = r();
|
|
2213
|
+
return t ? ai(t.row, e) : void 0;
|
|
2214
|
+
}), n = () => oi(t()), o = () => {
|
|
2215
|
+
let e = n();
|
|
2216
|
+
return !(!e || e.invalid === null && e.error === null);
|
|
2217
|
+
};
|
|
2218
|
+
return (() => {
|
|
2219
|
+
var s = xt();
|
|
2220
|
+
return w(s, "role", $ ? "gridcell" : void 0), S(s, b(k, {
|
|
2221
|
+
get when() {
|
|
2222
|
+
return r();
|
|
2223
|
+
},
|
|
2224
|
+
get fallback() {
|
|
2225
|
+
return b(k, {
|
|
2226
|
+
get when() {
|
|
2227
|
+
return i();
|
|
2228
|
+
},
|
|
2229
|
+
children: (t) => b(eo, {
|
|
2230
|
+
get row() {
|
|
2231
|
+
return t();
|
|
2232
|
+
},
|
|
2233
|
+
column: e,
|
|
2234
|
+
get labelColumn() {
|
|
2235
|
+
return e.definition.id === a();
|
|
2236
|
+
}
|
|
2237
|
+
})
|
|
2238
|
+
});
|
|
2239
|
+
},
|
|
2240
|
+
children: (n) => b($a, {
|
|
2241
|
+
get row() {
|
|
2242
|
+
return n();
|
|
2243
|
+
},
|
|
2244
|
+
column: e,
|
|
2245
|
+
get first() {
|
|
2246
|
+
return e === Z()[0];
|
|
2247
|
+
},
|
|
2248
|
+
get edit() {
|
|
2249
|
+
return t();
|
|
2250
|
+
}
|
|
2251
|
+
})
|
|
2252
|
+
})), x((r) => {
|
|
2253
|
+
var i = qa(e.definition.id), a = e.definition.id, c = e.state().pin || void 0, l = Li(e), u = Ii(e), d = e.definition.align, f = e.definition.numeric || void 0, p = t() ? "" : void 0, m = o() ? "" : void 0, h = n()?.stale ? "" : void 0, g = n()?.pending ? "" : void 0, _ = n()?.conflict ? "" : void 0;
|
|
2254
|
+
return i !== r.e && w(s, "aria-colindex", r.e = i), a !== r.t && w(s, "data-column", r.t = a), c !== r.a && w(s, "data-pin", r.a = c), l !== r.o && w(s, "data-pin-edge", r.o = l), r.i = fe(s, u, r.i), d !== r.n && w(s, "data-align", r.n = d), f !== r.s && w(s, "data-numeric", r.s = f), p !== r.h && w(s, "data-editable", r.h = p), m !== r.r && w(s, "data-invalid", r.r = m), h !== r.d && w(s, "data-stale", r.d = h), g !== r.l && w(s, "data-pending", r.l = g), _ !== r.u && w(s, "data-conflict", r.u = _), r;
|
|
2255
|
+
}, {
|
|
2256
|
+
e: void 0,
|
|
2257
|
+
t: void 0,
|
|
2258
|
+
a: void 0,
|
|
2259
|
+
o: void 0,
|
|
2260
|
+
i: void 0,
|
|
2261
|
+
n: void 0,
|
|
2262
|
+
s: void 0,
|
|
2263
|
+
h: void 0,
|
|
2264
|
+
r: void 0,
|
|
2265
|
+
d: void 0,
|
|
2266
|
+
l: void 0,
|
|
2267
|
+
u: void 0
|
|
2268
|
+
}), s;
|
|
2269
|
+
})();
|
|
2270
|
+
}
|
|
2271
|
+
})];
|
|
2272
|
+
}
|
|
2273
|
+
if (t.actions === void 0) return (() => {
|
|
2274
|
+
var a = St();
|
|
2275
|
+
return D((t) => ia(t, e.item().index), a), a.$$click = (e) => va(e, n()), a.$$keydown = (e) => _a(e, n()), a.addEventListener("focus", () => la(e.key)), T(a, "min-block-size", Qi), S(a, b(o, {})), x((o) => {
|
|
2276
|
+
var s = e.key, c = r()?.row.id, l = i()?.group.id, u = e.item().index, d = r() && Y(r()?.row.id ?? "") ? "" : void 0, f = r()?.pending ? "" : void 0, p = r() && r()?.error !== null ? "" : void 0, m = ua() === e.key ? 0 : t.onRowActivate || L || $ ? -1 : void 0, h = Ja(e.item().index), g = $ ? r()?.depth ?? 1 : void 0, _ = $ ? n().position : void 0, ee = $ ? n().setSize : void 0, te = i()?.expanded ?? (r()?.canExpand ? r()?.expanded : void 0), v = L && r() ? Y(r()?.row.id ?? "") : void 0, y = r()?.pending ? !0 : void 0, ne = Ci(), re = `translateY(${e.item().start}px)`, ie = t.variableRowHeight ? void 0 : Qi;
|
|
2277
|
+
return s !== o.e && w(a, "data-row-key", o.e = s), c !== o.t && w(a, "data-row-id", o.t = c), l !== o.a && w(a, "data-group-id", o.a = l), u !== o.o && w(a, "data-index", o.o = u), d !== o.i && w(a, "data-selected", o.i = d), f !== o.n && w(a, "data-loading", o.n = f), p !== o.s && w(a, "data-load-error", o.s = p), m !== o.h && w(a, "tabindex", o.h = m), h !== o.r && w(a, "aria-rowindex", o.r = h), g !== o.d && w(a, "aria-level", o.d = g), _ !== o.l && w(a, "aria-posinset", o.l = _), ee !== o.u && w(a, "aria-setsize", o.u = ee), te !== o.c && w(a, "aria-expanded", o.c = te), v !== o.w && w(a, "aria-selected", o.w = v), y !== o.m && w(a, "aria-busy", o.m = y), ne !== o.f && T(a, "grid-template-columns", o.f = ne), re !== o.y && T(a, "transform", o.y = re), ie !== o.g && T(a, "block-size", o.g = ie), o;
|
|
2278
|
+
}, {
|
|
2279
|
+
e: void 0,
|
|
2280
|
+
t: void 0,
|
|
2281
|
+
a: void 0,
|
|
2282
|
+
o: void 0,
|
|
2283
|
+
i: void 0,
|
|
2284
|
+
n: void 0,
|
|
2285
|
+
s: void 0,
|
|
2286
|
+
h: void 0,
|
|
2287
|
+
r: void 0,
|
|
2288
|
+
d: void 0,
|
|
2289
|
+
l: void 0,
|
|
2290
|
+
u: void 0,
|
|
2291
|
+
c: void 0,
|
|
2292
|
+
w: void 0,
|
|
2293
|
+
m: void 0,
|
|
2294
|
+
f: void 0,
|
|
2295
|
+
y: void 0,
|
|
2296
|
+
g: void 0
|
|
2297
|
+
}), a;
|
|
2298
|
+
})();
|
|
2299
|
+
let s = r();
|
|
2300
|
+
return b(he, {
|
|
2301
|
+
as: "tr",
|
|
2302
|
+
get items() {
|
|
2303
|
+
return s ? Wr(s.row) : [];
|
|
2304
|
+
},
|
|
2305
|
+
get disabled() {
|
|
2306
|
+
return !s || E().length === 0 || q();
|
|
2307
|
+
},
|
|
2308
|
+
onContextMenu: () => {
|
|
2309
|
+
let e = r();
|
|
2310
|
+
e && Ur(e.row);
|
|
2311
|
+
},
|
|
2312
|
+
get "data-row-key"() {
|
|
2313
|
+
return e.key;
|
|
2314
|
+
},
|
|
2315
|
+
get "data-row-id"() {
|
|
2316
|
+
return r()?.row.id;
|
|
2317
|
+
},
|
|
2318
|
+
get "data-group-id"() {
|
|
2319
|
+
return i()?.group.id;
|
|
2320
|
+
},
|
|
2321
|
+
get "data-index"() {
|
|
2322
|
+
return e.item().index;
|
|
2323
|
+
},
|
|
2324
|
+
get "data-selected"() {
|
|
2325
|
+
return r() && Y(r()?.row.id ?? "") ? "" : void 0;
|
|
2326
|
+
},
|
|
2327
|
+
get "data-loading"() {
|
|
2328
|
+
return r()?.pending ? "" : void 0;
|
|
2329
|
+
},
|
|
2330
|
+
get "data-load-error"() {
|
|
2331
|
+
return r() && r()?.error !== null ? "" : void 0;
|
|
2332
|
+
},
|
|
2333
|
+
get tabIndex() {
|
|
2334
|
+
return C(() => ua() === e.key)() ? 0 : t.onRowActivate || L || $ || E().length > 0 ? -1 : void 0;
|
|
2335
|
+
},
|
|
2336
|
+
get "aria-rowindex"() {
|
|
2337
|
+
return Ja(e.item().index);
|
|
2338
|
+
},
|
|
2339
|
+
get "aria-level"() {
|
|
2340
|
+
return $ ? r()?.depth ?? 1 : void 0;
|
|
2341
|
+
},
|
|
2342
|
+
get "aria-posinset"() {
|
|
2343
|
+
return $ ? n().position : void 0;
|
|
2344
|
+
},
|
|
2345
|
+
get "aria-setsize"() {
|
|
2346
|
+
return $ ? n().setSize : void 0;
|
|
2347
|
+
},
|
|
2348
|
+
get "aria-expanded"() {
|
|
2349
|
+
return i()?.expanded ?? (r()?.canExpand ? r()?.expanded : void 0);
|
|
2350
|
+
},
|
|
2351
|
+
get "aria-selected"() {
|
|
2352
|
+
return C(() => !!(L && r()))() ? Y(r()?.row.id ?? "") : void 0;
|
|
2353
|
+
},
|
|
2354
|
+
get "aria-busy"() {
|
|
2355
|
+
return r()?.pending ? !0 : void 0;
|
|
2356
|
+
},
|
|
2357
|
+
onFocus: () => la(e.key),
|
|
2358
|
+
onKeyDown: (e) => _a(e, n()),
|
|
2359
|
+
onClick: (e) => va(e, n()),
|
|
2360
|
+
ref: (t) => {
|
|
2361
|
+
if (!(t instanceof HTMLTableRowElement)) throw Error("DataTable context rows must render as table rows");
|
|
2362
|
+
ia(t, e.item().index);
|
|
2363
|
+
},
|
|
2364
|
+
get style() {
|
|
2365
|
+
return {
|
|
2366
|
+
"grid-template-columns": Ci(),
|
|
2367
|
+
transform: `translateY(${e.item().start}px)`,
|
|
2368
|
+
"block-size": t.variableRowHeight ? void 0 : Qi,
|
|
2369
|
+
"min-block-size": Qi
|
|
2370
|
+
};
|
|
2371
|
+
},
|
|
2372
|
+
get children() {
|
|
2373
|
+
return b(o, {});
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
})), x((t) => T(e, "height", `${na.getTotalSize()}px`)), e;
|
|
2378
|
+
}
|
|
2379
|
+
}), null), S(i, b(k, {
|
|
2380
|
+
get when() {
|
|
2381
|
+
return La();
|
|
2382
|
+
},
|
|
2383
|
+
get children() {
|
|
2384
|
+
var e = tt(), t = e.firstChild;
|
|
2385
|
+
return S(t, b(k, {
|
|
2386
|
+
when: L,
|
|
2387
|
+
get children() {
|
|
2388
|
+
var e = et();
|
|
2389
|
+
return w(e, "role", $ ? "gridcell" : void 0), e;
|
|
2390
|
+
}
|
|
2391
|
+
}), null), S(t, b(O, {
|
|
2392
|
+
get each() {
|
|
2393
|
+
return Z();
|
|
2394
|
+
},
|
|
2395
|
+
children: (e) => (() => {
|
|
2396
|
+
var t = xt();
|
|
2397
|
+
return w(t, "role", $ ? "gridcell" : void 0), S(t, (() => {
|
|
2398
|
+
var t = C(() => typeof e.definition.footer == "function");
|
|
2399
|
+
return () => t() ? e.definition.footer(Ia()) : e.definition.footer ?? "";
|
|
2400
|
+
})()), x((n) => {
|
|
2401
|
+
var r = qa(e.definition.id), i = e.definition.id, a = e.state().pin || void 0, o = Li(e), s = Ii(e), c = e.definition.align, l = e.definition.numeric || void 0;
|
|
2402
|
+
return r !== n.e && w(t, "aria-colindex", n.e = r), i !== n.t && w(t, "data-column", n.t = i), a !== n.a && w(t, "data-pin", n.a = a), o !== n.o && w(t, "data-pin-edge", n.o = o), n.i = fe(t, s, n.i), c !== n.n && w(t, "data-align", n.n = c), l !== n.s && w(t, "data-numeric", n.s = l), n;
|
|
2403
|
+
}, {
|
|
2404
|
+
e: void 0,
|
|
2405
|
+
t: void 0,
|
|
2406
|
+
a: void 0,
|
|
2407
|
+
o: void 0,
|
|
2408
|
+
i: void 0,
|
|
2409
|
+
n: void 0,
|
|
2410
|
+
s: void 0
|
|
2411
|
+
}), t;
|
|
2412
|
+
})()
|
|
2413
|
+
}), null), x((e) => {
|
|
2414
|
+
var n = Xa(), r = Ci();
|
|
2415
|
+
return n !== e.e && w(t, "aria-rowindex", e.e = n), r !== e.t && T(t, "grid-template-columns", e.t = r), e;
|
|
2416
|
+
}, {
|
|
2417
|
+
e: void 0,
|
|
2418
|
+
t: void 0
|
|
2419
|
+
}), e;
|
|
2420
|
+
}
|
|
2421
|
+
}), null), S(n, b(k, {
|
|
2422
|
+
when: I,
|
|
2423
|
+
get children() {
|
|
2424
|
+
var e = at();
|
|
2425
|
+
return D((e) => {
|
|
2426
|
+
Bn = e;
|
|
2427
|
+
}, e), S(e, b(k, {
|
|
2428
|
+
get when() {
|
|
2429
|
+
return Oa().length > 0;
|
|
2430
|
+
},
|
|
2431
|
+
get fallback() {
|
|
2432
|
+
return (() => {
|
|
2433
|
+
var e = wt();
|
|
2434
|
+
return S(e, b(k, {
|
|
2435
|
+
get when() {
|
|
2436
|
+
return Q() === "cold";
|
|
2437
|
+
},
|
|
2438
|
+
get children() {
|
|
2439
|
+
var e = Ct(), t = e.firstChild;
|
|
2440
|
+
return S(t, () => P().loading), S(e, b(O, {
|
|
2441
|
+
get each() {
|
|
2442
|
+
return Ba.slice(0, 3);
|
|
2443
|
+
},
|
|
2444
|
+
children: () => (() => {
|
|
2445
|
+
var e = Tt();
|
|
2446
|
+
return S(e, b(be, {}), null), S(e, b(be, {}), null), S(e, b(be, {}), null), e;
|
|
2447
|
+
})()
|
|
2448
|
+
}), null), x((t) => {
|
|
2449
|
+
var n = Nn() ? "" : void 0, r = Nn() ? "status" : void 0;
|
|
2450
|
+
return n !== t.e && w(e, "data-visible", t.e = n), r !== t.t && w(e, "role", t.t = r), t;
|
|
2451
|
+
}, {
|
|
2452
|
+
e: void 0,
|
|
2453
|
+
t: void 0
|
|
2454
|
+
}), e;
|
|
2455
|
+
}
|
|
2456
|
+
}), null), S(e, b(k, {
|
|
2457
|
+
get when() {
|
|
2458
|
+
return Q() === "error";
|
|
2459
|
+
},
|
|
2460
|
+
get children() {
|
|
2461
|
+
var e = vt(), t = e.firstChild, n = t.nextSibling;
|
|
2462
|
+
return S(t, () => P().serverError), S(n, () => Mt(Yn())), S(e, b(pe, {
|
|
2463
|
+
onClick: pr,
|
|
2464
|
+
get children() {
|
|
2465
|
+
return P().retry;
|
|
2466
|
+
}
|
|
2467
|
+
}), null), e;
|
|
2468
|
+
}
|
|
2469
|
+
}), null), S(e, b(k, {
|
|
2470
|
+
get when() {
|
|
2471
|
+
return Q() === "no-results";
|
|
2472
|
+
},
|
|
2473
|
+
get children() {
|
|
2474
|
+
return b(_e, {
|
|
2475
|
+
kind: "no-results",
|
|
2476
|
+
get children() {
|
|
2477
|
+
return b(pe, {
|
|
2478
|
+
onClick: fr,
|
|
2479
|
+
get children() {
|
|
2480
|
+
return Fa();
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
}
|
|
2484
|
+
});
|
|
2485
|
+
}
|
|
2486
|
+
}), null), S(e, b(k, {
|
|
2487
|
+
get when() {
|
|
2488
|
+
return Q() === "empty";
|
|
2489
|
+
},
|
|
2490
|
+
get children() {
|
|
2491
|
+
return b(_e, { kind: "empty" });
|
|
2492
|
+
}
|
|
2493
|
+
}), null), x(() => w(e, "data-state", Q())), e;
|
|
2494
|
+
})();
|
|
2495
|
+
},
|
|
2496
|
+
get children() {
|
|
2497
|
+
return [
|
|
2498
|
+
b(k, {
|
|
2499
|
+
get when() {
|
|
2500
|
+
return !!(L || Ma().length);
|
|
2501
|
+
},
|
|
2502
|
+
get children() {
|
|
2503
|
+
var e = nt();
|
|
2504
|
+
return S(e, b(k, {
|
|
2505
|
+
when: L,
|
|
2506
|
+
get children() {
|
|
2507
|
+
return b(me, {
|
|
2508
|
+
"data-sheen-selection-control": "",
|
|
2509
|
+
class: "sheen-data-table-selection-control",
|
|
2510
|
+
get label() {
|
|
2511
|
+
return P().selectPage;
|
|
2512
|
+
},
|
|
2513
|
+
get checked() {
|
|
2514
|
+
return C(() => Aa().length > 0)() && ja() === Aa().length;
|
|
2515
|
+
},
|
|
2516
|
+
get indeterminate() {
|
|
2517
|
+
return C(() => ja() > 0)() && ja() < Aa().length;
|
|
2518
|
+
},
|
|
2519
|
+
get disabled() {
|
|
2520
|
+
return q() || Aa().length === 0;
|
|
2521
|
+
},
|
|
2522
|
+
onCheckedChange: Ua
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
}), null), S(e, b(k, {
|
|
2526
|
+
get when() {
|
|
2527
|
+
return Ma().length > 0;
|
|
2528
|
+
},
|
|
2529
|
+
get children() {
|
|
2530
|
+
return b(ge, {
|
|
2531
|
+
get trigger() {
|
|
2532
|
+
return P().sort;
|
|
2533
|
+
},
|
|
2534
|
+
get items() {
|
|
2535
|
+
return Ma();
|
|
2536
|
+
},
|
|
2537
|
+
get disabled() {
|
|
2538
|
+
return q();
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
}), null), e;
|
|
2543
|
+
}
|
|
2544
|
+
}),
|
|
2545
|
+
(() => {
|
|
2546
|
+
var e = rt();
|
|
2547
|
+
return S(e, b(Te, {
|
|
2548
|
+
get each() {
|
|
2549
|
+
return Oa();
|
|
2550
|
+
},
|
|
2551
|
+
children: (e) => {
|
|
2552
|
+
let n = e, r = () => Dt(n()), i = !!(t.onRowActivate || L || $ || E().length > 0), a = () => i ? Na() === n().key ? 0 : -1 : void 0;
|
|
2553
|
+
return (() => {
|
|
2554
|
+
var e = Et();
|
|
2555
|
+
return e.$$click = (e) => va(e, n()), e.$$keydown = (e) => Ga(e, n()), e.addEventListener("focus", () => la(n().key)), S(e, b(ro, { get row() {
|
|
2556
|
+
return n();
|
|
2557
|
+
} })), x((t) => {
|
|
2558
|
+
var i = n().key, o = r()?.row.id, s = Ot(n())?.group.id, c = r() && Y(r()?.row.id ?? "") ? "" : void 0, l = r()?.pending ? "" : void 0, u = r() && r()?.error !== null ? "" : void 0, d = a(), f = r()?.pending ? !0 : void 0;
|
|
2559
|
+
return i !== t.e && w(e, "data-mobile-row-key", t.e = i), o !== t.t && w(e, "data-mobile-row-id", t.t = o), s !== t.a && w(e, "data-mobile-group-id", t.a = s), c !== t.o && w(e, "data-selected", t.o = c), l !== t.i && w(e, "data-loading", t.i = l), u !== t.n && w(e, "data-load-error", t.n = u), d !== t.s && w(e, "tabindex", t.s = d), f !== t.h && w(e, "aria-busy", t.h = f), t;
|
|
2560
|
+
}, {
|
|
2561
|
+
e: void 0,
|
|
2562
|
+
t: void 0,
|
|
2563
|
+
a: void 0,
|
|
2564
|
+
o: void 0,
|
|
2565
|
+
i: void 0,
|
|
2566
|
+
n: void 0,
|
|
2567
|
+
s: void 0,
|
|
2568
|
+
h: void 0
|
|
2569
|
+
}), e;
|
|
2570
|
+
})();
|
|
2571
|
+
}
|
|
2572
|
+
})), x(() => w(e, "aria-label", P().cardView.replaceAll("{caption}", t.caption))), e;
|
|
2573
|
+
})(),
|
|
2574
|
+
b(k, {
|
|
2575
|
+
get when() {
|
|
2576
|
+
return La();
|
|
2577
|
+
},
|
|
2578
|
+
get children() {
|
|
2579
|
+
var e = it();
|
|
2580
|
+
return S(e, b(O, {
|
|
2581
|
+
get each() {
|
|
2582
|
+
return Z().filter((e) => e.definition.footer !== null);
|
|
2583
|
+
},
|
|
2584
|
+
children: (e) => (() => {
|
|
2585
|
+
var t = Ye(), n = t.firstChild, r = n.nextSibling;
|
|
2586
|
+
return S(n, () => e.definition.header), S(r, (() => {
|
|
2587
|
+
var t = C(() => typeof e.definition.footer == "function");
|
|
2588
|
+
return () => t() ? e.definition.footer(Ia()) : e.definition.footer;
|
|
2589
|
+
})()), t;
|
|
2590
|
+
})()
|
|
2591
|
+
})), e;
|
|
2592
|
+
}
|
|
2593
|
+
}),
|
|
2594
|
+
b(k, {
|
|
2595
|
+
get when() {
|
|
2596
|
+
return Da();
|
|
2597
|
+
},
|
|
2598
|
+
children: (e) => b(k, {
|
|
2599
|
+
get when() {
|
|
2600
|
+
return e().pageCount > 1;
|
|
2601
|
+
},
|
|
2602
|
+
get children() {
|
|
2603
|
+
return b(ve, {
|
|
2604
|
+
class: "sheen-data-table-mobile-pagination",
|
|
2605
|
+
get label() {
|
|
2606
|
+
return P().cardView.replaceAll("{caption}", t.caption);
|
|
2607
|
+
},
|
|
2608
|
+
get pageIndex() {
|
|
2609
|
+
return e().pageIndex;
|
|
2610
|
+
},
|
|
2611
|
+
get pageCount() {
|
|
2612
|
+
return e().pageCount;
|
|
2613
|
+
},
|
|
2614
|
+
get pending() {
|
|
2615
|
+
return qn();
|
|
2616
|
+
},
|
|
2617
|
+
get disabled() {
|
|
2618
|
+
return Jn();
|
|
2619
|
+
},
|
|
2620
|
+
onPageChange: Ha
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
2623
|
+
})
|
|
2624
|
+
})
|
|
2625
|
+
];
|
|
2626
|
+
}
|
|
2627
|
+
})), e;
|
|
2628
|
+
}
|
|
2629
|
+
}), null), S(n, b(k, {
|
|
2630
|
+
get when() {
|
|
2631
|
+
return Kr();
|
|
2632
|
+
},
|
|
2633
|
+
get children() {
|
|
2634
|
+
var e = ot(), t = e.firstChild;
|
|
2635
|
+
return e.addEventListener("animationend", Xr), S(t, () => P().selectedCount.replaceAll("{count}", br().format(Gr()))), S(e, b(O, {
|
|
2636
|
+
get each() {
|
|
2637
|
+
return E();
|
|
2638
|
+
},
|
|
2639
|
+
children: (e) => {
|
|
2640
|
+
let t = () => Vr();
|
|
2641
|
+
return b(pe, {
|
|
2642
|
+
size: "sm",
|
|
2643
|
+
get tone() {
|
|
2644
|
+
return e.tone ?? "neutral";
|
|
2645
|
+
},
|
|
2646
|
+
get disabled() {
|
|
2647
|
+
return Hr(e, t());
|
|
2648
|
+
},
|
|
2649
|
+
onClick: () => e.onSelect(Vr()),
|
|
2650
|
+
get children() {
|
|
2651
|
+
return e.label;
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2655
|
+
}), null), S(e, b(pe, {
|
|
2656
|
+
size: "sm",
|
|
2657
|
+
variant: "outline",
|
|
2658
|
+
onClick: Ir,
|
|
2659
|
+
get children() {
|
|
2660
|
+
return P().clearSelection;
|
|
2661
|
+
}
|
|
2662
|
+
}), null), x((t) => {
|
|
2663
|
+
var n = String(Jr()), r = P().selectionActions, i = !Jr() || void 0, a = !Jr();
|
|
2664
|
+
return n !== t.e && w(e, "data-open", t.e = n), r !== t.t && w(e, "aria-label", t.t = r), i !== t.a && w(e, "aria-hidden", t.a = i), a !== t.o && (e.inert = t.o = a), t;
|
|
2665
|
+
}, {
|
|
2666
|
+
e: void 0,
|
|
2667
|
+
t: void 0,
|
|
2668
|
+
a: void 0,
|
|
2669
|
+
o: void 0
|
|
2670
|
+
}), e;
|
|
2671
|
+
}
|
|
2672
|
+
}), null), S(e, b(k, {
|
|
2673
|
+
get when() {
|
|
2674
|
+
return Ea();
|
|
2675
|
+
},
|
|
2676
|
+
children: (e) => b(ve, {
|
|
2677
|
+
class: "sheen-data-table-pagination",
|
|
2678
|
+
get pageIndex() {
|
|
2679
|
+
return e().pageIndex;
|
|
2680
|
+
},
|
|
2681
|
+
get pageCount() {
|
|
2682
|
+
return e().pageCount;
|
|
2683
|
+
},
|
|
2684
|
+
get pending() {
|
|
2685
|
+
return qn();
|
|
2686
|
+
},
|
|
2687
|
+
get disabled() {
|
|
2688
|
+
return Jn();
|
|
2689
|
+
},
|
|
2690
|
+
onPageChange: lr
|
|
2691
|
+
})
|
|
2692
|
+
}), null), S(e, b(k, {
|
|
2693
|
+
when: rn,
|
|
2694
|
+
children: (e) => b(xe, { get controller() {
|
|
2695
|
+
return e();
|
|
2696
|
+
} })
|
|
2697
|
+
}), null), x((n) => {
|
|
2698
|
+
var r = Va(), a = ne(), s = ue(), c = t.variableRowHeight ? "" : void 0, l = qn() ? "" : void 0, u = Jn() ? "" : void 0, d = qn() || void 0, f = Ya(), p = za(), m = Ci();
|
|
2699
|
+
return r !== n.e && le(e, n.e = r), a !== n.t && w(e, "data-variant", n.t = a), s !== n.a && w(e, "data-sheen-density", n.a = s), c !== n.o && w(e, "data-variable-height", n.o = c), l !== n.i && w(e, "data-pending", n.i = l), u !== n.n && w(e, "data-previous-results", n.n = u), d !== n.s && w(e, "aria-busy", n.s = d), f !== n.h && w(i, "aria-rowcount", n.h = f), p !== n.r && w(i, "aria-colcount", n.r = p), m !== n.d && T(o, "grid-template-columns", n.d = m), n;
|
|
2700
|
+
}, {
|
|
2701
|
+
e: void 0,
|
|
2702
|
+
t: void 0,
|
|
2703
|
+
a: void 0,
|
|
2704
|
+
o: void 0,
|
|
2705
|
+
i: void 0,
|
|
2706
|
+
n: void 0,
|
|
2707
|
+
s: void 0,
|
|
2708
|
+
h: void 0,
|
|
2709
|
+
r: void 0,
|
|
2710
|
+
d: void 0
|
|
2711
|
+
}), e;
|
|
2712
|
+
})();
|
|
2713
|
+
}
|
|
2714
|
+
ue([
|
|
2715
|
+
"keydown",
|
|
2716
|
+
"input",
|
|
2717
|
+
"click",
|
|
2718
|
+
"pointerdown",
|
|
2719
|
+
"pointermove",
|
|
2720
|
+
"pointerup",
|
|
2721
|
+
"dblclick"
|
|
2722
|
+
]);
|
|
2723
|
+
//#endregion
|
|
2724
|
+
export { Kt as DataTable };
|