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