@krosoft/react 0.0.354 → 0.0.355
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/TableActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC;CACR;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAwGhG"}
|
|
@@ -2,129 +2,146 @@ import { t as e } from "../../../tailwind.helper-CJaRYBmL.js";
|
|
|
2
2
|
import { ACTIONS_COLUMN_KEY as t, SELECTION_COLUMN_KEY as n, getAlignmentClass as r, getColumnAlignment as i, getFixedCellProps as a } from "../../../helpers/index.js";
|
|
3
3
|
import { t as o } from "../../../i18n-IJZY85S7.js";
|
|
4
4
|
import { At as s, C as c, D as l, Ft as u, Gt as d, Nt as f, O as p, S as m, T as h, bn as g, jt as _, k as v, v as y } from "../../../ui-DkYZe7sQ.js";
|
|
5
|
-
import { c as b } from "../../../tooltip-_geGvbS7.js";
|
|
6
|
-
import { h as
|
|
7
|
-
import { i as
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import { useMemo as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { formatJsonValue as
|
|
13
|
-
import { AlertTriangleIcon as
|
|
14
|
-
import { useNavigate as
|
|
5
|
+
import { c as b, i as x, n as S, r as C, t as w } from "../../../tooltip-_geGvbS7.js";
|
|
6
|
+
import { h as T, m as E, p as D } from "../../../sheet-C_t76Ttr.js";
|
|
7
|
+
import { i as O, l as k, n as A, t as j, u as M } from "../../../select-KWMg2_7Z.js";
|
|
8
|
+
import { n as N, t as P } from "../../../useFixedColumns-Bo-Az3Hp.js";
|
|
9
|
+
import { n as F, r as I } from "../../../datatable-COQcYUrk.js";
|
|
10
|
+
import { useMemo as L, useState as R } from "react";
|
|
11
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
12
|
+
import { formatJsonValue as H, isRecord as U, tryParseJson as W } from "@krosoft/core/helpers";
|
|
13
|
+
import { AlertTriangleIcon as G, ArrowDownIcon as K, ArrowUpDownIcon as q, ArrowUpIcon as J, ChevronLeftIcon as Y, ChevronRightIcon as ee, GripVerticalIcon as te, Loader2Icon as ne, MoreVerticalIcon as re, SearchIcon as ie, SettingsIcon as ae } from "lucide-react";
|
|
14
|
+
import { useNavigate as oe } from "react-router-dom";
|
|
15
15
|
//#region src/components/core/table/TableActions.tsx
|
|
16
|
-
function
|
|
16
|
+
function X({ actions: e, row: t }) {
|
|
17
17
|
let { t: n } = o(), r = e.filter((e) => e.visible === void 0 || e.visible(t));
|
|
18
18
|
if (r.length === 0) return null;
|
|
19
19
|
let i = r.filter((e) => e.overflow !== !0), a = r.filter((e) => e.overflow === !0);
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ B(C, { children: /* @__PURE__ */ V("div", {
|
|
21
21
|
className: "flex items-center justify-end gap-1",
|
|
22
22
|
children: [i.map((e, r) => {
|
|
23
|
-
let i = e.icon;
|
|
24
|
-
return /* @__PURE__ */
|
|
23
|
+
let i = e.icon, a = n(e.labelKey), o = e.disabled?.(t) ?? !1;
|
|
24
|
+
return e.iconOnly === !0 && i !== void 0 ? /* @__PURE__ */ V(w, { children: [/* @__PURE__ */ B(x, {
|
|
25
|
+
asChild: !0,
|
|
26
|
+
children: /* @__PURE__ */ B("span", {
|
|
27
|
+
className: "inline-flex",
|
|
28
|
+
tabIndex: o ? 0 : void 0,
|
|
29
|
+
children: /* @__PURE__ */ B(b, {
|
|
30
|
+
variant: e.variant ?? "ghost",
|
|
31
|
+
size: "icon",
|
|
32
|
+
disabled: o,
|
|
33
|
+
"aria-label": a,
|
|
34
|
+
className: `h-7 w-7 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
35
|
+
onClick: (n) => {
|
|
36
|
+
n.stopPropagation(), e.onClick(t);
|
|
37
|
+
},
|
|
38
|
+
children: /* @__PURE__ */ B(i, { className: "size-3.5" })
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}), /* @__PURE__ */ B(S, { children: a })] }, r) : /* @__PURE__ */ V(b, {
|
|
25
42
|
variant: e.variant ?? "ghost",
|
|
26
43
|
size: "sm",
|
|
27
|
-
disabled:
|
|
44
|
+
disabled: o,
|
|
28
45
|
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
29
46
|
onClick: (n) => {
|
|
30
47
|
n.stopPropagation(), e.onClick(t);
|
|
31
48
|
},
|
|
32
|
-
children: [i !== void 0 && /* @__PURE__ */
|
|
49
|
+
children: [i !== void 0 && /* @__PURE__ */ B(i, { className: "size-3.5" }), a]
|
|
33
50
|
}, r);
|
|
34
|
-
}), a.length > 0 && /* @__PURE__ */
|
|
51
|
+
}), a.length > 0 && /* @__PURE__ */ V(_, { children: [/* @__PURE__ */ B(d, {
|
|
35
52
|
asChild: !0,
|
|
36
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ B(b, {
|
|
37
54
|
variant: "ghost",
|
|
38
55
|
size: "icon",
|
|
39
56
|
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
40
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ B(re, { className: "size-3.5" })
|
|
41
58
|
})
|
|
42
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ B(f, {
|
|
43
60
|
align: "end",
|
|
44
61
|
onClick: (e) => {
|
|
45
62
|
e.stopPropagation();
|
|
46
63
|
},
|
|
47
64
|
children: a.map((e, r) => {
|
|
48
65
|
let i = e.icon;
|
|
49
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ V(u, {
|
|
50
67
|
disabled: e.disabled?.(t) ?? !1,
|
|
51
68
|
onClick: () => {
|
|
52
69
|
e.onClick(t);
|
|
53
70
|
},
|
|
54
71
|
className: e.className,
|
|
55
|
-
children: [i !== void 0 && /* @__PURE__ */
|
|
72
|
+
children: [i !== void 0 && /* @__PURE__ */ B("span", {
|
|
56
73
|
className: "mr-2 size-4 flex items-center justify-center",
|
|
57
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ B(i, { className: "size-4" })
|
|
58
75
|
}), n(e.labelKey)]
|
|
59
76
|
}, r);
|
|
60
77
|
})
|
|
61
78
|
})] })]
|
|
62
|
-
});
|
|
79
|
+
}) });
|
|
63
80
|
}
|
|
64
81
|
//#endregion
|
|
65
82
|
//#region src/components/core/table/TableBody.tsx
|
|
66
|
-
function
|
|
67
|
-
let { t: k } = o(), A = k(l?.loadingKey ?? "states.loading"), j = k(l?.emptyKey ?? "states.noResult"), M =
|
|
83
|
+
function se({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedData: u, rowKey: d, onRowClick: f, onRowNavigate: p, rowNavigable: m, hasBulkActions: h, rowSelectable: _, selectedKeys: v, toggleRowSelection: y, visibleColumnsArray: b, columnWidths: x, hasActions: S, actions: C, columns: w, bordered: T = !1, dense: E = !1, resizableColumns: D = !1, fixedColumns: O = {} }) {
|
|
84
|
+
let { t: k } = o(), A = k(l?.loadingKey ?? "states.loading"), j = k(l?.emptyKey ?? "states.noResult"), M = oe(), N = (e, t) => {
|
|
68
85
|
let n = w.find((e) => e.key === t);
|
|
69
86
|
if (n?.renderCell !== void 0) return n.renderCell(e);
|
|
70
87
|
let r = e[t];
|
|
71
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ B("span", {
|
|
72
89
|
className: "text-sm truncate",
|
|
73
90
|
children: r == null ? "-" : String(r)
|
|
74
91
|
});
|
|
75
92
|
};
|
|
76
|
-
if (e) return /* @__PURE__ */
|
|
93
|
+
if (e) return /* @__PURE__ */ B("tbody", {
|
|
77
94
|
className: "divide-y divide-border",
|
|
78
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
79
96
|
colSpan: c,
|
|
80
97
|
className: "py-8 text-center",
|
|
81
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ V("div", {
|
|
82
99
|
className: "flex flex-col items-center justify-center gap-2 text-muted-foreground",
|
|
83
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ B(ne, { className: "h-6 w-6 animate-spin text-primary" }), /* @__PURE__ */ B("span", {
|
|
84
101
|
className: "text-sm",
|
|
85
102
|
children: A
|
|
86
103
|
})]
|
|
87
104
|
})
|
|
88
105
|
}) })
|
|
89
106
|
});
|
|
90
|
-
if (s) return /* @__PURE__ */
|
|
107
|
+
if (s) return /* @__PURE__ */ B("tbody", {
|
|
91
108
|
className: "divide-y divide-border",
|
|
92
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
93
110
|
colSpan: c,
|
|
94
111
|
className: "py-8 text-center",
|
|
95
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ V("div", {
|
|
96
113
|
className: "flex flex-col items-center justify-center gap-2 text-destructive",
|
|
97
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ B(G, { className: "h-6 w-6" }), /* @__PURE__ */ B("span", {
|
|
98
115
|
className: "text-sm",
|
|
99
116
|
children: s
|
|
100
117
|
})]
|
|
101
118
|
})
|
|
102
119
|
}) })
|
|
103
120
|
});
|
|
104
|
-
if (u.length === 0) return /* @__PURE__ */
|
|
121
|
+
if (u.length === 0) return /* @__PURE__ */ B("tbody", {
|
|
105
122
|
className: "divide-y divide-border",
|
|
106
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
107
124
|
colSpan: c,
|
|
108
125
|
className: "py-8 text-center text-sm text-muted-foreground",
|
|
109
126
|
children: j
|
|
110
127
|
}) })
|
|
111
128
|
});
|
|
112
|
-
let P = a(O[n], "body"), F = a(O[t], "body"),
|
|
129
|
+
let P = a(O[n], "body"), F = a(O[t], "body"), I = h && v.size > 0, L = (e) => {
|
|
113
130
|
if (m === void 0 || m(e)) return p?.(e);
|
|
114
|
-
},
|
|
115
|
-
|
|
131
|
+
}, R = (e, t, n) => {
|
|
132
|
+
I ? y(e) : t === void 0 ? f?.(e, n) : n.ctrlKey || n.metaKey ? window.open(t, "_blank") : M(t);
|
|
116
133
|
};
|
|
117
|
-
return /* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ B("tbody", {
|
|
118
135
|
className: "divide-y divide-border",
|
|
119
136
|
children: u.map((e) => {
|
|
120
|
-
let t = d(e), n = _ === void 0 || _(e), o =
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
className: `group hover:bg-muted/50 transition-colors ${
|
|
137
|
+
let t = d(e), n = _ === void 0 || _(e), o = L(e);
|
|
138
|
+
return /* @__PURE__ */ V("tr", {
|
|
139
|
+
className: `group hover:bg-muted/50 transition-colors ${I || o !== void 0 || f !== void 0 ? "cursor-pointer" : ""}`,
|
|
123
140
|
onClick: (t) => {
|
|
124
|
-
|
|
141
|
+
R(e, o, t);
|
|
125
142
|
},
|
|
126
143
|
children: [
|
|
127
|
-
h ? /* @__PURE__ */
|
|
144
|
+
h ? /* @__PURE__ */ B("td", {
|
|
128
145
|
className: `p-1 text-center align-middle ${P.className}`,
|
|
129
146
|
style: {
|
|
130
147
|
width: "48px",
|
|
@@ -135,9 +152,9 @@ function ae({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedDat
|
|
|
135
152
|
onClick: (e) => {
|
|
136
153
|
e.stopPropagation();
|
|
137
154
|
},
|
|
138
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ B("div", {
|
|
139
156
|
className: "flex items-center justify-center",
|
|
140
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ B(g, {
|
|
141
158
|
checked: v.has(t),
|
|
142
159
|
disabled: !n,
|
|
143
160
|
onCheckedChange: () => {
|
|
@@ -148,19 +165,19 @@ function ae({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedDat
|
|
|
148
165
|
}) : null,
|
|
149
166
|
b.map((t, n) => {
|
|
150
167
|
let o = n === b.length - 1, s = a(O[t.key], "body");
|
|
151
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ B("td", {
|
|
152
169
|
className: `${`${n === 0 && !h ? "pl-4" : "pl-2"} ${o && !S ? "pr-4" : "pr-2"}`} ${E ? "py-2" : "py-4"} text-sm ${r(i(t))} ${s.className} ${T && !o ? "border-r border-border" : ""} ${t.className ?? ""}`,
|
|
153
170
|
style: {
|
|
154
171
|
...D ? { width: x[t.key] } : { minWidth: x[t.key] },
|
|
155
172
|
...s.style
|
|
156
173
|
},
|
|
157
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ B("div", {
|
|
158
175
|
className: "w-full h-full",
|
|
159
176
|
children: N(e, t.key)
|
|
160
177
|
})
|
|
161
178
|
}, t.key);
|
|
162
179
|
}),
|
|
163
|
-
S ? /* @__PURE__ */
|
|
180
|
+
S ? /* @__PURE__ */ B("td", {
|
|
164
181
|
className: `py-1 pl-1 pr-4 text-right align-middle whitespace-nowrap ${F.className}`,
|
|
165
182
|
style: {
|
|
166
183
|
minWidth: "32px",
|
|
@@ -169,9 +186,9 @@ function ae({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedDat
|
|
|
169
186
|
onClick: (e) => {
|
|
170
187
|
e.stopPropagation();
|
|
171
188
|
},
|
|
172
|
-
children: C !== void 0 && C.length > 0 ? /* @__PURE__ */
|
|
189
|
+
children: C !== void 0 && C.length > 0 ? /* @__PURE__ */ B("div", {
|
|
173
190
|
className: "flex items-center justify-end",
|
|
174
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ B(X, {
|
|
175
192
|
actions: C,
|
|
176
193
|
row: e
|
|
177
194
|
})
|
|
@@ -184,20 +201,20 @@ function ae({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedDat
|
|
|
184
201
|
}
|
|
185
202
|
//#endregion
|
|
186
203
|
//#region src/components/core/table/TableBulkActions.tsx
|
|
187
|
-
function
|
|
204
|
+
function ce({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
188
205
|
let { t: r } = o();
|
|
189
|
-
return /* @__PURE__ */
|
|
206
|
+
return /* @__PURE__ */ V("div", {
|
|
190
207
|
className: "bg-muted/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
|
|
191
|
-
children: [/* @__PURE__ */
|
|
208
|
+
children: [/* @__PURE__ */ V("div", {
|
|
192
209
|
className: "flex items-center gap-4",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
210
|
+
children: [/* @__PURE__ */ B("span", {
|
|
194
211
|
className: "text-sm font-medium text-primary ml-1",
|
|
195
212
|
children: r("table.selectedCount", { count: e.length })
|
|
196
|
-
}), /* @__PURE__ */
|
|
213
|
+
}), /* @__PURE__ */ B("div", {
|
|
197
214
|
className: "flex items-center gap-2",
|
|
198
215
|
children: n.map((n, i) => {
|
|
199
216
|
let a = n.icon;
|
|
200
|
-
return /* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ V(b, {
|
|
201
218
|
variant: "outline",
|
|
202
219
|
size: "sm",
|
|
203
220
|
onClick: () => {
|
|
@@ -206,14 +223,14 @@ function oe({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
|
206
223
|
});
|
|
207
224
|
},
|
|
208
225
|
className: `h-7 bg-background shadow-sm text-xs px-2.5 ${n.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
|
|
209
|
-
children: [a !== void 0 && /* @__PURE__ */
|
|
226
|
+
children: [a !== void 0 && /* @__PURE__ */ B("span", {
|
|
210
227
|
className: "mr-1.5 flex items-center justify-center",
|
|
211
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ B(a, { className: "h-3.5 w-3.5" })
|
|
212
229
|
}), r(n.labelKey)]
|
|
213
230
|
}, i);
|
|
214
231
|
})
|
|
215
232
|
})]
|
|
216
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ B(b, {
|
|
217
234
|
variant: "ghost",
|
|
218
235
|
size: "sm",
|
|
219
236
|
onClick: () => {
|
|
@@ -226,17 +243,17 @@ function oe({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
|
226
243
|
}
|
|
227
244
|
//#endregion
|
|
228
245
|
//#region src/components/core/table/TableHeader.tsx
|
|
229
|
-
var
|
|
246
|
+
var Z = {
|
|
230
247
|
left: "justify-start",
|
|
231
248
|
center: "justify-center",
|
|
232
249
|
right: "justify-end"
|
|
233
250
|
};
|
|
234
|
-
function
|
|
251
|
+
function le({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAll: l, visibleColumnsArray: u, draggableColumns: d, resizableColumns: f, columnWidths: p, sortColumn: m, sortDirection: h, handleSort: _, handleDragStart: v, handleDragOver: y, handleDrop: b, handleMouseDown: x, hasActions: S, settingsNode: C, bordered: w = !1, dense: T = !1, fixedColumns: E = {}, fixedSelection: D = !1, fixedActions: O = !1 }) {
|
|
235
252
|
let { t: k } = o(), A = !1;
|
|
236
253
|
s ? A = !0 : c && (A = "indeterminate");
|
|
237
|
-
let j = (e) => e.sortable === !0 ? m === e.key ?
|
|
254
|
+
let j = (e) => e.sortable === !0 ? m === e.key ? B(h === "asc" ? J : K, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ B(q, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }) : null, M = (t, n, o) => {
|
|
238
255
|
let s = o !== !1 && t.fixed === void 0, c = t.sortable === !0, l = a(E[t.key], "header"), d = i(t), m = j(t), h = n === 0 && !e, g = n === u.length - 1 && !(S || C !== void 0), D = `${h ? "pl-4" : "pl-2"} ${g ? "pr-4" : "pr-2"}`;
|
|
239
|
-
return /* @__PURE__ */
|
|
256
|
+
return /* @__PURE__ */ V("th", {
|
|
240
257
|
"data-column-key": t.key,
|
|
241
258
|
"data-fixed-side": t.fixed,
|
|
242
259
|
className: [
|
|
@@ -264,20 +281,20 @@ function ce({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAl
|
|
|
264
281
|
onDrop: (e) => {
|
|
265
282
|
b(e, t.key);
|
|
266
283
|
},
|
|
267
|
-
children: [/* @__PURE__ */
|
|
268
|
-
className: `flex items-center gap-1 ${
|
|
284
|
+
children: [/* @__PURE__ */ V("div", {
|
|
285
|
+
className: `flex items-center gap-1 ${Z[d]} ${f ? "pr-2" : ""}`,
|
|
269
286
|
children: [
|
|
270
|
-
s ? /* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
287
|
+
s ? /* @__PURE__ */ B(te, { className: "size-4 text-muted-foreground cursor-grab shrink-0" }) : null,
|
|
288
|
+
/* @__PURE__ */ B("span", {
|
|
272
289
|
className: "truncate",
|
|
273
290
|
children: k(t.headerKey)
|
|
274
291
|
}),
|
|
275
|
-
m === null ? null : /* @__PURE__ */
|
|
292
|
+
m === null ? null : /* @__PURE__ */ B("span", {
|
|
276
293
|
className: "ml-1 shrink-0",
|
|
277
294
|
children: m
|
|
278
295
|
})
|
|
279
296
|
]
|
|
280
|
-
}), f ? /* @__PURE__ */
|
|
297
|
+
}), f ? /* @__PURE__ */ B("div", {
|
|
281
298
|
className: "absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500 opacity-0 group-hover:opacity-50 transition-opacity",
|
|
282
299
|
onMouseDown: (e) => {
|
|
283
300
|
x(e, t.key);
|
|
@@ -285,10 +302,10 @@ function ce({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAl
|
|
|
285
302
|
}) : null]
|
|
286
303
|
}, t.key);
|
|
287
304
|
}, N = a(E[n], "header"), P = a(E[t], "header");
|
|
288
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ B("thead", {
|
|
289
306
|
className: "bg-muted/50 border-b border-border",
|
|
290
|
-
children: /* @__PURE__ */
|
|
291
|
-
e ? /* @__PURE__ */
|
|
307
|
+
children: /* @__PURE__ */ V("tr", { children: [
|
|
308
|
+
e ? /* @__PURE__ */ B("th", {
|
|
292
309
|
"data-column-key": n,
|
|
293
310
|
"data-fixed-side": D ? "left" : void 0,
|
|
294
311
|
className: `p-1 text-center align-middle ${N.className}`,
|
|
@@ -298,16 +315,16 @@ function ce({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAl
|
|
|
298
315
|
maxWidth: "48px",
|
|
299
316
|
...N.style
|
|
300
317
|
},
|
|
301
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ B("div", {
|
|
302
319
|
className: "flex items-center justify-center",
|
|
303
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ B(g, {
|
|
304
321
|
checked: A,
|
|
305
322
|
onCheckedChange: l
|
|
306
323
|
})
|
|
307
324
|
})
|
|
308
325
|
}) : null,
|
|
309
326
|
u.map((e, t) => M(e, t, d)),
|
|
310
|
-
S || C !== void 0 ? /* @__PURE__ */
|
|
327
|
+
S || C !== void 0 ? /* @__PURE__ */ B("th", {
|
|
311
328
|
"data-column-key": t,
|
|
312
329
|
"data-fixed-side": O ? "right" : void 0,
|
|
313
330
|
className: `py-1 pl-1 pr-4 text-right align-middle ${P.className}`,
|
|
@@ -322,45 +339,45 @@ function ce({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAl
|
|
|
322
339
|
}
|
|
323
340
|
//#endregion
|
|
324
341
|
//#region src/components/core/table/TablePagination.tsx
|
|
325
|
-
var
|
|
326
|
-
function
|
|
342
|
+
var Q = "…";
|
|
343
|
+
function $(e, t) {
|
|
327
344
|
return Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
328
345
|
}
|
|
329
|
-
function
|
|
330
|
-
if (n * 2 + 5 >= t) return
|
|
346
|
+
function ue(e, t, n = 1) {
|
|
347
|
+
if (n * 2 + 5 >= t) return $(1, t);
|
|
331
348
|
let r = Math.max(e - n, 1), i = Math.min(e + n, t), a = r > 2, o = i < t - 1;
|
|
332
349
|
return !a && o ? [
|
|
333
|
-
|
|
334
|
-
|
|
350
|
+
...$(1, n + 2),
|
|
351
|
+
Q,
|
|
335
352
|
t
|
|
336
353
|
] : a && !o ? [
|
|
337
354
|
1,
|
|
338
|
-
|
|
339
|
-
|
|
355
|
+
Q,
|
|
356
|
+
...$(t - (n + 2) + 1, t)
|
|
340
357
|
] : [
|
|
341
358
|
1,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
359
|
+
Q,
|
|
360
|
+
...$(r, i),
|
|
361
|
+
Q,
|
|
345
362
|
t
|
|
346
363
|
];
|
|
347
364
|
}
|
|
348
|
-
function
|
|
349
|
-
let { t: u } = o(), d =
|
|
350
|
-
return /* @__PURE__ */
|
|
365
|
+
function de({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: s, pageSizeOptions: c, totalPages: l }) {
|
|
366
|
+
let { t: u } = o(), d = ue(a, l);
|
|
367
|
+
return /* @__PURE__ */ V("div", {
|
|
351
368
|
className: "px-4 py-2 border-t border-border flex flex-col sm:grid sm:grid-cols-3 items-center gap-2 bg-muted/50",
|
|
352
369
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ B("div", {
|
|
354
371
|
className: "text-sm text-muted-foreground justify-self-start",
|
|
355
372
|
children: u("table.rangeOfTotal", {
|
|
356
373
|
range: e === 0 ? "0" : `${String(t + 1)} - ${String(n)}`,
|
|
357
374
|
total: e
|
|
358
375
|
})
|
|
359
376
|
}),
|
|
360
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ B("div", {
|
|
361
378
|
className: "flex items-center justify-center gap-1",
|
|
362
|
-
children: l > 1 && /* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
379
|
+
children: l > 1 && /* @__PURE__ */ V(z, { children: [
|
|
380
|
+
/* @__PURE__ */ B(b, {
|
|
364
381
|
variant: "ghost",
|
|
365
382
|
size: "icon",
|
|
366
383
|
className: "h-8 w-8 rounded-control",
|
|
@@ -369,12 +386,12 @@ function le({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSiz
|
|
|
369
386
|
},
|
|
370
387
|
disabled: a === 1,
|
|
371
388
|
"aria-label": u("table.previousPage"),
|
|
372
|
-
children: /* @__PURE__ */
|
|
389
|
+
children: /* @__PURE__ */ B(Y, { className: "size-4" })
|
|
373
390
|
}),
|
|
374
|
-
d.map((e, t) => e ===
|
|
391
|
+
d.map((e, t) => e === Q ? /* @__PURE__ */ B("span", {
|
|
375
392
|
className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
|
|
376
|
-
children:
|
|
377
|
-
}, `dots-${String(t)}`) : /* @__PURE__ */
|
|
393
|
+
children: Q
|
|
394
|
+
}, `dots-${String(t)}`) : /* @__PURE__ */ B(b, {
|
|
378
395
|
variant: e === a ? "default" : "ghost",
|
|
379
396
|
className: "h-8 min-w-8 px-2 rounded-control text-sm tabular-nums",
|
|
380
397
|
onClick: () => {
|
|
@@ -383,7 +400,7 @@ function le({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSiz
|
|
|
383
400
|
"aria-current": e === a ? "page" : void 0,
|
|
384
401
|
children: e
|
|
385
402
|
}, e)),
|
|
386
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ B(b, {
|
|
387
404
|
variant: "ghost",
|
|
388
405
|
size: "icon",
|
|
389
406
|
className: "h-8 w-8 rounded-control",
|
|
@@ -392,21 +409,21 @@ function le({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSiz
|
|
|
392
409
|
},
|
|
393
410
|
disabled: a === l,
|
|
394
411
|
"aria-label": u("table.nextPage"),
|
|
395
|
-
children: /* @__PURE__ */
|
|
412
|
+
children: /* @__PURE__ */ B(ee, { className: "size-4" })
|
|
396
413
|
})
|
|
397
414
|
] })
|
|
398
415
|
}),
|
|
399
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ B("div", {
|
|
400
417
|
className: "justify-self-end",
|
|
401
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ V(j, {
|
|
402
419
|
value: String(r),
|
|
403
420
|
onValueChange: (e) => {
|
|
404
421
|
i(Number(e)), s(1);
|
|
405
422
|
},
|
|
406
|
-
children: [/* @__PURE__ */
|
|
423
|
+
children: [/* @__PURE__ */ B(k, {
|
|
407
424
|
className: "h-8 w-[110px] text-sm",
|
|
408
|
-
children: /* @__PURE__ */
|
|
409
|
-
}), /* @__PURE__ */
|
|
425
|
+
children: /* @__PURE__ */ B(M, {})
|
|
426
|
+
}), /* @__PURE__ */ B(A, { children: c.map((e) => /* @__PURE__ */ B(O, {
|
|
410
427
|
value: String(e),
|
|
411
428
|
children: u("table.perPage", { count: e })
|
|
412
429
|
}, e)) })]
|
|
@@ -417,40 +434,40 @@ function le({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSiz
|
|
|
417
434
|
}
|
|
418
435
|
//#endregion
|
|
419
436
|
//#region src/components/core/table/TableSettings.tsx
|
|
420
|
-
function
|
|
421
|
-
let { t: a } = o(), [s, c] =
|
|
437
|
+
function fe({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColumnsVisibility: i }) {
|
|
438
|
+
let { t: a } = o(), [s, c] = R(""), l = L(() => t.map((e, t) => ({
|
|
422
439
|
key: e.key,
|
|
423
440
|
label: a(e.headerKey),
|
|
424
441
|
locked: t === 0
|
|
425
|
-
})), [t, a]), u =
|
|
442
|
+
})), [t, a]), u = L(() => {
|
|
426
443
|
let e = s.trim().toLowerCase();
|
|
427
444
|
return e === "" ? l : l.filter((t) => t.label.toLowerCase().includes(e));
|
|
428
445
|
}, [l, s]), d = (e) => {
|
|
429
446
|
let t = u.filter((e) => !e.locked).map((e) => e.key).filter((t) => n.has(t) !== e);
|
|
430
447
|
i === void 0 ? t.forEach(r) : i(t, e);
|
|
431
448
|
};
|
|
432
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ V(D, {
|
|
433
450
|
onOpenChange: (e) => {
|
|
434
451
|
e || c("");
|
|
435
452
|
},
|
|
436
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ B(T, {
|
|
437
454
|
asChild: !0,
|
|
438
|
-
children: /* @__PURE__ */
|
|
455
|
+
children: /* @__PURE__ */ B(b, {
|
|
439
456
|
variant: "outline",
|
|
440
457
|
size: "sm",
|
|
441
458
|
className: "size-7 p-0 bg-background hover:bg-muted shadow-sm border-border",
|
|
442
|
-
children: /* @__PURE__ */
|
|
459
|
+
children: /* @__PURE__ */ B(ae, { className: "size-3.5 text-muted-foreground" })
|
|
443
460
|
})
|
|
444
|
-
}), /* @__PURE__ */
|
|
461
|
+
}), /* @__PURE__ */ V(E, {
|
|
445
462
|
align: "end",
|
|
446
463
|
className: "w-64 p-0",
|
|
447
464
|
children: [
|
|
448
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ V("div", {
|
|
449
466
|
className: "flex items-center justify-between px-3 pt-3 pb-2",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
467
|
+
children: [/* @__PURE__ */ B("span", {
|
|
451
468
|
className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
452
469
|
children: a("table.columnsTitle")
|
|
453
|
-
}), /* @__PURE__ */
|
|
470
|
+
}), /* @__PURE__ */ V("span", {
|
|
454
471
|
className: "text-xs text-muted-foreground",
|
|
455
472
|
children: [
|
|
456
473
|
n.size,
|
|
@@ -459,11 +476,11 @@ function ue({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColum
|
|
|
459
476
|
]
|
|
460
477
|
})]
|
|
461
478
|
}),
|
|
462
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ B("div", {
|
|
463
480
|
className: "px-2 pb-2",
|
|
464
|
-
children: /* @__PURE__ */
|
|
481
|
+
children: /* @__PURE__ */ V("div", {
|
|
465
482
|
className: "relative",
|
|
466
|
-
children: [/* @__PURE__ */
|
|
483
|
+
children: [/* @__PURE__ */ B(ie, { className: "absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ B("input", {
|
|
467
484
|
value: s,
|
|
468
485
|
onChange: (e) => {
|
|
469
486
|
c(e.target.value);
|
|
@@ -474,30 +491,30 @@ function ue({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColum
|
|
|
474
491
|
})]
|
|
475
492
|
})
|
|
476
493
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ V("div", {
|
|
478
495
|
className: "flex max-h-72 flex-col gap-0.5 overflow-y-auto overflow-x-hidden border-t border-border p-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent",
|
|
479
|
-
children: [u.length === 0 && /* @__PURE__ */
|
|
496
|
+
children: [u.length === 0 && /* @__PURE__ */ B("p", {
|
|
480
497
|
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
481
498
|
children: a("states.noResult")
|
|
482
|
-
}), u.map((t) => /* @__PURE__ */
|
|
499
|
+
}), u.map((t) => /* @__PURE__ */ V("label", {
|
|
483
500
|
className: e("flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5 text-sm transition-colors", t.locked ? "cursor-not-allowed text-muted-foreground" : "cursor-pointer hover:bg-muted"),
|
|
484
|
-
children: [/* @__PURE__ */
|
|
501
|
+
children: [/* @__PURE__ */ B(g, {
|
|
485
502
|
checked: t.locked || n.has(t.key),
|
|
486
503
|
disabled: t.locked,
|
|
487
504
|
onCheckedChange: () => {
|
|
488
505
|
r(t.key);
|
|
489
506
|
}
|
|
490
|
-
}), /* @__PURE__ */
|
|
507
|
+
}), /* @__PURE__ */ B("span", {
|
|
491
508
|
className: "min-w-0 flex-1 truncate",
|
|
492
509
|
title: t.label,
|
|
493
510
|
children: t.label
|
|
494
511
|
})]
|
|
495
512
|
}, t.key))]
|
|
496
513
|
}),
|
|
497
|
-
u.length > 0 && /* @__PURE__ */
|
|
514
|
+
u.length > 0 && /* @__PURE__ */ V("div", {
|
|
498
515
|
className: "flex items-center justify-end gap-2 border-t border-border px-3 py-2 text-xs",
|
|
499
516
|
children: [
|
|
500
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ B("button", {
|
|
501
518
|
type: "button",
|
|
502
519
|
onClick: () => {
|
|
503
520
|
d(!0);
|
|
@@ -505,11 +522,11 @@ function ue({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColum
|
|
|
505
522
|
className: "font-medium text-primary hover:underline",
|
|
506
523
|
children: a("table.showAllColumns")
|
|
507
524
|
}),
|
|
508
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ B("span", {
|
|
509
526
|
className: "h-3 w-px bg-border",
|
|
510
527
|
"aria-hidden": !0
|
|
511
528
|
}),
|
|
512
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ B("button", {
|
|
513
530
|
type: "button",
|
|
514
531
|
onClick: () => {
|
|
515
532
|
d(!1);
|
|
@@ -525,8 +542,8 @@ function ue({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColum
|
|
|
525
542
|
}
|
|
526
543
|
//#endregion
|
|
527
544
|
//#region src/components/core/table/DataTable.tsx
|
|
528
|
-
function
|
|
529
|
-
let { columns: a, rowKey: o, rowSelectable: s, onRowClick: c, onRowNavigate: l, rowNavigable: u, actions: d, bulkActions: f } = r, p = r.pageSizeDefault ??
|
|
545
|
+
function pe({ data: e, isLoading: t = !1, error: n = null, config: r, server: i }) {
|
|
546
|
+
let { columns: a, rowKey: o, rowSelectable: s, onRowClick: c, onRowNavigate: l, rowNavigable: u, actions: d, bulkActions: f } = r, p = r.pageSizeDefault ?? F, m = r.pageSizeOptions ?? I, h = r.dense ?? !1, g = r.bordered ?? !1, _ = r.draggableColumns ?? !1, v = r.resizableColumns ?? !1, y = r.columnVisibility ?? !1, b = r.fixedActions ?? !1, { sortColumn: x, sortDirection: S, selectedRows: C, setSelectedRows: w, visibleColumns: T, columnWidths: E, safeCurrentPage: D, totalPages: O, startIndex: k, endIndex: A, tableRef: j, hasActions: M, hasBulkActions: R, visibleColumnsArray: z, colSpanCount: H, paginatedData: U, handleSort: W, handleMouseDown: G, handleDragStart: K, handleDragOver: q, handleDrop: J, toggleColumnVisibility: Y, setColumnsVisibility: ee, toggleRowSelection: te, toggleSelectAll: ne, pageSize: re, setPageSize: ie, setCurrentPage: ae } = N({
|
|
530
547
|
data: e,
|
|
531
548
|
columns: a,
|
|
532
549
|
rowKey: o,
|
|
@@ -539,81 +556,81 @@ function Q({ data: e, isLoading: t = !1, error: n = null, config: r, server: i }
|
|
|
539
556
|
onColumnVisibilityChange: r.onColumnVisibilityChange,
|
|
540
557
|
columnVisibilityStorage: r.columnVisibilityStorage,
|
|
541
558
|
server: i
|
|
542
|
-
}),
|
|
543
|
-
return /* @__PURE__ */
|
|
559
|
+
}), oe = R && z.some((e) => e.fixed === "left"), X = P(j), Z = L(() => new Set(C.map(o)), [C, o]), Q = L(() => s === void 0 ? e : e.filter(s), [e, s]), $ = Q.length > 0 && Q.every((e) => Z.has(o(e))), ue = !$ && Q.some((e) => Z.has(o(e)));
|
|
560
|
+
return /* @__PURE__ */ V("div", {
|
|
544
561
|
className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
|
|
545
|
-
children: [C.length > 0 && f !== void 0 && f.length > 0 && /* @__PURE__ */
|
|
562
|
+
children: [C.length > 0 && f !== void 0 && f.length > 0 && /* @__PURE__ */ B(ce, {
|
|
546
563
|
selectedRows: C,
|
|
547
564
|
setSelectedRows: w,
|
|
548
565
|
bulkActions: f
|
|
549
|
-
}), /* @__PURE__ */
|
|
566
|
+
}), /* @__PURE__ */ V("div", {
|
|
550
567
|
className: "w-full bg-card rounded-surface border border-border overflow-hidden",
|
|
551
|
-
children: [/* @__PURE__ */
|
|
568
|
+
children: [/* @__PURE__ */ B("div", {
|
|
552
569
|
className: "overflow-x-auto",
|
|
553
|
-
children: /* @__PURE__ */
|
|
554
|
-
ref:
|
|
570
|
+
children: /* @__PURE__ */ V("table", {
|
|
571
|
+
ref: j,
|
|
555
572
|
className: "w-full",
|
|
556
|
-
children: [/* @__PURE__ */
|
|
557
|
-
hasBulkActions:
|
|
558
|
-
allSelected:
|
|
559
|
-
someSelected:
|
|
560
|
-
toggleSelectAll:
|
|
561
|
-
visibleColumnsArray:
|
|
573
|
+
children: [/* @__PURE__ */ B(le, {
|
|
574
|
+
hasBulkActions: R,
|
|
575
|
+
allSelected: $,
|
|
576
|
+
someSelected: ue,
|
|
577
|
+
toggleSelectAll: ne,
|
|
578
|
+
visibleColumnsArray: z,
|
|
562
579
|
draggableColumns: _,
|
|
563
580
|
resizableColumns: v,
|
|
564
581
|
columnWidths: E,
|
|
565
582
|
sortColumn: x,
|
|
566
583
|
sortDirection: S,
|
|
567
|
-
handleSort:
|
|
568
|
-
handleDragStart:
|
|
569
|
-
handleDragOver:
|
|
570
|
-
handleDrop:
|
|
571
|
-
handleMouseDown:
|
|
572
|
-
hasActions:
|
|
584
|
+
handleSort: W,
|
|
585
|
+
handleDragStart: K,
|
|
586
|
+
handleDragOver: q,
|
|
587
|
+
handleDrop: J,
|
|
588
|
+
handleMouseDown: G,
|
|
589
|
+
hasActions: M,
|
|
573
590
|
bordered: g,
|
|
574
591
|
dense: h,
|
|
575
|
-
fixedColumns:
|
|
576
|
-
fixedSelection:
|
|
592
|
+
fixedColumns: X,
|
|
593
|
+
fixedSelection: oe,
|
|
577
594
|
fixedActions: b,
|
|
578
|
-
settingsNode: y ? /* @__PURE__ */
|
|
595
|
+
settingsNode: y ? /* @__PURE__ */ B(fe, {
|
|
579
596
|
columns: a,
|
|
580
597
|
visibleColumns: T,
|
|
581
|
-
toggleColumnVisibility:
|
|
582
|
-
setColumnsVisibility:
|
|
598
|
+
toggleColumnVisibility: Y,
|
|
599
|
+
setColumnsVisibility: ee
|
|
583
600
|
}) : void 0
|
|
584
|
-
}), /* @__PURE__ */
|
|
601
|
+
}), /* @__PURE__ */ B(se, {
|
|
585
602
|
bordered: g,
|
|
586
603
|
dense: h,
|
|
587
604
|
isLoading: t,
|
|
588
605
|
error: n,
|
|
589
|
-
colSpanCount:
|
|
606
|
+
colSpanCount: H,
|
|
590
607
|
messages: r.messages,
|
|
591
|
-
paginatedData:
|
|
608
|
+
paginatedData: U,
|
|
592
609
|
rowKey: o,
|
|
593
610
|
onRowClick: c,
|
|
594
611
|
onRowNavigate: l,
|
|
595
612
|
rowNavigable: u,
|
|
596
|
-
hasBulkActions:
|
|
613
|
+
hasBulkActions: R,
|
|
597
614
|
rowSelectable: s,
|
|
598
|
-
selectedKeys:
|
|
599
|
-
toggleRowSelection:
|
|
600
|
-
visibleColumnsArray:
|
|
615
|
+
selectedKeys: Z,
|
|
616
|
+
toggleRowSelection: te,
|
|
617
|
+
visibleColumnsArray: z,
|
|
601
618
|
columnWidths: E,
|
|
602
|
-
hasActions:
|
|
619
|
+
hasActions: M || y,
|
|
603
620
|
actions: d,
|
|
604
621
|
columns: a,
|
|
605
622
|
resizableColumns: v,
|
|
606
|
-
fixedColumns:
|
|
623
|
+
fixedColumns: X
|
|
607
624
|
})]
|
|
608
625
|
})
|
|
609
|
-
}), /* @__PURE__ */
|
|
626
|
+
}), /* @__PURE__ */ B(de, {
|
|
610
627
|
totalItems: i?.totalRows ?? e.length,
|
|
611
|
-
startIndex:
|
|
612
|
-
endIndex:
|
|
613
|
-
pageSize:
|
|
614
|
-
setPageSize:
|
|
628
|
+
startIndex: k,
|
|
629
|
+
endIndex: A,
|
|
630
|
+
pageSize: re,
|
|
631
|
+
setPageSize: ie,
|
|
615
632
|
currentPage: D,
|
|
616
|
-
setCurrentPage:
|
|
633
|
+
setCurrentPage: ae,
|
|
617
634
|
pageSizeOptions: m,
|
|
618
635
|
totalPages: O
|
|
619
636
|
})]
|
|
@@ -622,70 +639,70 @@ function Q({ data: e, isLoading: t = !1, error: n = null, config: r, server: i }
|
|
|
622
639
|
}
|
|
623
640
|
//#endregion
|
|
624
641
|
//#region src/components/core/table/JsonTableOutput.tsx
|
|
625
|
-
var
|
|
626
|
-
let { t: n } = o(), [r, i] =
|
|
642
|
+
var me = ({ header: e, output: t }) => {
|
|
643
|
+
let { t: n } = o(), [r, i] = R(!0), a = W(t), u = a !== null, d = () => /* @__PURE__ */ V("div", {
|
|
627
644
|
className: "flex items-center justify-between mb-2",
|
|
628
|
-
children: [/* @__PURE__ */
|
|
645
|
+
children: [/* @__PURE__ */ B("span", {
|
|
629
646
|
className: "font-medium text-sm",
|
|
630
647
|
children: e
|
|
631
|
-
}), /* @__PURE__ */
|
|
648
|
+
}), /* @__PURE__ */ V("div", {
|
|
632
649
|
className: "flex items-center gap-2",
|
|
633
|
-
children: [/* @__PURE__ */
|
|
650
|
+
children: [/* @__PURE__ */ B(y, {
|
|
634
651
|
id: "table-mode",
|
|
635
652
|
checked: r,
|
|
636
653
|
onCheckedChange: i
|
|
637
|
-
}), /* @__PURE__ */
|
|
654
|
+
}), /* @__PURE__ */ B(s, {
|
|
638
655
|
htmlFor: "table-mode",
|
|
639
656
|
className: "text-xs",
|
|
640
657
|
children: n("table.tableMode")
|
|
641
658
|
})]
|
|
642
659
|
})]
|
|
643
|
-
}), f = ({ children: e }) => /* @__PURE__ */
|
|
660
|
+
}), f = ({ children: e }) => /* @__PURE__ */ B("div", {
|
|
644
661
|
className: "border rounded min-w-0 w-full",
|
|
645
|
-
children: /* @__PURE__ */
|
|
646
|
-
}), g = () => /* @__PURE__ */
|
|
662
|
+
children: /* @__PURE__ */ B(m, { children: e })
|
|
663
|
+
}), g = () => /* @__PURE__ */ B("pre", {
|
|
647
664
|
className: "text-xs bg-muted p-4 rounded overflow-x-auto whitespace-pre-wrap",
|
|
648
665
|
children: u && !r ? JSON.stringify(a, null, 2) : t
|
|
649
666
|
});
|
|
650
|
-
return t ? /* @__PURE__ */
|
|
667
|
+
return t ? /* @__PURE__ */ V("div", {
|
|
651
668
|
className: "min-w-0 w-full",
|
|
652
669
|
children: [d(), (() => {
|
|
653
|
-
if (!u || !r) return /* @__PURE__ */
|
|
654
|
-
if (Array.isArray(a) && a.length > 0 &&
|
|
670
|
+
if (!u || !r) return /* @__PURE__ */ B(g, {});
|
|
671
|
+
if (Array.isArray(a) && a.length > 0 && U(a[0])) {
|
|
655
672
|
let e = a, t = Object.keys(e[0]);
|
|
656
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ V(f, { children: [/* @__PURE__ */ B(p, {
|
|
657
674
|
className: "bg-muted/50",
|
|
658
|
-
children: /* @__PURE__ */
|
|
675
|
+
children: /* @__PURE__ */ B(v, { children: t.map((e) => /* @__PURE__ */ B(l, {
|
|
659
676
|
className: "font-medium",
|
|
660
677
|
children: e
|
|
661
678
|
}, e)) })
|
|
662
|
-
}), /* @__PURE__ */
|
|
679
|
+
}), /* @__PURE__ */ B(c, { children: e.map((e, n) => /* @__PURE__ */ B(v, { children: t.map((t) => /* @__PURE__ */ B(h, {
|
|
663
680
|
className: "text-sm whitespace-pre-wrap",
|
|
664
|
-
children:
|
|
681
|
+
children: H(e[t])
|
|
665
682
|
}, t)) }, n)) })] });
|
|
666
683
|
}
|
|
667
|
-
if (
|
|
684
|
+
if (U(a)) {
|
|
668
685
|
let e = Object.entries(a);
|
|
669
|
-
return /* @__PURE__ */
|
|
686
|
+
return /* @__PURE__ */ V(f, { children: [/* @__PURE__ */ B(p, {
|
|
670
687
|
className: "bg-muted/50",
|
|
671
|
-
children: /* @__PURE__ */
|
|
688
|
+
children: /* @__PURE__ */ V(v, { children: [/* @__PURE__ */ B(l, {
|
|
672
689
|
className: "font-medium",
|
|
673
690
|
children: n("table.property")
|
|
674
|
-
}), /* @__PURE__ */
|
|
691
|
+
}), /* @__PURE__ */ B(l, {
|
|
675
692
|
className: "font-medium",
|
|
676
693
|
children: n("table.value")
|
|
677
694
|
})] })
|
|
678
|
-
}), /* @__PURE__ */
|
|
695
|
+
}), /* @__PURE__ */ B(c, { children: e.map(([e, t]) => /* @__PURE__ */ V(v, { children: [/* @__PURE__ */ B(h, {
|
|
679
696
|
className: "font-medium text-sm",
|
|
680
697
|
children: e
|
|
681
|
-
}), /* @__PURE__ */
|
|
698
|
+
}), /* @__PURE__ */ B(h, {
|
|
682
699
|
className: "text-sm whitespace-pre-wrap",
|
|
683
|
-
children:
|
|
700
|
+
children: H(t)
|
|
684
701
|
})] }, e)) })] });
|
|
685
702
|
}
|
|
686
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ B(g, {});
|
|
687
704
|
})()]
|
|
688
705
|
}) : null;
|
|
689
706
|
};
|
|
690
707
|
//#endregion
|
|
691
|
-
export {
|
|
708
|
+
export { pe as DataTable, me as JsonTableOutput, X as TableActions, se as TableBody, ce as TableBulkActions, le as TableHeader, de as TablePagination, fe as TableSettings };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableRowAction.d.ts","sourceRoot":"","sources":["../../src/types/DataTableRowAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,kBAAkB,CAAC,CAAC;IAEnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAEjF,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE9B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"DataTableRowAction.d.ts","sourceRoot":"","sources":["../../src/types/DataTableRowAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,kBAAkB,CAAC,CAAC;IAEnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAEjF,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE9B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAE/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|