laif-ds 0.1.34 → 0.1.36
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/_virtual/index.js +5 -2
- package/dist/_virtual/index3.js +2 -7
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index6.js +5 -2
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/dist/components/ui/checkbox.js +12 -12
- package/dist/components/ui/data-table.js +10 -10
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/message-input.js +1 -1
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +348 -0
- package/dist/components/ui/tables/data-cross-table/edit-controls.js +47 -0
- package/dist/components/ui/tables/data-cross-table/editable-input.js +100 -0
- package/dist/components/ui/tables/data-cross-table/truncated-text.js +19 -0
- package/dist/index.d.ts +29 -3
- package/dist/index.js +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +126 -122
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +10 -6
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +44 -42
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +33 -43
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +237 -120
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +17 -16
- package/dist/node_modules/@radix-ui/react-context-menu/dist/index.js +95 -94
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +20 -19
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +3 -3
- package/dist/node_modules/@radix-ui/react-hover-card/dist/index.js +14 -13
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +136 -136
- package/dist/node_modules/@radix-ui/react-menubar/dist/index.js +70 -68
- package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +66 -64
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +10 -9
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +16 -16
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +11 -10
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +161 -146
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +87 -84
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +269 -257
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +3 -3
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +29 -28
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +101 -86
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +23 -22
- package/dist/node_modules/@radix-ui/react-toggle/dist/index.js +17 -16
- package/dist/node_modules/@radix-ui/react-toggle-group/dist/index.js +25 -23
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +77 -76
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +43 -21
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +18 -18
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +36 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +491 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +53 -0
- package/dist/node_modules/classnames/index.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/property-information/lib/html.js +9 -9
- package/dist/node_modules/react-hook-form/dist/index.esm.js +88 -88
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/react-resizable-panels/dist/react-resizable-panels.browser.esm.js +830 -801
- package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
- package/dist/node_modules/remeda/dist/chunk-AIG3BDKO.js +9 -0
- package/dist/node_modules/remeda/dist/{chunk-A3PVMI4K.js → chunk-KI5X74E2.js} +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +3 -3
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +11 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/dist/components/ui/data-cross-table.js +0 -216
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +0 -49
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -128
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -138
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +0 -625
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +0 -221
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +0 -37
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -184
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -55
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.js +0 -49
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-primitive/dist/index.js +0 -33
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -55
- package/dist/node_modules/remeda/dist/chunk-OAMXQXGR.js +0 -9
package/dist/_virtual/index.js
CHANGED
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var t = e();
|
|
5
|
-
const a = /* @__PURE__ */ r(t);
|
|
6
|
-
export {
|
|
7
|
-
a as default
|
|
8
|
-
};
|
|
2
|
+
import { __require as e } from "../node_modules/react-is/index.js";
|
|
3
|
+
e();
|
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
-
var t = r();
|
|
5
|
-
const x = /* @__PURE__ */ e(t);
|
|
2
|
+
var e = { exports: {} };
|
|
6
3
|
export {
|
|
7
|
-
|
|
4
|
+
e as __module
|
|
8
5
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
-
import { __require as e } from "../node_modules/
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
|
|
4
|
+
var t = e();
|
|
5
|
+
const a = /* @__PURE__ */ r(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as default
|
|
8
8
|
};
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
+
var t = r();
|
|
5
|
+
const x = /* @__PURE__ */ e(t);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
x as default
|
|
5
8
|
};
|
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as e } from "../node_modules/classnames/index.js";
|
|
4
|
+
var s = e();
|
|
5
|
+
const o = /* @__PURE__ */ r(s);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
o as default
|
|
5
8
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
import { cn as
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Checkbox as t, CheckboxIndicator as a } from "../../node_modules/@radix-ui/react-checkbox/dist/index.js";
|
|
4
|
+
import { cn as d } from "../../lib/utils.js";
|
|
5
5
|
import o from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
6
|
-
function
|
|
7
|
-
className:
|
|
6
|
+
function b({
|
|
7
|
+
className: r,
|
|
8
8
|
...i
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ e(
|
|
11
11
|
t,
|
|
12
12
|
{
|
|
13
13
|
"data-slot": "checkbox",
|
|
14
|
-
className:
|
|
14
|
+
className: d(
|
|
15
15
|
"peer border-d-input dark:bg-d-input/30 data-[state=checked]:bg-d-primary data-[state=checked]:text-d-primary-foreground dark:data-[state=checked]:bg-d-primary data-[state=checked]:border-d-primary focus-visible:border-d-ring focus-visible:ring-d-ring/50 aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
|
|
16
|
+
r
|
|
17
17
|
),
|
|
18
18
|
...i,
|
|
19
|
-
children: /* @__PURE__ */
|
|
20
|
-
|
|
19
|
+
children: /* @__PURE__ */ e(
|
|
20
|
+
a,
|
|
21
21
|
{
|
|
22
22
|
"data-slot": "checkbox-indicator",
|
|
23
23
|
className: "flex items-center justify-center text-current transition-none",
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ e(o, { className: "size-3.5" })
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
b as Checkbox
|
|
32
32
|
};
|
|
@@ -14,17 +14,17 @@ function se({
|
|
|
14
14
|
data: g,
|
|
15
15
|
loading: C = !1,
|
|
16
16
|
emptyComponent: R,
|
|
17
|
-
className:
|
|
18
|
-
rowSelection:
|
|
17
|
+
className: x,
|
|
18
|
+
rowSelection: k = {},
|
|
19
19
|
onRowSelectionChange: u,
|
|
20
20
|
checkable: a = !1,
|
|
21
21
|
onCheckedRowsChange: c,
|
|
22
|
-
notFoundMessage:
|
|
22
|
+
notFoundMessage: M = "Nessun risultato trovato.",
|
|
23
23
|
clientFilter: s = null,
|
|
24
|
-
clientFilterPlaceholder:
|
|
24
|
+
clientFilterPlaceholder: N = "Cerca..."
|
|
25
25
|
}) {
|
|
26
26
|
var h, S;
|
|
27
|
-
const [
|
|
27
|
+
const [y, v] = i([]), [T, z] = i([]), [D, F] = i({}), [V, $] = i({}), f = u ? k : V, A = u || $, H = j.useMemo(() => a ? [
|
|
28
28
|
{
|
|
29
29
|
id: "select",
|
|
30
30
|
header: ({ table: t }) => /* @__PURE__ */ l("div", { className: "text-center", children: /* @__PURE__ */ l(
|
|
@@ -59,7 +59,7 @@ function se({
|
|
|
59
59
|
onColumnVisibilityChange: F,
|
|
60
60
|
onRowSelectionChange: A,
|
|
61
61
|
state: {
|
|
62
|
-
sorting:
|
|
62
|
+
sorting: y,
|
|
63
63
|
columnFilters: T,
|
|
64
64
|
columnVisibility: D,
|
|
65
65
|
rowSelection: f
|
|
@@ -70,12 +70,12 @@ function se({
|
|
|
70
70
|
const t = o.getFilteredSelectedRowModel().rows.map((e) => e.original);
|
|
71
71
|
c(t);
|
|
72
72
|
}
|
|
73
|
-
}, [o, c, a, f]), /* @__PURE__ */ d("div", { className: L("h-full w-full",
|
|
74
|
-
s && /* @__PURE__ */ l("div", { className: "flex items-center
|
|
73
|
+
}, [o, c, a, f]), /* @__PURE__ */ d("div", { className: L("flex h-full w-full flex-col gap-2", x), children: [
|
|
74
|
+
s && /* @__PURE__ */ l("div", { className: "flex items-center", children: /* @__PURE__ */ l(
|
|
75
75
|
E,
|
|
76
76
|
{
|
|
77
77
|
iconLeft: "Search",
|
|
78
|
-
placeholder:
|
|
78
|
+
placeholder: N ?? "Cerca...",
|
|
79
79
|
value: (h = o.getColumn(s)) == null ? void 0 : h.getFilterValue(),
|
|
80
80
|
onChange: (t) => {
|
|
81
81
|
var e;
|
|
@@ -128,7 +128,7 @@ function se({
|
|
|
128
128
|
{
|
|
129
129
|
colSpan: n.length,
|
|
130
130
|
className: "h-24 text-center",
|
|
131
|
-
children: R ||
|
|
131
|
+
children: R || M
|
|
132
132
|
}
|
|
133
133
|
) }) })
|
|
134
134
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o, jsxs as M, Fragment as N } from "react/jsx-runtime";
|
|
3
3
|
import { useContext as R, useRef as a, useState as s, useCallback as k, useMemo as y, useEffect as u } from "react";
|
|
4
|
-
import A from "../../../../../_virtual/
|
|
4
|
+
import A from "../../../../../_virtual/index7.js";
|
|
5
5
|
import B from "../../../../../_virtual/debounce.js";
|
|
6
6
|
import { GanttContext as F } from "../Gantt/GanttContext.js";
|
|
7
7
|
import { transformData as O } from "../../utils/transformData.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { useState as y, useEffect as C, useRef as Y } from "react";
|
|
4
4
|
import { AnimatePresence as v, motion as x } from "framer-motion";
|
|
5
|
-
import { a as I } from "../../node_modules/remeda/dist/chunk-
|
|
5
|
+
import { a as I } from "../../node_modules/remeda/dist/chunk-KI5X74E2.js";
|
|
6
6
|
import { cn as R } from "../../lib/utils.js";
|
|
7
7
|
import { useAudioRecording as Z } from "../../hooks/use-audio-recording.js";
|
|
8
8
|
import { useAutosizeTextArea as _ } from "../../hooks/use-autosize-textarea.js";
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as O, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as g, useEffect as Y, useMemo as B, useRef as ce } from "react";
|
|
4
|
+
import { useReactTable as fe, flexRender as q } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
5
|
+
import { useVirtualizer as me } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
6
|
+
import { TableSkeleton as pe } from "../../table-skeleton.js";
|
|
7
|
+
import { TruncatedText as I } from "./truncated-text.js";
|
|
8
|
+
import { EditControls as ge } from "./edit-controls.js";
|
|
9
|
+
import { EditableInput as he } from "./editable-input.js";
|
|
10
|
+
import { Button as G } from "../../button.js";
|
|
11
|
+
import { TableRow as F, TableCell as J, Table as xe, TableHeader as be, TableHead as ve, TableBody as ye } from "../../table.js";
|
|
12
|
+
import { getSortedRowModel as Ce, getCoreRowModel as Se } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
13
|
+
function De({
|
|
14
|
+
crossTableData: N,
|
|
15
|
+
filterable: h = !1,
|
|
16
|
+
loading: Q = !1,
|
|
17
|
+
emptyComponent: X,
|
|
18
|
+
className: z,
|
|
19
|
+
notFoundMessage: Z = "Nessun risultato trovato.",
|
|
20
|
+
cornerHeaderFrom: T = "Da",
|
|
21
|
+
cornerHeaderTo: j = "A",
|
|
22
|
+
maxHeaderLength: x = 15,
|
|
23
|
+
minWidthCell: k = 160,
|
|
24
|
+
editable: V = !1,
|
|
25
|
+
editMode: H = !1,
|
|
26
|
+
editConfirmLabel: W = "Conferma",
|
|
27
|
+
editCancelLabel: ee = "Annulla",
|
|
28
|
+
onConfirmedCells: R,
|
|
29
|
+
onEditModeChange: E,
|
|
30
|
+
onSelectedRow: _,
|
|
31
|
+
selectedRow: a,
|
|
32
|
+
rowSortAsc: te = !0
|
|
33
|
+
}) {
|
|
34
|
+
const [re, oe] = g([]), u = N.headerTop, d = N.headerLeft, f = N.data, [b, $] = g(
|
|
35
|
+
(a == null ? void 0 : a.id) ?? null
|
|
36
|
+
), [A, M] = g(te), [S, ne] = g(V && H);
|
|
37
|
+
Y(() => {
|
|
38
|
+
E && E(!!S);
|
|
39
|
+
}, [S, E]), Y(() => {
|
|
40
|
+
a != null && a.id && $(a.id);
|
|
41
|
+
}, [a]);
|
|
42
|
+
const [v, w] = g({}), [K, D] = g({}), le = (l) => l && typeof l == "object" && "value" in l ? l.value : l, c = B(() => {
|
|
43
|
+
if (!b || !d.find((e) => e.id === b)) return u;
|
|
44
|
+
const t = d.findIndex(
|
|
45
|
+
(e) => e.id === b
|
|
46
|
+
);
|
|
47
|
+
if (t === -1) return u;
|
|
48
|
+
const r = u.map((e, s) => {
|
|
49
|
+
var m;
|
|
50
|
+
const o = ((m = f[t]) == null ? void 0 : m[s]) ?? null, n = le(o);
|
|
51
|
+
return { header: e, value: n };
|
|
52
|
+
});
|
|
53
|
+
return r.sort((e, s) => {
|
|
54
|
+
if (typeof e.value == "number" && typeof s.value == "number")
|
|
55
|
+
return A ? e.value - s.value : s.value - e.value;
|
|
56
|
+
const o = String(e.value ?? ""), n = String(s.value ?? "");
|
|
57
|
+
return A ? o.localeCompare(n) : n.localeCompare(o);
|
|
58
|
+
}), r.map((e) => e.header);
|
|
59
|
+
}, [u, d, f, b, A]), se = B(() => {
|
|
60
|
+
const l = [
|
|
61
|
+
{
|
|
62
|
+
id: "cross-header",
|
|
63
|
+
header: () => /* @__PURE__ */ O("div", { className: "relative", children: [
|
|
64
|
+
/* @__PURE__ */ i("div", { className: "absolute top-0 left-2 text-xs", children: T }),
|
|
65
|
+
/* @__PURE__ */ i("div", { className: "absolute right-2 bottom-0 text-xs", children: j })
|
|
66
|
+
] }),
|
|
67
|
+
accessorFn: (t) => t.item,
|
|
68
|
+
cell: (t) => {
|
|
69
|
+
const r = t.getValue();
|
|
70
|
+
if (!h)
|
|
71
|
+
return /* @__PURE__ */ i(
|
|
72
|
+
I,
|
|
73
|
+
{
|
|
74
|
+
text: r.label,
|
|
75
|
+
maxLength: x,
|
|
76
|
+
className: "w-full"
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const e = b === r.id;
|
|
80
|
+
return /* @__PURE__ */ i(
|
|
81
|
+
G,
|
|
82
|
+
{
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
size: "sm",
|
|
85
|
+
iconLeft: "ArrowLeftRight",
|
|
86
|
+
className: "text-right",
|
|
87
|
+
onClick: () => {
|
|
88
|
+
h && (e ? M((s) => !s) : ($(d[t.row.index].id), M(!0), _ && _(d[t.row.index])));
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ i(I, { text: r.label, maxLength: x })
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
return c.forEach((t) => {
|
|
97
|
+
l.push({
|
|
98
|
+
id: t.id,
|
|
99
|
+
accessorFn: (r) => r[t.id],
|
|
100
|
+
header: ({ column: r }) => h ? /* @__PURE__ */ i(
|
|
101
|
+
G,
|
|
102
|
+
{
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
size: "sm",
|
|
105
|
+
iconLeft: "ArrowUpDown",
|
|
106
|
+
onClick: h ? () => r.toggleSorting(r.getIsSorted() === "asc") : void 0,
|
|
107
|
+
children: /* @__PURE__ */ i(I, { text: t.label, maxLength: x })
|
|
108
|
+
}
|
|
109
|
+
) : /* @__PURE__ */ i(
|
|
110
|
+
I,
|
|
111
|
+
{
|
|
112
|
+
text: t.label,
|
|
113
|
+
maxLength: x,
|
|
114
|
+
className: "font-medium"
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
sortingFn: (r, e, s) => {
|
|
118
|
+
let o = r.getValue(s), n = e.getValue(s);
|
|
119
|
+
return o == null && n == null ? 0 : o == null ? 1 : n == null ? -1 : (o && typeof o == "object" && "value" in o && (o = o.value), n && typeof n == "object" && "value" in n && (n = n.value), typeof o == "number" && typeof n == "number" ? o - n : String(o).localeCompare(String(n)));
|
|
120
|
+
},
|
|
121
|
+
cell: (r) => {
|
|
122
|
+
const e = r.getValue();
|
|
123
|
+
return e ? e.render ? e.render(e.fromId, e.toId, e.id) : /* @__PURE__ */ i("div", { children: e.value }) : null;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}), l;
|
|
127
|
+
}, [
|
|
128
|
+
c,
|
|
129
|
+
T,
|
|
130
|
+
j,
|
|
131
|
+
a,
|
|
132
|
+
h,
|
|
133
|
+
x,
|
|
134
|
+
$,
|
|
135
|
+
M
|
|
136
|
+
]), ie = B(() => d.map((l, t) => {
|
|
137
|
+
const r = { item: l };
|
|
138
|
+
return c.forEach((e) => {
|
|
139
|
+
var o;
|
|
140
|
+
const s = u.findIndex((n) => n.id === e.id);
|
|
141
|
+
r[e.id] = s !== -1 ? ((o = f[t]) == null ? void 0 : o[s]) ?? null : null;
|
|
142
|
+
}), r;
|
|
143
|
+
}), [d, c, f, u]), L = fe({
|
|
144
|
+
data: ie,
|
|
145
|
+
columns: se,
|
|
146
|
+
state: { sorting: re },
|
|
147
|
+
onSortingChange: oe,
|
|
148
|
+
getCoreRowModel: Se(),
|
|
149
|
+
getSortedRowModel: Ce()
|
|
150
|
+
});
|
|
151
|
+
if (!f || f.length === 0)
|
|
152
|
+
return /* @__PURE__ */ i("div", { className: z, children: /* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(J, { colSpan: c.length + 1, children: X || Z }) }) });
|
|
153
|
+
if (Q)
|
|
154
|
+
return /* @__PURE__ */ i(
|
|
155
|
+
pe,
|
|
156
|
+
{
|
|
157
|
+
headerRow: c.map((l) => l.label),
|
|
158
|
+
rowCount: d.length || 5,
|
|
159
|
+
columnCount: c.length || 5,
|
|
160
|
+
className: z,
|
|
161
|
+
cornerHeaderFrom: T,
|
|
162
|
+
cornerHeaderTo: j
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
const ae = (l) => {
|
|
166
|
+
const t = l.column.id === "cross-header", r = t, e = ["bg-d-secondary"];
|
|
167
|
+
t || e.push("border-r"), t && e.push("sticky left-0"), e.push("sticky top-0 z-20"), r ? e.push("z-40") : t && e.push("z-30");
|
|
168
|
+
let s = "none";
|
|
169
|
+
return t && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
|
|
170
|
+
className: e.join(" "),
|
|
171
|
+
style: { boxShadow: s, width: `${k}px` }
|
|
172
|
+
};
|
|
173
|
+
}, P = ce(null), U = me({
|
|
174
|
+
count: L.getRowModel().rows.length,
|
|
175
|
+
getScrollElement: () => P.current,
|
|
176
|
+
estimateSize: () => 40,
|
|
177
|
+
overscan: 5,
|
|
178
|
+
measureElement: typeof window < "u" ? (l) => l.getBoundingClientRect().height : void 0
|
|
179
|
+
});
|
|
180
|
+
return /* @__PURE__ */ O("div", { className: `w-[900px] ${z || ""}`, children: [
|
|
181
|
+
V && /* @__PURE__ */ i(
|
|
182
|
+
ge,
|
|
183
|
+
{
|
|
184
|
+
editable: V,
|
|
185
|
+
editConfirmLabel: W,
|
|
186
|
+
editCancelLabel: ee,
|
|
187
|
+
editMode: S,
|
|
188
|
+
setEditMode: ne,
|
|
189
|
+
editedCount: Object.keys(v).length,
|
|
190
|
+
confirmAll: () => {
|
|
191
|
+
if (R && (Object.keys(v).length > 0 || Object.keys(K).length > 0)) {
|
|
192
|
+
const t = Object.entries(v).map(
|
|
193
|
+
([s, { value: o, cell: n }]) => ({
|
|
194
|
+
fromId: n.fromId,
|
|
195
|
+
toId: n.toId,
|
|
196
|
+
id: n.id,
|
|
197
|
+
value: o
|
|
198
|
+
})
|
|
199
|
+
), r = Object.entries(K).map(
|
|
200
|
+
([s, { value: o, cell: n }]) => ({
|
|
201
|
+
fromId: n.fromId,
|
|
202
|
+
toId: n.toId,
|
|
203
|
+
id: n.id,
|
|
204
|
+
value: o
|
|
205
|
+
})
|
|
206
|
+
);
|
|
207
|
+
R({
|
|
208
|
+
editedCells: t,
|
|
209
|
+
toDefaultCells: r
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
w({}), D({});
|
|
213
|
+
},
|
|
214
|
+
cancelAll: () => {
|
|
215
|
+
w({}), D({});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ i(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
ref: P,
|
|
223
|
+
className: "max-h-[600px] overflow-auto rounded-md border",
|
|
224
|
+
children: /* @__PURE__ */ O(xe, { className: "relative w-full table-fixed border-collapse", children: [
|
|
225
|
+
/* @__PURE__ */ i(
|
|
226
|
+
be,
|
|
227
|
+
{
|
|
228
|
+
className: "bg-d-secondary sticky top-0 z-20",
|
|
229
|
+
style: { boxShadow: "0 1px 0 0 var(--d-border)" },
|
|
230
|
+
children: L.getHeaderGroups().map((l) => /* @__PURE__ */ i(
|
|
231
|
+
F,
|
|
232
|
+
{
|
|
233
|
+
className: "bg-d-secondary sticky top-0 z-20",
|
|
234
|
+
children: l.headers.map((t) => {
|
|
235
|
+
const r = ae(t);
|
|
236
|
+
return /* @__PURE__ */ i(
|
|
237
|
+
ve,
|
|
238
|
+
{
|
|
239
|
+
className: r.className,
|
|
240
|
+
style: r.style,
|
|
241
|
+
children: t.isPlaceholder ? null : q(
|
|
242
|
+
t.column.columnDef.header,
|
|
243
|
+
t.getContext()
|
|
244
|
+
)
|
|
245
|
+
},
|
|
246
|
+
t.id
|
|
247
|
+
);
|
|
248
|
+
})
|
|
249
|
+
},
|
|
250
|
+
l.id
|
|
251
|
+
))
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ i(
|
|
255
|
+
ye,
|
|
256
|
+
{
|
|
257
|
+
style: {
|
|
258
|
+
height: `${U.getTotalSize()}px`,
|
|
259
|
+
position: "relative",
|
|
260
|
+
width: "100%"
|
|
261
|
+
},
|
|
262
|
+
children: U.getVirtualItems().map((l) => {
|
|
263
|
+
const t = L.getRowModel().rows[l.index];
|
|
264
|
+
return /* @__PURE__ */ i(
|
|
265
|
+
F,
|
|
266
|
+
{
|
|
267
|
+
"data-index": l.index,
|
|
268
|
+
style: {
|
|
269
|
+
position: "absolute",
|
|
270
|
+
top: 0,
|
|
271
|
+
left: 0,
|
|
272
|
+
transform: `translateY(${l.start}px)`,
|
|
273
|
+
width: "100%",
|
|
274
|
+
height: `${l.size}px`,
|
|
275
|
+
display: "flex"
|
|
276
|
+
},
|
|
277
|
+
children: t.getVisibleCells().map((r, e) => {
|
|
278
|
+
const s = e === 0, o = r.getValue(), n = s ? "var(--d-secondary)" : (o == null ? void 0 : o.color) || "transparent";
|
|
279
|
+
return /* @__PURE__ */ i(
|
|
280
|
+
J,
|
|
281
|
+
{
|
|
282
|
+
className: `text-center ${s ? "sticky left-0 z-10" : "border-r"}`,
|
|
283
|
+
style: {
|
|
284
|
+
boxShadow: s ? "inset -1px 0 0 0 var(--d-border)" : "none",
|
|
285
|
+
backgroundColor: n,
|
|
286
|
+
width: `${k}px`,
|
|
287
|
+
flex: s ? "0 0 auto" : `1 0 ${k}px`,
|
|
288
|
+
display: "flex",
|
|
289
|
+
alignItems: "center",
|
|
290
|
+
justifyContent: "center"
|
|
291
|
+
},
|
|
292
|
+
children: s || !S || !o ? (
|
|
293
|
+
// Rendering normale per la prima colonna o quando non siamo in modalità edit
|
|
294
|
+
q(
|
|
295
|
+
r.column.columnDef.cell,
|
|
296
|
+
r.getContext()
|
|
297
|
+
)
|
|
298
|
+
) : (
|
|
299
|
+
// Rendering con EditableInput per le celle modificabili
|
|
300
|
+
(() => {
|
|
301
|
+
const m = `${t.index}-${r.column.id}`, de = m in v ? v[m].value : o.value || "";
|
|
302
|
+
return /* @__PURE__ */ i(
|
|
303
|
+
he,
|
|
304
|
+
{
|
|
305
|
+
value: de,
|
|
306
|
+
originalValue: o.value || "",
|
|
307
|
+
cellKey: m,
|
|
308
|
+
cellData: o,
|
|
309
|
+
onChange: (y, C) => {
|
|
310
|
+
w((p) => ({
|
|
311
|
+
...p,
|
|
312
|
+
[y]: { value: C, cell: o }
|
|
313
|
+
}));
|
|
314
|
+
},
|
|
315
|
+
resetCell: (y) => {
|
|
316
|
+
w((C) => {
|
|
317
|
+
const p = { ...C };
|
|
318
|
+
return delete p[y], p;
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
resetToDefault: (y, C, p) => {
|
|
322
|
+
D((ue) => ({
|
|
323
|
+
...ue,
|
|
324
|
+
[y]: { value: C, cell: p }
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
})()
|
|
330
|
+
)
|
|
331
|
+
},
|
|
332
|
+
r.id
|
|
333
|
+
);
|
|
334
|
+
})
|
|
335
|
+
},
|
|
336
|
+
t.id
|
|
337
|
+
);
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] })
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] });
|
|
345
|
+
}
|
|
346
|
+
export {
|
|
347
|
+
De as DataCrossTable
|
|
348
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as r, Fragment as h } from "react/jsx-runtime";
|
|
3
|
+
import { memo as l } from "react";
|
|
4
|
+
import { Switch as u } from "../../switch.js";
|
|
5
|
+
import { Button as m } from "../../button.js";
|
|
6
|
+
const f = l(
|
|
7
|
+
({
|
|
8
|
+
onClick: e,
|
|
9
|
+
label: t,
|
|
10
|
+
count: n
|
|
11
|
+
}) => /* @__PURE__ */ o(m, { size: "sm", onClick: e, children: [
|
|
12
|
+
t,
|
|
13
|
+
" ",
|
|
14
|
+
n > 0 && `(${n})`
|
|
15
|
+
] })
|
|
16
|
+
), p = l(
|
|
17
|
+
({ onClick: e, label: t }) => /* @__PURE__ */ r(m, { variant: "ghost", size: "sm", onClick: e, children: t })
|
|
18
|
+
);
|
|
19
|
+
function k({
|
|
20
|
+
editConfirmLabel: e,
|
|
21
|
+
editCancelLabel: t,
|
|
22
|
+
editMode: n,
|
|
23
|
+
setEditMode: c,
|
|
24
|
+
editedCount: i,
|
|
25
|
+
confirmAll: s,
|
|
26
|
+
cancelAll: a,
|
|
27
|
+
editable: d
|
|
28
|
+
}) {
|
|
29
|
+
return d ? /* @__PURE__ */ o("div", { className: "mb-2 flex items-center gap-2", children: [
|
|
30
|
+
/* @__PURE__ */ r(u, { id: "edit-mode", checked: n, onCheckedChange: c }),
|
|
31
|
+
/* @__PURE__ */ r("label", { htmlFor: "edit-mode", className: "text-sm select-none", children: "Edit mode" }),
|
|
32
|
+
n && i > 0 && /* @__PURE__ */ o(h, { children: [
|
|
33
|
+
/* @__PURE__ */ r(
|
|
34
|
+
f,
|
|
35
|
+
{
|
|
36
|
+
onClick: s,
|
|
37
|
+
label: e,
|
|
38
|
+
count: i
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ r(p, { onClick: a, label: t })
|
|
42
|
+
] })
|
|
43
|
+
] }) : null;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
k as EditControls
|
|
47
|
+
};
|