lite-table-js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +819 -921
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import e, { memo as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
2
|
-
import { AlertCircle as s, AreaChart as c, ArrowDown as l, ArrowUp as u, ArrowUpDown as d, BarChart3 as f, Bookmark as p, Check as m, ChevronDown as h, ChevronLeft as g, ChevronRight as _, ChevronsLeft as v, ChevronsRight as y, Database as b, Download as x, Edit3 as S, Filter as C, GripVertical as w, LayoutGrid as T, LineChart as E, List as D, MoreVertical as O, PieChart as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { Area as V, AreaChart as H, Bar as U, BarChart as W, CartesianGrid as G, Cell as K, Legend as q, Line as ne, LineChart as J, Pie as re, PieChart as ie, ResponsiveContainer as ae, Tooltip as oe, XAxis as se, YAxis as Y } from "recharts";
|
|
2
|
+
import { AlertCircle as s, AreaChart as c, ArrowDown as l, ArrowUp as u, ArrowUpDown as d, BarChart3 as f, Bookmark as p, Check as m, ChevronDown as h, ChevronLeft as g, ChevronRight as _, ChevronsLeft as v, ChevronsRight as y, Database as b, Download as x, Edit3 as S, Filter as C, GripVertical as w, LayoutGrid as T, LineChart as E, List as D, MoreVertical as O, PieChart as k, Plus as A, RefreshCw as j, RotateCcw as M, Save as N, Search as P, SlidersHorizontal as F, Table2 as ee, Trash2 as I, X as L } from "lucide-react";
|
|
3
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as V } from "react-dom";
|
|
6
5
|
//#region src/utils.js
|
|
7
|
-
function
|
|
6
|
+
function H(e, t) {
|
|
8
7
|
return t.split(".").reduce((e, t) => e?.[t], e);
|
|
9
8
|
}
|
|
10
|
-
function
|
|
9
|
+
function U(e, t) {
|
|
11
10
|
if (t.accessorFn) return t.accessorFn(e);
|
|
12
|
-
if (t.accessorKey) return
|
|
11
|
+
if (t.accessorKey) return H(e, t.accessorKey);
|
|
13
12
|
}
|
|
14
|
-
function
|
|
15
|
-
return typeof t == "function" ? t(e) : typeof t == "string" ? String(
|
|
13
|
+
function W(e, t, n) {
|
|
14
|
+
return typeof t == "function" ? t(e) : typeof t == "string" ? String(H(e, t)) : e.id === void 0 ? e._id === void 0 ? e.key === void 0 ? String(n) : String(e.key) : String(e._id) : String(e.id);
|
|
16
15
|
}
|
|
17
|
-
function
|
|
16
|
+
function G(e, t, n) {
|
|
18
17
|
if (!t.length) return e;
|
|
19
18
|
let r = [...e];
|
|
20
19
|
return r.sort((e, r) => {
|
|
@@ -27,31 +26,31 @@ function le(e, t, n) {
|
|
|
27
26
|
if (n !== 0) return n;
|
|
28
27
|
continue;
|
|
29
28
|
}
|
|
30
|
-
let a =
|
|
29
|
+
let a = te(U(e, t), U(r, t));
|
|
31
30
|
if (a !== 0) return i.direction === "asc" ? a : -a;
|
|
32
31
|
}
|
|
33
32
|
return 0;
|
|
34
33
|
}), r;
|
|
35
34
|
}
|
|
36
|
-
function
|
|
35
|
+
function te(e, t) {
|
|
37
36
|
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "string" && typeof t == "string" ? e.localeCompare(t, void 0, { sensitivity: "base" }) : typeof e == "number" && typeof t == "number" ? e - t : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : String(e).localeCompare(String(t));
|
|
38
37
|
}
|
|
39
|
-
function
|
|
38
|
+
function K(e, t, n, r) {
|
|
40
39
|
let i = e;
|
|
41
40
|
if (n.trim()) {
|
|
42
41
|
let e = n.toLowerCase();
|
|
43
42
|
i = i.filter((t) => r.some((n) => {
|
|
44
|
-
let r =
|
|
43
|
+
let r = U(t, n);
|
|
45
44
|
return r != null && String(r).toLowerCase().includes(e);
|
|
46
45
|
}));
|
|
47
46
|
}
|
|
48
47
|
for (let e of t) {
|
|
49
48
|
let t = r.find((t) => t.id === e.columnId);
|
|
50
|
-
t && (i = i.filter((n) =>
|
|
49
|
+
t && (i = i.filter((n) => ne(U(n, t), e)));
|
|
51
50
|
}
|
|
52
51
|
return i;
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function ne(e, t) {
|
|
55
54
|
let { value: n, operator: r = "contains" } = t;
|
|
56
55
|
if (n == null || n === "" || Array.isArray(n) && !n.length) return !0;
|
|
57
56
|
if (Array.isArray(n)) return n.includes(e);
|
|
@@ -69,59 +68,59 @@ function fe(e, t) {
|
|
|
69
68
|
default: return i.includes(a);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
function
|
|
71
|
+
function q(e, t, n) {
|
|
73
72
|
let r = (t - 1) * n;
|
|
74
73
|
return e.slice(r, r + n);
|
|
75
74
|
}
|
|
76
|
-
function
|
|
75
|
+
function J(e, t) {
|
|
77
76
|
let n = /* @__PURE__ */ new Map();
|
|
78
77
|
for (let r of e) {
|
|
79
|
-
let e =
|
|
78
|
+
let e = H(r, t), i = n.get(e) ?? [];
|
|
80
79
|
i.push(r), n.set(e, i);
|
|
81
80
|
}
|
|
82
81
|
return n;
|
|
83
82
|
}
|
|
84
|
-
function
|
|
83
|
+
function Y(e, t, n = "export") {
|
|
85
84
|
let r = t.map((e) => e.header), i = e.map((e) => t.map((t) => {
|
|
86
|
-
let n =
|
|
85
|
+
let n = U(e, t), r = String(n ?? "");
|
|
87
86
|
return r.includes(",") || r.includes("\"") || r.includes("\n") ? `"${r.replace(/"/g, "\"\"")}"` : r;
|
|
88
87
|
}));
|
|
89
|
-
|
|
88
|
+
re([r.join(","), ...i.map((e) => e.join(","))].join("\n"), `${n}.csv`, "text/csv");
|
|
90
89
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
90
|
+
function X(e, t = "export") {
|
|
91
|
+
re(JSON.stringify(e, null, 2), `${t}.json`, "application/json");
|
|
93
92
|
}
|
|
94
|
-
function
|
|
93
|
+
function re(e, t, n) {
|
|
95
94
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
96
95
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
97
96
|
}
|
|
98
|
-
function
|
|
97
|
+
function ie(e, t, n, r) {
|
|
99
98
|
if (r) {
|
|
100
99
|
r(e, t);
|
|
101
100
|
return;
|
|
102
101
|
}
|
|
103
102
|
switch (e) {
|
|
104
103
|
case "csv":
|
|
105
|
-
|
|
104
|
+
Y(t, n);
|
|
106
105
|
break;
|
|
107
106
|
case "excel":
|
|
108
|
-
|
|
107
|
+
Y(t, n, "export");
|
|
109
108
|
break;
|
|
110
109
|
case "pdf":
|
|
111
110
|
console.warn("PDF export requires a custom onExport handler");
|
|
112
111
|
break;
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
|
-
function
|
|
114
|
+
function ae(e, t, n) {
|
|
116
115
|
let r = [...e], [i] = r.splice(t, 1);
|
|
117
116
|
return r.splice(n, 0, i), r;
|
|
118
117
|
}
|
|
119
|
-
function
|
|
118
|
+
function oe(e, t, n) {
|
|
120
119
|
return Math.min(Math.max(e, t), n);
|
|
121
120
|
}
|
|
122
121
|
//#endregion
|
|
123
122
|
//#region src/hooks/useSorting.js
|
|
124
|
-
function
|
|
123
|
+
function se({ config: e, columns: t }) {
|
|
125
124
|
let [r, a] = o(e?.defaultSort ?? []), s = e?.sort !== void 0, c = s ? e.sort : r, l = n((n) => {
|
|
126
125
|
if (!t.find((e) => e.id === n)?.sortable) return;
|
|
127
126
|
let r = c.find((e) => e.columnId === n), i;
|
|
@@ -144,7 +143,7 @@ function ye({ config: e, columns: t }) {
|
|
|
144
143
|
s
|
|
145
144
|
]), u = n((e) => c.find((t) => t.columnId === e)?.direction ?? null, [c]), d = n((t) => {
|
|
146
145
|
s ? e?.onSortChange?.(t) : a(t);
|
|
147
|
-
}, [e, s]), f = n((e) =>
|
|
146
|
+
}, [e, s]), f = n((e) => G(e, c, t), [c, t]);
|
|
148
147
|
return i(() => ({
|
|
149
148
|
sorting: c,
|
|
150
149
|
toggleSort: l,
|
|
@@ -161,7 +160,7 @@ function ye({ config: e, columns: t }) {
|
|
|
161
160
|
}
|
|
162
161
|
//#endregion
|
|
163
162
|
//#region src/hooks/useFilters.js
|
|
164
|
-
function
|
|
163
|
+
function ce({ config: e, columns: t }) {
|
|
165
164
|
let [r, a] = o([]), [s, c] = o(""), [l, u] = o(e?.presets ?? []), d = e?.filters !== void 0, f = e?.globalSearch !== void 0, p = d ? e.filters : r, m = f ? e.globalSearch : s, h = n((t, n, r) => {
|
|
166
165
|
let i = p.filter((e) => e.columnId !== t);
|
|
167
166
|
n !== "" && n != null && !(Array.isArray(n) && !n.length) && i.push({
|
|
@@ -183,7 +182,7 @@ function be({ config: e, columns: t }) {
|
|
|
183
182
|
f
|
|
184
183
|
]), v = n((t) => {
|
|
185
184
|
f ? e?.onGlobalSearchChange?.(t) : c(t);
|
|
186
|
-
}, [e, f]), y = n((e) => p.find((t) => t.columnId === e)?.value ?? "", [p]), b = n((e) =>
|
|
185
|
+
}, [e, f]), y = n((e) => p.find((t) => t.columnId === e)?.value ?? "", [p]), b = n((e) => K(e, p, m, t), [
|
|
187
186
|
p,
|
|
188
187
|
m,
|
|
189
188
|
t
|
|
@@ -238,7 +237,7 @@ function be({ config: e, columns: t }) {
|
|
|
238
237
|
}
|
|
239
238
|
//#endregion
|
|
240
239
|
//#region src/hooks/usePagination.js
|
|
241
|
-
function
|
|
240
|
+
function le({ config: e, totalItems: t }) {
|
|
242
241
|
let [r, a] = o(1), [s, c] = o(e?.pageSize ?? 10), l = e?.page !== void 0, u = e?.onPageSizeChange !== void 0 && e?.pageSize !== void 0, d = l ? e.page : r, f = u ? e.pageSize : s, p = e?.pageSizeOptions ?? [
|
|
243
242
|
10,
|
|
244
243
|
25,
|
|
@@ -253,7 +252,7 @@ function xe({ config: e, totalItems: t }) {
|
|
|
253
252
|
l
|
|
254
253
|
]), _ = n((t) => {
|
|
255
254
|
c(t), e?.onPageSizeChange?.(t), l ? e?.onPageChange?.(1) : a(1);
|
|
256
|
-
}, [e, l]), v = n((e) =>
|
|
255
|
+
}, [e, l]), v = n((e) => q(e, d, f), [d, f]), y = d > h ? 1 : d;
|
|
257
256
|
return i(() => ({
|
|
258
257
|
page: y,
|
|
259
258
|
pageSize: f,
|
|
@@ -280,8 +279,8 @@ function xe({ config: e, totalItems: t }) {
|
|
|
280
279
|
}
|
|
281
280
|
//#endregion
|
|
282
281
|
//#region src/hooks/useSelection.js
|
|
283
|
-
function
|
|
284
|
-
let [r, s] = o([]), c = a(null), l = e?.mode ?? "none", u = e?.selectedKeys !== void 0, d = u ? e.selectedKeys : r, f = n((t, n) =>
|
|
282
|
+
function ue({ config: e, data: t }) {
|
|
283
|
+
let [r, s] = o([]), c = a(null), l = e?.mode ?? "none", u = e?.selectedKeys !== void 0, d = u ? e.selectedKeys : r, f = n((t, n) => W(t, e?.rowKey, n), [e?.rowKey]), p = n((n) => {
|
|
285
284
|
let r = t.filter((e, t) => n.includes(f(e, t)));
|
|
286
285
|
u || s(n), e?.onSelectionChange?.(n, r);
|
|
287
286
|
}, [
|
|
@@ -368,7 +367,7 @@ function Se({ config: e, data: t }) {
|
|
|
368
367
|
}
|
|
369
368
|
//#endregion
|
|
370
369
|
//#region src/hooks/useColumnManager.js
|
|
371
|
-
function
|
|
370
|
+
function de({ columns: e, enableVisibility: t = !1, enableResizing: r = !1, enableReordering: a = !1 }) {
|
|
372
371
|
let [s, c] = o(() => {
|
|
373
372
|
let t = /* @__PURE__ */ new Set();
|
|
374
373
|
return e.forEach((e) => {
|
|
@@ -385,18 +384,18 @@ function Ce({ columns: e, enableVisibility: t = !1, enableResizing: r = !1, enab
|
|
|
385
384
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
386
385
|
});
|
|
387
386
|
}, [t]), m = n((e, t) => {
|
|
388
|
-
a && u((n) =>
|
|
387
|
+
a && u((n) => ae(n, e, t));
|
|
389
388
|
}, [a]), h = n((e, t) => {
|
|
390
389
|
!a || e === t || u((n) => {
|
|
391
390
|
let r = n.indexOf(e), i = n.indexOf(t);
|
|
392
|
-
return r === -1 || i === -1 ? n :
|
|
391
|
+
return r === -1 || i === -1 ? n : ae(n, r, i);
|
|
393
392
|
});
|
|
394
393
|
}, [a]), g = n((t, n) => {
|
|
395
394
|
if (!r) return;
|
|
396
395
|
let i = e.find((e) => e.id === t), a = i?.minWidth ?? 50, o = i?.maxWidth ?? 1e3;
|
|
397
396
|
f((e) => ({
|
|
398
397
|
...e,
|
|
399
|
-
[t]:
|
|
398
|
+
[t]: oe(n, a, o)
|
|
400
399
|
}));
|
|
401
400
|
}, [r, e]), _ = i(() => {
|
|
402
401
|
let t = l.map((t) => e.find((e) => e.id === t)).filter((e) => e != null && !s.has(e.id)), n = new Set(l), r = e.filter((e) => !n.has(e.id) && !s.has(e.id));
|
|
@@ -448,7 +447,7 @@ function Ce({ columns: e, enableVisibility: t = !1, enableResizing: r = !1, enab
|
|
|
448
447
|
}
|
|
449
448
|
//#endregion
|
|
450
449
|
//#region src/hooks/usePersistence.js
|
|
451
|
-
function
|
|
450
|
+
function fe({ persistKey: e, syncUrl: t, state: i, onRestore: a }) {
|
|
452
451
|
let o = n(() => {
|
|
453
452
|
if (e) try {
|
|
454
453
|
let t = {
|
|
@@ -518,25 +517,25 @@ function we({ persistKey: e, syncUrl: t, state: i, onRestore: a }) {
|
|
|
518
517
|
}
|
|
519
518
|
//#endregion
|
|
520
519
|
//#region src/hooks/usePresets.js
|
|
521
|
-
var
|
|
522
|
-
function
|
|
523
|
-
return `${
|
|
520
|
+
var pe = "datatable_presets_";
|
|
521
|
+
function me(e) {
|
|
522
|
+
return `${pe}${e}`;
|
|
524
523
|
}
|
|
525
|
-
function
|
|
524
|
+
function he(e) {
|
|
526
525
|
try {
|
|
527
|
-
let t = localStorage.getItem(
|
|
526
|
+
let t = localStorage.getItem(me(e));
|
|
528
527
|
return t ? JSON.parse(t) : [];
|
|
529
528
|
} catch {
|
|
530
529
|
return [];
|
|
531
530
|
}
|
|
532
531
|
}
|
|
533
|
-
function
|
|
532
|
+
function Z(e, t) {
|
|
534
533
|
try {
|
|
535
|
-
localStorage.setItem(
|
|
534
|
+
localStorage.setItem(me(e), JSON.stringify(t));
|
|
536
535
|
} catch {}
|
|
537
536
|
}
|
|
538
|
-
function
|
|
539
|
-
let [t, r] = o(() =>
|
|
537
|
+
function ge({ tableId: e }) {
|
|
538
|
+
let [t, r] = o(() => he(e)), a = n((t, n) => {
|
|
540
539
|
let i = Date.now(), a = {
|
|
541
540
|
id: `preset_${i}_${Math.random().toString(36).slice(2, 8)}`,
|
|
542
541
|
name: t,
|
|
@@ -546,7 +545,7 @@ function ke({ tableId: e }) {
|
|
|
546
545
|
};
|
|
547
546
|
return r((t) => {
|
|
548
547
|
let n = [...t, a];
|
|
549
|
-
return
|
|
548
|
+
return Z(e, n), n;
|
|
550
549
|
}), a;
|
|
551
550
|
}, [e]), s = n((e) => t.find((t) => t.name === e)?.config ?? null, [t]), c = n((e) => t.find((t) => t.id === e)?.config ?? null, [t]), l = n((t, n) => {
|
|
552
551
|
r((r) => {
|
|
@@ -558,12 +557,12 @@ function ke({ tableId: e }) {
|
|
|
558
557
|
},
|
|
559
558
|
updatedAt: Date.now()
|
|
560
559
|
} : e);
|
|
561
|
-
return
|
|
560
|
+
return Z(e, i), i;
|
|
562
561
|
});
|
|
563
562
|
}, [e]), u = n((t) => {
|
|
564
563
|
r((n) => {
|
|
565
564
|
let r = n.filter((e) => e.id !== t);
|
|
566
|
-
return
|
|
565
|
+
return Z(e, r), r;
|
|
567
566
|
});
|
|
568
567
|
}, [e]), d = n((t, n) => {
|
|
569
568
|
r((r) => {
|
|
@@ -572,10 +571,10 @@ function ke({ tableId: e }) {
|
|
|
572
571
|
name: n,
|
|
573
572
|
updatedAt: Date.now()
|
|
574
573
|
} : e);
|
|
575
|
-
return
|
|
574
|
+
return Z(e, i), i;
|
|
576
575
|
});
|
|
577
576
|
}, [e]), f = n(() => {
|
|
578
|
-
r([]),
|
|
577
|
+
r([]), Z(e, []);
|
|
579
578
|
}, [e]);
|
|
580
579
|
return i(() => ({
|
|
581
580
|
presets: t,
|
|
@@ -599,7 +598,7 @@ function ke({ tableId: e }) {
|
|
|
599
598
|
}
|
|
600
599
|
//#endregion
|
|
601
600
|
//#region src/themes.js
|
|
602
|
-
var
|
|
601
|
+
var _e = {
|
|
603
602
|
background: "#ffffff",
|
|
604
603
|
foreground: "#111827",
|
|
605
604
|
primary: "#2563eb",
|
|
@@ -610,7 +609,7 @@ var Ae = {
|
|
|
610
609
|
selected: "#eff6ff",
|
|
611
610
|
surface: "#f9fafb",
|
|
612
611
|
textSecondary: "#6b7280"
|
|
613
|
-
},
|
|
612
|
+
}, ve = {
|
|
614
613
|
background: "#111827",
|
|
615
614
|
foreground: "#f3f4f6",
|
|
616
615
|
primary: "#3b82f6",
|
|
@@ -621,7 +620,7 @@ var Ae = {
|
|
|
621
620
|
selected: "#1e3a5f",
|
|
622
621
|
surface: "#1f2937",
|
|
623
622
|
textSecondary: "#9ca3af"
|
|
624
|
-
},
|
|
623
|
+
}, ye = {
|
|
625
624
|
background: "#ffffff",
|
|
626
625
|
foreground: "#1e1b4b",
|
|
627
626
|
primary: "#7c3aed",
|
|
@@ -632,7 +631,7 @@ var Ae = {
|
|
|
632
631
|
selected: "#ede9fe",
|
|
633
632
|
surface: "#f8f7ff",
|
|
634
633
|
textSecondary: "#6d28d9"
|
|
635
|
-
},
|
|
634
|
+
}, Q = {
|
|
636
635
|
background: "#ffffff",
|
|
637
636
|
foreground: "#1a1a2e",
|
|
638
637
|
primary: "#0f766e",
|
|
@@ -643,18 +642,18 @@ var Ae = {
|
|
|
643
642
|
selected: "#f0fdfa",
|
|
644
643
|
surface: "#f8fafc",
|
|
645
644
|
textSecondary: "#64748b"
|
|
646
|
-
},
|
|
645
|
+
}, $ = {
|
|
647
646
|
fontFamily: "inherit",
|
|
648
647
|
fontSize: "0.875rem",
|
|
649
648
|
headerFontSize: "0.75rem",
|
|
650
649
|
headerFontWeight: 600
|
|
651
|
-
},
|
|
650
|
+
}, be = {
|
|
652
651
|
cellPaddingX: "1rem",
|
|
653
652
|
cellPaddingY: "0.5rem",
|
|
654
653
|
compactCellPaddingY: "0.25rem",
|
|
655
654
|
rowHeight: "2.5rem"
|
|
656
655
|
};
|
|
657
|
-
function
|
|
656
|
+
function xe(e) {
|
|
658
657
|
return {
|
|
659
658
|
"--dt-bg": e.background,
|
|
660
659
|
"--dt-surface": e.surface,
|
|
@@ -668,7 +667,7 @@ function Ie(e) {
|
|
|
668
667
|
"--dt-muted": e.muted
|
|
669
668
|
};
|
|
670
669
|
}
|
|
671
|
-
function
|
|
670
|
+
function Se(e, t, n = $, r = be, i) {
|
|
672
671
|
return {
|
|
673
672
|
name: e,
|
|
674
673
|
colors: t,
|
|
@@ -713,24 +712,24 @@ function Le(e, t, n = Pe, r = Fe, i) {
|
|
|
713
712
|
fontSize: "0.75rem",
|
|
714
713
|
boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
|
|
715
714
|
},
|
|
716
|
-
cssVariables:
|
|
715
|
+
cssVariables: xe(t),
|
|
717
716
|
...i
|
|
718
717
|
};
|
|
719
718
|
}
|
|
720
|
-
var
|
|
721
|
-
|
|
719
|
+
var Ce = Se("light", _e), we = Se("dark", ve), Te = Se("quartz", ye), Ee = Se("alpine", Q, {
|
|
720
|
+
...$,
|
|
722
721
|
fontFamily: "'Inter', system-ui, sans-serif",
|
|
723
722
|
headerFontWeight: 700
|
|
724
723
|
}, {
|
|
725
|
-
...
|
|
724
|
+
...be,
|
|
726
725
|
cellPaddingY: "0.625rem"
|
|
727
|
-
}),
|
|
728
|
-
light:
|
|
729
|
-
dark:
|
|
730
|
-
quartz:
|
|
731
|
-
alpine:
|
|
726
|
+
}), De = {
|
|
727
|
+
light: Ce,
|
|
728
|
+
dark: we,
|
|
729
|
+
quartz: Te,
|
|
730
|
+
alpine: Ee
|
|
732
731
|
};
|
|
733
|
-
function
|
|
732
|
+
function Oe(e, t) {
|
|
734
733
|
let n = e.colors && t.colors ? {
|
|
735
734
|
...e.colors,
|
|
736
735
|
...t.colors
|
|
@@ -793,18 +792,18 @@ function Ue(e, t) {
|
|
|
793
792
|
}
|
|
794
793
|
//#endregion
|
|
795
794
|
//#region src/hooks/useTheme.js
|
|
796
|
-
var
|
|
797
|
-
function
|
|
795
|
+
var ke = "datatable_theme_";
|
|
796
|
+
function Ae({ themeConfig: e, persistKey: t }) {
|
|
798
797
|
let [r, a] = o(() => {
|
|
799
798
|
if (t) try {
|
|
800
|
-
return localStorage.getItem(`${
|
|
799
|
+
return localStorage.getItem(`${ke}${t}`) ?? e?.name ?? "light";
|
|
801
800
|
} catch {}
|
|
802
801
|
return e?.name ?? "light";
|
|
803
802
|
}), s = n((e) => {
|
|
804
803
|
if (a(e), t) try {
|
|
805
|
-
localStorage.setItem(`${
|
|
804
|
+
localStorage.setItem(`${ke}${t}`, e);
|
|
806
805
|
} catch {}
|
|
807
|
-
}, [t]), c = i(() => e || (
|
|
806
|
+
}, [t]), c = i(() => e || (De[r] ?? De.light), [e, r]), l = i(() => c?.cssVariables ?? void 0, [c]), u = i(() => (e, t, n, r) => {
|
|
808
807
|
let i = { ...c.row };
|
|
809
808
|
if (n && c.selectedRow ? i = {
|
|
810
809
|
...i,
|
|
@@ -860,7 +859,7 @@ function Ge({ themeConfig: e, persistKey: t }) {
|
|
|
860
859
|
}
|
|
861
860
|
//#endregion
|
|
862
861
|
//#region src/hooks/useVirtualization.js
|
|
863
|
-
function
|
|
862
|
+
function je({ totalItems: e, config: t }) {
|
|
864
863
|
let s = t?.enabled ?? !1, c = t?.rowHeight ?? 40, l = t?.overscan ?? 5, u = a(null), [d, f] = o(0), [p, m] = o(0);
|
|
865
864
|
r(() => {
|
|
866
865
|
if (!s) return;
|
|
@@ -919,7 +918,7 @@ function Ke({ totalItems: e, config: t }) {
|
|
|
919
918
|
}
|
|
920
919
|
//#endregion
|
|
921
920
|
//#region src/hooks/useRowGrouping.js
|
|
922
|
-
function
|
|
921
|
+
function Me(e, t) {
|
|
923
922
|
if (!e.length) return null;
|
|
924
923
|
switch (t) {
|
|
925
924
|
case "sum": return e.reduce((e, t) => Number(e) + Number(t), 0);
|
|
@@ -932,7 +931,7 @@ function qe(e, t) {
|
|
|
932
931
|
default: return e.length;
|
|
933
932
|
}
|
|
934
933
|
}
|
|
935
|
-
function
|
|
934
|
+
function Ne({ config: e, columns: t }) {
|
|
936
935
|
let [r, a] = o(() => e?.defaultExpanded ? new Set(["__all__"]) : /* @__PURE__ */ new Set()), s = n((e) => r.has("__all__") || r.has(e), [r]), c = n((e) => {
|
|
937
936
|
a((t) => {
|
|
938
937
|
let n = new Set(t);
|
|
@@ -945,7 +944,7 @@ function Je({ config: e, columns: t }) {
|
|
|
945
944
|
if (n >= r.length) return e;
|
|
946
945
|
let c = r[n], l = /* @__PURE__ */ new Map();
|
|
947
946
|
for (let t of e) {
|
|
948
|
-
let e =
|
|
947
|
+
let e = H(t, c) ?? "__null__";
|
|
949
948
|
l.has(e) || l.set(e, []), l.get(e).push(t);
|
|
950
949
|
}
|
|
951
950
|
let u = [];
|
|
@@ -953,7 +952,7 @@ function Je({ config: e, columns: t }) {
|
|
|
953
952
|
let l = `${o}${c}:${e}`, d = {};
|
|
954
953
|
for (let [e, n] of Object.entries(i)) {
|
|
955
954
|
let i = t.find((t) => t.id === e);
|
|
956
|
-
i && (d[e] =
|
|
955
|
+
i && (d[e] = Me(r.map((e) => U(e, i)), n));
|
|
957
956
|
}
|
|
958
957
|
u.push({
|
|
959
958
|
__isGroupRow: !0,
|
|
@@ -993,8 +992,8 @@ function Je({ config: e, columns: t }) {
|
|
|
993
992
|
}
|
|
994
993
|
//#endregion
|
|
995
994
|
//#region src/hooks/useTreeData.js
|
|
996
|
-
function
|
|
997
|
-
let [r, a] = o(() => e?.defaultExpanded ? new Set(["__all__"]) : /* @__PURE__ */ new Set()), s = n((e, n) => typeof t == "function" ? t(e) : typeof t == "string" ? String(
|
|
995
|
+
function Pe({ config: e, rowKey: t }) {
|
|
996
|
+
let [r, a] = o(() => e?.defaultExpanded ? new Set(["__all__"]) : /* @__PURE__ */ new Set()), s = n((e, n) => typeof t == "function" ? t(e) : typeof t == "string" ? String(H(e, t)) : e.id === void 0 ? String(n) : String(e.id), [t]), c = n((e) => r.has("__all__") || r.has(e), [r]), l = n((e) => {
|
|
998
997
|
a((t) => {
|
|
999
998
|
let n = new Set(t);
|
|
1000
999
|
return n.has("__all__") ? (n.delete("__all__"), n.delete(e), n) : (n.has(e) ? n.delete(e) : n.add(e), n);
|
|
@@ -1010,7 +1009,7 @@ function Ye({ config: e, rowKey: t }) {
|
|
|
1010
1009
|
let n = e.childrenField, r = [];
|
|
1011
1010
|
function i(e, t, a) {
|
|
1012
1011
|
e.forEach((e, o) => {
|
|
1013
|
-
let l = s(e, a + o), u =
|
|
1012
|
+
let l = s(e, a + o), u = H(e, n), d = Array.isArray(u) && u.length > 0, f = d && c(l);
|
|
1014
1013
|
r.push({
|
|
1015
1014
|
row: e,
|
|
1016
1015
|
level: t,
|
|
@@ -1044,7 +1043,7 @@ function Ye({ config: e, rowKey: t }) {
|
|
|
1044
1043
|
}
|
|
1045
1044
|
//#endregion
|
|
1046
1045
|
//#region src/hooks/useEditing.js
|
|
1047
|
-
function
|
|
1046
|
+
function Fe({ config: e, columns: t, data: r, getKey: a }) {
|
|
1048
1047
|
let [s, c] = o(null), [l, u] = o(null), [d, f] = o({}), [p, m] = o({}), h = n((e, t) => c({
|
|
1049
1048
|
rowKey: e,
|
|
1050
1049
|
columnId: t
|
|
@@ -1074,7 +1073,7 @@ function Xe({ config: e, columns: t, data: r, getKey: a }) {
|
|
|
1074
1073
|
if (!i) return;
|
|
1075
1074
|
let o = {};
|
|
1076
1075
|
t.forEach((e) => {
|
|
1077
|
-
e.editable && (o[e.id] =
|
|
1076
|
+
e.editable && (o[e.id] = U(i, e));
|
|
1078
1077
|
}), u(n), f(o), m({});
|
|
1079
1078
|
}, [
|
|
1080
1079
|
e?.enabled,
|
|
@@ -1151,22 +1150,22 @@ function Xe({ config: e, columns: t, data: r, getKey: a }) {
|
|
|
1151
1150
|
}
|
|
1152
1151
|
//#endregion
|
|
1153
1152
|
//#region src/hooks/useChartConfig.js
|
|
1154
|
-
var
|
|
1155
|
-
function
|
|
1153
|
+
var Ie = "datatable_charts_";
|
|
1154
|
+
function Le(e) {
|
|
1156
1155
|
try {
|
|
1157
|
-
let t = localStorage.getItem(`${
|
|
1156
|
+
let t = localStorage.getItem(`${Ie}${e}`);
|
|
1158
1157
|
return t ? JSON.parse(t) : [];
|
|
1159
1158
|
} catch {
|
|
1160
1159
|
return [];
|
|
1161
1160
|
}
|
|
1162
1161
|
}
|
|
1163
|
-
function
|
|
1162
|
+
function Re(e, t) {
|
|
1164
1163
|
try {
|
|
1165
|
-
localStorage.setItem(`${
|
|
1164
|
+
localStorage.setItem(`${Ie}${e}`, JSON.stringify(t));
|
|
1166
1165
|
} catch {}
|
|
1167
1166
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let t = e ?? "__default__", [r, a] = o(() =>
|
|
1167
|
+
function ze({ tableId: e } = {}) {
|
|
1168
|
+
let t = e ?? "__default__", [r, a] = o(() => Le(t)), [s, c] = o(!1), [l, u] = o(null), d = n((e) => {
|
|
1170
1169
|
let n = {
|
|
1171
1170
|
id: `chart_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
|
|
1172
1171
|
config: {
|
|
@@ -1177,7 +1176,7 @@ function et({ tableId: e } = {}) {
|
|
|
1177
1176
|
};
|
|
1178
1177
|
return a((e) => {
|
|
1179
1178
|
let r = [...e, n];
|
|
1180
|
-
return
|
|
1179
|
+
return Re(t, r), r;
|
|
1181
1180
|
}), n;
|
|
1182
1181
|
}, [t]), f = n((e, n) => {
|
|
1183
1182
|
a((r) => {
|
|
@@ -1188,15 +1187,15 @@ function et({ tableId: e } = {}) {
|
|
|
1188
1187
|
...n
|
|
1189
1188
|
}
|
|
1190
1189
|
} : t);
|
|
1191
|
-
return
|
|
1190
|
+
return Re(t, i), i;
|
|
1192
1191
|
});
|
|
1193
1192
|
}, [t]), p = n((e) => {
|
|
1194
1193
|
a((n) => {
|
|
1195
1194
|
let r = n.filter((t) => t.id !== e);
|
|
1196
|
-
return
|
|
1195
|
+
return Re(t, r), r;
|
|
1197
1196
|
});
|
|
1198
1197
|
}, [t]), m = n(() => {
|
|
1199
|
-
a([]),
|
|
1198
|
+
a([]), Re(t, []);
|
|
1200
1199
|
}, [t]), h = n((e) => {
|
|
1201
1200
|
u(e ?? null), c(!0);
|
|
1202
1201
|
}, []), g = n(() => {
|
|
@@ -1228,80 +1227,80 @@ function et({ tableId: e } = {}) {
|
|
|
1228
1227
|
}
|
|
1229
1228
|
//#endregion
|
|
1230
1229
|
//#region src/hooks/useDataTable.js
|
|
1231
|
-
function
|
|
1232
|
-
let { data: t, columns: a, mode: s = "client", serverSide: c, loading: l = !1, sorting: u, filtering: d, pagination: f, selection: p, expandable: m, plugins: h = [], viewMode: g, onViewModeChange: _, columnVisibility: v = !1, columnResizing: y = !1, columnReordering: b = !1, persistKey: x, syncUrl: S, themeConfig: C, rowGrouping: w, treeData: T, rowPinning: E, virtualization: D, rowEditing: O } = e, [
|
|
1233
|
-
_ ? _(e) :
|
|
1234
|
-
}, [_]), [
|
|
1235
|
-
let t =
|
|
1236
|
-
m?.onExpandChange ? m.onExpandChange(t) :
|
|
1237
|
-
}, [
|
|
1230
|
+
function Be(e) {
|
|
1231
|
+
let { data: t, columns: a, mode: s = "client", serverSide: c, loading: l = !1, sorting: u, filtering: d, pagination: f, selection: p, expandable: m, plugins: h = [], viewMode: g, onViewModeChange: _, columnVisibility: v = !1, columnResizing: y = !1, columnReordering: b = !1, persistKey: x, syncUrl: S, themeConfig: C, rowGrouping: w, treeData: T, rowPinning: E, virtualization: D, rowEditing: O } = e, [k, A] = o(g ?? "table"), j = g ?? k, M = n((e) => {
|
|
1232
|
+
_ ? _(e) : A(e);
|
|
1233
|
+
}, [_]), [N, P] = o([]), F = m?.expandedKeys ?? N, ee = n((e) => {
|
|
1234
|
+
let t = F.includes(e) ? F.filter((t) => t !== e) : [...F, e];
|
|
1235
|
+
m?.onExpandChange ? m.onExpandChange(t) : P(t);
|
|
1236
|
+
}, [F, m]), I = n((e, t) => W(e, p?.rowKey, t), [p?.rowKey]), L = Fe({
|
|
1238
1237
|
config: O,
|
|
1239
1238
|
columns: a,
|
|
1240
1239
|
data: t,
|
|
1241
|
-
getKey:
|
|
1242
|
-
}),
|
|
1240
|
+
getKey: I
|
|
1241
|
+
}), R = L.editingCell, z = L.startCellEdit, B = de({
|
|
1243
1242
|
columns: a,
|
|
1244
1243
|
enableVisibility: v,
|
|
1245
1244
|
enableResizing: y,
|
|
1246
1245
|
enableReordering: b
|
|
1247
|
-
}),
|
|
1246
|
+
}), V = se({
|
|
1248
1247
|
config: u,
|
|
1249
1248
|
columns: a
|
|
1250
|
-
}),
|
|
1249
|
+
}), H = ce({
|
|
1251
1250
|
config: d,
|
|
1252
1251
|
columns: a
|
|
1253
|
-
}),
|
|
1252
|
+
}), U = Ae({ themeConfig: C }), G = Ne({
|
|
1254
1253
|
config: w,
|
|
1255
1254
|
columns: a
|
|
1256
|
-
}),
|
|
1255
|
+
}), te = Pe({
|
|
1257
1256
|
config: T,
|
|
1258
1257
|
rowKey: p?.rowKey
|
|
1259
|
-
}),
|
|
1260
|
-
|
|
1258
|
+
}), K = ge({ tableId: x ?? "__default__" }), ne = ze({ tableId: x }), [q, J] = o(E?.pinnedTop ?? []), [Y, X] = o(E?.pinnedBottom ?? []), re = n((e, t) => {
|
|
1259
|
+
J((t) => t.filter((t) => t !== e)), X((t) => t.filter((t) => t !== e)), t === "top" && J((t) => [...t, e]), t === "bottom" && X((t) => [...t, e]), E?.onPinChange?.(t === "top" ? [...q, e] : q.filter((t) => t !== e), t === "bottom" ? [...Y, e] : Y.filter((t) => t !== e));
|
|
1261
1260
|
}, [
|
|
1262
1261
|
q,
|
|
1263
|
-
|
|
1262
|
+
Y,
|
|
1264
1263
|
E
|
|
1265
|
-
]), [
|
|
1264
|
+
]), [ie, ae] = o([]), [oe, pe] = o(0), [me, he] = o(!1), Z = i(() => s === "server" ? ie : H.applyFilters(t), [
|
|
1266
1265
|
s,
|
|
1267
1266
|
t,
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
]),
|
|
1267
|
+
ie,
|
|
1268
|
+
H
|
|
1269
|
+
]), _e = i(() => s === "server" ? Z : V.applySorting(Z), [
|
|
1271
1270
|
s,
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
]),
|
|
1275
|
-
let e =
|
|
1276
|
-
for (let t of h) t.processData && (e = t.processData(e,
|
|
1271
|
+
Z,
|
|
1272
|
+
V
|
|
1273
|
+
]), ve = i(() => {
|
|
1274
|
+
let e = _e;
|
|
1275
|
+
for (let t of h) t.processData && (e = t.processData(e, Se));
|
|
1277
1276
|
return e;
|
|
1278
|
-
}, [
|
|
1277
|
+
}, [_e, h]), ye = s === "server" ? oe : ve.length, Q = le({
|
|
1279
1278
|
config: f,
|
|
1280
|
-
totalItems:
|
|
1281
|
-
}), $ = i(() => s === "server" || Q.isInfinite ?
|
|
1279
|
+
totalItems: ye
|
|
1280
|
+
}), $ = i(() => s === "server" || Q.isInfinite ? ve : Q.applyPagination(ve), [
|
|
1282
1281
|
s,
|
|
1283
|
-
|
|
1282
|
+
ve,
|
|
1284
1283
|
Q
|
|
1285
|
-
]),
|
|
1284
|
+
]), be = je({
|
|
1286
1285
|
totalItems: $.length,
|
|
1287
1286
|
config: D
|
|
1288
|
-
}),
|
|
1287
|
+
}), xe = ue({
|
|
1289
1288
|
config: p,
|
|
1290
1289
|
data: t
|
|
1291
1290
|
});
|
|
1292
1291
|
r(() => {
|
|
1293
1292
|
if (s !== "server" || !c?.onFetch) return;
|
|
1294
1293
|
let e = !1;
|
|
1295
|
-
return
|
|
1294
|
+
return he(!0), c.onFetch({
|
|
1296
1295
|
page: Q.page,
|
|
1297
1296
|
pageSize: Q.pageSize,
|
|
1298
|
-
sort:
|
|
1299
|
-
filters:
|
|
1300
|
-
globalSearch:
|
|
1297
|
+
sort: V.sorting,
|
|
1298
|
+
filters: H.filters,
|
|
1299
|
+
globalSearch: H.globalSearch
|
|
1301
1300
|
}).then((t) => {
|
|
1302
|
-
e || (
|
|
1301
|
+
e || (ae(t.data), pe(t.totalItems));
|
|
1303
1302
|
}).finally(() => {
|
|
1304
|
-
e ||
|
|
1303
|
+
e || he(!1);
|
|
1305
1304
|
}), () => {
|
|
1306
1305
|
e = !0;
|
|
1307
1306
|
};
|
|
@@ -1310,151 +1309,151 @@ function tt(e) {
|
|
|
1310
1309
|
c,
|
|
1311
1310
|
Q.page,
|
|
1312
1311
|
Q.pageSize,
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1312
|
+
V.sorting,
|
|
1313
|
+
H.filters,
|
|
1314
|
+
H.globalSearch
|
|
1316
1315
|
]);
|
|
1317
|
-
let
|
|
1316
|
+
let Se = i(() => ({
|
|
1318
1317
|
data: t,
|
|
1319
1318
|
processedData: $,
|
|
1320
1319
|
columns: a,
|
|
1321
|
-
visibleColumns:
|
|
1322
|
-
sorting:
|
|
1323
|
-
filters:
|
|
1324
|
-
globalSearch:
|
|
1320
|
+
visibleColumns: B.visibleColumns,
|
|
1321
|
+
sorting: V.sorting,
|
|
1322
|
+
filters: H.filters,
|
|
1323
|
+
globalSearch: H.globalSearch,
|
|
1325
1324
|
page: Q.page,
|
|
1326
1325
|
pageSize: Q.pageSize,
|
|
1327
|
-
totalItems:
|
|
1328
|
-
selectedKeys:
|
|
1329
|
-
expandedKeys:
|
|
1330
|
-
viewMode:
|
|
1331
|
-
columnOrder:
|
|
1332
|
-
columnWidths:
|
|
1333
|
-
editingCell:
|
|
1326
|
+
totalItems: ye,
|
|
1327
|
+
selectedKeys: xe.selectedKeys,
|
|
1328
|
+
expandedKeys: F,
|
|
1329
|
+
viewMode: j,
|
|
1330
|
+
columnOrder: B.columnOrder,
|
|
1331
|
+
columnWidths: B.columnWidths,
|
|
1332
|
+
editingCell: R
|
|
1334
1333
|
}), [
|
|
1335
1334
|
t,
|
|
1336
1335
|
$,
|
|
1337
1336
|
a,
|
|
1338
|
-
z,
|
|
1339
1337
|
B,
|
|
1340
1338
|
V,
|
|
1339
|
+
H,
|
|
1341
1340
|
Q,
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1341
|
+
ye,
|
|
1342
|
+
xe,
|
|
1343
|
+
F,
|
|
1344
|
+
j,
|
|
1345
|
+
R
|
|
1347
1346
|
]);
|
|
1348
|
-
|
|
1347
|
+
fe({
|
|
1349
1348
|
persistKey: x,
|
|
1350
1349
|
syncUrl: S,
|
|
1351
1350
|
state: {
|
|
1352
|
-
sorting:
|
|
1353
|
-
filters:
|
|
1354
|
-
globalSearch:
|
|
1351
|
+
sorting: V.sorting,
|
|
1352
|
+
filters: H.filters,
|
|
1353
|
+
globalSearch: H.globalSearch,
|
|
1355
1354
|
page: Q.page,
|
|
1356
1355
|
pageSize: Q.pageSize,
|
|
1357
|
-
viewMode:
|
|
1358
|
-
hiddenColumns:
|
|
1359
|
-
columnOrder:
|
|
1356
|
+
viewMode: j,
|
|
1357
|
+
hiddenColumns: B.hiddenColumns,
|
|
1358
|
+
columnOrder: B.columnOrder
|
|
1360
1359
|
}
|
|
1361
1360
|
});
|
|
1362
|
-
let
|
|
1363
|
-
columnOrder:
|
|
1364
|
-
hiddenColumns: Array.from(
|
|
1365
|
-
columnWidths:
|
|
1366
|
-
sorting:
|
|
1367
|
-
filters:
|
|
1368
|
-
globalSearch:
|
|
1361
|
+
let Ce = n(() => ({
|
|
1362
|
+
columnOrder: B.columnOrder,
|
|
1363
|
+
hiddenColumns: Array.from(B.hiddenColumns),
|
|
1364
|
+
columnWidths: B.columnWidths,
|
|
1365
|
+
sorting: V.sorting,
|
|
1366
|
+
filters: H.filters,
|
|
1367
|
+
globalSearch: H.globalSearch,
|
|
1369
1368
|
pageSize: Q.pageSize,
|
|
1370
|
-
viewMode:
|
|
1369
|
+
viewMode: j
|
|
1371
1370
|
}), [
|
|
1372
|
-
z,
|
|
1373
1371
|
B,
|
|
1374
1372
|
V,
|
|
1373
|
+
H,
|
|
1375
1374
|
Q,
|
|
1376
|
-
|
|
1377
|
-
]),
|
|
1378
|
-
let t =
|
|
1379
|
-
t && (t.columnOrder?.length &&
|
|
1375
|
+
j
|
|
1376
|
+
]), we = n((e) => {
|
|
1377
|
+
let t = K.loadPresetById(e);
|
|
1378
|
+
t && (t.columnOrder?.length && B.setColumnOrderIds(t.columnOrder), t.hiddenColumns && B.setHiddenColumnIds(t.hiddenColumns), t.columnWidths && B.setColumnWidthMap(t.columnWidths), V.setSorting(t.sorting ?? []), H.setFilters(t.filters ?? []), H.setGlobalSearch(t.globalSearch ?? ""), t.pageSize && Q.setPageSize(t.pageSize), t.viewMode && M(t.viewMode));
|
|
1380
1379
|
}, [
|
|
1381
|
-
|
|
1382
|
-
z,
|
|
1380
|
+
K,
|
|
1383
1381
|
B,
|
|
1384
1382
|
V,
|
|
1383
|
+
H,
|
|
1385
1384
|
Q,
|
|
1386
|
-
|
|
1387
|
-
]),
|
|
1385
|
+
M
|
|
1386
|
+
]), Te = i(() => $.filter((e, t) => q.includes(I(e, t))), [
|
|
1388
1387
|
$,
|
|
1389
1388
|
q,
|
|
1390
|
-
|
|
1391
|
-
]),
|
|
1389
|
+
I
|
|
1390
|
+
]), Ee = i(() => $.filter((e, t) => Y.includes(I(e, t))), [
|
|
1392
1391
|
$,
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
]),
|
|
1396
|
-
let n =
|
|
1397
|
-
return !q.includes(n) && !
|
|
1392
|
+
Y,
|
|
1393
|
+
I
|
|
1394
|
+
]), De = i(() => $.filter((e, t) => {
|
|
1395
|
+
let n = I(e, t);
|
|
1396
|
+
return !q.includes(n) && !Y.includes(n);
|
|
1398
1397
|
}), [
|
|
1399
1398
|
$,
|
|
1400
1399
|
q,
|
|
1401
|
-
|
|
1402
|
-
|
|
1400
|
+
Y,
|
|
1401
|
+
I
|
|
1403
1402
|
]);
|
|
1404
1403
|
return {
|
|
1405
|
-
state:
|
|
1404
|
+
state: Se,
|
|
1406
1405
|
processedData: $,
|
|
1407
|
-
allFilteredData:
|
|
1408
|
-
loading: l ||
|
|
1409
|
-
sorting:
|
|
1410
|
-
filtering:
|
|
1406
|
+
allFilteredData: ve,
|
|
1407
|
+
loading: l || me,
|
|
1408
|
+
sorting: V,
|
|
1409
|
+
filtering: H,
|
|
1411
1410
|
pagination: Q,
|
|
1412
|
-
selection:
|
|
1413
|
-
columnManager:
|
|
1414
|
-
viewMode:
|
|
1415
|
-
setViewMode:
|
|
1416
|
-
expandedKeys:
|
|
1417
|
-
toggleExpand:
|
|
1418
|
-
editingCell:
|
|
1419
|
-
setEditingCell:
|
|
1420
|
-
editing:
|
|
1421
|
-
theme:
|
|
1422
|
-
rowGrouping:
|
|
1423
|
-
treeData:
|
|
1424
|
-
presets:
|
|
1425
|
-
chartConfig:
|
|
1426
|
-
virtualization:
|
|
1427
|
-
pinnedTopRows:
|
|
1428
|
-
pinnedBottomRows:
|
|
1429
|
-
unpinnedData:
|
|
1430
|
-
pinRow:
|
|
1431
|
-
getKey:
|
|
1432
|
-
getCurrentPresetConfig:
|
|
1433
|
-
applyPreset:
|
|
1411
|
+
selection: xe,
|
|
1412
|
+
columnManager: B,
|
|
1413
|
+
viewMode: j,
|
|
1414
|
+
setViewMode: M,
|
|
1415
|
+
expandedKeys: F,
|
|
1416
|
+
toggleExpand: ee,
|
|
1417
|
+
editingCell: R,
|
|
1418
|
+
setEditingCell: z,
|
|
1419
|
+
editing: L,
|
|
1420
|
+
theme: U,
|
|
1421
|
+
rowGrouping: G,
|
|
1422
|
+
treeData: te,
|
|
1423
|
+
presets: K,
|
|
1424
|
+
chartConfig: ne,
|
|
1425
|
+
virtualization: be,
|
|
1426
|
+
pinnedTopRows: Te,
|
|
1427
|
+
pinnedBottomRows: Ee,
|
|
1428
|
+
unpinnedData: De,
|
|
1429
|
+
pinRow: re,
|
|
1430
|
+
getKey: I,
|
|
1431
|
+
getCurrentPresetConfig: Ce,
|
|
1432
|
+
applyPreset: we,
|
|
1434
1433
|
plugins: h
|
|
1435
1434
|
};
|
|
1436
1435
|
}
|
|
1437
1436
|
//#endregion
|
|
1438
1437
|
//#region src/exportUtils.js
|
|
1439
|
-
function
|
|
1438
|
+
function Ve(e, t) {
|
|
1440
1439
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1441
1440
|
r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
1442
1441
|
}
|
|
1443
|
-
function
|
|
1442
|
+
function He(e, t) {
|
|
1444
1443
|
return t?.length ? t.map((t) => e.find((e) => e.id === t)).filter((e) => e != null) : e;
|
|
1445
1444
|
}
|
|
1446
|
-
function
|
|
1445
|
+
function Ue(e, t) {
|
|
1447
1446
|
return e.map((e) => t.map((t) => {
|
|
1448
|
-
let n =
|
|
1447
|
+
let n = U(e, t);
|
|
1449
1448
|
return String(n ?? "");
|
|
1450
1449
|
}));
|
|
1451
1450
|
}
|
|
1452
|
-
function
|
|
1453
|
-
let i =
|
|
1454
|
-
|
|
1451
|
+
function We(e, t, n, r = "export") {
|
|
1452
|
+
let i = He(t, n), a = i.map((e) => e.header), o = Ue(e, i), s = (e) => e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e, c = [a.map(s).join(","), ...o.map((e) => e.map(s).join(","))].join("\n");
|
|
1453
|
+
Ve(new Blob(["" + c], { type: "text/csv;charset=utf-8;" }), `${r}.csv`);
|
|
1455
1454
|
}
|
|
1456
|
-
async function
|
|
1457
|
-
let a =
|
|
1455
|
+
async function Ge(e, t, n, r = "export", i = "Sheet1") {
|
|
1456
|
+
let a = He(t, n), o = a.map((e) => e.header), s = Ue(e, a);
|
|
1458
1457
|
try {
|
|
1459
1458
|
let e = await import("xlsx"), t = [o, ...s], n = e.utils.aoa_to_sheet(t);
|
|
1460
1459
|
n["!cols"] = o.map((e, t) => {
|
|
@@ -1464,12 +1463,12 @@ async function ot(e, t, n, r = "export", i = "Sheet1") {
|
|
|
1464
1463
|
let a = e.utils.book_new();
|
|
1465
1464
|
e.utils.book_append_sheet(a, n, i), e.writeFile(a, `${r}.xlsx`);
|
|
1466
1465
|
} catch {
|
|
1467
|
-
console.warn("xlsx library not available, falling back to CSV export"),
|
|
1466
|
+
console.warn("xlsx library not available, falling back to CSV export"), We(e, t, n, r);
|
|
1468
1467
|
}
|
|
1469
1468
|
}
|
|
1470
1469
|
//#endregion
|
|
1471
1470
|
//#region src/components/Toolbar.jsx
|
|
1472
|
-
function
|
|
1471
|
+
function Ke({ globalSearch: e, onSearchChange: t, searchDebounce: n = 300, viewMode: i, onViewModeChange: a, views: s = [
|
|
1473
1472
|
"table",
|
|
1474
1473
|
"grid",
|
|
1475
1474
|
"list"
|
|
@@ -1486,18 +1485,18 @@ function st({ globalSearch: e, onSearchChange: t, searchDebounce: n = 300, viewM
|
|
|
1486
1485
|
h(e);
|
|
1487
1486
|
}, [e]);
|
|
1488
1487
|
let v = {
|
|
1489
|
-
table: /* @__PURE__ */
|
|
1490
|
-
grid: /* @__PURE__ */
|
|
1491
|
-
list: /* @__PURE__ */
|
|
1488
|
+
table: /* @__PURE__ */ z(ee, { className: "h-4 w-4" }),
|
|
1489
|
+
grid: /* @__PURE__ */ z(T, { className: "h-4 w-4" }),
|
|
1490
|
+
list: /* @__PURE__ */ z(D, { className: "h-4 w-4" })
|
|
1492
1491
|
};
|
|
1493
|
-
return /* @__PURE__ */
|
|
1492
|
+
return /* @__PURE__ */ B("div", {
|
|
1494
1493
|
className: `flex flex-wrap items-center gap-2 px-4 py-3 border-b border-[var(--app-border,#e5e7eb)] ${p}`,
|
|
1495
1494
|
children: [
|
|
1496
|
-
/* @__PURE__ */
|
|
1495
|
+
/* @__PURE__ */ B("div", {
|
|
1497
1496
|
className: "relative flex-1 min-w-[200px] max-w-md",
|
|
1498
1497
|
children: [
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1498
|
+
/* @__PURE__ */ z(P, { className: "h-4 w-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2" }),
|
|
1499
|
+
/* @__PURE__ */ z("input", {
|
|
1501
1500
|
type: "text",
|
|
1502
1501
|
value: m,
|
|
1503
1502
|
onChange: (e) => h(e.target.value),
|
|
@@ -1505,39 +1504,39 @@ function st({ globalSearch: e, onSearchChange: t, searchDebounce: n = 300, viewM
|
|
|
1505
1504
|
className: "w-full h-9 pl-9 pr-8 text-sm rounded-md border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:border-brand-500 bg-[var(--app-bg)]",
|
|
1506
1505
|
"aria-label": "Search table"
|
|
1507
1506
|
}),
|
|
1508
|
-
m && /* @__PURE__ */
|
|
1507
|
+
m && /* @__PURE__ */ z("button", {
|
|
1509
1508
|
type: "button",
|
|
1510
1509
|
onClick: () => {
|
|
1511
1510
|
h(""), t("");
|
|
1512
1511
|
},
|
|
1513
1512
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",
|
|
1514
1513
|
"aria-label": "Clear search",
|
|
1515
|
-
children: /* @__PURE__ */
|
|
1514
|
+
children: /* @__PURE__ */ z(L, { className: "h-4 w-4" })
|
|
1516
1515
|
})
|
|
1517
1516
|
]
|
|
1518
1517
|
}),
|
|
1519
|
-
u && /* @__PURE__ */
|
|
1518
|
+
u && /* @__PURE__ */ B("button", {
|
|
1520
1519
|
type: "button",
|
|
1521
1520
|
onClick: d,
|
|
1522
1521
|
className: "inline-flex items-center gap-1 px-2 py-1.5 text-xs font-medium text-brand-700 bg-brand-50 rounded-md hover:bg-brand-100 transition-colors",
|
|
1523
1522
|
children: [
|
|
1524
|
-
/* @__PURE__ */
|
|
1523
|
+
/* @__PURE__ */ z(F, { className: "h-3 w-3" }),
|
|
1525
1524
|
"Filters active",
|
|
1526
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ z(M, { className: "h-3 w-3 ml-1" })
|
|
1527
1526
|
]
|
|
1528
1527
|
}),
|
|
1529
1528
|
f,
|
|
1530
|
-
/* @__PURE__ */
|
|
1529
|
+
/* @__PURE__ */ B("div", {
|
|
1531
1530
|
className: "flex items-center gap-1 ml-auto",
|
|
1532
|
-
children: [c && c.length > 0 && l && /* @__PURE__ */
|
|
1531
|
+
children: [c && c.length > 0 && l && /* @__PURE__ */ z(qe, {
|
|
1533
1532
|
formats: c,
|
|
1534
1533
|
onExport: l,
|
|
1535
1534
|
isOpen: g,
|
|
1536
1535
|
onToggleOpen: () => _((e) => !e),
|
|
1537
1536
|
onClose: () => _(!1)
|
|
1538
|
-
}), s.length > 1 && /* @__PURE__ */
|
|
1537
|
+
}), s.length > 1 && /* @__PURE__ */ z("div", {
|
|
1539
1538
|
className: "flex items-center border border-gray-300 dark:border-gray-600 rounded-md overflow-hidden",
|
|
1540
|
-
children: s.map((e) => /* @__PURE__ */
|
|
1539
|
+
children: s.map((e) => /* @__PURE__ */ z("button", {
|
|
1541
1540
|
type: "button",
|
|
1542
1541
|
onClick: () => a(e),
|
|
1543
1542
|
className: `p-2 transition-colors ${i === e ? "bg-brand-600 text-white" : "bg-[var(--app-bg)] text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700"}`,
|
|
@@ -1551,7 +1550,7 @@ function st({ globalSearch: e, onSearchChange: t, searchDebounce: n = 300, viewM
|
|
|
1551
1550
|
]
|
|
1552
1551
|
});
|
|
1553
1552
|
}
|
|
1554
|
-
function
|
|
1553
|
+
function qe({ formats: t, onExport: n, isOpen: r, onToggleOpen: i, onClose: a }) {
|
|
1555
1554
|
let o = e.useRef(null);
|
|
1556
1555
|
e.useEffect(() => {
|
|
1557
1556
|
if (!r) return;
|
|
@@ -1565,18 +1564,18 @@ function ct({ formats: t, onExport: n, isOpen: r, onToggleOpen: i, onClose: a })
|
|
|
1565
1564
|
excel: "Export Excel",
|
|
1566
1565
|
pdf: "Export PDF"
|
|
1567
1566
|
};
|
|
1568
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ B("div", {
|
|
1569
1568
|
className: "relative",
|
|
1570
1569
|
ref: o,
|
|
1571
|
-
children: [/* @__PURE__ */
|
|
1570
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1572
1571
|
type: "button",
|
|
1573
1572
|
onClick: i,
|
|
1574
1573
|
className: "p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",
|
|
1575
1574
|
"aria-label": "Export data",
|
|
1576
|
-
children: /* @__PURE__ */
|
|
1577
|
-
}), r && /* @__PURE__ */
|
|
1575
|
+
children: /* @__PURE__ */ z(x, { className: "h-4 w-4" })
|
|
1576
|
+
}), r && /* @__PURE__ */ z("div", {
|
|
1578
1577
|
className: "absolute right-0 top-full mt-1 z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[140px]",
|
|
1579
|
-
children: t.map((e) => /* @__PURE__ */
|
|
1578
|
+
children: t.map((e) => /* @__PURE__ */ z("button", {
|
|
1580
1579
|
type: "button",
|
|
1581
1580
|
onClick: () => {
|
|
1582
1581
|
n(e), a();
|
|
@@ -1589,54 +1588,54 @@ function ct({ formats: t, onExport: n, isOpen: r, onToggleOpen: i, onClose: a })
|
|
|
1589
1588
|
}
|
|
1590
1589
|
//#endregion
|
|
1591
1590
|
//#region src/components/BulkActions.jsx
|
|
1592
|
-
function
|
|
1593
|
-
return e === 0 ? null : /* @__PURE__ */
|
|
1591
|
+
function Je({ selectedCount: e, selectedRows: t, actions: n, onClearSelection: r }) {
|
|
1592
|
+
return e === 0 ? null : /* @__PURE__ */ B("div", {
|
|
1594
1593
|
className: "flex items-center gap-3 px-4 py-2 bg-brand-50 dark:bg-brand-900/20 border-b border-brand-200 dark:border-brand-800 animate-in slide-in-from-top-1",
|
|
1595
1594
|
children: [
|
|
1596
|
-
/* @__PURE__ */
|
|
1595
|
+
/* @__PURE__ */ B("span", {
|
|
1597
1596
|
className: "text-sm font-medium text-brand-700 dark:text-brand-300",
|
|
1598
1597
|
children: [e, " selected"]
|
|
1599
1598
|
}),
|
|
1600
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ z("div", {
|
|
1601
1600
|
className: "flex items-center gap-2",
|
|
1602
|
-
children: n.map((e) => /* @__PURE__ */
|
|
1601
|
+
children: n.map((e) => /* @__PURE__ */ B("button", {
|
|
1603
1602
|
type: "button",
|
|
1604
1603
|
onClick: () => e.onClick(t),
|
|
1605
1604
|
className: `inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${e.variant === "danger" ? "text-red-700 bg-red-100 hover:bg-red-200 dark:text-red-300 dark:bg-red-900/30 dark:hover:bg-red-900/50" : "text-brand-700 bg-brand-100 hover:bg-brand-200 dark:text-brand-300 dark:bg-brand-900/30 dark:hover:bg-brand-900/50"}`,
|
|
1606
1605
|
children: [e.icon, e.label]
|
|
1607
1606
|
}, e.id))
|
|
1608
1607
|
}),
|
|
1609
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ z("button", {
|
|
1610
1609
|
type: "button",
|
|
1611
1610
|
onClick: r,
|
|
1612
1611
|
className: "ml-auto p-1 text-gray-400 hover:text-gray-600 transition-colors",
|
|
1613
1612
|
"aria-label": "Clear selection",
|
|
1614
|
-
children: /* @__PURE__ */
|
|
1613
|
+
children: /* @__PURE__ */ z(L, { className: "h-4 w-4" })
|
|
1615
1614
|
})
|
|
1616
1615
|
]
|
|
1617
1616
|
});
|
|
1618
1617
|
}
|
|
1619
1618
|
//#endregion
|
|
1620
1619
|
//#region src/components/ColumnFilter.jsx
|
|
1621
|
-
function
|
|
1620
|
+
function Ye({ column: e, value: t, onChange: n }) {
|
|
1622
1621
|
let [r, i] = o(!1), a = e.filterType ?? "text", s = t !== "" && t != null && !(Array.isArray(t) && !t.length);
|
|
1623
1622
|
if (e.filterComponent) {
|
|
1624
1623
|
let r = e.filterComponent;
|
|
1625
|
-
return /* @__PURE__ */
|
|
1624
|
+
return /* @__PURE__ */ z(r, {
|
|
1626
1625
|
column: e,
|
|
1627
1626
|
value: t,
|
|
1628
1627
|
onChange: (t) => n(e.id, t)
|
|
1629
1628
|
});
|
|
1630
1629
|
}
|
|
1631
|
-
return /* @__PURE__ */
|
|
1630
|
+
return /* @__PURE__ */ B("div", {
|
|
1632
1631
|
className: "relative inline-block",
|
|
1633
|
-
children: [/* @__PURE__ */
|
|
1632
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1634
1633
|
type: "button",
|
|
1635
1634
|
onClick: () => i((e) => !e),
|
|
1636
1635
|
className: `p-1 rounded transition-colors ${s ? "text-brand-600 bg-brand-50" : "text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,
|
|
1637
1636
|
"aria-label": `Filter ${e.header}`,
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1639
|
-
}), r && /* @__PURE__ */
|
|
1637
|
+
children: /* @__PURE__ */ z(C, { className: "h-3.5 w-3.5" })
|
|
1638
|
+
}), r && /* @__PURE__ */ z(Xe, {
|
|
1640
1639
|
column: e,
|
|
1641
1640
|
filterType: a,
|
|
1642
1641
|
value: t,
|
|
@@ -1645,7 +1644,7 @@ function ut({ column: e, value: t, onChange: n }) {
|
|
|
1645
1644
|
})]
|
|
1646
1645
|
});
|
|
1647
1646
|
}
|
|
1648
|
-
function
|
|
1647
|
+
function Xe({ column: t, filterType: r, value: i, onChange: a, onClose: o }) {
|
|
1649
1648
|
let s = e.useRef(null);
|
|
1650
1649
|
e.useEffect(() => {
|
|
1651
1650
|
let e = (e) => {
|
|
@@ -1660,23 +1659,23 @@ function dt({ column: t, filterType: r, value: i, onChange: a, onClose: o }) {
|
|
|
1660
1659
|
a,
|
|
1661
1660
|
o
|
|
1662
1661
|
]);
|
|
1663
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ B("div", {
|
|
1664
1663
|
ref: s,
|
|
1665
1664
|
className: "absolute left-0 top-full mt-1 z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[200px]",
|
|
1666
1665
|
children: [
|
|
1667
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ B("div", {
|
|
1668
1667
|
className: "flex items-center justify-between mb-2",
|
|
1669
|
-
children: [/* @__PURE__ */
|
|
1668
|
+
children: [/* @__PURE__ */ B("span", {
|
|
1670
1669
|
className: "text-xs font-medium text-gray-500",
|
|
1671
1670
|
children: ["Filter: ", t.header]
|
|
1672
|
-
}), /* @__PURE__ */
|
|
1671
|
+
}), /* @__PURE__ */ z("button", {
|
|
1673
1672
|
type: "button",
|
|
1674
1673
|
onClick: c,
|
|
1675
1674
|
className: "text-xs text-gray-400 hover:text-gray-600",
|
|
1676
|
-
children: /* @__PURE__ */
|
|
1675
|
+
children: /* @__PURE__ */ z(L, { className: "h-3 w-3" })
|
|
1677
1676
|
})]
|
|
1678
1677
|
}),
|
|
1679
|
-
r === "text" && /* @__PURE__ */
|
|
1678
|
+
r === "text" && /* @__PURE__ */ z("input", {
|
|
1680
1679
|
type: "text",
|
|
1681
1680
|
value: String(i ?? ""),
|
|
1682
1681
|
onChange: (e) => a(t.id, e.target.value, "contains"),
|
|
@@ -1684,7 +1683,7 @@ function dt({ column: t, filterType: r, value: i, onChange: a, onClose: o }) {
|
|
|
1684
1683
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]",
|
|
1685
1684
|
autoFocus: !0
|
|
1686
1685
|
}),
|
|
1687
|
-
r === "number" && /* @__PURE__ */
|
|
1686
|
+
r === "number" && /* @__PURE__ */ z("input", {
|
|
1688
1687
|
type: "number",
|
|
1689
1688
|
value: String(i ?? ""),
|
|
1690
1689
|
onChange: (e) => a(t.id, e.target.value ? Number(e.target.value) : "", "eq"),
|
|
@@ -1692,25 +1691,25 @@ function dt({ column: t, filterType: r, value: i, onChange: a, onClose: o }) {
|
|
|
1692
1691
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]",
|
|
1693
1692
|
autoFocus: !0
|
|
1694
1693
|
}),
|
|
1695
|
-
r === "date" && /* @__PURE__ */
|
|
1694
|
+
r === "date" && /* @__PURE__ */ z("input", {
|
|
1696
1695
|
type: "date",
|
|
1697
1696
|
value: String(i ?? ""),
|
|
1698
1697
|
onChange: (e) => a(t.id, e.target.value, "eq"),
|
|
1699
1698
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]"
|
|
1700
1699
|
}),
|
|
1701
|
-
r === "select" && t.filterOptions && /* @__PURE__ */
|
|
1700
|
+
r === "select" && t.filterOptions && /* @__PURE__ */ B("select", {
|
|
1702
1701
|
value: String(i ?? ""),
|
|
1703
1702
|
onChange: (e) => a(t.id, e.target.value, "eq"),
|
|
1704
1703
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]",
|
|
1705
|
-
children: [/* @__PURE__ */
|
|
1704
|
+
children: [/* @__PURE__ */ z("option", {
|
|
1706
1705
|
value: "",
|
|
1707
1706
|
children: "All"
|
|
1708
|
-
}), t.filterOptions.map((e) => /* @__PURE__ */
|
|
1707
|
+
}), t.filterOptions.map((e) => /* @__PURE__ */ z("option", {
|
|
1709
1708
|
value: e.value,
|
|
1710
1709
|
children: e.label
|
|
1711
1710
|
}, e.value))]
|
|
1712
1711
|
}),
|
|
1713
|
-
r === "multi-select" && t.filterOptions && /* @__PURE__ */
|
|
1712
|
+
r === "multi-select" && t.filterOptions && /* @__PURE__ */ z(Ze, {
|
|
1714
1713
|
options: t.filterOptions,
|
|
1715
1714
|
value: Array.isArray(i) ? i : [],
|
|
1716
1715
|
onChange: (e) => a(t.id, e)
|
|
@@ -1718,20 +1717,20 @@ function dt({ column: t, filterType: r, value: i, onChange: a, onClose: o }) {
|
|
|
1718
1717
|
]
|
|
1719
1718
|
});
|
|
1720
1719
|
}
|
|
1721
|
-
function
|
|
1720
|
+
function Ze({ options: e, value: t, onChange: n }) {
|
|
1722
1721
|
let r = (e) => {
|
|
1723
1722
|
n(t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
1724
1723
|
};
|
|
1725
|
-
return /* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ z("div", {
|
|
1726
1725
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
1727
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1726
|
+
children: e.map((e) => /* @__PURE__ */ B("label", {
|
|
1728
1727
|
className: "flex items-center gap-2 px-1 py-0.5 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 rounded",
|
|
1729
|
-
children: [/* @__PURE__ */
|
|
1728
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1730
1729
|
type: "checkbox",
|
|
1731
1730
|
checked: t.includes(e.value),
|
|
1732
1731
|
onChange: () => r(e.value),
|
|
1733
1732
|
className: "h-3.5 w-3.5 rounded border-gray-300 text-brand-600 focus:ring-brand-600"
|
|
1734
|
-
}), /* @__PURE__ */
|
|
1733
|
+
}), /* @__PURE__ */ z("span", {
|
|
1735
1734
|
className: "text-sm text-gray-700 dark:text-gray-300",
|
|
1736
1735
|
children: e.label
|
|
1737
1736
|
})]
|
|
@@ -1740,26 +1739,26 @@ function ft({ options: e, value: t, onChange: n }) {
|
|
|
1740
1739
|
}
|
|
1741
1740
|
//#endregion
|
|
1742
1741
|
//#region src/components/FloatingFilterRow.jsx
|
|
1743
|
-
function
|
|
1742
|
+
function Qe({ columns: e, getFilterValue: t, onFilterChange: n, showCheckbox: r = !1, showExpandToggle: i = !1, showActions: a = !1, compact: o = !1 }) {
|
|
1744
1743
|
let s = o ? "py-1" : "py-1.5";
|
|
1745
|
-
return /* @__PURE__ */
|
|
1744
|
+
return /* @__PURE__ */ B("tr", {
|
|
1746
1745
|
className: "bg-[var(--app-surface,#f9fafb)] border-b border-[var(--app-border,#e5e7eb)]",
|
|
1747
1746
|
children: [
|
|
1748
|
-
r && /* @__PURE__ */
|
|
1749
|
-
i && /* @__PURE__ */
|
|
1750
|
-
e.map((e) => /* @__PURE__ */
|
|
1747
|
+
r && /* @__PURE__ */ z("td", { className: `px-4 ${s}` }),
|
|
1748
|
+
i && /* @__PURE__ */ z("td", { className: `px-2 ${s}` }),
|
|
1749
|
+
e.map((e) => /* @__PURE__ */ z("td", {
|
|
1751
1750
|
className: `px-2 ${s}`,
|
|
1752
|
-
children: e.filterable !== !1 && e.filterType ? /* @__PURE__ */
|
|
1751
|
+
children: e.filterable !== !1 && e.filterType ? /* @__PURE__ */ z($e, {
|
|
1753
1752
|
column: e,
|
|
1754
1753
|
value: t(e.id),
|
|
1755
1754
|
onChange: n
|
|
1756
1755
|
}) : null
|
|
1757
1756
|
}, e.id)),
|
|
1758
|
-
a && /* @__PURE__ */
|
|
1757
|
+
a && /* @__PURE__ */ z("td", { className: `px-4 ${s}` })
|
|
1759
1758
|
]
|
|
1760
1759
|
});
|
|
1761
1760
|
}
|
|
1762
|
-
function
|
|
1761
|
+
function $e({ column: e, value: t, onChange: i }) {
|
|
1763
1762
|
let s = e.filterType ?? "text", [c, l] = o(String(t ?? "")), u = a();
|
|
1764
1763
|
r(() => {
|
|
1765
1764
|
l(String(t ?? ""));
|
|
@@ -1773,27 +1772,27 @@ function mt({ column: e, value: t, onChange: i }) {
|
|
|
1773
1772
|
}, [e.id, i]);
|
|
1774
1773
|
if (e.filterComponent) {
|
|
1775
1774
|
let n = e.filterComponent;
|
|
1776
|
-
return /* @__PURE__ */
|
|
1775
|
+
return /* @__PURE__ */ z(n, {
|
|
1777
1776
|
column: e,
|
|
1778
1777
|
value: t,
|
|
1779
1778
|
onChange: (t) => i(e.id, t)
|
|
1780
1779
|
});
|
|
1781
1780
|
}
|
|
1782
|
-
return s === "select" ? /* @__PURE__ */
|
|
1781
|
+
return s === "select" ? /* @__PURE__ */ B("select", {
|
|
1783
1782
|
value: String(t ?? ""),
|
|
1784
1783
|
onChange: (t) => i(e.id, t.target.value, "eq"),
|
|
1785
1784
|
className: "w-full px-1.5 py-1 text-xs border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg,white)] text-gray-700",
|
|
1786
1785
|
"aria-label": `Filter ${e.header}`,
|
|
1787
|
-
children: [/* @__PURE__ */
|
|
1786
|
+
children: [/* @__PURE__ */ z("option", {
|
|
1788
1787
|
value: "",
|
|
1789
1788
|
children: "All"
|
|
1790
|
-
}), e.filterOptions?.map((e) => /* @__PURE__ */
|
|
1789
|
+
}), e.filterOptions?.map((e) => /* @__PURE__ */ z("option", {
|
|
1791
1790
|
value: e.value,
|
|
1792
1791
|
children: e.label
|
|
1793
1792
|
}, e.value))]
|
|
1794
|
-
}) : s === "number" ? /* @__PURE__ */
|
|
1793
|
+
}) : s === "number" ? /* @__PURE__ */ B("div", {
|
|
1795
1794
|
className: "relative",
|
|
1796
|
-
children: [/* @__PURE__ */
|
|
1795
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1797
1796
|
type: "number",
|
|
1798
1797
|
value: c,
|
|
1799
1798
|
onChange: (t) => {
|
|
@@ -1802,62 +1801,62 @@ function mt({ column: e, value: t, onChange: i }) {
|
|
|
1802
1801
|
placeholder: "...",
|
|
1803
1802
|
className: "w-full px-1.5 py-1 text-xs border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg,white)] pr-5",
|
|
1804
1803
|
"aria-label": `Filter ${e.header}`
|
|
1805
|
-
}), c && /* @__PURE__ */
|
|
1806
|
-
}) : s === "date" ? /* @__PURE__ */
|
|
1804
|
+
}), c && /* @__PURE__ */ z(et, { onClick: f })]
|
|
1805
|
+
}) : s === "date" ? /* @__PURE__ */ z("input", {
|
|
1807
1806
|
type: "date",
|
|
1808
1807
|
value: String(t ?? ""),
|
|
1809
1808
|
onChange: (t) => i(e.id, t.target.value, "eq"),
|
|
1810
1809
|
className: "w-full px-1.5 py-1 text-xs border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg,white)]",
|
|
1811
1810
|
"aria-label": `Filter ${e.header}`
|
|
1812
|
-
}) : /* @__PURE__ */
|
|
1811
|
+
}) : /* @__PURE__ */ B("div", {
|
|
1813
1812
|
className: "relative",
|
|
1814
|
-
children: [/* @__PURE__ */
|
|
1813
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1815
1814
|
type: "text",
|
|
1816
1815
|
value: c,
|
|
1817
1816
|
onChange: (e) => d(e.target.value),
|
|
1818
1817
|
placeholder: "Filter...",
|
|
1819
1818
|
className: "w-full px-1.5 py-1 text-xs border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg,white)] pr-5",
|
|
1820
1819
|
"aria-label": `Filter ${e.header}`
|
|
1821
|
-
}), c && /* @__PURE__ */
|
|
1820
|
+
}), c && /* @__PURE__ */ z(et, { onClick: f })]
|
|
1822
1821
|
});
|
|
1823
1822
|
}
|
|
1824
|
-
function
|
|
1825
|
-
return /* @__PURE__ */
|
|
1823
|
+
function et({ onClick: e }) {
|
|
1824
|
+
return /* @__PURE__ */ z("button", {
|
|
1826
1825
|
type: "button",
|
|
1827
1826
|
onClick: e,
|
|
1828
1827
|
className: "absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-gray-400 hover:text-gray-600 rounded",
|
|
1829
1828
|
"aria-label": "Clear filter",
|
|
1830
|
-
children: /* @__PURE__ */
|
|
1829
|
+
children: /* @__PURE__ */ z(L, { className: "h-3 w-3" })
|
|
1831
1830
|
});
|
|
1832
1831
|
}
|
|
1833
1832
|
//#endregion
|
|
1834
1833
|
//#region src/components/DataTableHeader.jsx
|
|
1835
|
-
var
|
|
1836
|
-
function
|
|
1837
|
-
let [T, E] = o(null), [D, O] = o(null), [
|
|
1834
|
+
var tt = "application/x-datatable-column";
|
|
1835
|
+
function nt({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onResize: c, enableResizing: l = !1, enableReordering: u = !1, onReorder: d, onReorderById: f, showCheckbox: p = !1, isAllSelected: m = !1, isSomeSelected: h = !1, onToggleAll: g, showExpandToggle: _ = !1, showActions: v = !1, compact: y = !1, getFilterValue: b, onFilterChange: x, floatingFilters: S = !1, showColumnGroups: C = !1 }) {
|
|
1836
|
+
let [T, E] = o(null), [D, O] = o(null), [k, A] = o(null), j = a(/* @__PURE__ */ new Map()), M = n((e, t) => {
|
|
1838
1837
|
if (!u) return;
|
|
1839
|
-
E(t), e.dataTransfer.setData(
|
|
1840
|
-
let n =
|
|
1838
|
+
E(t), e.dataTransfer.setData(tt, t), e.dataTransfer.effectAllowed = "move";
|
|
1839
|
+
let n = j.current.get(t);
|
|
1841
1840
|
if (n) {
|
|
1842
1841
|
let t = n.cloneNode(!0);
|
|
1843
1842
|
t.style.position = "absolute", t.style.top = "-9999px", t.style.left = "-9999px", t.style.opacity = "0.85", t.style.background = "var(--app-surface, #f9fafb)", t.style.border = "1px solid var(--app-border, #e5e7eb)", t.style.borderRadius = "6px", t.style.padding = "8px 12px", t.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", t.style.whiteSpace = "nowrap", document.body.appendChild(t), e.dataTransfer.setDragImage(t, 20, 20), requestAnimationFrame(() => document.body.removeChild(t));
|
|
1844
1843
|
}
|
|
1845
|
-
}, [u]),
|
|
1844
|
+
}, [u]), N = n((e, t) => {
|
|
1846
1845
|
if (!u || !T || T === t) return;
|
|
1847
1846
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
1848
|
-
let n =
|
|
1847
|
+
let n = j.current.get(t);
|
|
1849
1848
|
if (n) {
|
|
1850
1849
|
let r = n.getBoundingClientRect(), i = r.left + r.width / 2;
|
|
1851
|
-
O(t),
|
|
1850
|
+
O(t), A(e.clientX < i ? "left" : "right");
|
|
1852
1851
|
}
|
|
1853
|
-
}, [u, T]),
|
|
1854
|
-
let n = e.relatedTarget, r =
|
|
1855
|
-
r && n && r.contains(n) || D === t && (O(null),
|
|
1856
|
-
}, [D]),
|
|
1852
|
+
}, [u, T]), P = n((e, t) => {
|
|
1853
|
+
let n = e.relatedTarget, r = j.current.get(t);
|
|
1854
|
+
r && n && r.contains(n) || D === t && (O(null), A(null));
|
|
1855
|
+
}, [D]), F = n((t, n) => {
|
|
1857
1856
|
t.preventDefault();
|
|
1858
|
-
let r = t.dataTransfer.getData(
|
|
1857
|
+
let r = t.dataTransfer.getData(tt);
|
|
1859
1858
|
if (!r || r === n) {
|
|
1860
|
-
|
|
1859
|
+
I();
|
|
1861
1860
|
return;
|
|
1862
1861
|
}
|
|
1863
1862
|
if (f) {
|
|
@@ -1867,16 +1866,16 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1867
1866
|
let t = e.findIndex((e) => e.id === r), i = e.findIndex((e) => e.id === n);
|
|
1868
1867
|
t !== -1 && i !== -1 && d(t, i);
|
|
1869
1868
|
}
|
|
1870
|
-
|
|
1869
|
+
I();
|
|
1871
1870
|
}, [
|
|
1872
1871
|
e,
|
|
1873
1872
|
d,
|
|
1874
1873
|
f
|
|
1875
|
-
]),
|
|
1876
|
-
E(null), O(null),
|
|
1877
|
-
},
|
|
1878
|
-
t ?
|
|
1879
|
-
}, []),
|
|
1874
|
+
]), ee = n(() => I(), []), I = () => {
|
|
1875
|
+
E(null), O(null), A(null);
|
|
1876
|
+
}, L = n((e) => (t) => {
|
|
1877
|
+
t ? j.current.set(e, t) : j.current.delete(e);
|
|
1878
|
+
}, []), R = i(() => {
|
|
1880
1879
|
if (!C || !e.some((e) => e.group)) return null;
|
|
1881
1880
|
let t = [], n, r = 0;
|
|
1882
1881
|
return e.forEach((i, a) => {
|
|
@@ -1888,27 +1887,27 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1888
1887
|
colSpan: r
|
|
1889
1888
|
});
|
|
1890
1889
|
}), t;
|
|
1891
|
-
}, [e, C]),
|
|
1892
|
-
return /* @__PURE__ */
|
|
1890
|
+
}, [e, C]), V = y ? "py-2" : "py-3";
|
|
1891
|
+
return /* @__PURE__ */ B("thead", {
|
|
1893
1892
|
className: "bg-[var(--app-surface,#f9fafb)] border-b border-[var(--app-border,#e5e7eb)]",
|
|
1894
1893
|
children: [
|
|
1895
|
-
|
|
1894
|
+
R && /* @__PURE__ */ B("tr", {
|
|
1896
1895
|
className: "border-b border-[var(--app-border,#e5e7eb)]",
|
|
1897
1896
|
children: [
|
|
1898
|
-
p && /* @__PURE__ */
|
|
1899
|
-
_ && /* @__PURE__ */
|
|
1900
|
-
|
|
1897
|
+
p && /* @__PURE__ */ z("th", { className: "px-4 py-1" }),
|
|
1898
|
+
_ && /* @__PURE__ */ z("th", { className: "px-2 py-1" }),
|
|
1899
|
+
R.map((e, t) => /* @__PURE__ */ z("th", {
|
|
1901
1900
|
colSpan: e.colSpan,
|
|
1902
1901
|
className: "px-4 py-1.5 text-center text-[10px] font-bold uppercase tracking-widest text-gray-400 border-x border-[var(--app-border,#e5e7eb)] first:border-l-0 last:border-r-0",
|
|
1903
1902
|
children: e.label
|
|
1904
1903
|
}, `${e.label}-${t}`)),
|
|
1905
|
-
v && /* @__PURE__ */
|
|
1904
|
+
v && /* @__PURE__ */ z("th", { className: "px-4 py-1" })
|
|
1906
1905
|
]
|
|
1907
1906
|
}),
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
p && /* @__PURE__ */
|
|
1910
|
-
className: `px-4 ${
|
|
1911
|
-
children: /* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ B("tr", { children: [
|
|
1908
|
+
p && /* @__PURE__ */ z("th", {
|
|
1909
|
+
className: `px-4 ${V} w-12`,
|
|
1910
|
+
children: /* @__PURE__ */ z("input", {
|
|
1912
1911
|
type: "checkbox",
|
|
1913
1912
|
checked: m,
|
|
1914
1913
|
ref: (e) => {
|
|
@@ -1919,16 +1918,16 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1919
1918
|
"aria-label": "Select all rows"
|
|
1920
1919
|
})
|
|
1921
1920
|
}),
|
|
1922
|
-
_ && /* @__PURE__ */
|
|
1921
|
+
_ && /* @__PURE__ */ z("th", { className: `px-2 ${V} w-10` }),
|
|
1923
1922
|
e.map((e) => {
|
|
1924
1923
|
let n = t(e.id), i = s[e.id], a = i ? {
|
|
1925
1924
|
width: i,
|
|
1926
1925
|
minWidth: i
|
|
1927
|
-
} : {}, o = T === e.id, d = D === e.id, f = d &&
|
|
1928
|
-
return /* @__PURE__ */
|
|
1929
|
-
ref:
|
|
1926
|
+
} : {}, o = T === e.id, d = D === e.id, f = d && k === "left", p = d && k === "right", m = e.filterable !== !1 && e.filterType && b && x;
|
|
1927
|
+
return /* @__PURE__ */ B("th", {
|
|
1928
|
+
ref: L(e.id),
|
|
1930
1929
|
className: `
|
|
1931
|
-
px-4 ${
|
|
1930
|
+
px-4 ${V} text-left text-xs font-semibold uppercase tracking-wider
|
|
1932
1931
|
text-[var(--app-text-secondary,#6b7280)] select-none relative group
|
|
1933
1932
|
transition-opacity duration-150
|
|
1934
1933
|
${o ? "opacity-30" : ""}
|
|
@@ -1936,25 +1935,25 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1936
1935
|
`,
|
|
1937
1936
|
style: a,
|
|
1938
1937
|
draggable: u,
|
|
1939
|
-
onDragStart: (t) =>
|
|
1940
|
-
onDragOver: (t) =>
|
|
1941
|
-
onDragLeave: (t) =>
|
|
1942
|
-
onDrop: (t) =>
|
|
1943
|
-
onDragEnd:
|
|
1938
|
+
onDragStart: (t) => M(t, e.id),
|
|
1939
|
+
onDragOver: (t) => N(t, e.id),
|
|
1940
|
+
onDragLeave: (t) => P(t, e.id),
|
|
1941
|
+
onDrop: (t) => F(t, e.id),
|
|
1942
|
+
onDragEnd: ee,
|
|
1944
1943
|
children: [
|
|
1945
|
-
f && /* @__PURE__ */
|
|
1946
|
-
p && /* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1944
|
+
f && /* @__PURE__ */ z("div", { className: "absolute left-0 top-1 bottom-1 w-0.5 bg-brand-500 rounded-full z-10 animate-pulse" }),
|
|
1945
|
+
p && /* @__PURE__ */ z("div", { className: "absolute right-0 top-1 bottom-1 w-0.5 bg-brand-500 rounded-full z-10 animate-pulse" }),
|
|
1946
|
+
/* @__PURE__ */ B("div", {
|
|
1948
1947
|
className: "flex items-center gap-1",
|
|
1949
1948
|
children: [
|
|
1950
|
-
u && /* @__PURE__ */
|
|
1949
|
+
u && /* @__PURE__ */ z(w, { className: `h-3.5 w-3.5 shrink-0 transition-all duration-150
|
|
1951
1950
|
${o ? "text-brand-500 opacity-100" : "text-gray-400 opacity-0 group-hover:opacity-100"}
|
|
1952
1951
|
` }),
|
|
1953
1952
|
e.headerCell ? e.headerCell({
|
|
1954
1953
|
column: e,
|
|
1955
1954
|
sortDirection: n,
|
|
1956
1955
|
onSort: () => r(e.id)
|
|
1957
|
-
}) : /* @__PURE__ */
|
|
1956
|
+
}) : /* @__PURE__ */ B("button", {
|
|
1958
1957
|
type: "button",
|
|
1959
1958
|
className: `flex items-center gap-1 ${e.sortable === !1 ? "cursor-default" : "cursor-pointer hover:text-[var(--app-text)]"}`,
|
|
1960
1959
|
onClick: () => e.sortable !== !1 && r(e.id),
|
|
@@ -1962,21 +1961,21 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1962
1961
|
onDragStart: (e) => {
|
|
1963
1962
|
e.stopPropagation(), e.preventDefault();
|
|
1964
1963
|
},
|
|
1965
|
-
children: [/* @__PURE__ */
|
|
1964
|
+
children: [/* @__PURE__ */ z("span", { children: e.header }), e.sortable !== !1 && /* @__PURE__ */ z(it, { direction: n })]
|
|
1966
1965
|
}),
|
|
1967
|
-
m && /* @__PURE__ */
|
|
1966
|
+
m && /* @__PURE__ */ z("div", {
|
|
1968
1967
|
onClick: (e) => e.stopPropagation(),
|
|
1969
1968
|
onDragStart: (e) => {
|
|
1970
1969
|
e.stopPropagation(), e.preventDefault();
|
|
1971
1970
|
},
|
|
1972
1971
|
draggable: !1,
|
|
1973
|
-
children: /* @__PURE__ */
|
|
1972
|
+
children: /* @__PURE__ */ z(Ye, {
|
|
1974
1973
|
column: e,
|
|
1975
1974
|
value: b(e.id),
|
|
1976
1975
|
onChange: x
|
|
1977
1976
|
})
|
|
1978
1977
|
}),
|
|
1979
|
-
l && e.resizable !== !1 && /* @__PURE__ */
|
|
1978
|
+
l && e.resizable !== !1 && /* @__PURE__ */ z(at, {
|
|
1980
1979
|
columnId: e.id,
|
|
1981
1980
|
currentWidth: i ?? e.width ?? 150,
|
|
1982
1981
|
onResize: c
|
|
@@ -1986,12 +1985,12 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
1986
1985
|
]
|
|
1987
1986
|
}, e.id);
|
|
1988
1987
|
}),
|
|
1989
|
-
v && /* @__PURE__ */
|
|
1990
|
-
className: `px-4 ${
|
|
1988
|
+
v && /* @__PURE__ */ z("th", {
|
|
1989
|
+
className: `px-4 ${V} text-right text-xs font-semibold uppercase tracking-wider text-[var(--app-text-secondary,#6b7280)] w-24`,
|
|
1991
1990
|
children: "Actions"
|
|
1992
1991
|
})
|
|
1993
1992
|
] }),
|
|
1994
|
-
S && b && x && /* @__PURE__ */
|
|
1993
|
+
S && b && x && /* @__PURE__ */ z(Qe, {
|
|
1995
1994
|
columns: e,
|
|
1996
1995
|
getFilterValue: b,
|
|
1997
1996
|
onFilterChange: x,
|
|
@@ -2003,13 +2002,13 @@ function _t({ columns: e, getSortDirection: t, onSort: r, columnWidths: s, onRes
|
|
|
2003
2002
|
]
|
|
2004
2003
|
});
|
|
2005
2004
|
}
|
|
2006
|
-
var
|
|
2007
|
-
function
|
|
2008
|
-
return e === "asc" ? /* @__PURE__ */
|
|
2005
|
+
var rt = t(nt);
|
|
2006
|
+
function it({ direction: e }) {
|
|
2007
|
+
return e === "asc" ? /* @__PURE__ */ z(u, { className: "h-3.5 w-3.5" }) : e === "desc" ? /* @__PURE__ */ z(l, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(d, { className: "h-3.5 w-3.5 opacity-30" });
|
|
2009
2008
|
}
|
|
2010
|
-
function
|
|
2009
|
+
function at({ columnId: e, currentWidth: t, onResize: r }) {
|
|
2011
2010
|
let i = a(0), o = a(t);
|
|
2012
|
-
return /* @__PURE__ */
|
|
2011
|
+
return /* @__PURE__ */ z("div", {
|
|
2013
2012
|
className: "absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-brand-500 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2014
2013
|
onMouseDown: n((n) => {
|
|
2015
2014
|
n.preventDefault(), n.stopPropagation(), i.current = n.clientX, o.current = t;
|
|
@@ -2035,7 +2034,7 @@ function bt({ columnId: e, currentWidth: t, onResize: r }) {
|
|
|
2035
2034
|
}
|
|
2036
2035
|
//#endregion
|
|
2037
2036
|
//#region src/components/CellTooltip.jsx
|
|
2038
|
-
function
|
|
2037
|
+
function ot({ content: e, children: t, delay: r = 400, style: i, disabled: s = !1 }) {
|
|
2039
2038
|
let [c, l] = o(!1), [u, d] = o({
|
|
2040
2039
|
top: 0,
|
|
2041
2040
|
left: 0
|
|
@@ -2056,7 +2055,7 @@ function xt({ content: e, children: t, delay: r = 400, style: i, disabled: s = !
|
|
|
2056
2055
|
]), h = n(() => {
|
|
2057
2056
|
clearTimeout(f.current), l(!1);
|
|
2058
2057
|
}, []);
|
|
2059
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
|
|
2060
2059
|
ref: p,
|
|
2061
2060
|
onMouseEnter: m,
|
|
2062
2061
|
onMouseLeave: h,
|
|
@@ -2064,20 +2063,20 @@ function xt({ content: e, children: t, delay: r = 400, style: i, disabled: s = !
|
|
|
2064
2063
|
onBlur: h,
|
|
2065
2064
|
className: "contents",
|
|
2066
2065
|
children: t
|
|
2067
|
-
}), c && e &&
|
|
2066
|
+
}), c && e && V(/* @__PURE__ */ z("div", {
|
|
2068
2067
|
role: "tooltip",
|
|
2069
2068
|
className: "fixed z-[99999] pointer-events-none animate-in fade-in duration-150",
|
|
2070
2069
|
style: {
|
|
2071
2070
|
top: u.top,
|
|
2072
2071
|
left: u.left,
|
|
2073
2072
|
transform: "translate(-50%, -100%)",
|
|
2074
|
-
...
|
|
2073
|
+
...st,
|
|
2075
2074
|
...i
|
|
2076
2075
|
},
|
|
2077
2076
|
children: e
|
|
2078
2077
|
}), document.body)] });
|
|
2079
2078
|
}
|
|
2080
|
-
var
|
|
2079
|
+
var st = {
|
|
2081
2080
|
backgroundColor: "#1f2937",
|
|
2082
2081
|
color: "#f9fafb",
|
|
2083
2082
|
padding: "0.375rem 0.625rem",
|
|
@@ -2089,8 +2088,8 @@ var St = {
|
|
|
2089
2088
|
};
|
|
2090
2089
|
//#endregion
|
|
2091
2090
|
//#region src/components/TableCell.jsx
|
|
2092
|
-
function
|
|
2093
|
-
let h =
|
|
2091
|
+
function ct({ row: e, rowIndex: t, column: n, isEditing: r, onStartEdit: i, onSaveEdit: a, onCancelEdit: o, width: s, className: c = "", validationError: l, pendingValue: u, onPendingChange: d, enableTooltip: f = !1, tooltipStyle: p, themeCellStyle: m }) {
|
|
2092
|
+
let h = U(e, n), g = n.align === "center" ? "text-center" : n.align === "right" ? "text-right" : "text-left", _ = {
|
|
2094
2093
|
...s ? {
|
|
2095
2094
|
width: s,
|
|
2096
2095
|
minWidth: s
|
|
@@ -2109,19 +2108,19 @@ function Ct({ row: e, rowIndex: t, column: n, isEditing: r, onStartEdit: i, onSa
|
|
|
2109
2108
|
onCancel: o,
|
|
2110
2109
|
error: l
|
|
2111
2110
|
};
|
|
2112
|
-
return /* @__PURE__ */
|
|
2111
|
+
return /* @__PURE__ */ B("td", {
|
|
2113
2112
|
className: `px-4 py-2 ${g} ${n.className ?? ""} ${c}`,
|
|
2114
2113
|
style: _,
|
|
2115
|
-
children: [n.editCell(t), l && /* @__PURE__ */
|
|
2114
|
+
children: [n.editCell(t), l && /* @__PURE__ */ z("p", {
|
|
2116
2115
|
className: "text-xs text-red-500 mt-0.5",
|
|
2117
2116
|
children: l
|
|
2118
2117
|
})]
|
|
2119
2118
|
});
|
|
2120
2119
|
}
|
|
2121
|
-
return /* @__PURE__ */
|
|
2120
|
+
return /* @__PURE__ */ z("td", {
|
|
2122
2121
|
className: `px-4 py-2 ${g} ${n.className ?? ""} ${c}`,
|
|
2123
2122
|
style: _,
|
|
2124
|
-
children: /* @__PURE__ */
|
|
2123
|
+
children: /* @__PURE__ */ z(dt, {
|
|
2125
2124
|
value: u ?? h,
|
|
2126
2125
|
onSave: (e) => d(e),
|
|
2127
2126
|
onCancel: o,
|
|
@@ -2138,19 +2137,19 @@ function Ct({ row: e, rowIndex: t, column: n, isEditing: r, onStartEdit: i, onSa
|
|
|
2138
2137
|
onCancel: o,
|
|
2139
2138
|
error: l
|
|
2140
2139
|
};
|
|
2141
|
-
return /* @__PURE__ */
|
|
2140
|
+
return /* @__PURE__ */ B("td", {
|
|
2142
2141
|
className: `px-4 py-2 ${g} ${n.className ?? ""} ${c}`,
|
|
2143
2142
|
style: _,
|
|
2144
|
-
children: [n.editCell(t), l && /* @__PURE__ */
|
|
2143
|
+
children: [n.editCell(t), l && /* @__PURE__ */ z("p", {
|
|
2145
2144
|
className: "text-xs text-red-500 mt-0.5",
|
|
2146
2145
|
children: l
|
|
2147
2146
|
})]
|
|
2148
2147
|
});
|
|
2149
2148
|
}
|
|
2150
|
-
if (r && n.editable) return /* @__PURE__ */
|
|
2149
|
+
if (r && n.editable) return /* @__PURE__ */ z("td", {
|
|
2151
2150
|
className: `px-4 py-2 ${g} ${n.className ?? ""} ${c} ${v}`,
|
|
2152
2151
|
style: _,
|
|
2153
|
-
children: /* @__PURE__ */
|
|
2152
|
+
children: /* @__PURE__ */ z(dt, {
|
|
2154
2153
|
value: h,
|
|
2155
2154
|
onSave: a,
|
|
2156
2155
|
onCancel: o,
|
|
@@ -2162,20 +2161,20 @@ function Ct({ row: e, rowIndex: t, column: n, isEditing: r, onStartEdit: i, onSa
|
|
|
2162
2161
|
row: e,
|
|
2163
2162
|
rowIndex: t,
|
|
2164
2163
|
column: n
|
|
2165
|
-
}) : h ?? "—", b =
|
|
2166
|
-
return /* @__PURE__ */
|
|
2164
|
+
}) : h ?? "—", b = ut(n, h, e, t, f);
|
|
2165
|
+
return /* @__PURE__ */ z("td", {
|
|
2167
2166
|
className: `px-4 py-2 text-sm text-[var(--app-text)] ${g} ${n.className ?? ""} ${c}`,
|
|
2168
2167
|
style: _,
|
|
2169
2168
|
onDoubleClick: n.editable ? i : void 0,
|
|
2170
|
-
children: b ? /* @__PURE__ */
|
|
2169
|
+
children: b ? /* @__PURE__ */ z(ot, {
|
|
2171
2170
|
content: b,
|
|
2172
2171
|
style: p,
|
|
2173
2172
|
children: y
|
|
2174
2173
|
}) : y
|
|
2175
2174
|
});
|
|
2176
2175
|
}
|
|
2177
|
-
var
|
|
2178
|
-
function
|
|
2176
|
+
var lt = t(ct);
|
|
2177
|
+
function ut(e, t, n, r, i) {
|
|
2179
2178
|
return !e.tooltip && !i ? null : typeof e.tooltip == "function" ? e.tooltip({
|
|
2180
2179
|
value: t,
|
|
2181
2180
|
row: n,
|
|
@@ -2183,9 +2182,9 @@ function Tt(e, t, n, r, i) {
|
|
|
2183
2182
|
column: e
|
|
2184
2183
|
}) || null : e.tooltip === !0 ? t == null ? null : String(t) : null;
|
|
2185
2184
|
}
|
|
2186
|
-
function
|
|
2185
|
+
function dt({ value: e, onSave: t, onCancel: r, error: i }) {
|
|
2187
2186
|
let [a, s] = o(String(e ?? ""));
|
|
2188
|
-
return /* @__PURE__ */
|
|
2187
|
+
return /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("input", {
|
|
2189
2188
|
type: "text",
|
|
2190
2189
|
value: a,
|
|
2191
2190
|
onChange: (e) => s(e.target.value),
|
|
@@ -2199,14 +2198,14 @@ function Et({ value: e, onSave: t, onCancel: r, error: i }) {
|
|
|
2199
2198
|
onBlur: () => t(a),
|
|
2200
2199
|
className: `w-full px-2 py-1 text-sm border rounded focus:outline-none focus:ring-1 bg-[var(--app-bg)] ${i ? "border-red-400 focus:ring-red-400" : "border-brand-500 focus:ring-brand-500"}`,
|
|
2201
2200
|
autoFocus: !0
|
|
2202
|
-
}), i && /* @__PURE__ */
|
|
2201
|
+
}), i && /* @__PURE__ */ z("p", {
|
|
2203
2202
|
className: "text-xs text-red-500 mt-0.5",
|
|
2204
2203
|
children: i
|
|
2205
2204
|
})] });
|
|
2206
2205
|
}
|
|
2207
2206
|
//#endregion
|
|
2208
2207
|
//#region src/components/PortalDropdown.jsx
|
|
2209
|
-
function
|
|
2208
|
+
function ft({ anchorRef: e, open: t, onClose: i, children: s, align: c = "right", offset: l = 4, minWidth: u = 140, className: d = "" }) {
|
|
2210
2209
|
let f = a(null), [p, m] = o({
|
|
2211
2210
|
top: 0,
|
|
2212
2211
|
left: 0
|
|
@@ -2251,7 +2250,7 @@ function Dt({ anchorRef: e, open: t, onClose: i, children: s, align: c = "right"
|
|
|
2251
2250
|
e.key === "Escape" && i();
|
|
2252
2251
|
};
|
|
2253
2252
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
2254
|
-
}, [t, i]), t ?
|
|
2253
|
+
}, [t, i]), t ? V(/* @__PURE__ */ z("div", {
|
|
2255
2254
|
ref: f,
|
|
2256
2255
|
role: "menu",
|
|
2257
2256
|
className: `fixed z-[9999] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 transition-opacity duration-150 ${_ ? "opacity-100" : "opacity-0"} ${h ? "origin-bottom" : "origin-top"} ${d}`,
|
|
@@ -2265,20 +2264,20 @@ function Dt({ anchorRef: e, open: t, onClose: i, children: s, align: c = "right"
|
|
|
2265
2264
|
}
|
|
2266
2265
|
//#endregion
|
|
2267
2266
|
//#region src/components/DataTableRow.jsx
|
|
2268
|
-
function
|
|
2269
|
-
let [
|
|
2270
|
-
return /* @__PURE__ */
|
|
2271
|
-
className: `border-b border-[var(--app-border,#e5e7eb)] hover:bg-[var(--app-hover,#f3f4f6)] transition-colors ${
|
|
2272
|
-
style:
|
|
2273
|
-
onClick:
|
|
2274
|
-
onDoubleClick:
|
|
2275
|
-
onContextMenu:
|
|
2267
|
+
function pt({ row: t, rowIndex: r, rowKey: i, columns: o, columnWidths: s, isSelected: c, isExpanded: l, showCheckbox: u, showExpandToggle: d, rowActions: f, onToggleSelect: p, onShiftSelect: m, onToggleExpand: g, onClick: v, onDoubleClick: y, editingCell: b, onStartEdit: x, onSaveEdit: S, onCancelEdit: C, expandContent: w, striped: T = !1, compact: E = !1, rowClassName: D = "", rowStyle: k, onContextMenu: A, validationErrors: j, pendingEdits: M, isEditingRow: N = !1, onPendingChange: P, enableTooltips: F = !1, tooltipStyle: ee, getCellStyle: I }) {
|
|
2268
|
+
let [L, V] = e.useState(!1), H = a(null), U = n(() => v?.(t), [v, t]), W = n(() => y?.(t), [y, t]), G = E ? "py-1" : "py-2", te = c ? "bg-brand-50 dark:bg-brand-900/20" : T && r % 2 == 1 ? "bg-gray-50/50 dark:bg-gray-800/30" : "bg-[var(--app-bg,white)]", K = f && f.some((e) => !e.hidden?.(t));
|
|
2269
|
+
return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("tr", {
|
|
2270
|
+
className: `border-b border-[var(--app-border,#e5e7eb)] hover:bg-[var(--app-hover,#f3f4f6)] transition-colors ${te} ${v ? "cursor-pointer" : ""} ${D}`,
|
|
2271
|
+
style: k,
|
|
2272
|
+
onClick: U,
|
|
2273
|
+
onDoubleClick: W,
|
|
2274
|
+
onContextMenu: A,
|
|
2276
2275
|
role: "row",
|
|
2277
2276
|
"aria-selected": c,
|
|
2278
2277
|
children: [
|
|
2279
|
-
u && /* @__PURE__ */
|
|
2280
|
-
className: `px-4 ${
|
|
2281
|
-
children: /* @__PURE__ */
|
|
2278
|
+
u && /* @__PURE__ */ z("td", {
|
|
2279
|
+
className: `px-4 ${G} w-12`,
|
|
2280
|
+
children: /* @__PURE__ */ z("input", {
|
|
2282
2281
|
type: "checkbox",
|
|
2283
2282
|
checked: c,
|
|
2284
2283
|
onChange: (e) => {
|
|
@@ -2289,9 +2288,9 @@ function Ot({ row: t, rowIndex: r, rowKey: i, columns: o, columnWidths: s, isSel
|
|
|
2289
2288
|
"aria-label": `Select row ${r + 1}`
|
|
2290
2289
|
})
|
|
2291
2290
|
}),
|
|
2292
|
-
d && /* @__PURE__ */
|
|
2293
|
-
className: `px-2 ${
|
|
2294
|
-
children: /* @__PURE__ */
|
|
2291
|
+
d && /* @__PURE__ */ z("td", {
|
|
2292
|
+
className: `px-2 ${G} w-10`,
|
|
2293
|
+
children: /* @__PURE__ */ z("button", {
|
|
2295
2294
|
type: "button",
|
|
2296
2295
|
onClick: (e) => {
|
|
2297
2296
|
e.stopPropagation(), g(i);
|
|
@@ -2299,12 +2298,12 @@ function Ot({ row: t, rowIndex: r, rowKey: i, columns: o, columnWidths: s, isSel
|
|
|
2299
2298
|
className: "p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",
|
|
2300
2299
|
"aria-label": l ? "Collapse row" : "Expand row",
|
|
2301
2300
|
"aria-expanded": l,
|
|
2302
|
-
children:
|
|
2301
|
+
children: z(l ? h : _, { className: "h-4 w-4 text-gray-500" })
|
|
2303
2302
|
})
|
|
2304
2303
|
}),
|
|
2305
2304
|
o.map((e) => {
|
|
2306
|
-
let n =
|
|
2307
|
-
return /* @__PURE__ */
|
|
2305
|
+
let n = N ? e.editable ?? !1 : b?.rowKey === i && b?.columnId === e.id;
|
|
2306
|
+
return /* @__PURE__ */ z(lt, {
|
|
2308
2307
|
row: t,
|
|
2309
2308
|
rowIndex: r,
|
|
2310
2309
|
column: e,
|
|
@@ -2313,56 +2312,56 @@ function Ot({ row: t, rowIndex: r, rowKey: i, columns: o, columnWidths: s, isSel
|
|
|
2313
2312
|
onStartEdit: () => x(i, e.id),
|
|
2314
2313
|
onSaveEdit: (t) => S(i, e.id, t),
|
|
2315
2314
|
onCancelEdit: C,
|
|
2316
|
-
validationError:
|
|
2317
|
-
pendingValue:
|
|
2318
|
-
onPendingChange:
|
|
2319
|
-
enableTooltip:
|
|
2320
|
-
tooltipStyle:
|
|
2321
|
-
themeCellStyle:
|
|
2315
|
+
validationError: j?.[e.id],
|
|
2316
|
+
pendingValue: N ? M?.[e.id] : void 0,
|
|
2317
|
+
onPendingChange: N && P ? (t) => P(e.id, t) : void 0,
|
|
2318
|
+
enableTooltip: F,
|
|
2319
|
+
tooltipStyle: ee,
|
|
2320
|
+
themeCellStyle: I?.(t, e)
|
|
2322
2321
|
}, e.id);
|
|
2323
2322
|
}),
|
|
2324
|
-
K && /* @__PURE__ */
|
|
2325
|
-
className: `px-4 ${
|
|
2326
|
-
children: /* @__PURE__ */
|
|
2323
|
+
K && /* @__PURE__ */ z("td", {
|
|
2324
|
+
className: `px-4 ${G} text-right`,
|
|
2325
|
+
children: /* @__PURE__ */ B("div", {
|
|
2327
2326
|
className: "inline-block",
|
|
2328
|
-
children: [/* @__PURE__ */
|
|
2329
|
-
ref:
|
|
2327
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2328
|
+
ref: H,
|
|
2330
2329
|
type: "button",
|
|
2331
2330
|
onClick: (e) => {
|
|
2332
|
-
e.stopPropagation(),
|
|
2331
|
+
e.stopPropagation(), V((e) => !e);
|
|
2333
2332
|
},
|
|
2334
2333
|
className: "p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",
|
|
2335
2334
|
"aria-label": "Row actions",
|
|
2336
2335
|
"aria-haspopup": "menu",
|
|
2337
|
-
"aria-expanded":
|
|
2338
|
-
children: /* @__PURE__ */
|
|
2339
|
-
}), /* @__PURE__ */
|
|
2340
|
-
anchorRef:
|
|
2341
|
-
open:
|
|
2342
|
-
onClose: () =>
|
|
2336
|
+
"aria-expanded": L,
|
|
2337
|
+
children: /* @__PURE__ */ z(O, { className: "h-4 w-4 text-gray-500" })
|
|
2338
|
+
}), /* @__PURE__ */ z(ft, {
|
|
2339
|
+
anchorRef: H,
|
|
2340
|
+
open: L,
|
|
2341
|
+
onClose: () => V(!1),
|
|
2343
2342
|
align: "right",
|
|
2344
|
-
children: /* @__PURE__ */
|
|
2343
|
+
children: /* @__PURE__ */ z(ht, {
|
|
2345
2344
|
row: t,
|
|
2346
2345
|
actions: f,
|
|
2347
|
-
onClose: () =>
|
|
2346
|
+
onClose: () => V(!1)
|
|
2348
2347
|
})
|
|
2349
2348
|
})]
|
|
2350
2349
|
})
|
|
2351
2350
|
}),
|
|
2352
|
-
!K && f && /* @__PURE__ */
|
|
2351
|
+
!K && f && /* @__PURE__ */ z("td", { className: `px-4 ${G}` })
|
|
2353
2352
|
]
|
|
2354
|
-
}), l && w && /* @__PURE__ */
|
|
2353
|
+
}), l && w && /* @__PURE__ */ z("tr", {
|
|
2355
2354
|
className: "bg-gray-50/50 dark:bg-gray-800/20",
|
|
2356
|
-
children: /* @__PURE__ */
|
|
2355
|
+
children: /* @__PURE__ */ z("td", {
|
|
2357
2356
|
colSpan: o.length + (u ? 1 : 0) + (d ? 1 : 0) + (f ? 1 : 0),
|
|
2358
2357
|
className: "px-8 py-4",
|
|
2359
2358
|
children: w
|
|
2360
2359
|
})
|
|
2361
2360
|
})] });
|
|
2362
2361
|
}
|
|
2363
|
-
var
|
|
2364
|
-
function
|
|
2365
|
-
return /* @__PURE__ */ R
|
|
2362
|
+
var mt = t(pt);
|
|
2363
|
+
function ht({ row: e, actions: t, onClose: n }) {
|
|
2364
|
+
return /* @__PURE__ */ z(R, { children: t.filter((t) => !t.hidden?.(e)).map((t) => /* @__PURE__ */ B("button", {
|
|
2366
2365
|
type: "button",
|
|
2367
2366
|
onClick: (r) => {
|
|
2368
2367
|
r.stopPropagation(), t.onClick(e), n();
|
|
@@ -2378,29 +2377,29 @@ function At({ row: e, actions: t, onClose: n }) {
|
|
|
2378
2377
|
}
|
|
2379
2378
|
//#endregion
|
|
2380
2379
|
//#region src/components/GroupRow.jsx
|
|
2381
|
-
function
|
|
2382
|
-
return /* @__PURE__ */
|
|
2380
|
+
function gt({ group: e, colSpan: t, isExpanded: n, onToggle: r, renderGroupHeader: i }) {
|
|
2381
|
+
return /* @__PURE__ */ z("tr", {
|
|
2383
2382
|
className: "bg-gray-50 dark:bg-gray-800/50 border-b border-[var(--app-border,#e5e7eb)]",
|
|
2384
|
-
children: /* @__PURE__ */
|
|
2383
|
+
children: /* @__PURE__ */ z("td", {
|
|
2385
2384
|
colSpan: t,
|
|
2386
2385
|
className: "px-4 py-2",
|
|
2387
|
-
children: /* @__PURE__ */
|
|
2386
|
+
children: /* @__PURE__ */ B("div", {
|
|
2388
2387
|
className: "flex items-center gap-2",
|
|
2389
2388
|
style: { paddingLeft: e.__level * 24 },
|
|
2390
|
-
children: [/* @__PURE__ */
|
|
2389
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2391
2390
|
type: "button",
|
|
2392
2391
|
onClick: () => r(e.__groupKey),
|
|
2393
2392
|
className: "p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",
|
|
2394
2393
|
"aria-label": n ? "Collapse group" : "Expand group",
|
|
2395
2394
|
"aria-expanded": n,
|
|
2396
|
-
children:
|
|
2397
|
-
}), i ? i(e.__groupKey, e.__groupValue, e.__children, e.__level) : /* @__PURE__ */
|
|
2395
|
+
children: z(n ? h : _, { className: "h-4 w-4 text-gray-500" })
|
|
2396
|
+
}), i ? i(e.__groupKey, e.__groupValue, e.__children, e.__level) : /* @__PURE__ */ B("span", {
|
|
2398
2397
|
className: "text-sm font-medium text-gray-700 dark:text-gray-300",
|
|
2399
2398
|
children: [
|
|
2400
2399
|
e.__groupField,
|
|
2401
2400
|
": ",
|
|
2402
2401
|
String(e.__groupValue ?? "N/A"),
|
|
2403
|
-
/* @__PURE__ */
|
|
2402
|
+
/* @__PURE__ */ B("span", {
|
|
2404
2403
|
className: "ml-2 text-xs text-gray-400 font-normal",
|
|
2405
2404
|
children: [
|
|
2406
2405
|
"(",
|
|
@@ -2408,9 +2407,9 @@ function jt({ group: e, colSpan: t, isExpanded: n, onToggle: r, renderGroupHeade
|
|
|
2408
2407
|
" items)"
|
|
2409
2408
|
]
|
|
2410
2409
|
}),
|
|
2411
|
-
Object.entries(e.__aggregates).length > 0 && /* @__PURE__ */
|
|
2410
|
+
Object.entries(e.__aggregates).length > 0 && /* @__PURE__ */ z("span", {
|
|
2412
2411
|
className: "ml-3 text-xs text-gray-400",
|
|
2413
|
-
children: Object.entries(e.__aggregates).map(([e, t]) => /* @__PURE__ */
|
|
2412
|
+
children: Object.entries(e.__aggregates).map(([e, t]) => /* @__PURE__ */ B("span", {
|
|
2414
2413
|
className: "ml-2",
|
|
2415
2414
|
children: [
|
|
2416
2415
|
e,
|
|
@@ -2427,38 +2426,38 @@ function jt({ group: e, colSpan: t, isExpanded: n, onToggle: r, renderGroupHeade
|
|
|
2427
2426
|
}
|
|
2428
2427
|
//#endregion
|
|
2429
2428
|
//#region src/components/TableView.jsx
|
|
2430
|
-
function
|
|
2431
|
-
let { processedData: s, sorting: c, filtering: l, selection: u, columnManager: d, expandedKeys: f, toggleExpand: p, editingCell: m, setEditingCell: h, getKey: g, pagination: _, theme: v, rowGrouping: y, treeData: b, virtualization: x, pinnedTopRows: S, pinnedBottomRows: C, unpinnedData: w } = e, { expandable: T, rowActions: E, onRowClick: D, onRowDoubleClick: O, onCellEdit:
|
|
2429
|
+
function _t({ table: e, props: t, onContextMenu: o }) {
|
|
2430
|
+
let { processedData: s, sorting: c, filtering: l, selection: u, columnManager: d, expandedKeys: f, toggleExpand: p, editingCell: m, setEditingCell: h, getKey: g, pagination: _, theme: v, rowGrouping: y, treeData: b, virtualization: x, pinnedTopRows: S, pinnedBottomRows: C, unpinnedData: w } = e, { expandable: T, rowActions: E, onRowClick: D, onRowDoubleClick: O, onCellEdit: k, striped: A = !1, compact: j = !1, maxHeight: M, bordered: N = !1, rowClassName: P, rowPinning: F, rowGrouping: ee, treeData: I, enableTooltips: L = !1, onRowReorder: R, floatingFilters: V = !1 } = t, H = a(null), U = x.enabled ? x.containerRef : H;
|
|
2432
2431
|
r(() => {
|
|
2433
2432
|
if (!_.isInfinite || !_.hasMore || !_.onLoadMore) return;
|
|
2434
|
-
let e =
|
|
2433
|
+
let e = U.current;
|
|
2435
2434
|
if (!e) return;
|
|
2436
2435
|
let t = () => {
|
|
2437
2436
|
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e;
|
|
2438
2437
|
n - t - r < 100 && _.onLoadMore?.();
|
|
2439
2438
|
};
|
|
2440
2439
|
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
2441
|
-
}, [_,
|
|
2442
|
-
let
|
|
2440
|
+
}, [_, U]);
|
|
2441
|
+
let W = n((e, t) => {
|
|
2443
2442
|
h({
|
|
2444
2443
|
rowKey: e,
|
|
2445
2444
|
columnId: t
|
|
2446
2445
|
});
|
|
2447
|
-
}, [h]),
|
|
2448
|
-
|
|
2449
|
-
}, [
|
|
2446
|
+
}, [h]), G = n((e, t, n) => {
|
|
2447
|
+
k?.(e, t, n), h(null);
|
|
2448
|
+
}, [k, h]), te = n(() => h(null), [h]), K = T?.enabled ?? !1, ne = !!E?.length, q = !!(F && (S.length || C.length)), J = q ? w : s, Y = i(() => y.enabled ? y.applyGrouping(J) : J, [y, J]), X = i(() => x.enabled ? x.getVirtualItems(Y) : Y, [x, Y]), re = i(() => b.enabled && I ? b.flattenTree(X) : null, [
|
|
2450
2449
|
b,
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
]),
|
|
2454
|
-
maxHeight:
|
|
2450
|
+
I,
|
|
2451
|
+
X
|
|
2452
|
+
]), ie = M ? {
|
|
2453
|
+
maxHeight: M,
|
|
2455
2454
|
overflow: "auto"
|
|
2456
2455
|
} : x.enabled ? {
|
|
2457
2456
|
height: "100%",
|
|
2458
2457
|
overflow: "auto"
|
|
2459
|
-
} : {},
|
|
2460
|
-
let i = g(t, n), a = typeof
|
|
2461
|
-
return /* @__PURE__ */
|
|
2458
|
+
} : {}, ae = d.visibleColumns.length + (u.showCheckbox ? 1 : 0) + (K ? 1 : 0) + (ne ? 1 : 0), oe = (t, n, r = "") => {
|
|
2459
|
+
let i = g(t, n), a = typeof P == "function" ? P(t) : P ?? "", c = re?.find((e) => e.treeKey === i), l = e.editing.isEditingRow(i), h = v.getRowStyle(t, n, u.isSelected(i), A), _ = v.getConditionalClassName(t);
|
|
2460
|
+
return /* @__PURE__ */ z(mt, {
|
|
2462
2461
|
row: t,
|
|
2463
2462
|
rowIndex: n,
|
|
2464
2463
|
rowKey: i,
|
|
@@ -2475,12 +2474,12 @@ function Mt({ table: e, props: t, onContextMenu: o }) {
|
|
|
2475
2474
|
onClick: D,
|
|
2476
2475
|
onDoubleClick: O,
|
|
2477
2476
|
editingCell: m,
|
|
2478
|
-
onStartEdit:
|
|
2479
|
-
onSaveEdit:
|
|
2480
|
-
onCancelEdit:
|
|
2477
|
+
onStartEdit: W,
|
|
2478
|
+
onSaveEdit: G,
|
|
2479
|
+
onCancelEdit: te,
|
|
2481
2480
|
expandContent: T?.render?.(t),
|
|
2482
|
-
striped:
|
|
2483
|
-
compact:
|
|
2481
|
+
striped: A,
|
|
2482
|
+
compact: j,
|
|
2484
2483
|
rowClassName: `${a} ${_} ${r}`,
|
|
2485
2484
|
rowStyle: h,
|
|
2486
2485
|
onContextMenu: o ? (e) => o(e, t) : void 0,
|
|
@@ -2488,30 +2487,30 @@ function Mt({ table: e, props: t, onContextMenu: o }) {
|
|
|
2488
2487
|
validationErrors: l ? e.editing.validationErrors : void 0,
|
|
2489
2488
|
pendingEdits: l ? e.editing.pendingEdits : void 0,
|
|
2490
2489
|
onPendingChange: l ? e.editing.updatePendingEdit : void 0,
|
|
2491
|
-
enableTooltips:
|
|
2490
|
+
enableTooltips: L,
|
|
2492
2491
|
tooltipStyle: v.tooltipStyle,
|
|
2493
2492
|
getCellStyle: v.getCellStyle
|
|
2494
2493
|
}, i);
|
|
2495
2494
|
};
|
|
2496
|
-
return /* @__PURE__ */
|
|
2497
|
-
ref:
|
|
2498
|
-
style:
|
|
2495
|
+
return /* @__PURE__ */ B("div", {
|
|
2496
|
+
ref: U,
|
|
2497
|
+
style: ie,
|
|
2499
2498
|
className: "overflow-x-auto",
|
|
2500
2499
|
onScroll: x.enabled ? x.handleScroll : void 0,
|
|
2501
|
-
children: [x.enabled && /* @__PURE__ */
|
|
2500
|
+
children: [x.enabled && /* @__PURE__ */ z("div", {
|
|
2502
2501
|
style: x.spacerStyle,
|
|
2503
|
-
children: /* @__PURE__ */
|
|
2502
|
+
children: /* @__PURE__ */ z("div", {
|
|
2504
2503
|
style: x.offsetStyle,
|
|
2505
|
-
children: /* @__PURE__ */
|
|
2504
|
+
children: /* @__PURE__ */ z(se, {})
|
|
2506
2505
|
})
|
|
2507
|
-
}), !x.enabled && /* @__PURE__ */
|
|
2506
|
+
}), !x.enabled && /* @__PURE__ */ z(se, {})]
|
|
2508
2507
|
});
|
|
2509
|
-
function
|
|
2510
|
-
return /* @__PURE__ */
|
|
2511
|
-
className: `w-full text-sm ${
|
|
2508
|
+
function se() {
|
|
2509
|
+
return /* @__PURE__ */ B("table", {
|
|
2510
|
+
className: `w-full text-sm ${N ? "border-collapse" : ""}`,
|
|
2512
2511
|
role: "grid",
|
|
2513
2512
|
"aria-label": t.ariaLabel ?? "Data table",
|
|
2514
|
-
children: [/* @__PURE__ */
|
|
2513
|
+
children: [/* @__PURE__ */ z(rt, {
|
|
2515
2514
|
columns: d.visibleColumns,
|
|
2516
2515
|
getSortDirection: c.getSortDirection,
|
|
2517
2516
|
onSort: c.toggleSort,
|
|
@@ -2526,50 +2525,50 @@ function Mt({ table: e, props: t, onContextMenu: o }) {
|
|
|
2526
2525
|
isSomeSelected: u.isSomeSelected(s),
|
|
2527
2526
|
onToggleAll: () => u.toggleAll(s),
|
|
2528
2527
|
showExpandToggle: K,
|
|
2529
|
-
showActions:
|
|
2530
|
-
compact:
|
|
2528
|
+
showActions: ne,
|
|
2529
|
+
compact: j,
|
|
2531
2530
|
getFilterValue: l.getFilterValue,
|
|
2532
2531
|
onFilterChange: l.setFilter,
|
|
2533
|
-
floatingFilters:
|
|
2532
|
+
floatingFilters: V,
|
|
2534
2533
|
showColumnGroups: !0
|
|
2535
|
-
}), /* @__PURE__ */
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
colSpan:
|
|
2534
|
+
}), /* @__PURE__ */ B("tbody", { children: [
|
|
2535
|
+
q && S.map((e, t) => oe(e, t, "bg-blue-50/50 dark:bg-blue-900/10")),
|
|
2536
|
+
q && S.length > 0 && /* @__PURE__ */ z("tr", { children: /* @__PURE__ */ z("td", {
|
|
2537
|
+
colSpan: ae,
|
|
2539
2538
|
className: "h-0.5 bg-blue-200 dark:bg-blue-800"
|
|
2540
2539
|
}) }),
|
|
2541
|
-
|
|
2540
|
+
re ? re.map((e, t) => oe(e.row, t)) : X.map((e, t) => {
|
|
2542
2541
|
let n = e;
|
|
2543
|
-
return n.__isGroupRow ? /* @__PURE__ */
|
|
2542
|
+
return n.__isGroupRow ? /* @__PURE__ */ z(gt, {
|
|
2544
2543
|
group: n,
|
|
2545
|
-
colSpan:
|
|
2544
|
+
colSpan: ae,
|
|
2546
2545
|
isExpanded: y.isGroupExpanded(n.__groupKey),
|
|
2547
2546
|
onToggle: y.toggleGroup,
|
|
2548
|
-
renderGroupHeader:
|
|
2549
|
-
}, n.__groupKey) :
|
|
2547
|
+
renderGroupHeader: ee?.renderGroupHeader
|
|
2548
|
+
}, n.__groupKey) : oe(e, t);
|
|
2550
2549
|
}),
|
|
2551
|
-
|
|
2552
|
-
colSpan:
|
|
2550
|
+
q && C.length > 0 && /* @__PURE__ */ z("tr", { children: /* @__PURE__ */ z("td", {
|
|
2551
|
+
colSpan: ae,
|
|
2553
2552
|
className: "h-0.5 bg-blue-200 dark:bg-blue-800"
|
|
2554
2553
|
}) }),
|
|
2555
|
-
|
|
2554
|
+
q && C.map((e, t) => oe(e, t, "bg-blue-50/50 dark:bg-blue-900/10"))
|
|
2556
2555
|
] })]
|
|
2557
2556
|
});
|
|
2558
2557
|
}
|
|
2559
2558
|
}
|
|
2560
2559
|
//#endregion
|
|
2561
2560
|
//#region src/components/GridView.jsx
|
|
2562
|
-
function
|
|
2561
|
+
function vt({ table: e, props: t }) {
|
|
2563
2562
|
let { processedData: n, selection: r, columnManager: i, getKey: a } = e, { renderGridCard: o, onRowClick: s, theme: c } = t;
|
|
2564
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ z("div", {
|
|
2565
2564
|
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-4",
|
|
2566
2565
|
children: n.map((e, t) => {
|
|
2567
2566
|
let n = a(e, t), l = r.isSelected(n);
|
|
2568
|
-
return o ? /* @__PURE__ */
|
|
2567
|
+
return o ? /* @__PURE__ */ z("div", {
|
|
2569
2568
|
className: `${l ? "ring-2 ring-brand-500" : ""} ${s ? "cursor-pointer" : ""}`,
|
|
2570
2569
|
onClick: () => s?.(e),
|
|
2571
2570
|
children: o(e)
|
|
2572
|
-
}, n) : /* @__PURE__ */
|
|
2571
|
+
}, n) : /* @__PURE__ */ B("div", {
|
|
2573
2572
|
className: `bg-[var(--app-bg,white)] border border-[var(--app-border,#e5e7eb)] rounded-lg p-4 shadow-sm hover:shadow-md transition-shadow
|
|
2574
2573
|
${l ? "ring-2 ring-brand-500" : ""}
|
|
2575
2574
|
${s ? "cursor-pointer" : ""}
|
|
@@ -2577,9 +2576,9 @@ function Nt({ table: e, props: t }) {
|
|
|
2577
2576
|
`,
|
|
2578
2577
|
onClick: () => s?.(e),
|
|
2579
2578
|
role: "article",
|
|
2580
|
-
children: [r.showCheckbox && /* @__PURE__ */
|
|
2579
|
+
children: [r.showCheckbox && /* @__PURE__ */ z("div", {
|
|
2581
2580
|
className: "mb-3",
|
|
2582
|
-
children: /* @__PURE__ */
|
|
2581
|
+
children: /* @__PURE__ */ z("input", {
|
|
2583
2582
|
type: "checkbox",
|
|
2584
2583
|
checked: l,
|
|
2585
2584
|
onChange: () => r.toggleRow(n),
|
|
@@ -2587,19 +2586,19 @@ function Nt({ table: e, props: t }) {
|
|
|
2587
2586
|
className: "h-4 w-4 rounded border-gray-300 text-brand-600 focus:ring-brand-600",
|
|
2588
2587
|
"aria-label": `Select item ${t + 1}`
|
|
2589
2588
|
})
|
|
2590
|
-
}), /* @__PURE__ */
|
|
2589
|
+
}), /* @__PURE__ */ z("div", {
|
|
2591
2590
|
className: "space-y-2",
|
|
2592
2591
|
children: i.visibleColumns.slice(0, 6).map((n) => {
|
|
2593
|
-
let r =
|
|
2592
|
+
let r = U(e, n), i = n.cell ? n.cell({
|
|
2594
2593
|
value: r,
|
|
2595
2594
|
row: e,
|
|
2596
2595
|
rowIndex: t,
|
|
2597
2596
|
column: n
|
|
2598
2597
|
}) : r ?? "—";
|
|
2599
|
-
return /* @__PURE__ */
|
|
2598
|
+
return /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("span", {
|
|
2600
2599
|
className: "text-xs font-medium text-gray-500 uppercase",
|
|
2601
2600
|
children: n.header
|
|
2602
|
-
}), /* @__PURE__ */
|
|
2601
|
+
}), /* @__PURE__ */ z("div", {
|
|
2603
2602
|
className: "text-sm text-[var(--app-text)]",
|
|
2604
2603
|
children: i
|
|
2605
2604
|
})] }, n.id);
|
|
@@ -2611,16 +2610,16 @@ function Nt({ table: e, props: t }) {
|
|
|
2611
2610
|
}
|
|
2612
2611
|
//#endregion
|
|
2613
2612
|
//#region src/components/ListView.jsx
|
|
2614
|
-
function
|
|
2613
|
+
function yt({ table: e, props: t }) {
|
|
2615
2614
|
let { processedData: n, selection: r, columnManager: i, getKey: a } = e, { renderListItem: o, onRowClick: s, theme: c } = t;
|
|
2616
|
-
return /* @__PURE__ */
|
|
2615
|
+
return /* @__PURE__ */ z("div", {
|
|
2617
2616
|
className: "divide-y divide-[var(--app-border,#e5e7eb)]",
|
|
2618
2617
|
children: n.map((e, t) => {
|
|
2619
2618
|
let n = a(e, t), l = r.isSelected(n);
|
|
2620
|
-
return o ? /* @__PURE__ */
|
|
2619
|
+
return o ? /* @__PURE__ */ z("div", {
|
|
2621
2620
|
className: `${l ? "bg-brand-50 dark:bg-brand-900/20" : ""} ${s ? "cursor-pointer" : ""}`,
|
|
2622
2621
|
children: o(e)
|
|
2623
|
-
}, n) : /* @__PURE__ */
|
|
2622
|
+
}, n) : /* @__PURE__ */ B("div", {
|
|
2624
2623
|
className: `flex items-center gap-4 px-4 py-3 hover:bg-[var(--app-hover,#f3f4f6)] transition-colors
|
|
2625
2624
|
${l ? "bg-brand-50 dark:bg-brand-900/20" : ""}
|
|
2626
2625
|
${s ? "cursor-pointer" : ""}
|
|
@@ -2628,28 +2627,28 @@ function Pt({ table: e, props: t }) {
|
|
|
2628
2627
|
`,
|
|
2629
2628
|
onClick: () => s?.(e),
|
|
2630
2629
|
role: "listitem",
|
|
2631
|
-
children: [r.showCheckbox && /* @__PURE__ */
|
|
2630
|
+
children: [r.showCheckbox && /* @__PURE__ */ z("input", {
|
|
2632
2631
|
type: "checkbox",
|
|
2633
2632
|
checked: l,
|
|
2634
2633
|
onChange: () => r.toggleRow(n),
|
|
2635
2634
|
onClick: (e) => e.stopPropagation(),
|
|
2636
2635
|
className: "h-4 w-4 rounded border-gray-300 text-brand-600 focus:ring-brand-600 shrink-0",
|
|
2637
2636
|
"aria-label": `Select item ${t + 1}`
|
|
2638
|
-
}), /* @__PURE__ */
|
|
2637
|
+
}), /* @__PURE__ */ z("div", {
|
|
2639
2638
|
className: "flex-1 flex items-center gap-6 min-w-0",
|
|
2640
2639
|
children: i.visibleColumns.slice(0, 5).map((n) => {
|
|
2641
|
-
let r =
|
|
2640
|
+
let r = U(e, n), i = n.cell ? n.cell({
|
|
2642
2641
|
value: r,
|
|
2643
2642
|
row: e,
|
|
2644
2643
|
rowIndex: t,
|
|
2645
2644
|
column: n
|
|
2646
2645
|
}) : r ?? "—";
|
|
2647
|
-
return /* @__PURE__ */
|
|
2646
|
+
return /* @__PURE__ */ B("div", {
|
|
2648
2647
|
className: "min-w-0",
|
|
2649
|
-
children: [/* @__PURE__ */
|
|
2648
|
+
children: [/* @__PURE__ */ z("span", {
|
|
2650
2649
|
className: "text-xs text-gray-500 block",
|
|
2651
2650
|
children: n.header
|
|
2652
|
-
}), /* @__PURE__ */
|
|
2651
|
+
}), /* @__PURE__ */ z("div", {
|
|
2653
2652
|
className: "text-sm text-[var(--app-text)] truncate",
|
|
2654
2653
|
children: i
|
|
2655
2654
|
})]
|
|
@@ -2662,7 +2661,7 @@ function Pt({ table: e, props: t }) {
|
|
|
2662
2661
|
}
|
|
2663
2662
|
//#endregion
|
|
2664
2663
|
//#region src/components/DataTablePagination.jsx
|
|
2665
|
-
function
|
|
2664
|
+
function bt({ page: e, pageSize: t, totalPages: n, totalItems: r, pageSizeOptions: i, onPageChange: a, onPageSizeChange: o }) {
|
|
2666
2665
|
let s = (e - 1) * t + 1, c = Math.min(e * t, r), l = () => {
|
|
2667
2666
|
if (n <= 7) return Array.from({ length: n }, (e, t) => t + 1);
|
|
2668
2667
|
let t = [1];
|
|
@@ -2671,11 +2670,11 @@ function Ft({ page: e, pageSize: t, totalPages: n, totalItems: r, pageSizeOption
|
|
|
2671
2670
|
for (let e = r; e <= i; e++) t.push(e);
|
|
2672
2671
|
return e < n - 2 && t.push("..."), t.push(n), t;
|
|
2673
2672
|
};
|
|
2674
|
-
return /* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ B("div", {
|
|
2675
2674
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between px-4 py-3 border-t border-[var(--app-border,#e5e7eb)]",
|
|
2676
|
-
children: [/* @__PURE__ */
|
|
2675
|
+
children: [/* @__PURE__ */ B("div", {
|
|
2677
2676
|
className: "flex items-center gap-3",
|
|
2678
|
-
children: [/* @__PURE__ */
|
|
2677
|
+
children: [/* @__PURE__ */ B("span", {
|
|
2679
2678
|
className: "text-sm text-gray-500",
|
|
2680
2679
|
children: [
|
|
2681
2680
|
s,
|
|
@@ -2684,59 +2683,59 @@ function Ft({ page: e, pageSize: t, totalPages: n, totalItems: r, pageSizeOption
|
|
|
2684
2683
|
" of ",
|
|
2685
2684
|
r
|
|
2686
2685
|
]
|
|
2687
|
-
}), /* @__PURE__ */
|
|
2686
|
+
}), /* @__PURE__ */ z("select", {
|
|
2688
2687
|
value: t,
|
|
2689
2688
|
onChange: (e) => o(Number(e.target.value)),
|
|
2690
2689
|
className: "h-8 px-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-[var(--app-bg)] focus:outline-none focus:ring-1 focus:ring-brand-500",
|
|
2691
2690
|
"aria-label": "Rows per page",
|
|
2692
|
-
children: i.map((e) => /* @__PURE__ */
|
|
2691
|
+
children: i.map((e) => /* @__PURE__ */ B("option", {
|
|
2693
2692
|
value: e,
|
|
2694
2693
|
children: [e, " / page"]
|
|
2695
2694
|
}, e))
|
|
2696
2695
|
})]
|
|
2697
|
-
}), /* @__PURE__ */
|
|
2696
|
+
}), /* @__PURE__ */ B("div", {
|
|
2698
2697
|
className: "flex items-center gap-1",
|
|
2699
2698
|
children: [
|
|
2700
|
-
/* @__PURE__ */
|
|
2699
|
+
/* @__PURE__ */ z(xt, {
|
|
2701
2700
|
onClick: () => a(1),
|
|
2702
2701
|
disabled: e <= 1,
|
|
2703
2702
|
"aria-label": "First page",
|
|
2704
|
-
children: /* @__PURE__ */
|
|
2703
|
+
children: /* @__PURE__ */ z(v, { className: "h-4 w-4" })
|
|
2705
2704
|
}),
|
|
2706
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ z(xt, {
|
|
2707
2706
|
onClick: () => a(e - 1),
|
|
2708
2707
|
disabled: e <= 1,
|
|
2709
2708
|
"aria-label": "Previous page",
|
|
2710
|
-
children: /* @__PURE__ */
|
|
2709
|
+
children: /* @__PURE__ */ z(g, { className: "h-4 w-4" })
|
|
2711
2710
|
}),
|
|
2712
|
-
l().map((t, n) => t === "..." ? /* @__PURE__ */
|
|
2711
|
+
l().map((t, n) => t === "..." ? /* @__PURE__ */ z("span", {
|
|
2713
2712
|
className: "px-2 text-sm text-gray-400",
|
|
2714
2713
|
children: "…"
|
|
2715
|
-
}, `ellipsis-${n}`) : /* @__PURE__ */
|
|
2714
|
+
}, `ellipsis-${n}`) : /* @__PURE__ */ z(xt, {
|
|
2716
2715
|
onClick: () => a(t),
|
|
2717
2716
|
active: t === e,
|
|
2718
2717
|
"aria-label": `Page ${t}`,
|
|
2719
2718
|
"aria-current": t === e ? "page" : void 0,
|
|
2720
2719
|
children: t
|
|
2721
2720
|
}, t)),
|
|
2722
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ z(xt, {
|
|
2723
2722
|
onClick: () => a(e + 1),
|
|
2724
2723
|
disabled: e >= n,
|
|
2725
2724
|
"aria-label": "Next page",
|
|
2726
|
-
children: /* @__PURE__ */
|
|
2725
|
+
children: /* @__PURE__ */ z(_, { className: "h-4 w-4" })
|
|
2727
2726
|
}),
|
|
2728
|
-
/* @__PURE__ */
|
|
2727
|
+
/* @__PURE__ */ z(xt, {
|
|
2729
2728
|
onClick: () => a(n),
|
|
2730
2729
|
disabled: e >= n,
|
|
2731
2730
|
"aria-label": "Last page",
|
|
2732
|
-
children: /* @__PURE__ */
|
|
2731
|
+
children: /* @__PURE__ */ z(y, { className: "h-4 w-4" })
|
|
2733
2732
|
})
|
|
2734
2733
|
]
|
|
2735
2734
|
})]
|
|
2736
2735
|
});
|
|
2737
2736
|
}
|
|
2738
|
-
function
|
|
2739
|
-
return /* @__PURE__ */
|
|
2737
|
+
function xt({ children: e, onClick: t, disabled: n = !1, active: r = !1, ...i }) {
|
|
2738
|
+
return /* @__PURE__ */ z("button", {
|
|
2740
2739
|
type: "button",
|
|
2741
2740
|
onClick: t,
|
|
2742
2741
|
disabled: n,
|
|
@@ -2748,31 +2747,31 @@ function It({ children: e, onClick: t, disabled: n = !1, active: r = !1, ...i })
|
|
|
2748
2747
|
}
|
|
2749
2748
|
//#endregion
|
|
2750
2749
|
//#region src/components/SidebarPanel.jsx
|
|
2751
|
-
function
|
|
2750
|
+
function St({ panels: e, activePanel: t, onClose: n, columns: r, hiddenColumns: i, columnOrder: a, onToggleColumn: o, onReorderColumns: s, filters: c, onFilterChange: l, onClearFilters: u }) {
|
|
2752
2751
|
let d = e.find((e) => e.type === t);
|
|
2753
|
-
return d ? /* @__PURE__ */
|
|
2752
|
+
return d ? /* @__PURE__ */ B("div", {
|
|
2754
2753
|
className: "w-64 border-l border-[var(--app-border,#e5e7eb)] bg-[var(--app-bg,white)] flex flex-col overflow-hidden shrink-0",
|
|
2755
|
-
children: [/* @__PURE__ */
|
|
2754
|
+
children: [/* @__PURE__ */ B("div", {
|
|
2756
2755
|
className: "flex items-center justify-between px-3 py-2 border-b border-[var(--app-border,#e5e7eb)]",
|
|
2757
|
-
children: [/* @__PURE__ */
|
|
2756
|
+
children: [/* @__PURE__ */ z("span", {
|
|
2758
2757
|
className: "text-sm font-semibold text-[var(--app-text)]",
|
|
2759
2758
|
children: d.title
|
|
2760
|
-
}), /* @__PURE__ */
|
|
2759
|
+
}), /* @__PURE__ */ z("button", {
|
|
2761
2760
|
type: "button",
|
|
2762
2761
|
onClick: n,
|
|
2763
2762
|
className: "p-1 text-gray-400 hover:text-gray-600 rounded transition-colors",
|
|
2764
2763
|
"aria-label": "Close panel",
|
|
2765
|
-
children: /* @__PURE__ */
|
|
2764
|
+
children: /* @__PURE__ */ z(L, { className: "h-4 w-4" })
|
|
2766
2765
|
})]
|
|
2767
|
-
}), /* @__PURE__ */
|
|
2766
|
+
}), /* @__PURE__ */ B("div", {
|
|
2768
2767
|
className: "flex-1 overflow-y-auto p-3",
|
|
2769
2768
|
children: [
|
|
2770
|
-
d.type === "columns" && r && o && /* @__PURE__ */
|
|
2769
|
+
d.type === "columns" && r && o && /* @__PURE__ */ z(Ct, {
|
|
2771
2770
|
columns: r,
|
|
2772
2771
|
hiddenColumns: i ?? /* @__PURE__ */ new Set(),
|
|
2773
2772
|
onToggle: o
|
|
2774
2773
|
}),
|
|
2775
|
-
d.type === "filters" && r && l && /* @__PURE__ */
|
|
2774
|
+
d.type === "filters" && r && l && /* @__PURE__ */ z(wt, {
|
|
2776
2775
|
columns: r,
|
|
2777
2776
|
filters: c ?? [],
|
|
2778
2777
|
onFilterChange: l,
|
|
@@ -2783,63 +2782,63 @@ function Lt({ panels: e, activePanel: t, onClose: n, columns: r, hiddenColumns:
|
|
|
2783
2782
|
})]
|
|
2784
2783
|
}) : null;
|
|
2785
2784
|
}
|
|
2786
|
-
function
|
|
2787
|
-
return /* @__PURE__ */
|
|
2785
|
+
function Ct({ columns: e, hiddenColumns: t, onToggle: n }) {
|
|
2786
|
+
return /* @__PURE__ */ B("div", {
|
|
2788
2787
|
className: "space-y-1",
|
|
2789
|
-
children: [/* @__PURE__ */
|
|
2788
|
+
children: [/* @__PURE__ */ z("p", {
|
|
2790
2789
|
className: "text-xs text-gray-500 mb-2",
|
|
2791
2790
|
children: "Toggle column visibility"
|
|
2792
|
-
}), e.map((e) => /* @__PURE__ */
|
|
2791
|
+
}), e.map((e) => /* @__PURE__ */ B("label", {
|
|
2793
2792
|
className: "flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
2794
|
-
children: [/* @__PURE__ */
|
|
2793
|
+
children: [/* @__PURE__ */ z("input", {
|
|
2795
2794
|
type: "checkbox",
|
|
2796
2795
|
checked: !t.has(e.id),
|
|
2797
2796
|
onChange: () => n(e.id),
|
|
2798
2797
|
className: "h-3.5 w-3.5 rounded border-gray-300 text-brand-600 focus:ring-brand-600"
|
|
2799
|
-
}), /* @__PURE__ */
|
|
2798
|
+
}), /* @__PURE__ */ z("span", {
|
|
2800
2799
|
className: "text-sm text-gray-700 dark:text-gray-300 truncate",
|
|
2801
2800
|
children: e.header
|
|
2802
2801
|
})]
|
|
2803
2802
|
}, e.id))]
|
|
2804
2803
|
});
|
|
2805
2804
|
}
|
|
2806
|
-
function
|
|
2805
|
+
function wt({ columns: e, filters: t, onFilterChange: n, onClearFilters: r }) {
|
|
2807
2806
|
let i = e.filter((e) => e.filterable !== !1 && e.filterType);
|
|
2808
|
-
return /* @__PURE__ */
|
|
2807
|
+
return /* @__PURE__ */ B("div", {
|
|
2809
2808
|
className: "space-y-3",
|
|
2810
2809
|
children: [
|
|
2811
|
-
r && t.length > 0 && /* @__PURE__ */
|
|
2810
|
+
r && t.length > 0 && /* @__PURE__ */ z("button", {
|
|
2812
2811
|
type: "button",
|
|
2813
2812
|
onClick: r,
|
|
2814
2813
|
className: "text-xs text-brand-600 hover:text-brand-700 underline",
|
|
2815
2814
|
children: "Clear all filters"
|
|
2816
2815
|
}),
|
|
2817
|
-
i.length === 0 && /* @__PURE__ */
|
|
2816
|
+
i.length === 0 && /* @__PURE__ */ z("p", {
|
|
2818
2817
|
className: "text-xs text-gray-400",
|
|
2819
2818
|
children: "No filterable columns"
|
|
2820
2819
|
}),
|
|
2821
2820
|
i.map((e) => {
|
|
2822
2821
|
let r = t.find((t) => t.columnId === e.id)?.value ?? "";
|
|
2823
|
-
return /* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2822
|
+
return /* @__PURE__ */ B("div", { children: [
|
|
2823
|
+
/* @__PURE__ */ z("label", {
|
|
2825
2824
|
className: "text-xs font-medium text-gray-500 block mb-1",
|
|
2826
2825
|
children: e.header
|
|
2827
2826
|
}),
|
|
2828
|
-
(e.filterType === "text" || e.filterType === "number") && /* @__PURE__ */
|
|
2827
|
+
(e.filterType === "text" || e.filterType === "number") && /* @__PURE__ */ z("input", {
|
|
2829
2828
|
type: e.filterType === "number" ? "number" : "text",
|
|
2830
2829
|
value: String(r),
|
|
2831
2830
|
onChange: (t) => n(e.id, t.target.value, "contains"),
|
|
2832
2831
|
placeholder: "Filter...",
|
|
2833
2832
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]"
|
|
2834
2833
|
}),
|
|
2835
|
-
e.filterType === "select" && e.filterOptions && /* @__PURE__ */
|
|
2834
|
+
e.filterType === "select" && e.filterOptions && /* @__PURE__ */ B("select", {
|
|
2836
2835
|
value: String(r),
|
|
2837
2836
|
onChange: (t) => n(e.id, t.target.value, "eq"),
|
|
2838
2837
|
className: "w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]",
|
|
2839
|
-
children: [/* @__PURE__ */
|
|
2838
|
+
children: [/* @__PURE__ */ z("option", {
|
|
2840
2839
|
value: "",
|
|
2841
2840
|
children: "All"
|
|
2842
|
-
}), e.filterOptions.map((e) => /* @__PURE__ */
|
|
2841
|
+
}), e.filterOptions.map((e) => /* @__PURE__ */ z("option", {
|
|
2843
2842
|
value: e.value,
|
|
2844
2843
|
children: e.label
|
|
2845
2844
|
}, e.value))]
|
|
@@ -2851,7 +2850,7 @@ function zt({ columns: e, filters: t, onFilterChange: n, onClearFilters: r }) {
|
|
|
2851
2850
|
}
|
|
2852
2851
|
//#endregion
|
|
2853
2852
|
//#region src/components/PresetManager.jsx
|
|
2854
|
-
function
|
|
2853
|
+
function Tt({ presets: t, onSave: n, onLoad: r, onDelete: i, onRename: a, getCurrentConfig: s }) {
|
|
2855
2854
|
let [c, l] = o(!1), [u, d] = o(""), [f, h] = o(null), [g, _] = o(""), v = e.useRef(null);
|
|
2856
2855
|
e.useEffect(() => {
|
|
2857
2856
|
if (!c) return;
|
|
@@ -2865,52 +2864,52 @@ function Bt({ presets: t, onSave: n, onLoad: r, onDelete: i, onRename: a, getCur
|
|
|
2865
2864
|
}, b = (e) => {
|
|
2866
2865
|
g.trim() && (a(e, g.trim()), h(null));
|
|
2867
2866
|
};
|
|
2868
|
-
return /* @__PURE__ */
|
|
2867
|
+
return /* @__PURE__ */ B("div", {
|
|
2869
2868
|
className: "relative",
|
|
2870
2869
|
ref: v,
|
|
2871
|
-
children: [/* @__PURE__ */
|
|
2870
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2872
2871
|
type: "button",
|
|
2873
2872
|
onClick: () => l((e) => !e),
|
|
2874
2873
|
className: "inline-flex items-center gap-1.5 px-3 py-2 text-sm text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-md transition-colors",
|
|
2875
2874
|
"aria-label": "Table presets",
|
|
2876
2875
|
title: "Table presets",
|
|
2877
2876
|
children: [
|
|
2878
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ z(p, { className: "h-4 w-4" }),
|
|
2879
2878
|
"Presets",
|
|
2880
|
-
t.length > 0 && /* @__PURE__ */
|
|
2879
|
+
t.length > 0 && /* @__PURE__ */ z("span", {
|
|
2881
2880
|
className: "ml-1 text-xs bg-gray-200 text-gray-600 rounded-full px-1.5 py-0.5",
|
|
2882
2881
|
children: t.length
|
|
2883
2882
|
})
|
|
2884
2883
|
]
|
|
2885
|
-
}), c && /* @__PURE__ */
|
|
2884
|
+
}), c && /* @__PURE__ */ B("div", {
|
|
2886
2885
|
className: "absolute right-0 top-full mt-1 z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[280px]",
|
|
2887
|
-
children: [/* @__PURE__ */
|
|
2886
|
+
children: [/* @__PURE__ */ B("div", {
|
|
2888
2887
|
className: "flex items-center gap-2 mb-3",
|
|
2889
|
-
children: [/* @__PURE__ */
|
|
2888
|
+
children: [/* @__PURE__ */ z("input", {
|
|
2890
2889
|
type: "text",
|
|
2891
2890
|
value: u,
|
|
2892
2891
|
onChange: (e) => d(e.target.value),
|
|
2893
2892
|
onKeyDown: (e) => e.key === "Enter" && y(),
|
|
2894
2893
|
placeholder: "Save current view as...",
|
|
2895
2894
|
className: "flex-1 px-2 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]"
|
|
2896
|
-
}), /* @__PURE__ */
|
|
2895
|
+
}), /* @__PURE__ */ z("button", {
|
|
2897
2896
|
type: "button",
|
|
2898
2897
|
onClick: y,
|
|
2899
2898
|
disabled: !u.trim(),
|
|
2900
2899
|
className: "p-1.5 text-brand-600 hover:bg-brand-50 rounded disabled:opacity-50",
|
|
2901
2900
|
"aria-label": "Save preset",
|
|
2902
|
-
children: /* @__PURE__ */
|
|
2901
|
+
children: /* @__PURE__ */ z(N, { className: "h-4 w-4" })
|
|
2903
2902
|
})]
|
|
2904
|
-
}), t.length === 0 ? /* @__PURE__ */
|
|
2903
|
+
}), t.length === 0 ? /* @__PURE__ */ z("p", {
|
|
2905
2904
|
className: "text-xs text-gray-400 text-center py-2",
|
|
2906
2905
|
children: "No saved presets"
|
|
2907
|
-
}) : /* @__PURE__ */
|
|
2906
|
+
}) : /* @__PURE__ */ z("div", {
|
|
2908
2907
|
className: "space-y-1 max-h-64 overflow-y-auto",
|
|
2909
|
-
children: t.map((e) => /* @__PURE__ */
|
|
2908
|
+
children: t.map((e) => /* @__PURE__ */ z("div", {
|
|
2910
2909
|
className: "flex items-center justify-between px-2 py-1.5 rounded hover:bg-gray-50 dark:hover:bg-gray-700 group",
|
|
2911
|
-
children: f === e.id ? /* @__PURE__ */
|
|
2910
|
+
children: f === e.id ? /* @__PURE__ */ B("div", {
|
|
2912
2911
|
className: "flex items-center gap-1 flex-1",
|
|
2913
|
-
children: [/* @__PURE__ */
|
|
2912
|
+
children: [/* @__PURE__ */ z("input", {
|
|
2914
2913
|
type: "text",
|
|
2915
2914
|
value: g,
|
|
2916
2915
|
onChange: (e) => _(e.target.value),
|
|
@@ -2919,13 +2918,13 @@ function Bt({ presets: t, onSave: n, onLoad: r, onDelete: i, onRename: a, getCur
|
|
|
2919
2918
|
},
|
|
2920
2919
|
className: "flex-1 px-1 py-0.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-brand-500 bg-[var(--app-bg)]",
|
|
2921
2920
|
autoFocus: !0
|
|
2922
|
-
}), /* @__PURE__ */
|
|
2921
|
+
}), /* @__PURE__ */ z("button", {
|
|
2923
2922
|
type: "button",
|
|
2924
2923
|
onClick: () => b(e.id),
|
|
2925
2924
|
className: "p-1 text-green-600 hover:bg-green-50 rounded",
|
|
2926
|
-
children: /* @__PURE__ */
|
|
2925
|
+
children: /* @__PURE__ */ z(m, { className: "h-3 w-3" })
|
|
2927
2926
|
})]
|
|
2928
|
-
}) : /* @__PURE__ */
|
|
2927
|
+
}) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("button", {
|
|
2929
2928
|
type: "button",
|
|
2930
2929
|
onClick: () => {
|
|
2931
2930
|
r(e.id), l(!1);
|
|
@@ -2933,22 +2932,22 @@ function Bt({ presets: t, onSave: n, onLoad: r, onDelete: i, onRename: a, getCur
|
|
|
2933
2932
|
className: "text-sm text-gray-700 dark:text-gray-300 truncate flex-1 text-left",
|
|
2934
2933
|
title: `Load "${e.name}"`,
|
|
2935
2934
|
children: e.name
|
|
2936
|
-
}), /* @__PURE__ */
|
|
2935
|
+
}), /* @__PURE__ */ B("div", {
|
|
2937
2936
|
className: "flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2938
|
-
children: [/* @__PURE__ */
|
|
2937
|
+
children: [/* @__PURE__ */ z("button", {
|
|
2939
2938
|
type: "button",
|
|
2940
2939
|
onClick: () => {
|
|
2941
2940
|
h(e.id), _(e.name);
|
|
2942
2941
|
},
|
|
2943
2942
|
className: "p-1 text-gray-400 hover:text-gray-600",
|
|
2944
2943
|
"aria-label": `Rename preset ${e.name}`,
|
|
2945
|
-
children: /* @__PURE__ */
|
|
2946
|
-
}), /* @__PURE__ */
|
|
2944
|
+
children: /* @__PURE__ */ z(S, { className: "h-3 w-3" })
|
|
2945
|
+
}), /* @__PURE__ */ z("button", {
|
|
2947
2946
|
type: "button",
|
|
2948
2947
|
onClick: () => i(e.id),
|
|
2949
2948
|
className: "p-1 text-gray-400 hover:text-red-500",
|
|
2950
2949
|
"aria-label": `Delete preset ${e.name}`,
|
|
2951
|
-
children: /* @__PURE__ */
|
|
2950
|
+
children: /* @__PURE__ */ z(I, { className: "h-3 w-3" })
|
|
2952
2951
|
})]
|
|
2953
2952
|
})] })
|
|
2954
2953
|
}, e.id))
|
|
@@ -2958,7 +2957,7 @@ function Bt({ presets: t, onSave: n, onLoad: r, onDelete: i, onRename: a, getCur
|
|
|
2958
2957
|
}
|
|
2959
2958
|
//#endregion
|
|
2960
2959
|
//#region src/components/ContextMenu.jsx
|
|
2961
|
-
function
|
|
2960
|
+
function Et({ x: e, y: t, row: n, items: i, onClose: o }) {
|
|
2962
2961
|
let s = a(null);
|
|
2963
2962
|
r(() => {
|
|
2964
2963
|
let e = (e) => {
|
|
@@ -2975,7 +2974,7 @@ function Vt({ x: e, y: t, row: n, items: i, onClose: o }) {
|
|
|
2975
2974
|
n.right > window.innerWidth && (r.style.left = `${e - n.width}px`), n.bottom > window.innerHeight && (r.style.top = `${t - n.height}px`);
|
|
2976
2975
|
}, [e, t]);
|
|
2977
2976
|
let c = i.filter((e) => !e.hidden?.(n));
|
|
2978
|
-
return c.length ? /* @__PURE__ */
|
|
2977
|
+
return c.length ? /* @__PURE__ */ z("div", {
|
|
2979
2978
|
ref: s,
|
|
2980
2979
|
className: "fixed z-[9999] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl py-1 min-w-[160px] animate-in fade-in zoom-in-95 duration-100",
|
|
2981
2980
|
style: {
|
|
@@ -2983,10 +2982,10 @@ function Vt({ x: e, y: t, row: n, items: i, onClose: o }) {
|
|
|
2983
2982
|
top: t
|
|
2984
2983
|
},
|
|
2985
2984
|
role: "menu",
|
|
2986
|
-
children: c.map((e) => e.separator ? /* @__PURE__ */
|
|
2985
|
+
children: c.map((e) => e.separator ? /* @__PURE__ */ z("div", {
|
|
2987
2986
|
className: "my-1 border-t border-gray-200 dark:border-gray-700",
|
|
2988
2987
|
role: "separator"
|
|
2989
|
-
}, e.id) : /* @__PURE__ */
|
|
2988
|
+
}, e.id) : /* @__PURE__ */ B("button", {
|
|
2990
2989
|
type: "button",
|
|
2991
2990
|
onClick: () => {
|
|
2992
2991
|
e.onClick(n), o();
|
|
@@ -2994,7 +2993,7 @@ function Vt({ x: e, y: t, row: n, items: i, onClose: o }) {
|
|
|
2994
2993
|
disabled: e.disabled?.(n),
|
|
2995
2994
|
className: `w-full text-left px-3 py-2 text-sm flex items-center gap-2 transition-colors ${e.variant === "danger" ? "text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${e.disabled?.(n) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
2996
2995
|
role: "menuitem",
|
|
2997
|
-
children: [e.icon && /* @__PURE__ */
|
|
2996
|
+
children: [e.icon && /* @__PURE__ */ z("span", {
|
|
2998
2997
|
className: "w-4 h-4 flex-shrink-0",
|
|
2999
2998
|
children: e.icon
|
|
3000
2999
|
}), e.label]
|
|
@@ -3003,28 +3002,28 @@ function Vt({ x: e, y: t, row: n, items: i, onClose: o }) {
|
|
|
3003
3002
|
}
|
|
3004
3003
|
//#endregion
|
|
3005
3004
|
//#region src/components/StatusBar.jsx
|
|
3006
|
-
function
|
|
3005
|
+
function Dt({ config: e, data: t, state: n }) {
|
|
3007
3006
|
let r = i(() => e.computeItems?.(t, n) ?? [], [
|
|
3008
3007
|
e,
|
|
3009
3008
|
t,
|
|
3010
3009
|
n
|
|
3011
3010
|
]), a = i(() => [...e.items ?? [], ...r], [e.items, r]);
|
|
3012
|
-
return a.length ? /* @__PURE__ */
|
|
3011
|
+
return a.length ? /* @__PURE__ */ z("div", {
|
|
3013
3012
|
className: `flex items-center gap-4 px-4 py-2 text-xs text-gray-500 border-t border-[var(--app-border,#e5e7eb)] bg-[var(--app-surface,#f9fafb)] ${e.className ?? ""}`,
|
|
3014
3013
|
role: "status",
|
|
3015
3014
|
"aria-label": "Table status",
|
|
3016
|
-
children: a.map((e) => /* @__PURE__ */
|
|
3015
|
+
children: a.map((e) => /* @__PURE__ */ B("div", {
|
|
3017
3016
|
className: "flex items-center gap-1.5",
|
|
3018
3017
|
children: [
|
|
3019
|
-
e.icon && /* @__PURE__ */
|
|
3018
|
+
e.icon && /* @__PURE__ */ z("span", {
|
|
3020
3019
|
className: "w-3.5 h-3.5 flex-shrink-0",
|
|
3021
3020
|
children: e.icon
|
|
3022
3021
|
}),
|
|
3023
|
-
/* @__PURE__ */
|
|
3022
|
+
/* @__PURE__ */ B("span", {
|
|
3024
3023
|
className: "text-gray-400",
|
|
3025
3024
|
children: [e.label, ":"]
|
|
3026
3025
|
}),
|
|
3027
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ z("span", {
|
|
3028
3027
|
className: "font-medium text-gray-600",
|
|
3029
3028
|
children: e.value
|
|
3030
3029
|
})
|
|
@@ -3034,7 +3033,7 @@ function Ht({ config: e, data: t, state: n }) {
|
|
|
3034
3033
|
}
|
|
3035
3034
|
//#endregion
|
|
3036
3035
|
//#region src/hooks/useChartData.js
|
|
3037
|
-
var
|
|
3036
|
+
var Ot = [
|
|
3038
3037
|
"#6366f1",
|
|
3039
3038
|
"#f59e0b",
|
|
3040
3039
|
"#10b981",
|
|
@@ -3046,13 +3045,13 @@ var Ut = [
|
|
|
3046
3045
|
"#ec4899",
|
|
3047
3046
|
"#14b8a6"
|
|
3048
3047
|
];
|
|
3049
|
-
function
|
|
3048
|
+
function kt(e) {
|
|
3050
3049
|
if (typeof e == "number") return e;
|
|
3051
3050
|
if (typeof e == "boolean") return e ? 1 : 0;
|
|
3052
3051
|
let t = Number(e);
|
|
3053
3052
|
return isNaN(t) ? 0 : t;
|
|
3054
3053
|
}
|
|
3055
|
-
function
|
|
3054
|
+
function At(e, t) {
|
|
3056
3055
|
if (!e.length) return 0;
|
|
3057
3056
|
switch (t) {
|
|
3058
3057
|
case "sum": return e.reduce((e, t) => e + t, 0);
|
|
@@ -3063,34 +3062,34 @@ function Gt(e, t) {
|
|
|
3063
3062
|
default: return e.reduce((e, t) => e + t, 0);
|
|
3064
3063
|
}
|
|
3065
3064
|
}
|
|
3066
|
-
function
|
|
3065
|
+
function jt(e, t, n, r, i) {
|
|
3067
3066
|
let a = n.find((e) => e.id === t.groupBy);
|
|
3068
3067
|
if (!a) return [];
|
|
3069
3068
|
let o = /* @__PURE__ */ new Map();
|
|
3070
3069
|
e.forEach((e) => {
|
|
3071
|
-
let t = String(
|
|
3070
|
+
let t = String(U(e, a) ?? "Unknown"), n = o.get(t) ?? [];
|
|
3072
3071
|
n.push(e), o.set(t, n);
|
|
3073
3072
|
});
|
|
3074
3073
|
let s = t.aggregation ?? "sum";
|
|
3075
3074
|
return Array.from(o.entries()).map(([e, t]) => {
|
|
3076
3075
|
let n = { label: e };
|
|
3077
3076
|
return i.forEach((e) => {
|
|
3078
|
-
let r = t.map((t) =>
|
|
3079
|
-
n[e.id] =
|
|
3077
|
+
let r = t.map((t) => kt(U(t, e)));
|
|
3078
|
+
n[e.id] = At(r, s);
|
|
3080
3079
|
}), n;
|
|
3081
3080
|
});
|
|
3082
3081
|
}
|
|
3083
|
-
function
|
|
3082
|
+
function Mt({ data: e, config: t, columns: n }) {
|
|
3084
3083
|
return {
|
|
3085
3084
|
chartData: i(() => {
|
|
3086
3085
|
if (!e.length || !t.labelColumn || !t.dataColumns.length) return [];
|
|
3087
3086
|
let r = n.find((e) => e.id === t.labelColumn);
|
|
3088
3087
|
if (!r) return [];
|
|
3089
3088
|
let i = t.dataColumns.map((e) => n.find((t) => t.id === e)).filter((e) => e != null);
|
|
3090
|
-
return i.length ? t.groupBy ?
|
|
3091
|
-
let t = { label: String(
|
|
3089
|
+
return i.length ? t.groupBy ? jt(e, t, n, r, i) : e.map((e) => {
|
|
3090
|
+
let t = { label: String(U(e, r) ?? "") };
|
|
3092
3091
|
return i.forEach((n) => {
|
|
3093
|
-
t[n.id] =
|
|
3092
|
+
t[n.id] = kt(U(e, n));
|
|
3094
3093
|
}), t;
|
|
3095
3094
|
}) : [];
|
|
3096
3095
|
}, [
|
|
@@ -3101,7 +3100,7 @@ function qt({ data: e, config: t, columns: n }) {
|
|
|
3101
3100
|
series: i(() => t.dataColumns.map((e, r) => ({
|
|
3102
3101
|
key: e,
|
|
3103
3102
|
name: n.find((t) => t.id === e)?.header ?? e,
|
|
3104
|
-
color: t.colors?.[r] ??
|
|
3103
|
+
color: t.colors?.[r] ?? Ot[r % Ot.length]
|
|
3105
3104
|
})), [
|
|
3106
3105
|
t.dataColumns,
|
|
3107
3106
|
t.colors,
|
|
@@ -3111,196 +3110,95 @@ function qt({ data: e, config: t, columns: n }) {
|
|
|
3111
3110
|
}
|
|
3112
3111
|
//#endregion
|
|
3113
3112
|
//#region src/components/DataChart.jsx
|
|
3114
|
-
|
|
3115
|
-
|
|
3113
|
+
var Nt = null;
|
|
3114
|
+
function Pt() {
|
|
3115
|
+
let [e, t] = o(Nt), [n, r] = o(!1);
|
|
3116
|
+
return {
|
|
3117
|
+
recharts: e,
|
|
3118
|
+
error: n
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
function Ft({ data: e, config: t, columns: r, onRemove: i, onEdit: o, className: s = "" }) {
|
|
3122
|
+
let { chartData: c, series: l } = Mt({
|
|
3116
3123
|
data: e,
|
|
3117
3124
|
config: t,
|
|
3118
3125
|
columns: r
|
|
3119
|
-
}), u = a(null)
|
|
3126
|
+
}), u = a(null);
|
|
3127
|
+
t.height;
|
|
3128
|
+
let { recharts: d, error: f } = Pt(), p = n(async () => {
|
|
3120
3129
|
if (u.current) try {
|
|
3121
3130
|
let { toPng: e } = await import("html-to-image"), n = await e(u.current, { backgroundColor: "#ffffff" }), r = document.createElement("a");
|
|
3122
3131
|
r.download = `${t.title || "chart"}.png`, r.href = n, r.click();
|
|
3123
3132
|
} catch {}
|
|
3124
3133
|
}, [t.title]);
|
|
3125
|
-
return c.length ? /* @__PURE__ */ z("div", {
|
|
3134
|
+
return c.length ? f ? /* @__PURE__ */ z("div", {
|
|
3135
|
+
className: `flex items-center justify-center h-48 text-sm text-red-400 border border-dashed border-red-300 rounded-lg ${s}`,
|
|
3136
|
+
children: "Charts require the \"recharts\" package. Install it with: npm install recharts"
|
|
3137
|
+
}) : d ? /* @__PURE__ */ z("div", {
|
|
3126
3138
|
className: `bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${s}`,
|
|
3127
|
-
children:
|
|
3139
|
+
children: /* @__PURE__ */ B("div", {
|
|
3128
3140
|
className: "flex items-center justify-between px-4 py-2 border-b border-gray-100 dark:border-gray-800",
|
|
3129
|
-
children: [/* @__PURE__ */
|
|
3141
|
+
children: [/* @__PURE__ */ z("span", {
|
|
3130
3142
|
className: "text-sm font-medium text-gray-700 dark:text-gray-300 truncate",
|
|
3131
3143
|
children: t.title || "Chart"
|
|
3132
|
-
}), /* @__PURE__ */
|
|
3144
|
+
}), /* @__PURE__ */ B("div", {
|
|
3133
3145
|
className: "flex items-center gap-1",
|
|
3134
3146
|
children: [
|
|
3135
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ z("button", {
|
|
3136
3148
|
type: "button",
|
|
3137
|
-
onClick:
|
|
3149
|
+
onClick: p,
|
|
3138
3150
|
className: "p-1 text-gray-400 hover:text-gray-600 rounded transition-colors",
|
|
3139
3151
|
title: "Export as PNG",
|
|
3140
|
-
children: /* @__PURE__ */
|
|
3152
|
+
children: /* @__PURE__ */ z(x, { className: "h-3.5 w-3.5" })
|
|
3141
3153
|
}),
|
|
3142
|
-
o && /* @__PURE__ */
|
|
3154
|
+
o && /* @__PURE__ */ z("button", {
|
|
3143
3155
|
type: "button",
|
|
3144
3156
|
onClick: o,
|
|
3145
3157
|
className: "p-1 text-gray-400 hover:text-brand-600 rounded transition-colors",
|
|
3146
3158
|
title: "Edit chart",
|
|
3147
|
-
children: /* @__PURE__ */
|
|
3159
|
+
children: /* @__PURE__ */ z(S, { className: "h-3.5 w-3.5" })
|
|
3148
3160
|
}),
|
|
3149
|
-
i && /* @__PURE__ */
|
|
3161
|
+
i && /* @__PURE__ */ z("button", {
|
|
3150
3162
|
type: "button",
|
|
3151
3163
|
onClick: i,
|
|
3152
3164
|
className: "p-1 text-gray-400 hover:text-red-500 rounded transition-colors",
|
|
3153
3165
|
title: "Remove chart",
|
|
3154
|
-
children: /* @__PURE__ */
|
|
3166
|
+
children: /* @__PURE__ */ z(L, { className: "h-3.5 w-3.5" })
|
|
3155
3167
|
})
|
|
3156
3168
|
]
|
|
3157
3169
|
})]
|
|
3158
|
-
})
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
height: d,
|
|
3164
|
-
children: Yt(t, c, l)
|
|
3165
|
-
})
|
|
3166
|
-
})]
|
|
3167
|
-
}) : /* @__PURE__ */ R("div", {
|
|
3170
|
+
})
|
|
3171
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3172
|
+
className: `flex items-center justify-center h-48 text-sm text-gray-400 ${s}`,
|
|
3173
|
+
children: "Loading chart..."
|
|
3174
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3168
3175
|
className: `flex items-center justify-center h-48 text-sm text-gray-400 border border-dashed border-gray-300 rounded-lg ${s}`,
|
|
3169
3176
|
children: "No data to display"
|
|
3170
3177
|
});
|
|
3171
3178
|
}
|
|
3172
|
-
function Yt(e, t, n) {
|
|
3173
|
-
let r = e.showLegend ?? !0, i = e.showTooltip ?? !0;
|
|
3174
|
-
switch (e.type) {
|
|
3175
|
-
case "bar": return /* @__PURE__ */ z(W, {
|
|
3176
|
-
data: t,
|
|
3177
|
-
children: [
|
|
3178
|
-
/* @__PURE__ */ R(G, {
|
|
3179
|
-
strokeDasharray: "3 3",
|
|
3180
|
-
stroke: "#e5e7eb"
|
|
3181
|
-
}),
|
|
3182
|
-
/* @__PURE__ */ R(se, {
|
|
3183
|
-
dataKey: "label",
|
|
3184
|
-
tick: { fontSize: 12 }
|
|
3185
|
-
}),
|
|
3186
|
-
/* @__PURE__ */ R(Y, { tick: { fontSize: 12 } }),
|
|
3187
|
-
i && /* @__PURE__ */ R(oe, {}),
|
|
3188
|
-
r && /* @__PURE__ */ R(q, {}),
|
|
3189
|
-
n.map((t) => /* @__PURE__ */ R(U, {
|
|
3190
|
-
dataKey: t.key,
|
|
3191
|
-
name: t.name,
|
|
3192
|
-
fill: t.color,
|
|
3193
|
-
stackId: e.stacked ? "stack" : void 0,
|
|
3194
|
-
radius: [
|
|
3195
|
-
2,
|
|
3196
|
-
2,
|
|
3197
|
-
0,
|
|
3198
|
-
0
|
|
3199
|
-
]
|
|
3200
|
-
}, t.key))
|
|
3201
|
-
]
|
|
3202
|
-
});
|
|
3203
|
-
case "line": return /* @__PURE__ */ z(J, {
|
|
3204
|
-
data: t,
|
|
3205
|
-
children: [
|
|
3206
|
-
/* @__PURE__ */ R(G, {
|
|
3207
|
-
strokeDasharray: "3 3",
|
|
3208
|
-
stroke: "#e5e7eb"
|
|
3209
|
-
}),
|
|
3210
|
-
/* @__PURE__ */ R(se, {
|
|
3211
|
-
dataKey: "label",
|
|
3212
|
-
tick: { fontSize: 12 }
|
|
3213
|
-
}),
|
|
3214
|
-
/* @__PURE__ */ R(Y, { tick: { fontSize: 12 } }),
|
|
3215
|
-
i && /* @__PURE__ */ R(oe, {}),
|
|
3216
|
-
r && /* @__PURE__ */ R(q, {}),
|
|
3217
|
-
n.map((e) => /* @__PURE__ */ R(ne, {
|
|
3218
|
-
type: "monotone",
|
|
3219
|
-
dataKey: e.key,
|
|
3220
|
-
name: e.name,
|
|
3221
|
-
stroke: e.color,
|
|
3222
|
-
strokeWidth: 2,
|
|
3223
|
-
dot: { r: 3 },
|
|
3224
|
-
activeDot: { r: 5 }
|
|
3225
|
-
}, e.key))
|
|
3226
|
-
]
|
|
3227
|
-
});
|
|
3228
|
-
case "area": return /* @__PURE__ */ z(H, {
|
|
3229
|
-
data: t,
|
|
3230
|
-
children: [
|
|
3231
|
-
/* @__PURE__ */ R(G, {
|
|
3232
|
-
strokeDasharray: "3 3",
|
|
3233
|
-
stroke: "#e5e7eb"
|
|
3234
|
-
}),
|
|
3235
|
-
/* @__PURE__ */ R(se, {
|
|
3236
|
-
dataKey: "label",
|
|
3237
|
-
tick: { fontSize: 12 }
|
|
3238
|
-
}),
|
|
3239
|
-
/* @__PURE__ */ R(Y, { tick: { fontSize: 12 } }),
|
|
3240
|
-
i && /* @__PURE__ */ R(oe, {}),
|
|
3241
|
-
r && /* @__PURE__ */ R(q, {}),
|
|
3242
|
-
n.map((t) => /* @__PURE__ */ R(V, {
|
|
3243
|
-
type: "monotone",
|
|
3244
|
-
dataKey: t.key,
|
|
3245
|
-
name: t.name,
|
|
3246
|
-
stroke: t.color,
|
|
3247
|
-
fill: t.color,
|
|
3248
|
-
fillOpacity: .15,
|
|
3249
|
-
stackId: e.stacked ? "stack" : void 0
|
|
3250
|
-
}, t.key))
|
|
3251
|
-
]
|
|
3252
|
-
});
|
|
3253
|
-
case "pie": return /* @__PURE__ */ z(ie, { children: [
|
|
3254
|
-
i && /* @__PURE__ */ R(oe, {}),
|
|
3255
|
-
r && /* @__PURE__ */ R(q, {}),
|
|
3256
|
-
/* @__PURE__ */ R(re, {
|
|
3257
|
-
data: t,
|
|
3258
|
-
dataKey: n[0]?.key ?? "value",
|
|
3259
|
-
nameKey: "label",
|
|
3260
|
-
cx: "50%",
|
|
3261
|
-
cy: "50%",
|
|
3262
|
-
outerRadius: "80%",
|
|
3263
|
-
label: ({ name: e, percent: t }) => `${e} ${(t * 100).toFixed(0)}%`,
|
|
3264
|
-
labelLine: !1,
|
|
3265
|
-
children: t.map((t, n) => /* @__PURE__ */ R(K, { fill: e.colors?.[n] ?? Ut[n % Ut.length] }, n))
|
|
3266
|
-
})
|
|
3267
|
-
] });
|
|
3268
|
-
default: return /* @__PURE__ */ z(W, {
|
|
3269
|
-
data: t,
|
|
3270
|
-
children: [
|
|
3271
|
-
/* @__PURE__ */ R(se, { dataKey: "label" }),
|
|
3272
|
-
/* @__PURE__ */ R(Y, {}),
|
|
3273
|
-
n.map((e) => /* @__PURE__ */ R(U, {
|
|
3274
|
-
dataKey: e.key,
|
|
3275
|
-
fill: e.color
|
|
3276
|
-
}, e.key))
|
|
3277
|
-
]
|
|
3278
|
-
});
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
3179
|
//#endregion
|
|
3282
3180
|
//#region src/components/ChartPanel.jsx
|
|
3283
|
-
function
|
|
3284
|
-
return e.length ? /* @__PURE__ */
|
|
3181
|
+
function It({ charts: e, data: t, columns: n, onAddChart: r, onEditChart: i, onRemoveChart: a }) {
|
|
3182
|
+
return e.length ? /* @__PURE__ */ B("div", {
|
|
3285
3183
|
className: "border-t border-gray-200 dark:border-gray-700 p-4",
|
|
3286
|
-
children: [/* @__PURE__ */
|
|
3184
|
+
children: [/* @__PURE__ */ B("div", {
|
|
3287
3185
|
className: "flex items-center justify-between mb-3",
|
|
3288
|
-
children: [/* @__PURE__ */
|
|
3186
|
+
children: [/* @__PURE__ */ B("span", {
|
|
3289
3187
|
className: "text-xs font-medium text-gray-500 uppercase tracking-wide",
|
|
3290
3188
|
children: [
|
|
3291
3189
|
"Charts (",
|
|
3292
3190
|
e.length,
|
|
3293
3191
|
")"
|
|
3294
3192
|
]
|
|
3295
|
-
}), /* @__PURE__ */
|
|
3193
|
+
}), /* @__PURE__ */ B("button", {
|
|
3296
3194
|
type: "button",
|
|
3297
3195
|
onClick: r,
|
|
3298
3196
|
className: "inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-brand-600 hover:bg-brand-50 rounded transition-colors",
|
|
3299
|
-
children: [/* @__PURE__ */
|
|
3197
|
+
children: [/* @__PURE__ */ z(A, { className: "h-3.5 w-3.5" }), "Add"]
|
|
3300
3198
|
})]
|
|
3301
|
-
}), /* @__PURE__ */
|
|
3199
|
+
}), /* @__PURE__ */ z("div", {
|
|
3302
3200
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
3303
|
-
children: e.map((e) => /* @__PURE__ */
|
|
3201
|
+
children: e.map((e) => /* @__PURE__ */ z(Ft, {
|
|
3304
3202
|
data: t,
|
|
3305
3203
|
config: e.config,
|
|
3306
3204
|
columns: n,
|
|
@@ -3308,21 +3206,21 @@ function Xt({ charts: e, data: t, columns: n, onAddChart: r, onEditChart: i, onR
|
|
|
3308
3206
|
onRemove: () => a(e.id)
|
|
3309
3207
|
}, e.id))
|
|
3310
3208
|
})]
|
|
3311
|
-
}) : /* @__PURE__ */
|
|
3209
|
+
}) : /* @__PURE__ */ z("div", {
|
|
3312
3210
|
className: "border-t border-gray-200 dark:border-gray-700 px-4 py-6",
|
|
3313
|
-
children: /* @__PURE__ */
|
|
3211
|
+
children: /* @__PURE__ */ B("div", {
|
|
3314
3212
|
className: "flex flex-col items-center justify-center text-center",
|
|
3315
3213
|
children: [
|
|
3316
|
-
/* @__PURE__ */
|
|
3317
|
-
/* @__PURE__ */
|
|
3214
|
+
/* @__PURE__ */ z(f, { className: "h-8 w-8 text-gray-300 mb-2" }),
|
|
3215
|
+
/* @__PURE__ */ z("p", {
|
|
3318
3216
|
className: "text-sm text-gray-400 mb-3",
|
|
3319
3217
|
children: "No charts yet"
|
|
3320
3218
|
}),
|
|
3321
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ B("button", {
|
|
3322
3220
|
type: "button",
|
|
3323
3221
|
onClick: r,
|
|
3324
3222
|
className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-brand-600 bg-brand-50 rounded-lg hover:bg-brand-100 transition-colors",
|
|
3325
|
-
children: [/* @__PURE__ */
|
|
3223
|
+
children: [/* @__PURE__ */ z(A, { className: "h-4 w-4" }), "Create Chart"]
|
|
3326
3224
|
})
|
|
3327
3225
|
]
|
|
3328
3226
|
})
|
|
@@ -3330,28 +3228,28 @@ function Xt({ charts: e, data: t, columns: n, onAddChart: r, onEditChart: i, onR
|
|
|
3330
3228
|
}
|
|
3331
3229
|
//#endregion
|
|
3332
3230
|
//#region src/components/ChartBuilderModal.jsx
|
|
3333
|
-
var
|
|
3231
|
+
var Lt = [
|
|
3334
3232
|
{
|
|
3335
3233
|
type: "bar",
|
|
3336
3234
|
label: "Bar",
|
|
3337
|
-
icon: /* @__PURE__ */
|
|
3235
|
+
icon: /* @__PURE__ */ z(f, { className: "h-5 w-5" })
|
|
3338
3236
|
},
|
|
3339
3237
|
{
|
|
3340
3238
|
type: "line",
|
|
3341
3239
|
label: "Line",
|
|
3342
|
-
icon: /* @__PURE__ */
|
|
3240
|
+
icon: /* @__PURE__ */ z(E, { className: "h-5 w-5" })
|
|
3343
3241
|
},
|
|
3344
3242
|
{
|
|
3345
3243
|
type: "area",
|
|
3346
3244
|
label: "Area",
|
|
3347
|
-
icon: /* @__PURE__ */
|
|
3245
|
+
icon: /* @__PURE__ */ z(c, { className: "h-5 w-5" })
|
|
3348
3246
|
},
|
|
3349
3247
|
{
|
|
3350
3248
|
type: "pie",
|
|
3351
3249
|
label: "Pie",
|
|
3352
|
-
icon: /* @__PURE__ */
|
|
3250
|
+
icon: /* @__PURE__ */ z(k, { className: "h-5 w-5" })
|
|
3353
3251
|
}
|
|
3354
|
-
],
|
|
3252
|
+
], Rt = [
|
|
3355
3253
|
{
|
|
3356
3254
|
value: "",
|
|
3357
3255
|
label: "None"
|
|
@@ -3377,7 +3275,7 @@ var Zt = [
|
|
|
3377
3275
|
label: "Max"
|
|
3378
3276
|
}
|
|
3379
3277
|
];
|
|
3380
|
-
function
|
|
3278
|
+
function zt({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l, editingChart: u }) {
|
|
3381
3279
|
let [d, f] = o("bar"), [p, m] = o(""), [h, g] = o(""), [_, v] = o([]), [y, b] = o(""), [x, S] = o(""), [C, w] = o(!0), [T, E] = o(!0), [D, O] = o(!1);
|
|
3382
3280
|
r(() => {
|
|
3383
3281
|
if (u) {
|
|
@@ -3385,7 +3283,7 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3385
3283
|
f(e.type), m(e.title ?? ""), g(e.labelColumn), v(e.dataColumns), b(e.groupBy ?? ""), S(e.aggregation ?? ""), w(e.showLegend ?? !0), E(e.showTooltip ?? !0), O(e.stacked ?? !1);
|
|
3386
3284
|
} else e && (f("bar"), m(""), g(""), v([]), b(""), S(""), w(!0), E(!0), O(!1));
|
|
3387
3285
|
}, [u, e]);
|
|
3388
|
-
let
|
|
3286
|
+
let k = i(() => ({
|
|
3389
3287
|
type: d,
|
|
3390
3288
|
title: p || "Preview",
|
|
3391
3289
|
labelColumn: h,
|
|
@@ -3406,8 +3304,8 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3406
3304
|
C,
|
|
3407
3305
|
T,
|
|
3408
3306
|
D
|
|
3409
|
-
]),
|
|
3410
|
-
if (!
|
|
3307
|
+
]), A = h && _.length > 0, j = n(() => {
|
|
3308
|
+
if (!A) return;
|
|
3411
3309
|
let e = {
|
|
3412
3310
|
type: d,
|
|
3413
3311
|
title: p || void 0,
|
|
@@ -3421,7 +3319,7 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3421
3319
|
};
|
|
3422
3320
|
u && s ? s(u.id, e) : a(e), t();
|
|
3423
3321
|
}, [
|
|
3424
|
-
|
|
3322
|
+
A,
|
|
3425
3323
|
d,
|
|
3426
3324
|
p,
|
|
3427
3325
|
h,
|
|
@@ -3435,133 +3333,133 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3435
3333
|
s,
|
|
3436
3334
|
a,
|
|
3437
3335
|
t
|
|
3438
|
-
]),
|
|
3336
|
+
]), M = (e) => {
|
|
3439
3337
|
v((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
3440
3338
|
};
|
|
3441
3339
|
if (!e) return null;
|
|
3442
|
-
let
|
|
3443
|
-
return /* @__PURE__ */
|
|
3340
|
+
let N = "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-500 bg-white dark:bg-gray-800";
|
|
3341
|
+
return /* @__PURE__ */ B("div", {
|
|
3444
3342
|
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
3445
|
-
children: [/* @__PURE__ */
|
|
3343
|
+
children: [/* @__PURE__ */ z("div", {
|
|
3446
3344
|
className: "absolute inset-0 bg-black/40",
|
|
3447
3345
|
onClick: t
|
|
3448
|
-
}), /* @__PURE__ */
|
|
3346
|
+
}), /* @__PURE__ */ B("div", {
|
|
3449
3347
|
className: "relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",
|
|
3450
3348
|
children: [
|
|
3451
|
-
/* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ B("div", {
|
|
3452
3350
|
className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",
|
|
3453
|
-
children: [/* @__PURE__ */
|
|
3351
|
+
children: [/* @__PURE__ */ z("h2", {
|
|
3454
3352
|
className: "text-lg font-semibold text-gray-900 dark:text-gray-100",
|
|
3455
3353
|
children: u ? "Edit Chart" : "Create Chart"
|
|
3456
|
-
}), /* @__PURE__ */
|
|
3354
|
+
}), /* @__PURE__ */ z("button", {
|
|
3457
3355
|
type: "button",
|
|
3458
3356
|
onClick: t,
|
|
3459
3357
|
className: "p-1 text-gray-400 hover:text-gray-600 rounded",
|
|
3460
|
-
children: /* @__PURE__ */
|
|
3358
|
+
children: /* @__PURE__ */ z(L, { className: "h-5 w-5" })
|
|
3461
3359
|
})]
|
|
3462
3360
|
}),
|
|
3463
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ z("div", {
|
|
3464
3362
|
className: "flex-1 overflow-y-auto p-6",
|
|
3465
|
-
children: /* @__PURE__ */
|
|
3363
|
+
children: /* @__PURE__ */ B("div", {
|
|
3466
3364
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
3467
|
-
children: [/* @__PURE__ */
|
|
3365
|
+
children: [/* @__PURE__ */ B("div", {
|
|
3468
3366
|
className: "space-y-4",
|
|
3469
3367
|
children: [
|
|
3470
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3471
3369
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",
|
|
3472
3370
|
children: "Chart Type"
|
|
3473
|
-
}), /* @__PURE__ */
|
|
3371
|
+
}), /* @__PURE__ */ z("div", {
|
|
3474
3372
|
className: "flex gap-2",
|
|
3475
|
-
children:
|
|
3373
|
+
children: Lt.map((e) => /* @__PURE__ */ B("button", {
|
|
3476
3374
|
type: "button",
|
|
3477
3375
|
onClick: () => f(e.type),
|
|
3478
3376
|
className: `flex flex-col items-center gap-1 px-4 py-2.5 rounded-lg border-2 transition-colors ${d === e.type ? "border-brand-500 bg-brand-50 text-brand-700" : "border-gray-200 text-gray-500 hover:border-gray-300"}`,
|
|
3479
|
-
children: [e.icon, /* @__PURE__ */
|
|
3377
|
+
children: [e.icon, /* @__PURE__ */ z("span", {
|
|
3480
3378
|
className: "text-xs font-medium",
|
|
3481
3379
|
children: e.label
|
|
3482
3380
|
})]
|
|
3483
3381
|
}, e.type))
|
|
3484
3382
|
})] }),
|
|
3485
|
-
/* @__PURE__ */
|
|
3383
|
+
/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3486
3384
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",
|
|
3487
3385
|
children: "Title"
|
|
3488
|
-
}), /* @__PURE__ */
|
|
3386
|
+
}), /* @__PURE__ */ z("input", {
|
|
3489
3387
|
type: "text",
|
|
3490
3388
|
value: p,
|
|
3491
3389
|
onChange: (e) => m(e.target.value),
|
|
3492
3390
|
placeholder: "Chart title...",
|
|
3493
3391
|
className: "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-500 bg-white dark:bg-gray-800"
|
|
3494
3392
|
})] }),
|
|
3495
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3496
3394
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",
|
|
3497
3395
|
children: d === "pie" ? "Label Column" : "X-Axis Column"
|
|
3498
|
-
}), /* @__PURE__ */
|
|
3396
|
+
}), /* @__PURE__ */ B("select", {
|
|
3499
3397
|
value: h,
|
|
3500
3398
|
onChange: (e) => g(e.target.value),
|
|
3501
|
-
className:
|
|
3502
|
-
children: [/* @__PURE__ */
|
|
3399
|
+
className: N,
|
|
3400
|
+
children: [/* @__PURE__ */ z("option", {
|
|
3503
3401
|
value: "",
|
|
3504
3402
|
children: "Select column..."
|
|
3505
|
-
}), c.map((e) => /* @__PURE__ */
|
|
3403
|
+
}), c.map((e) => /* @__PURE__ */ z("option", {
|
|
3506
3404
|
value: e.id,
|
|
3507
3405
|
children: e.header
|
|
3508
3406
|
}, e.id))]
|
|
3509
3407
|
})] }),
|
|
3510
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3511
3409
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",
|
|
3512
3410
|
children: d === "pie" ? "Value Column" : "Y-Axis Columns"
|
|
3513
|
-
}), /* @__PURE__ */
|
|
3411
|
+
}), /* @__PURE__ */ z("div", {
|
|
3514
3412
|
className: "flex flex-wrap gap-1.5 p-2 border border-gray-300 rounded-lg min-h-[40px] bg-white dark:bg-gray-800",
|
|
3515
|
-
children: c.map((e) => /* @__PURE__ */
|
|
3413
|
+
children: c.map((e) => /* @__PURE__ */ z("button", {
|
|
3516
3414
|
type: "button",
|
|
3517
|
-
onClick: () =>
|
|
3415
|
+
onClick: () => M(e.id),
|
|
3518
3416
|
className: `px-2.5 py-1 text-xs rounded-md transition-colors ${_.includes(e.id) ? "bg-brand-100 text-brand-700 font-medium" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`,
|
|
3519
3417
|
children: e.header
|
|
3520
3418
|
}, e.id))
|
|
3521
3419
|
})] }),
|
|
3522
|
-
/* @__PURE__ */
|
|
3420
|
+
/* @__PURE__ */ B("div", {
|
|
3523
3421
|
className: "grid grid-cols-2 gap-3",
|
|
3524
|
-
children: [/* @__PURE__ */
|
|
3422
|
+
children: [/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3525
3423
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",
|
|
3526
3424
|
children: "Group By"
|
|
3527
|
-
}), /* @__PURE__ */
|
|
3425
|
+
}), /* @__PURE__ */ B("select", {
|
|
3528
3426
|
value: y,
|
|
3529
3427
|
onChange: (e) => b(e.target.value),
|
|
3530
|
-
className:
|
|
3531
|
-
children: [/* @__PURE__ */
|
|
3428
|
+
className: N,
|
|
3429
|
+
children: [/* @__PURE__ */ z("option", {
|
|
3532
3430
|
value: "",
|
|
3533
3431
|
children: "None"
|
|
3534
|
-
}), c.map((e) => /* @__PURE__ */
|
|
3432
|
+
}), c.map((e) => /* @__PURE__ */ z("option", {
|
|
3535
3433
|
value: e.id,
|
|
3536
3434
|
children: e.header
|
|
3537
3435
|
}, e.id))]
|
|
3538
|
-
})] }), /* @__PURE__ */
|
|
3436
|
+
})] }), /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3539
3437
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",
|
|
3540
3438
|
children: "Aggregation"
|
|
3541
|
-
}), /* @__PURE__ */
|
|
3439
|
+
}), /* @__PURE__ */ z("select", {
|
|
3542
3440
|
value: x,
|
|
3543
3441
|
onChange: (e) => S(e.target.value),
|
|
3544
|
-
className:
|
|
3545
|
-
children:
|
|
3442
|
+
className: N,
|
|
3443
|
+
children: Rt.map((e) => /* @__PURE__ */ z("option", {
|
|
3546
3444
|
value: e.value,
|
|
3547
3445
|
children: e.label
|
|
3548
3446
|
}, e.value))
|
|
3549
3447
|
})] })]
|
|
3550
3448
|
}),
|
|
3551
|
-
/* @__PURE__ */
|
|
3449
|
+
/* @__PURE__ */ B("div", {
|
|
3552
3450
|
className: "flex flex-wrap gap-4",
|
|
3553
3451
|
children: [
|
|
3554
|
-
/* @__PURE__ */
|
|
3452
|
+
/* @__PURE__ */ z(Bt, {
|
|
3555
3453
|
label: "Legend",
|
|
3556
3454
|
checked: C,
|
|
3557
3455
|
onChange: w
|
|
3558
3456
|
}),
|
|
3559
|
-
/* @__PURE__ */
|
|
3457
|
+
/* @__PURE__ */ z(Bt, {
|
|
3560
3458
|
label: "Tooltip",
|
|
3561
3459
|
checked: T,
|
|
3562
3460
|
onChange: E
|
|
3563
3461
|
}),
|
|
3564
|
-
(d === "bar" || d === "area") && /* @__PURE__ */
|
|
3462
|
+
(d === "bar" || d === "area") && /* @__PURE__ */ z(Bt, {
|
|
3565
3463
|
label: "Stacked",
|
|
3566
3464
|
checked: D,
|
|
3567
3465
|
onChange: O
|
|
@@ -3569,27 +3467,27 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3569
3467
|
]
|
|
3570
3468
|
})
|
|
3571
3469
|
]
|
|
3572
|
-
}), /* @__PURE__ */
|
|
3470
|
+
}), /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("label", {
|
|
3573
3471
|
className: "block text-xs font-medium text-gray-500 uppercase tracking-wide mb-2",
|
|
3574
3472
|
children: "Live Preview"
|
|
3575
|
-
}), /* @__PURE__ */
|
|
3473
|
+
}), /* @__PURE__ */ z(Ft, {
|
|
3576
3474
|
data: l,
|
|
3577
|
-
config:
|
|
3475
|
+
config: k,
|
|
3578
3476
|
columns: c
|
|
3579
3477
|
})] })]
|
|
3580
3478
|
})
|
|
3581
3479
|
}),
|
|
3582
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ B("div", {
|
|
3583
3481
|
className: "flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700",
|
|
3584
|
-
children: [/* @__PURE__ */
|
|
3482
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3585
3483
|
type: "button",
|
|
3586
3484
|
onClick: t,
|
|
3587
3485
|
className: "px-4 py-2 text-sm text-gray-600 hover:text-gray-800 rounded-lg transition-colors",
|
|
3588
3486
|
children: "Cancel"
|
|
3589
|
-
}), /* @__PURE__ */
|
|
3487
|
+
}), /* @__PURE__ */ z("button", {
|
|
3590
3488
|
type: "button",
|
|
3591
|
-
onClick:
|
|
3592
|
-
disabled: !
|
|
3489
|
+
onClick: j,
|
|
3490
|
+
disabled: !A,
|
|
3593
3491
|
className: "px-4 py-2 text-sm font-medium text-white bg-brand-600 rounded-lg hover:bg-brand-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
3594
3492
|
children: u ? "Update Chart" : "Create Chart"
|
|
3595
3493
|
})]
|
|
@@ -3598,15 +3496,15 @@ function $t({ open: e, onClose: t, onSave: a, onUpdate: s, columns: c, data: l,
|
|
|
3598
3496
|
})]
|
|
3599
3497
|
});
|
|
3600
3498
|
}
|
|
3601
|
-
function
|
|
3602
|
-
return /* @__PURE__ */
|
|
3499
|
+
function Bt({ label: e, checked: t, onChange: n }) {
|
|
3500
|
+
return /* @__PURE__ */ B("label", {
|
|
3603
3501
|
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
3604
|
-
children: [/* @__PURE__ */
|
|
3502
|
+
children: [/* @__PURE__ */ z("input", {
|
|
3605
3503
|
type: "checkbox",
|
|
3606
3504
|
checked: t,
|
|
3607
3505
|
onChange: (e) => n(e.target.checked),
|
|
3608
3506
|
className: "h-4 w-4 rounded border-gray-300 text-brand-600 focus:ring-brand-500"
|
|
3609
|
-
}), /* @__PURE__ */
|
|
3507
|
+
}), /* @__PURE__ */ z("span", {
|
|
3610
3508
|
className: "text-sm text-gray-600",
|
|
3611
3509
|
children: e
|
|
3612
3510
|
})]
|
|
@@ -3614,226 +3512,226 @@ function en({ label: e, checked: t, onChange: n }) {
|
|
|
3614
3512
|
}
|
|
3615
3513
|
//#endregion
|
|
3616
3514
|
//#region src/components/DataTable.jsx
|
|
3617
|
-
function
|
|
3618
|
-
let { loading: t = !1, error: r = null, onRetry: a, bulkActions: c, exportFormats: l, onExport: u, views: d = ["table"], theme: f, emptyText: p = "No data found", emptyIcon: m = b, className: h = "", filtering: g, columnVisibility: _ = !1, plugins: v = [], ariaLabel: y, ariaDescribedBy: x, sidebarPanels: S, contextMenu: C, persistKey: w, statusBar: T } = e, E =
|
|
3515
|
+
function Vt(e) {
|
|
3516
|
+
let { loading: t = !1, error: r = null, onRetry: a, bulkActions: c, exportFormats: l, onExport: u, views: d = ["table"], theme: f, emptyText: p = "No data found", emptyIcon: m = b, className: h = "", filtering: g, columnVisibility: _ = !1, plugins: v = [], ariaLabel: y, ariaDescribedBy: x, sidebarPanels: S, contextMenu: C, persistKey: w, statusBar: T } = e, E = Be(e), { processedData: D, allFilteredData: O, sorting: k, filtering: A, pagination: M, selection: N, columnManager: P, viewMode: F, setViewMode: ee, presets: I, getCurrentPresetConfig: L, applyPreset: V, theme: H, chartConfig: U } = E, [W, G] = o(null), [te, K] = o(null), ne = n((e, t) => {
|
|
3619
3517
|
C?.length && (e.preventDefault(), K({
|
|
3620
3518
|
x: e.clientX,
|
|
3621
3519
|
y: e.clientY,
|
|
3622
3520
|
row: t
|
|
3623
3521
|
}));
|
|
3624
|
-
}, [C]),
|
|
3522
|
+
}, [C]), q = i(() => (e) => {
|
|
3625
3523
|
if (u) {
|
|
3626
3524
|
u(e, O);
|
|
3627
3525
|
return;
|
|
3628
3526
|
}
|
|
3629
|
-
let t =
|
|
3527
|
+
let t = P.visibleColumns;
|
|
3630
3528
|
switch (e) {
|
|
3631
3529
|
case "csv":
|
|
3632
|
-
|
|
3530
|
+
We(O, t);
|
|
3633
3531
|
break;
|
|
3634
3532
|
case "excel":
|
|
3635
|
-
|
|
3533
|
+
Ge(O, t);
|
|
3636
3534
|
break;
|
|
3637
|
-
default:
|
|
3535
|
+
default: ie(e, O, t, u);
|
|
3638
3536
|
}
|
|
3639
3537
|
}, [
|
|
3640
3538
|
O,
|
|
3641
|
-
|
|
3539
|
+
P.visibleColumns,
|
|
3642
3540
|
u
|
|
3643
|
-
]), J = i(() => v.map((e) => e.renderToolbar?.(E.state)).filter(Boolean), [v, E.state]),
|
|
3644
|
-
return /* @__PURE__ */
|
|
3541
|
+
]), J = i(() => v.map((e) => e.renderToolbar?.(E.state)).filter(Boolean), [v, E.state]), Y = i(() => v.map((e) => e.renderFooter?.(E.state)).filter(Boolean), [v, E.state]), X = A.filters.length > 0 || A.globalSearch.length > 0, re = H.cssVarStyle ?? {};
|
|
3542
|
+
return /* @__PURE__ */ B("div", {
|
|
3645
3543
|
className: `bg-[var(--dt-bg,var(--app-bg,white))] border border-[var(--dt-border,var(--app-border,#e5e7eb))] rounded-lg shadow-sm overflow-hidden flex ${f?.wrapper ?? ""} ${h}`,
|
|
3646
|
-
style:
|
|
3544
|
+
style: re,
|
|
3647
3545
|
role: "region",
|
|
3648
3546
|
"aria-label": y ?? "Data table",
|
|
3649
3547
|
"aria-describedby": x,
|
|
3650
3548
|
children: [
|
|
3651
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ B("div", {
|
|
3652
3550
|
className: "flex-1 flex flex-col min-w-0 overflow-hidden",
|
|
3653
3551
|
children: [
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
globalSearch:
|
|
3656
|
-
onSearchChange:
|
|
3552
|
+
/* @__PURE__ */ z(Ke, {
|
|
3553
|
+
globalSearch: A.globalSearch,
|
|
3554
|
+
onSearchChange: A.setGlobalSearch,
|
|
3657
3555
|
searchDebounce: g?.searchDebounce,
|
|
3658
|
-
viewMode:
|
|
3659
|
-
onViewModeChange:
|
|
3556
|
+
viewMode: F,
|
|
3557
|
+
onViewModeChange: ee,
|
|
3660
3558
|
views: d,
|
|
3661
3559
|
exportFormats: l,
|
|
3662
|
-
onExport:
|
|
3663
|
-
columns:
|
|
3664
|
-
hiddenColumns:
|
|
3665
|
-
onToggleColumn:
|
|
3560
|
+
onExport: q,
|
|
3561
|
+
columns: P.allColumns,
|
|
3562
|
+
hiddenColumns: P.hiddenColumns,
|
|
3563
|
+
onToggleColumn: P.toggleColumnVisibility,
|
|
3666
3564
|
enableColumnVisibility: _,
|
|
3667
|
-
hasActiveFilters:
|
|
3668
|
-
onClearFilters:
|
|
3669
|
-
pluginToolbar: /* @__PURE__ */
|
|
3565
|
+
hasActiveFilters: X,
|
|
3566
|
+
onClearFilters: A.clearFilters,
|
|
3567
|
+
pluginToolbar: /* @__PURE__ */ B(R, { children: [
|
|
3670
3568
|
J,
|
|
3671
|
-
w && /* @__PURE__ */
|
|
3672
|
-
presets:
|
|
3673
|
-
onSave:
|
|
3674
|
-
onLoad:
|
|
3675
|
-
onDelete:
|
|
3676
|
-
onRename:
|
|
3677
|
-
getCurrentConfig:
|
|
3569
|
+
w && /* @__PURE__ */ z(Tt, {
|
|
3570
|
+
presets: I.presets,
|
|
3571
|
+
onSave: I.savePreset,
|
|
3572
|
+
onLoad: V,
|
|
3573
|
+
onDelete: I.deletePreset,
|
|
3574
|
+
onRename: I.renamePreset,
|
|
3575
|
+
getCurrentConfig: L
|
|
3678
3576
|
}),
|
|
3679
|
-
S?.map((e) => /* @__PURE__ */
|
|
3577
|
+
S?.map((e) => /* @__PURE__ */ z("button", {
|
|
3680
3578
|
type: "button",
|
|
3681
|
-
onClick: () => W
|
|
3682
|
-
className: `p-2 rounded-md transition-colors ${
|
|
3579
|
+
onClick: () => G(W === e.type ? null : e.type),
|
|
3580
|
+
className: `p-2 rounded-md transition-colors ${W === e.type ? "bg-brand-100 text-brand-700" : "text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`,
|
|
3683
3581
|
title: e.title,
|
|
3684
3582
|
"aria-label": e.title,
|
|
3685
|
-
"aria-pressed":
|
|
3583
|
+
"aria-pressed": W === e.type,
|
|
3686
3584
|
children: e.icon
|
|
3687
3585
|
}, e.type))
|
|
3688
3586
|
] }),
|
|
3689
3587
|
className: f?.toolbar
|
|
3690
3588
|
}),
|
|
3691
|
-
c && c.length > 0 && /* @__PURE__ */
|
|
3692
|
-
selectedCount:
|
|
3693
|
-
selectedRows:
|
|
3589
|
+
c && c.length > 0 && /* @__PURE__ */ z(Je, {
|
|
3590
|
+
selectedCount: N.selectedKeys.length,
|
|
3591
|
+
selectedRows: N.selectedRows,
|
|
3694
3592
|
actions: c,
|
|
3695
|
-
onClearSelection:
|
|
3593
|
+
onClearSelection: N.clearSelection
|
|
3696
3594
|
}),
|
|
3697
|
-
r && /* @__PURE__ */
|
|
3595
|
+
r && /* @__PURE__ */ B("div", {
|
|
3698
3596
|
className: "flex flex-col items-center justify-center py-16 px-6",
|
|
3699
3597
|
children: [
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ z(s, { className: "h-12 w-12 text-red-400 mb-4" }),
|
|
3599
|
+
/* @__PURE__ */ z("p", {
|
|
3702
3600
|
className: "text-sm text-red-600 mb-4",
|
|
3703
3601
|
children: r
|
|
3704
3602
|
}),
|
|
3705
|
-
a && /* @__PURE__ */
|
|
3603
|
+
a && /* @__PURE__ */ B("button", {
|
|
3706
3604
|
type: "button",
|
|
3707
3605
|
onClick: a,
|
|
3708
3606
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-brand-600 rounded-md hover:bg-brand-700 transition-colors",
|
|
3709
|
-
children: [/* @__PURE__ */
|
|
3607
|
+
children: [/* @__PURE__ */ z(j, { className: "h-4 w-4" }), "Retry"]
|
|
3710
3608
|
})
|
|
3711
3609
|
]
|
|
3712
3610
|
}),
|
|
3713
|
-
!r && t && /* @__PURE__ */
|
|
3611
|
+
!r && t && /* @__PURE__ */ z("div", {
|
|
3714
3612
|
className: "p-4",
|
|
3715
|
-
children: /* @__PURE__ */
|
|
3716
|
-
rows:
|
|
3717
|
-
columns:
|
|
3613
|
+
children: /* @__PURE__ */ z(Ht, {
|
|
3614
|
+
rows: M.pageSize,
|
|
3615
|
+
columns: P.visibleColumns.length
|
|
3718
3616
|
})
|
|
3719
3617
|
}),
|
|
3720
|
-
!r && !t && D.length === 0 && /* @__PURE__ */
|
|
3618
|
+
!r && !t && D.length === 0 && /* @__PURE__ */ B("div", {
|
|
3721
3619
|
className: "flex flex-col items-center justify-center py-16 px-6",
|
|
3722
3620
|
children: [
|
|
3723
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ z("div", {
|
|
3724
3622
|
className: "w-14 h-14 rounded-full bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4",
|
|
3725
|
-
children: /* @__PURE__ */
|
|
3623
|
+
children: /* @__PURE__ */ z(m, { className: "h-7 w-7 text-gray-400" })
|
|
3726
3624
|
}),
|
|
3727
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ z("p", {
|
|
3728
3626
|
className: "text-sm text-gray-500",
|
|
3729
3627
|
children: p
|
|
3730
3628
|
}),
|
|
3731
|
-
|
|
3629
|
+
X && /* @__PURE__ */ z("button", {
|
|
3732
3630
|
type: "button",
|
|
3733
|
-
onClick:
|
|
3631
|
+
onClick: A.clearFilters,
|
|
3734
3632
|
className: "mt-3 text-sm text-brand-600 hover:text-brand-700 underline",
|
|
3735
3633
|
children: "Clear all filters"
|
|
3736
3634
|
})
|
|
3737
3635
|
]
|
|
3738
3636
|
}),
|
|
3739
|
-
!r && !t && D.length > 0 && /* @__PURE__ */
|
|
3740
|
-
|
|
3637
|
+
!r && !t && D.length > 0 && /* @__PURE__ */ B(R, { children: [
|
|
3638
|
+
F === "table" && /* @__PURE__ */ z(_t, {
|
|
3741
3639
|
table: E,
|
|
3742
3640
|
props: e,
|
|
3743
|
-
onContextMenu:
|
|
3641
|
+
onContextMenu: ne
|
|
3744
3642
|
}),
|
|
3745
|
-
|
|
3643
|
+
F === "grid" && /* @__PURE__ */ z(vt, {
|
|
3746
3644
|
table: E,
|
|
3747
3645
|
props: e
|
|
3748
3646
|
}),
|
|
3749
|
-
|
|
3647
|
+
F === "list" && /* @__PURE__ */ z(yt, {
|
|
3750
3648
|
table: E,
|
|
3751
3649
|
props: e
|
|
3752
3650
|
})
|
|
3753
3651
|
] }),
|
|
3754
|
-
T?.position === "top" && /* @__PURE__ */
|
|
3652
|
+
T?.position === "top" && /* @__PURE__ */ z(Dt, {
|
|
3755
3653
|
config: T,
|
|
3756
3654
|
data: O,
|
|
3757
3655
|
state: E.state
|
|
3758
3656
|
}),
|
|
3759
|
-
!r && !
|
|
3760
|
-
page:
|
|
3761
|
-
pageSize:
|
|
3762
|
-
totalPages:
|
|
3763
|
-
totalItems:
|
|
3764
|
-
pageSizeOptions:
|
|
3765
|
-
onPageChange:
|
|
3766
|
-
onPageSizeChange:
|
|
3657
|
+
!r && !M.isInfinite && D.length > 0 && /* @__PURE__ */ z(bt, {
|
|
3658
|
+
page: M.page,
|
|
3659
|
+
pageSize: M.pageSize,
|
|
3660
|
+
totalPages: M.totalPages,
|
|
3661
|
+
totalItems: M.totalItems,
|
|
3662
|
+
pageSizeOptions: M.pageSizeOptions,
|
|
3663
|
+
onPageChange: M.setPage,
|
|
3664
|
+
onPageSizeChange: M.setPageSize
|
|
3767
3665
|
}),
|
|
3768
|
-
T && T.position !== "top" && /* @__PURE__ */
|
|
3666
|
+
T && T.position !== "top" && /* @__PURE__ */ z(Dt, {
|
|
3769
3667
|
config: T,
|
|
3770
3668
|
data: O,
|
|
3771
3669
|
state: E.state
|
|
3772
3670
|
}),
|
|
3773
|
-
|
|
3671
|
+
Y.length > 0 && /* @__PURE__ */ z("div", {
|
|
3774
3672
|
className: "border-t border-[var(--app-border,#e5e7eb)]",
|
|
3775
|
-
children:
|
|
3673
|
+
children: Y
|
|
3776
3674
|
}),
|
|
3777
|
-
w && /* @__PURE__ */
|
|
3778
|
-
charts:
|
|
3675
|
+
w && /* @__PURE__ */ z(It, {
|
|
3676
|
+
charts: U.charts,
|
|
3779
3677
|
data: O,
|
|
3780
|
-
columns:
|
|
3781
|
-
onAddChart: () =>
|
|
3782
|
-
onEditChart: (e) =>
|
|
3783
|
-
onRemoveChart:
|
|
3678
|
+
columns: P.allColumns,
|
|
3679
|
+
onAddChart: () => U.openBuilder(),
|
|
3680
|
+
onEditChart: (e) => U.openBuilder(e),
|
|
3681
|
+
onRemoveChart: U.removeChart
|
|
3784
3682
|
})
|
|
3785
3683
|
]
|
|
3786
3684
|
}),
|
|
3787
|
-
S &&
|
|
3685
|
+
S && W && /* @__PURE__ */ z(St, {
|
|
3788
3686
|
panels: S,
|
|
3789
|
-
activePanel:
|
|
3790
|
-
onClose: () =>
|
|
3791
|
-
columns:
|
|
3792
|
-
hiddenColumns:
|
|
3793
|
-
columnOrder:
|
|
3794
|
-
onToggleColumn:
|
|
3795
|
-
onReorderColumns:
|
|
3796
|
-
filters:
|
|
3797
|
-
onFilterChange:
|
|
3798
|
-
onClearFilters:
|
|
3687
|
+
activePanel: W,
|
|
3688
|
+
onClose: () => G(null),
|
|
3689
|
+
columns: P.allColumns,
|
|
3690
|
+
hiddenColumns: P.hiddenColumns,
|
|
3691
|
+
columnOrder: P.columnOrder,
|
|
3692
|
+
onToggleColumn: P.toggleColumnVisibility,
|
|
3693
|
+
onReorderColumns: P.reorderColumnsById,
|
|
3694
|
+
filters: A.filters,
|
|
3695
|
+
onFilterChange: A.setFilter,
|
|
3696
|
+
onClearFilters: A.clearFilters
|
|
3799
3697
|
}),
|
|
3800
|
-
|
|
3801
|
-
x:
|
|
3802
|
-
y:
|
|
3803
|
-
row:
|
|
3698
|
+
te && C && /* @__PURE__ */ z(Et, {
|
|
3699
|
+
x: te.x,
|
|
3700
|
+
y: te.y,
|
|
3701
|
+
row: te.row,
|
|
3804
3702
|
items: C,
|
|
3805
3703
|
onClose: () => K(null)
|
|
3806
3704
|
}),
|
|
3807
|
-
w && /* @__PURE__ */
|
|
3808
|
-
open:
|
|
3809
|
-
onClose:
|
|
3810
|
-
onSave:
|
|
3811
|
-
onUpdate:
|
|
3812
|
-
columns:
|
|
3705
|
+
w && /* @__PURE__ */ z(zt, {
|
|
3706
|
+
open: U.builderOpen,
|
|
3707
|
+
onClose: U.closeBuilder,
|
|
3708
|
+
onSave: U.addChart,
|
|
3709
|
+
onUpdate: U.updateChart,
|
|
3710
|
+
columns: P.allColumns,
|
|
3813
3711
|
data: O,
|
|
3814
|
-
editingChart:
|
|
3712
|
+
editingChart: U.editingChart
|
|
3815
3713
|
})
|
|
3816
3714
|
]
|
|
3817
3715
|
});
|
|
3818
3716
|
}
|
|
3819
|
-
function
|
|
3820
|
-
return /* @__PURE__ */
|
|
3717
|
+
function Ht({ rows: e, columns: t }) {
|
|
3718
|
+
return /* @__PURE__ */ B("div", {
|
|
3821
3719
|
className: "space-y-3",
|
|
3822
3720
|
role: "status",
|
|
3823
3721
|
"aria-label": "Loading data",
|
|
3824
3722
|
children: [
|
|
3825
|
-
/* @__PURE__ */
|
|
3723
|
+
/* @__PURE__ */ z("div", {
|
|
3826
3724
|
className: "flex gap-4 px-2",
|
|
3827
|
-
children: Array.from({ length: Math.min(t, 6) }).map((e, t) => /* @__PURE__ */
|
|
3725
|
+
children: Array.from({ length: Math.min(t, 6) }).map((e, t) => /* @__PURE__ */ z("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse flex-1" }, t))
|
|
3828
3726
|
}),
|
|
3829
|
-
Array.from({ length: Math.min(e, 8) }).map((e, n) => /* @__PURE__ */
|
|
3727
|
+
Array.from({ length: Math.min(e, 8) }).map((e, n) => /* @__PURE__ */ z("div", {
|
|
3830
3728
|
className: "flex gap-4 px-2",
|
|
3831
|
-
children: Array.from({ length: Math.min(t, 6) }).map((e, t) => /* @__PURE__ */
|
|
3729
|
+
children: Array.from({ length: Math.min(t, 6) }).map((e, t) => /* @__PURE__ */ z("div", {
|
|
3832
3730
|
className: "h-8 bg-gray-100 dark:bg-gray-800 rounded animate-pulse flex-1",
|
|
3833
3731
|
style: { animationDelay: `${n * 50 + t * 25}ms` }
|
|
3834
3732
|
}, t))
|
|
3835
3733
|
}, n)),
|
|
3836
|
-
/* @__PURE__ */
|
|
3734
|
+
/* @__PURE__ */ z("span", {
|
|
3837
3735
|
className: "sr-only",
|
|
3838
3736
|
children: "Loading..."
|
|
3839
3737
|
})
|
|
@@ -3842,33 +3740,33 @@ function nn({ rows: e, columns: t }) {
|
|
|
3842
3740
|
}
|
|
3843
3741
|
//#endregion
|
|
3844
3742
|
//#region src/plugins.js
|
|
3845
|
-
function
|
|
3743
|
+
function Ut() {
|
|
3846
3744
|
return { name: "row-number" };
|
|
3847
3745
|
}
|
|
3848
|
-
function
|
|
3746
|
+
function Wt(e, t) {
|
|
3849
3747
|
return {
|
|
3850
3748
|
name: "grouping",
|
|
3851
3749
|
processData: (t, n) => {
|
|
3852
|
-
let r =
|
|
3750
|
+
let r = J(t, e), i = [];
|
|
3853
3751
|
return r.forEach((e) => {
|
|
3854
3752
|
i.push(...e);
|
|
3855
3753
|
}), i;
|
|
3856
3754
|
}
|
|
3857
3755
|
};
|
|
3858
3756
|
}
|
|
3859
|
-
function
|
|
3757
|
+
function Gt() {
|
|
3860
3758
|
return {
|
|
3861
3759
|
name: "selection-summary",
|
|
3862
3760
|
renderFooter: (t) => t.selectedKeys.length === 0 ? null : e.createElement("div", { className: "px-4 py-2 text-sm text-gray-500" }, `${t.selectedKeys.length} of ${t.totalItems} row(s) selected`)
|
|
3863
3761
|
};
|
|
3864
3762
|
}
|
|
3865
|
-
function
|
|
3763
|
+
function Kt(e, t) {
|
|
3866
3764
|
return {
|
|
3867
3765
|
name: e,
|
|
3868
3766
|
processData: (e) => t(e)
|
|
3869
3767
|
};
|
|
3870
3768
|
}
|
|
3871
3769
|
//#endregion
|
|
3872
|
-
export {
|
|
3770
|
+
export { Je as BulkActions, ot as CellTooltip, zt as ChartBuilderModal, It as ChartPanel, Ye as ColumnFilter, Et as ContextMenu, Ft as DataChart, Vt as DataTable, lt as DataTableCell, rt as DataTableHeader, bt as DataTablePagination, mt as DataTableRow, Qe as FloatingFilterRow, vt as GridView, gt as GroupRowComponent, yt as ListView, ft as PortalDropdown, Tt as PresetManager, St as SidebarPanel, Dt as StatusBar, _t as TableView, Ke as Toolbar, Ee as alpineTheme, De as builtInThemes, Wt as createGroupingPlugin, Ut as createRowNumberPlugin, Gt as createSelectionSummaryPlugin, Oe as createTheme, Kt as createTransformPlugin, we as darkTheme, We as exportToCSV, Y as exportToCSVLegacy, Ge as exportToExcel, X as exportToJSON, K as filterData, U as getCellValue, H as getNestedValue, W as getRowKey, J as groupData, ie as handleExport, Ce as lightTheme, q as paginateData, Te as quartzTheme, ae as reorderArray, G as sortData, ze as useChartConfig, Mt as useChartData, de as useColumnManager, Be as useDataTable, Fe as useEditing, ce as useFilters, le as usePagination, fe as usePersistence, ge as usePresets, Ne as useRowGrouping, ue as useSelection, se as useSorting, Ae as useTheme, Pe as useTreeData, je as useVirtualization };
|
|
3873
3771
|
|
|
3874
3772
|
//# sourceMappingURL=index.js.map
|