@krosoft/react 0.0.255 → 0.0.256
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.
|
@@ -18,7 +18,7 @@ import { t as W } from "../../AppTitle-BR4JFZfp.js";
|
|
|
18
18
|
import { n as G, t as K } from "../../states-BusGNKku.js";
|
|
19
19
|
import { AppPageHeader as q, KpiCardsLayout as J } from "./layouts/index.js";
|
|
20
20
|
import { a as Y, i as X, n as Z, o as Q, r as $, t as ee } from "../../navbar-DLxNVUU9.js";
|
|
21
|
-
import { a as te, c as ne, d as re, f as ie, i as ae, l as oe, n as se, o as ce, p as le, r as ue, s as de, t as fe, u as pe } from "../../table-
|
|
21
|
+
import { a as te, c as ne, d as re, f as ie, i as ae, l as oe, n as se, o as ce, p as le, r as ue, s as de, t as fe, u as pe } from "../../table-B7lgx_iw.js";
|
|
22
22
|
import { AppTabContainer as me, AppTabHeader as he, AppTabs as ge, AppVerticalTabs as _e } from "./tabs/index.js";
|
|
23
23
|
import { t as ve } from "../../theme-Ck_D5xtg.js";
|
|
24
24
|
export { ne as ACTIONS_COLUMN_KEY, R as ActiveFilters, z as AdvancedFilters, k as AppActions, E as AppDialog, q as AppPageHeader, A as AppSubTitle, me as AppTabContainer, he as AppTabHeader, ge as AppTabs, W as AppTitle, _e as AppVerticalTabs, v as BarChartHorizontal, C as BarChartVertical, _ as CHART_COLORS, y as ChartCard, S as CircularGauge, D as ConfirmationDialog, r as DashboardCard, se as DataTable, P as DatePicker, I as DateRangePicker, l as Dialog, c as DialogClose, p as DialogContent, g as DialogDescription, s as DialogFooter, h as DialogHeader, d as DialogOverlay, f as DialogPortal, m as DialogTitle, u as DialogTrigger, N as ErrorAlert, G as ErrorState, B as FilterField, T as FormDialog, M as GenericForm, Q as GlobalSearch, O as ImageInput, fe as JsonTableOutput, e as KpiCard, t as KpiCards, J as KpiCardsLayout, U as LanguageSelector, b as LineChart, K as LoadingState, i as MetricCard, j as MultiSelect, Y as NotificationsBell, w as PieChart, o as Progress, oe as SELECTION_COLUMN_KEY, L as SearchInput, V as SearchableFilterPill, F as SearchableSelect, $ as Sidebar, Z as SidebarHeader, X as SidebarNavItem, n as SkeletonCard, a as SkeletonCards, le as TableActions, de as TableBody, ce as TableBulkActions, H as TableFilter, te as TableHeader, ae as TablePagination, ue as TableSettings, ve as ThemeSelector, ee as Topbar, re as getAlignmentClass, x as getChartColor, ie as getColumnAlignment, pe as getFixedCellProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonTableOutput.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/JsonTableOutput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"JsonTableOutput.d.ts","sourceRoot":"","sources":["../../../../src/components/core/table/JsonTableOutput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,eAAe,GAAI,oBAAoB,oBAAoB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAuG9F,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "../../../table-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "../../../table-B7lgx_iw.js";
|
|
2
2
|
export { t as ACTIONS_COLUMN_KEY, o as DataTable, d as JsonTableOutput, a as SELECTION_COLUMN_KEY, c as TableActions, u as TableBody, s as TableBulkActions, e as TableHeader, i as TablePagination, l as TableSettings, n as getAlignmentClass, r as getColumnAlignment, f as getFixedCellProps };
|
package/dist/components/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { t as qr } from "../AppTitle-BR4JFZfp.js";
|
|
|
21
21
|
import { n as Jr, t as Yr } from "../states-BusGNKku.js";
|
|
22
22
|
import { AppPageHeader as Xr, KpiCardsLayout as Zr } from "./core/layouts/index.js";
|
|
23
23
|
import { a as Qr, i as $r, n as ei, o as ti, r as ni, t as ri } from "../navbar-DLxNVUU9.js";
|
|
24
|
-
import { a as ii, c as ai, d as oi, f as si, i as ci, l as li, n as ui, o as di, p as fi, r as pi, s as mi, t as hi, u as gi } from "../table-
|
|
24
|
+
import { a as ii, c as ai, d as oi, f as si, i as ci, l as li, n as ui, o as di, p as fi, r as pi, s as mi, t as hi, u as gi } from "../table-B7lgx_iw.js";
|
|
25
25
|
import { AppTabContainer as _i, AppTabHeader as vi, AppTabs as yi, AppVerticalTabs as bi } from "./core/tabs/index.js";
|
|
26
26
|
import { t as xi } from "../theme-Ck_D5xtg.js";
|
|
27
27
|
import "./core/index.js";
|
|
@@ -5,20 +5,20 @@ import { i as g, l as _, n as v, t as y, u as b } from "./select-ULiTPOr5.js";
|
|
|
5
5
|
import { n as x, t as S } from "./useFixedColumns-DnzqhbfT.js";
|
|
6
6
|
import { useState as C } from "react";
|
|
7
7
|
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
import { AlertTriangleIcon as
|
|
10
|
-
import { useNavigate as
|
|
8
|
+
import { formatJsonValue as D, isRecord as O, tryParseJson as k } from "@krosoft/core/helpers";
|
|
9
|
+
import { AlertTriangleIcon as A, ArrowDownIcon as j, ArrowUpDownIcon as M, ArrowUpIcon as N, ChevronLeftIcon as ee, ChevronRightIcon as P, GripVerticalIcon as F, Loader2Icon as I, MoreVerticalIcon as L, SettingsIcon as R } from "lucide-react";
|
|
10
|
+
import { useNavigate as z } from "react-router-dom";
|
|
11
11
|
//#region src/constants/datatable.ts
|
|
12
|
-
var
|
|
12
|
+
var te = [
|
|
13
13
|
5,
|
|
14
14
|
10,
|
|
15
15
|
30,
|
|
16
16
|
50,
|
|
17
17
|
100
|
|
18
|
-
],
|
|
18
|
+
], ne = te[1];
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/components/core/table/TableActions.tsx
|
|
21
|
-
function
|
|
21
|
+
function B({ actions: e, row: t }) {
|
|
22
22
|
let n = e.filter((e) => e.visible === void 0 || e.visible(t));
|
|
23
23
|
if (n.length === 0) return null;
|
|
24
24
|
let a = n.filter((e) => e.overflow !== !0), s = n.filter((e) => e.overflow === !0);
|
|
@@ -42,7 +42,7 @@ function L({ actions: e, row: t }) {
|
|
|
42
42
|
variant: "ghost",
|
|
43
43
|
size: "icon",
|
|
44
44
|
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
45
|
-
children: /* @__PURE__ */ T(
|
|
45
|
+
children: /* @__PURE__ */ T(L, { className: "size-3.5" })
|
|
46
46
|
})
|
|
47
47
|
}), /* @__PURE__ */ T(o, {
|
|
48
48
|
align: "end",
|
|
@@ -68,26 +68,26 @@ function L({ actions: e, row: t }) {
|
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/components/core/table/columnAlignment.ts
|
|
71
|
-
var
|
|
71
|
+
var V = {
|
|
72
72
|
left: "text-left",
|
|
73
73
|
center: "text-center",
|
|
74
74
|
right: "text-right"
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function H(e) {
|
|
77
77
|
if (e.align !== void 0) return e.align;
|
|
78
78
|
let t = (e.className ?? "").split(/\s+/);
|
|
79
79
|
return t.includes("text-right") ? "right" : t.includes("text-center") ? "center" : "left";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function U(e) {
|
|
82
|
+
return V[e];
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/components/core/table/fixedColumns.ts
|
|
86
|
-
var
|
|
86
|
+
var W = "__selection__", G = "__actions__", K = {
|
|
87
87
|
left: "border-r border-gray-200 dark:border-gray-800",
|
|
88
88
|
right: "border-l border-gray-200 dark:border-gray-800"
|
|
89
89
|
};
|
|
90
|
-
function
|
|
90
|
+
function q(e, t) {
|
|
91
91
|
if (e === void 0) return {
|
|
92
92
|
className: "relative",
|
|
93
93
|
style: {}
|
|
@@ -99,15 +99,15 @@ function W(e, t) {
|
|
|
99
99
|
n ? "z-20" : "z-10",
|
|
100
100
|
"before:absolute before:inset-0 before:-z-10 before:pointer-events-none",
|
|
101
101
|
n ? "before:bg-muted/50 dark:before:bg-gray-900/50" : "group-hover:before:bg-muted/50 dark:group-hover:before:bg-gray-900/50",
|
|
102
|
-
e.isEdge ?
|
|
102
|
+
e.isEdge ? K[e.side] : ""
|
|
103
103
|
].filter(Boolean).join(" "),
|
|
104
104
|
style: e.side === "left" ? { left: e.offset } : { right: e.offset }
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/components/core/table/TableBody.tsx
|
|
109
|
-
function
|
|
110
|
-
let { t: S } = h(), C =
|
|
109
|
+
function J({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginatedData: i, getRowId: a, onRowClick: o, onRowNavigate: s, hasBulkActions: c, selectedRows: l, toggleRowSelection: d, visibleColumnsArray: f, columnWidths: p, hasActions: m, actions: g, columns: _, bordered: v = !1, dense: y = !1, resizableColumns: b = !1, fixedColumns: x = {} }) {
|
|
110
|
+
let { t: S } = h(), C = z(), w = (e, t) => {
|
|
111
111
|
let n = _.find((e) => e.key === t);
|
|
112
112
|
if (n?.renderCell !== void 0) return n.renderCell(e);
|
|
113
113
|
let r = e[t];
|
|
@@ -123,7 +123,7 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
123
123
|
className: "py-8 text-center",
|
|
124
124
|
children: /* @__PURE__ */ E("div", {
|
|
125
125
|
className: "flex flex-col items-center justify-center gap-2 text-muted-foreground",
|
|
126
|
-
children: [/* @__PURE__ */ T(
|
|
126
|
+
children: [/* @__PURE__ */ T(I, { className: "h-6 w-6 animate-spin text-primary" }), /* @__PURE__ */ T("span", {
|
|
127
127
|
className: "text-sm",
|
|
128
128
|
children: S("states.loading")
|
|
129
129
|
})]
|
|
@@ -137,7 +137,7 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
137
137
|
className: "py-8 text-center",
|
|
138
138
|
children: /* @__PURE__ */ E("div", {
|
|
139
139
|
className: "flex flex-col items-center justify-center gap-2 text-destructive",
|
|
140
|
-
children: [/* @__PURE__ */ T(
|
|
140
|
+
children: [/* @__PURE__ */ T(A, { className: "h-6 w-6" }), /* @__PURE__ */ T("span", {
|
|
141
141
|
className: "text-sm",
|
|
142
142
|
children: t
|
|
143
143
|
})]
|
|
@@ -152,7 +152,7 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
152
152
|
children: r ?? S("states.noResult")
|
|
153
153
|
}) })
|
|
154
154
|
});
|
|
155
|
-
let D =
|
|
155
|
+
let D = q(x[W], "body"), O = q(x[G], "body"), k = s !== void 0 || o !== void 0, j = (e, t) => {
|
|
156
156
|
if (s !== void 0) {
|
|
157
157
|
let n = s(e);
|
|
158
158
|
t.ctrlKey || t.metaKey ? window.open(n, "_blank") : C(n);
|
|
@@ -163,7 +163,7 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
163
163
|
children: i.map((e) => {
|
|
164
164
|
let t = a(e);
|
|
165
165
|
return /* @__PURE__ */ E("tr", {
|
|
166
|
-
className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${
|
|
166
|
+
className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${k ? "cursor-pointer" : ""}`,
|
|
167
167
|
onClick: (t) => {
|
|
168
168
|
j(e, t);
|
|
169
169
|
},
|
|
@@ -190,9 +190,9 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
190
190
|
})
|
|
191
191
|
}) : null,
|
|
192
192
|
f.map((t, n) => {
|
|
193
|
-
let r = n === f.length - 1, i =
|
|
193
|
+
let r = n === f.length - 1, i = q(x[t.key], "body");
|
|
194
194
|
return /* @__PURE__ */ T("td", {
|
|
195
|
-
className: `${`${n === 0 && !c ? "pl-4" : "pl-2"} ${r && !m ? "pr-4" : "pr-2"}`} ${y ? "py-2" : "py-4"} ${
|
|
195
|
+
className: `${`${n === 0 && !c ? "pl-4" : "pl-2"} ${r && !m ? "pr-4" : "pr-2"}`} ${y ? "py-2" : "py-4"} ${U(H(t))} ${i.className} ${v && !r ? "border-r border-gray-100 dark:border-gray-800" : ""} ${t.className ?? ""}`,
|
|
196
196
|
style: {
|
|
197
197
|
...b ? { width: p[t.key] } : { minWidth: p[t.key] },
|
|
198
198
|
...i.style
|
|
@@ -204,17 +204,17 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
204
204
|
}, t.key);
|
|
205
205
|
}),
|
|
206
206
|
m ? /* @__PURE__ */ T("td", {
|
|
207
|
-
className: `p-1 text-right align-middle whitespace-nowrap ${
|
|
207
|
+
className: `p-1 text-right align-middle whitespace-nowrap ${O.className}`,
|
|
208
208
|
style: {
|
|
209
209
|
minWidth: "32px",
|
|
210
|
-
...
|
|
210
|
+
...O.style
|
|
211
211
|
},
|
|
212
212
|
onClick: (e) => {
|
|
213
213
|
e.stopPropagation();
|
|
214
214
|
},
|
|
215
215
|
children: g !== void 0 && g.length > 0 ? /* @__PURE__ */ T("div", {
|
|
216
216
|
className: "flex items-center justify-end",
|
|
217
|
-
children: /* @__PURE__ */ T(
|
|
217
|
+
children: /* @__PURE__ */ T(B, {
|
|
218
218
|
actions: g,
|
|
219
219
|
row: e
|
|
220
220
|
})
|
|
@@ -227,7 +227,7 @@ function G({ isLoading: e, error: t, colSpanCount: n, noDataMessage: r, paginate
|
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/components/core/table/TableBulkActions.tsx
|
|
230
|
-
function
|
|
230
|
+
function Y({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
231
231
|
return /* @__PURE__ */ E("div", {
|
|
232
232
|
className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
|
|
233
233
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -268,22 +268,22 @@ function K({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/components/core/table/TableHeader.tsx
|
|
271
|
-
var
|
|
271
|
+
var X = {
|
|
272
272
|
left: "justify-start",
|
|
273
273
|
center: "justify-center",
|
|
274
274
|
right: "justify-end"
|
|
275
275
|
};
|
|
276
|
-
function
|
|
276
|
+
function re({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll: r, visibleColumnsArray: i, draggableColumns: a, resizableColumns: o, columnWidths: s, sortColumn: c, sortDirection: l, handleSort: d, handleDragStart: f, handleDragOver: p, handleDrop: m, handleMouseDown: h, hasActions: g, settingsNode: _, bordered: v = !1, dense: y = !1, fixedColumns: b = {}, fixedSelection: x = !1, fixedActions: S = !1 }) {
|
|
277
277
|
let C = !1;
|
|
278
278
|
t.length === n && n > 0 ? C = !0 : t.length > 0 && (C = "indeterminate");
|
|
279
|
-
let w = (e) => e.sortable === !0 ? c === e.key ? T(l === "asc" ?
|
|
280
|
-
let a = r !== !1 && t.fixed === void 0, c = t.sortable === !0, l =
|
|
279
|
+
let w = (e) => e.sortable === !0 ? c === e.key ? T(l === "asc" ? N : j, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ T(M, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }) : null, D = (t, n, r) => {
|
|
280
|
+
let a = r !== !1 && t.fixed === void 0, c = t.sortable === !0, l = q(b[t.key], "header"), u = H(t), x = w(t), S = n === 0 && !e, C = n === i.length - 1 && !(g || _ !== void 0), D = `${S ? "pl-4" : "pl-2"} ${C ? "pr-4" : "pr-2"}`;
|
|
281
281
|
return /* @__PURE__ */ E("th", {
|
|
282
282
|
"data-column-key": t.key,
|
|
283
283
|
"data-fixed-side": t.fixed,
|
|
284
284
|
className: [
|
|
285
285
|
`${D} ${y ? "py-2" : "py-4"} text-sm font-medium text-gray-900 dark:text-gray-100 group`,
|
|
286
|
-
|
|
286
|
+
U(u),
|
|
287
287
|
l.className,
|
|
288
288
|
v ? "border-r border-gray-200 dark:border-gray-800" : "",
|
|
289
289
|
c ? "cursor-pointer select-none" : "",
|
|
@@ -307,9 +307,9 @@ function J({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll:
|
|
|
307
307
|
m(e, t.key);
|
|
308
308
|
},
|
|
309
309
|
children: [/* @__PURE__ */ E("div", {
|
|
310
|
-
className: `flex items-center gap-1 ${
|
|
310
|
+
className: `flex items-center gap-1 ${X[u]} ${o ? "pr-2" : ""}`,
|
|
311
311
|
children: [
|
|
312
|
-
a ? /* @__PURE__ */ T(
|
|
312
|
+
a ? /* @__PURE__ */ T(F, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
|
|
313
313
|
/* @__PURE__ */ T("span", {
|
|
314
314
|
className: "truncate",
|
|
315
315
|
children: t.label
|
|
@@ -326,12 +326,12 @@ function J({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll:
|
|
|
326
326
|
}
|
|
327
327
|
}) : null]
|
|
328
328
|
}, t.key);
|
|
329
|
-
}, O =
|
|
329
|
+
}, O = q(b[W], "header"), k = q(b[G], "header");
|
|
330
330
|
return /* @__PURE__ */ T("thead", {
|
|
331
331
|
className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800",
|
|
332
332
|
children: /* @__PURE__ */ E("tr", { children: [
|
|
333
333
|
e ? /* @__PURE__ */ T("th", {
|
|
334
|
-
"data-column-key":
|
|
334
|
+
"data-column-key": W,
|
|
335
335
|
"data-fixed-side": x ? "left" : void 0,
|
|
336
336
|
className: `p-1 text-center align-middle ${O.className}`,
|
|
337
337
|
style: {
|
|
@@ -350,12 +350,12 @@ function J({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll:
|
|
|
350
350
|
}) : null,
|
|
351
351
|
i.map((e, t) => D(e, t, a)),
|
|
352
352
|
g || _ !== void 0 ? /* @__PURE__ */ T("th", {
|
|
353
|
-
"data-column-key":
|
|
353
|
+
"data-column-key": G,
|
|
354
354
|
"data-fixed-side": S ? "right" : void 0,
|
|
355
|
-
className: `p-1 text-right align-middle ${
|
|
355
|
+
className: `p-1 text-right align-middle ${k.className}`,
|
|
356
356
|
style: {
|
|
357
357
|
minWidth: "32px",
|
|
358
|
-
...
|
|
358
|
+
...k.style
|
|
359
359
|
},
|
|
360
360
|
children: _
|
|
361
361
|
}) : null
|
|
@@ -364,30 +364,30 @@ function J({ hasBulkActions: e, selectedRows: t, totalItems: n, toggleSelectAll:
|
|
|
364
364
|
}
|
|
365
365
|
//#endregion
|
|
366
366
|
//#region src/components/core/table/TablePagination.tsx
|
|
367
|
-
var
|
|
368
|
-
function
|
|
367
|
+
var Z = "…";
|
|
368
|
+
function Q(e, t) {
|
|
369
369
|
return Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
370
370
|
}
|
|
371
371
|
function ie(e, t, n = 1) {
|
|
372
|
-
if (n * 2 + 5 >= t) return
|
|
372
|
+
if (n * 2 + 5 >= t) return Q(1, t);
|
|
373
373
|
let r = Math.max(e - n, 1), i = Math.min(e + n, t), a = r > 2, o = i < t - 1;
|
|
374
374
|
return !a && o ? [
|
|
375
|
-
...
|
|
376
|
-
|
|
375
|
+
...Q(1, n + 2),
|
|
376
|
+
Z,
|
|
377
377
|
t
|
|
378
378
|
] : a && !o ? [
|
|
379
379
|
1,
|
|
380
|
-
|
|
381
|
-
...
|
|
380
|
+
Z,
|
|
381
|
+
...Q(t - (n + 2) + 1, t)
|
|
382
382
|
] : [
|
|
383
383
|
1,
|
|
384
|
-
|
|
385
|
-
...
|
|
386
|
-
|
|
384
|
+
Z,
|
|
385
|
+
...Q(r, i),
|
|
386
|
+
Z,
|
|
387
387
|
t
|
|
388
388
|
];
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function ae({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: o, pageSizeOptions: s, totalPages: c }) {
|
|
391
391
|
let { t: l } = h(), u = ie(a, c);
|
|
392
392
|
return /* @__PURE__ */ E("div", {
|
|
393
393
|
className: "px-4 py-2 border-t border-gray-200 dark:border-gray-800 flex flex-col sm:grid sm:grid-cols-3 items-center gap-2 bg-muted/50 dark:bg-gray-900/50",
|
|
@@ -412,11 +412,11 @@ function Z({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize
|
|
|
412
412
|
},
|
|
413
413
|
disabled: a === 1,
|
|
414
414
|
"aria-label": l("table.previousPage"),
|
|
415
|
-
children: /* @__PURE__ */ T(
|
|
415
|
+
children: /* @__PURE__ */ T(ee, { className: "size-4" })
|
|
416
416
|
}),
|
|
417
|
-
u.map((e, t) => e ===
|
|
417
|
+
u.map((e, t) => e === Z ? /* @__PURE__ */ T("span", {
|
|
418
418
|
className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
|
|
419
|
-
children:
|
|
419
|
+
children: Z
|
|
420
420
|
}, `dots-${String(t)}`) : /* @__PURE__ */ T(m, {
|
|
421
421
|
variant: e === a ? "default" : "ghost",
|
|
422
422
|
size: "icon",
|
|
@@ -436,7 +436,7 @@ function Z({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize
|
|
|
436
436
|
},
|
|
437
437
|
disabled: a === c,
|
|
438
438
|
"aria-label": l("table.nextPage"),
|
|
439
|
-
children: /* @__PURE__ */ T(
|
|
439
|
+
children: /* @__PURE__ */ T(P, { className: "size-4" })
|
|
440
440
|
})
|
|
441
441
|
] })
|
|
442
442
|
}),
|
|
@@ -461,14 +461,14 @@ function Z({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize
|
|
|
461
461
|
}
|
|
462
462
|
//#endregion
|
|
463
463
|
//#region src/components/core/table/TableSettings.tsx
|
|
464
|
-
function
|
|
464
|
+
function oe({ columns: e, visibleColumns: t, toggleColumnVisibility: n }) {
|
|
465
465
|
return /* @__PURE__ */ E(d, { children: [/* @__PURE__ */ T(i, {
|
|
466
466
|
asChild: !0,
|
|
467
467
|
children: /* @__PURE__ */ T(m, {
|
|
468
468
|
variant: "outline",
|
|
469
469
|
size: "sm",
|
|
470
470
|
className: "size-7 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800",
|
|
471
|
-
children: /* @__PURE__ */ T(
|
|
471
|
+
children: /* @__PURE__ */ T(R, { className: "size-3.5 text-gray-600 dark:text-gray-300" })
|
|
472
472
|
})
|
|
473
473
|
}), /* @__PURE__ */ T(o, {
|
|
474
474
|
align: "end",
|
|
@@ -484,8 +484,8 @@ function ae({ columns: e, visibleColumns: t, toggleColumnVisibility: n }) {
|
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
486
|
//#region src/components/core/table/DataTable.tsx
|
|
487
|
-
function
|
|
488
|
-
let { sortColumn: A, sortDirection: j, selectedRows: M, setSelectedRows: N, visibleColumns:
|
|
487
|
+
function $({ data: e, columns: t, getRowId: n, onRowClick: r, onRowNavigate: i, actions: a, bulkActions: o, draggableColumns: s = !1, resizableColumns: c = !1, columnVisibility: l = !1, isLoading: u = !1, error: d = null, bordered: f = !1, dense: p = !1, fixedActions: m = !1, noDataMessage: h, defaultPageSize: g = ne, pageSizeOptions: _ = te, totalRows: v, currentPage: y, pageSize: b, onPageChange: C, onPageSizeChange: w, sortColumn: D, sortDirection: O, onSortChange: k }) {
|
|
488
|
+
let { sortColumn: A, sortDirection: j, selectedRows: M, setSelectedRows: N, visibleColumns: ee, columnWidths: P, safeCurrentPage: F, totalPages: I, startIndex: L, endIndex: R, tableRef: z, hasActions: B, hasBulkActions: V, visibleColumnsArray: H, colSpanCount: U, paginatedData: W, handleSort: G, handleMouseDown: K, handleDragStart: q, handleDragOver: X, handleDrop: Z, toggleColumnVisibility: Q, toggleRowSelection: ie, toggleSelectAll: $, pageSize: se, setPageSize: ce, setCurrentPage: le } = x({
|
|
489
489
|
data: e,
|
|
490
490
|
columns: t,
|
|
491
491
|
getRowId: n,
|
|
@@ -501,10 +501,10 @@ function oe({ data: e, columns: t, getRowId: n, onRowClick: r, onRowNavigate: i,
|
|
|
501
501
|
sortColumn: D,
|
|
502
502
|
sortDirection: O,
|
|
503
503
|
onSortChange: k
|
|
504
|
-
}), ue =
|
|
504
|
+
}), ue = V && H.some((e) => e.fixed === "left"), de = S(z);
|
|
505
505
|
return /* @__PURE__ */ E("div", {
|
|
506
506
|
className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
|
|
507
|
-
children: [M.length > 0 && o !== void 0 && o.length > 0 && /* @__PURE__ */ T(
|
|
507
|
+
children: [M.length > 0 && o !== void 0 && o.length > 0 && /* @__PURE__ */ T(Y, {
|
|
508
508
|
selectedRows: M,
|
|
509
509
|
setSelectedRows: N,
|
|
510
510
|
bulkActions: o
|
|
@@ -513,76 +513,76 @@ function oe({ data: e, columns: t, getRowId: n, onRowClick: r, onRowNavigate: i,
|
|
|
513
513
|
children: [/* @__PURE__ */ T("div", {
|
|
514
514
|
className: "overflow-x-auto",
|
|
515
515
|
children: /* @__PURE__ */ E("table", {
|
|
516
|
-
ref:
|
|
516
|
+
ref: z,
|
|
517
517
|
className: "w-full",
|
|
518
|
-
children: [/* @__PURE__ */ T(
|
|
519
|
-
hasBulkActions:
|
|
518
|
+
children: [/* @__PURE__ */ T(re, {
|
|
519
|
+
hasBulkActions: V,
|
|
520
520
|
selectedRows: M,
|
|
521
521
|
totalItems: e.length,
|
|
522
522
|
toggleSelectAll: $,
|
|
523
|
-
visibleColumnsArray:
|
|
523
|
+
visibleColumnsArray: H,
|
|
524
524
|
draggableColumns: s,
|
|
525
525
|
resizableColumns: c,
|
|
526
|
-
columnWidths:
|
|
526
|
+
columnWidths: P,
|
|
527
527
|
sortColumn: A,
|
|
528
528
|
sortDirection: j,
|
|
529
|
-
handleSort:
|
|
530
|
-
handleDragStart:
|
|
529
|
+
handleSort: G,
|
|
530
|
+
handleDragStart: q,
|
|
531
531
|
handleDragOver: X,
|
|
532
|
-
handleDrop:
|
|
533
|
-
handleMouseDown:
|
|
534
|
-
hasActions:
|
|
532
|
+
handleDrop: Z,
|
|
533
|
+
handleMouseDown: K,
|
|
534
|
+
hasActions: B,
|
|
535
535
|
bordered: f,
|
|
536
536
|
dense: p,
|
|
537
537
|
fixedColumns: de,
|
|
538
538
|
fixedSelection: ue,
|
|
539
539
|
fixedActions: m,
|
|
540
|
-
settingsNode: l ? /* @__PURE__ */ T(
|
|
540
|
+
settingsNode: l ? /* @__PURE__ */ T(oe, {
|
|
541
541
|
columns: t,
|
|
542
|
-
visibleColumns:
|
|
543
|
-
toggleColumnVisibility:
|
|
542
|
+
visibleColumns: ee,
|
|
543
|
+
toggleColumnVisibility: Q
|
|
544
544
|
}) : void 0
|
|
545
|
-
}), /* @__PURE__ */ T(
|
|
545
|
+
}), /* @__PURE__ */ T(J, {
|
|
546
546
|
bordered: f,
|
|
547
547
|
dense: p,
|
|
548
548
|
isLoading: u,
|
|
549
549
|
error: d,
|
|
550
|
-
colSpanCount:
|
|
550
|
+
colSpanCount: U,
|
|
551
551
|
noDataMessage: h,
|
|
552
|
-
paginatedData:
|
|
552
|
+
paginatedData: W,
|
|
553
553
|
getRowId: n,
|
|
554
554
|
onRowClick: r,
|
|
555
555
|
onRowNavigate: i,
|
|
556
|
-
hasBulkActions:
|
|
556
|
+
hasBulkActions: V,
|
|
557
557
|
selectedRows: M,
|
|
558
|
-
toggleRowSelection:
|
|
559
|
-
visibleColumnsArray:
|
|
560
|
-
columnWidths:
|
|
561
|
-
hasActions:
|
|
558
|
+
toggleRowSelection: ie,
|
|
559
|
+
visibleColumnsArray: H,
|
|
560
|
+
columnWidths: P,
|
|
561
|
+
hasActions: B || l,
|
|
562
562
|
actions: a,
|
|
563
563
|
columns: t,
|
|
564
564
|
resizableColumns: c,
|
|
565
565
|
fixedColumns: de
|
|
566
566
|
})]
|
|
567
567
|
})
|
|
568
|
-
}), /* @__PURE__ */ T(
|
|
568
|
+
}), /* @__PURE__ */ T(ae, {
|
|
569
569
|
totalItems: v ?? e.length,
|
|
570
|
-
startIndex:
|
|
571
|
-
endIndex:
|
|
570
|
+
startIndex: L,
|
|
571
|
+
endIndex: R,
|
|
572
572
|
pageSize: se,
|
|
573
573
|
setPageSize: ce,
|
|
574
|
-
currentPage:
|
|
574
|
+
currentPage: F,
|
|
575
575
|
setCurrentPage: le,
|
|
576
576
|
pageSizeOptions: _,
|
|
577
|
-
totalPages:
|
|
577
|
+
totalPages: I
|
|
578
578
|
})]
|
|
579
579
|
})]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
//#endregion
|
|
583
583
|
//#region src/components/core/table/JsonTableOutput.tsx
|
|
584
|
-
var
|
|
585
|
-
let [a, o] = C(!0), u =
|
|
584
|
+
var se = ({ header: r, output: i }) => {
|
|
585
|
+
let [a, o] = C(!0), u = k(i), d = u !== null, m = () => /* @__PURE__ */ E("div", {
|
|
586
586
|
className: "flex items-center justify-between mb-2",
|
|
587
587
|
children: [/* @__PURE__ */ T("span", {
|
|
588
588
|
className: "font-medium text-sm",
|
|
@@ -610,17 +610,17 @@ var Q = (e) => typeof e == "object" && !!e, $ = (e) => e == null ? "" : typeof e
|
|
|
610
610
|
className: "min-w-0 w-full",
|
|
611
611
|
children: [m(), (() => {
|
|
612
612
|
if (!d || !a) return /* @__PURE__ */ T(g, {});
|
|
613
|
-
if (Array.isArray(u) && u.length > 0 &&
|
|
613
|
+
if (Array.isArray(u) && u.length > 0 && O(u[0])) {
|
|
614
614
|
let e = u, r = Object.keys(e[0]);
|
|
615
615
|
return /* @__PURE__ */ E(h, { children: [/* @__PURE__ */ T(s, { children: /* @__PURE__ */ T(f, { children: r.map((e) => /* @__PURE__ */ T(n, {
|
|
616
616
|
className: "font-medium",
|
|
617
617
|
children: e
|
|
618
618
|
}, e)) }) }), /* @__PURE__ */ T(t, { children: e.map((e, t) => /* @__PURE__ */ T(f, { children: r.map((t) => /* @__PURE__ */ T(l, {
|
|
619
619
|
className: "text-sm whitespace-pre-wrap",
|
|
620
|
-
children:
|
|
620
|
+
children: D(e[t])
|
|
621
621
|
}, t)) }, t)) })] });
|
|
622
622
|
}
|
|
623
|
-
if (
|
|
623
|
+
if (O(u)) {
|
|
624
624
|
let e = Object.entries(u);
|
|
625
625
|
return /* @__PURE__ */ E(h, { children: [/* @__PURE__ */ T(s, { children: /* @__PURE__ */ E(f, { children: [/* @__PURE__ */ T(n, {
|
|
626
626
|
className: "font-medium",
|
|
@@ -633,7 +633,7 @@ var Q = (e) => typeof e == "object" && !!e, $ = (e) => e == null ? "" : typeof e
|
|
|
633
633
|
children: e
|
|
634
634
|
}), /* @__PURE__ */ T(l, {
|
|
635
635
|
className: "text-sm whitespace-pre-wrap",
|
|
636
|
-
children:
|
|
636
|
+
children: D(t)
|
|
637
637
|
})] }, e)) })] });
|
|
638
638
|
}
|
|
639
639
|
return /* @__PURE__ */ T(g, {});
|
|
@@ -641,4 +641,4 @@ var Q = (e) => typeof e == "object" && !!e, $ = (e) => e == null ? "" : typeof e
|
|
|
641
641
|
}) : null;
|
|
642
642
|
};
|
|
643
643
|
//#endregion
|
|
644
|
-
export {
|
|
644
|
+
export { re as a, G as c, U as d, H as f, ae as i, W as l, $ as n, Y as o, B as p, oe as r, J as s, se as t, q as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krosoft/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.256",
|
|
4
4
|
"description": "Krosoft shared React package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"zod": "^4.4.3"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@krosoft/core": "^0.0.
|
|
98
|
+
"@krosoft/core": "^0.0.62",
|
|
99
99
|
"@krosoft/tooling-eslint": "^0.0.27",
|
|
100
100
|
"@krosoft/tooling-eslint-react": "^0.0.29",
|
|
101
101
|
"@krosoft/tooling-prettier": "^0.0.18",
|