laif-ds 0.1.62 → 0.1.64
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/index2.js +2 -5
- package/dist/_virtual/index3.js +2 -7
- package/dist/_virtual/index4.js +4 -2
- package/dist/_virtual/index5.js +5 -2
- package/dist/_virtual/index6.js +5 -2
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +2 -5
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +229 -217
- package/dist/components/ui/tables/data-cross-table/truncated-text.js +10 -12
- package/dist/index.d.ts +2 -2
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,142 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as d, jsx as
|
|
3
|
-
import { useState as f, useEffect as
|
|
4
|
-
import { useReactTable as
|
|
5
|
-
import { useVirtualizer as
|
|
6
|
-
import { TableSkeleton as
|
|
7
|
-
import { TruncatedText as
|
|
8
|
-
import { useDataCrossTable as
|
|
9
|
-
import { cn as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { Icon as
|
|
12
|
-
import { Popover as
|
|
13
|
-
import { TableRow as
|
|
14
|
-
import { getSortedRowModel as
|
|
15
|
-
function
|
|
16
|
-
crossTableData:
|
|
2
|
+
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useState as f, useEffect as ie, useCallback as y, useMemo as Y, useRef as Le } from "react";
|
|
4
|
+
import { useReactTable as $e, flexRender as se } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
5
|
+
import { useVirtualizer as Ae } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
6
|
+
import { TableSkeleton as Pe } from "../../table-skeleton.js";
|
|
7
|
+
import { TruncatedText as E } from "./truncated-text.js";
|
|
8
|
+
import { useDataCrossTable as He } from "./data-cross-table-context.js";
|
|
9
|
+
import { cn as I } from "../../../../lib/utils.js";
|
|
10
|
+
import { Button as C } from "../../button.js";
|
|
11
|
+
import { Icon as _ } from "../../icon.js";
|
|
12
|
+
import { Popover as Be, PopoverTrigger as Fe, PopoverContent as Oe } from "../../popover.js";
|
|
13
|
+
import { TableRow as q, TableCell as ae, Table as We, TableHeader as Ue, TableHead as Xe, TableBody as Ye } from "../../table.js";
|
|
14
|
+
import { getSortedRowModel as _e, getCoreRowModel as qe } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
15
|
+
function ut({
|
|
16
|
+
crossTableData: j,
|
|
17
17
|
filterable: b = !1,
|
|
18
|
-
loading:
|
|
19
|
-
emptyComponent:
|
|
20
|
-
className:
|
|
21
|
-
notFoundMessage:
|
|
22
|
-
cornerHeaderFrom:
|
|
23
|
-
cornerHeaderTo:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onSelectedRow: X,
|
|
18
|
+
loading: ce = !1,
|
|
19
|
+
emptyComponent: de,
|
|
20
|
+
className: D,
|
|
21
|
+
notFoundMessage: ue = "Nessun risultato trovato.",
|
|
22
|
+
cornerHeaderFrom: K = "Da",
|
|
23
|
+
cornerHeaderTo: M = "A",
|
|
24
|
+
minWidthCell: V = 160,
|
|
25
|
+
editable: fe = !1,
|
|
26
|
+
editMode: me = !1,
|
|
27
|
+
onEditModeChange: R,
|
|
28
|
+
onSelectedRow: G,
|
|
30
29
|
selectedRow: u,
|
|
31
|
-
rowSortAsc:
|
|
30
|
+
rowSortAsc: pe = !0
|
|
32
31
|
}) {
|
|
33
|
-
var
|
|
34
|
-
const [
|
|
32
|
+
var ee, te;
|
|
33
|
+
const [he, ge] = f([]), p = j.headerTop, m = j.headerLeft, v = j.data, [w, L] = f(
|
|
35
34
|
(u == null ? void 0 : u.id) ?? null
|
|
36
|
-
), [
|
|
35
|
+
), [$, A] = f(pe);
|
|
37
36
|
let c = null;
|
|
38
37
|
try {
|
|
39
|
-
c =
|
|
38
|
+
c = He();
|
|
40
39
|
} catch {
|
|
41
40
|
c = null;
|
|
42
41
|
}
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
u != null && u.id &&
|
|
42
|
+
const [ve, Ge] = f(fe && me), [xe, be] = f({}), [we, ye] = f({}), N = (c == null ? void 0 : c.editMode) ?? ve, J = (c == null ? void 0 : c.editedCells) ?? xe, P = (c == null ? void 0 : c.setEditedCells) ?? be, H = (c == null ? void 0 : c.toDefaultCells) ?? we, B = (c == null ? void 0 : c.setToDefaultCells) ?? ye;
|
|
43
|
+
ie(() => {
|
|
44
|
+
R && R(!!N);
|
|
45
|
+
}, [N, R]), ie(() => {
|
|
46
|
+
u != null && u.id && L(u.id);
|
|
48
47
|
}, [u]);
|
|
49
|
-
const [
|
|
48
|
+
const [r, Ce] = f(null), [Ne, x] = f(!1), [S, T] = f(null), Se = y(
|
|
50
49
|
(t) => {
|
|
51
|
-
t &&
|
|
50
|
+
t && r && T(r.value), x(t);
|
|
52
51
|
},
|
|
53
|
-
[
|
|
54
|
-
),
|
|
55
|
-
|
|
52
|
+
[r]
|
|
53
|
+
), Te = y(() => {
|
|
54
|
+
r && S !== null ? (P((t) => ({
|
|
56
55
|
...t,
|
|
57
|
-
[
|
|
56
|
+
[r.cellKey]: {
|
|
58
57
|
value: S,
|
|
59
|
-
cell:
|
|
58
|
+
cell: r.cellData
|
|
60
59
|
}
|
|
61
|
-
})),
|
|
60
|
+
})), H[r.cellKey] && B((t) => {
|
|
62
61
|
const e = { ...t };
|
|
63
|
-
return delete e[
|
|
62
|
+
return delete e[r.cellKey], e;
|
|
64
63
|
}), setTimeout(() => {
|
|
65
64
|
x(!1);
|
|
66
65
|
}, 300)) : x(!1);
|
|
67
|
-
}, [
|
|
68
|
-
|
|
66
|
+
}, [r, S, H]), ze = y(() => {
|
|
67
|
+
r && (T(r.originalValue), P((t) => {
|
|
69
68
|
const e = { ...t };
|
|
70
|
-
return e[
|
|
69
|
+
return e[r.cellKey] && delete e[r.cellKey], e;
|
|
71
70
|
}), B((t) => {
|
|
72
71
|
const e = { ...t };
|
|
73
|
-
return e[
|
|
72
|
+
return e[r.cellKey] && delete e[r.cellKey], e;
|
|
74
73
|
})), x(!1);
|
|
75
|
-
}, [
|
|
76
|
-
|
|
74
|
+
}, [r]), ke = y(() => {
|
|
75
|
+
r && (P((t) => {
|
|
77
76
|
const e = { ...t };
|
|
78
|
-
return e[
|
|
77
|
+
return e[r.cellKey] && delete e[r.cellKey], e;
|
|
79
78
|
}), B((t) => ({
|
|
80
79
|
...t,
|
|
81
|
-
[
|
|
82
|
-
value:
|
|
83
|
-
cell:
|
|
80
|
+
[r.cellKey]: {
|
|
81
|
+
value: r.originalValue,
|
|
82
|
+
cell: r.cellData
|
|
84
83
|
}
|
|
85
84
|
}))), x(!1);
|
|
86
|
-
}, [
|
|
85
|
+
}, [r]), Ee = y(
|
|
87
86
|
(t) => {
|
|
88
87
|
T(t.target.value);
|
|
89
88
|
},
|
|
90
89
|
[]
|
|
91
|
-
),
|
|
92
|
-
if (!
|
|
90
|
+
), Ie = (t) => t && typeof t == "object" && "value" in t ? t.value : t, h = Y(() => {
|
|
91
|
+
if (!w || !m.find((l) => l.id === w)) return p;
|
|
93
92
|
const e = m.findIndex(
|
|
94
|
-
(
|
|
93
|
+
(l) => l.id === w
|
|
95
94
|
);
|
|
96
95
|
if (e === -1) return p;
|
|
97
|
-
const
|
|
96
|
+
const i = p.map((l, s) => {
|
|
98
97
|
var g;
|
|
99
|
-
const
|
|
100
|
-
return { header:
|
|
98
|
+
const o = ((g = v[e]) == null ? void 0 : g[s]) ?? null, a = Ie(o);
|
|
99
|
+
return { header: l, value: a };
|
|
101
100
|
});
|
|
102
|
-
return
|
|
103
|
-
if (typeof
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
}),
|
|
108
|
-
}, [p, m, v,
|
|
101
|
+
return i.sort((l, s) => {
|
|
102
|
+
if (typeof l.value == "number" && typeof s.value == "number")
|
|
103
|
+
return $ ? l.value - s.value : s.value - l.value;
|
|
104
|
+
const o = String(l.value ?? ""), a = String(s.value ?? "");
|
|
105
|
+
return $ ? o.localeCompare(a) : a.localeCompare(o);
|
|
106
|
+
}), i.map((l) => l.header);
|
|
107
|
+
}, [p, m, v, w, $]), je = Y(() => {
|
|
109
108
|
const t = [
|
|
110
109
|
{
|
|
111
110
|
id: "cross-header",
|
|
112
111
|
header: () => /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ n("div", { className: "absolute top-0 left-2 text-xs", children: K }),
|
|
113
|
+
/* @__PURE__ */ n("div", { className: "absolute right-2 bottom-0 text-xs", children: M })
|
|
115
114
|
] }),
|
|
116
115
|
accessorFn: (e) => e.item,
|
|
117
116
|
cell: (e) => {
|
|
118
|
-
const
|
|
117
|
+
const i = e.getValue();
|
|
119
118
|
if (!b)
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
maxLength: y,
|
|
125
|
-
className: "w-full"
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
const r = C === s.id;
|
|
129
|
-
return /* @__PURE__ */ o(
|
|
130
|
-
N,
|
|
119
|
+
return /* @__PURE__ */ n(E, { text: i.label, className: "w-full" });
|
|
120
|
+
const l = w === i.id;
|
|
121
|
+
return /* @__PURE__ */ n(
|
|
122
|
+
C,
|
|
131
123
|
{
|
|
132
124
|
variant: "ghost",
|
|
133
125
|
size: "sm",
|
|
134
126
|
iconLeft: "ArrowLeftRight",
|
|
135
127
|
className: "text-right",
|
|
136
128
|
onClick: () => {
|
|
137
|
-
b && (
|
|
129
|
+
b && (l ? A((s) => !s) : (L(m[e.row.index].id), A(!0), G && G(m[e.row.index])));
|
|
138
130
|
},
|
|
139
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ n(E, { text: i.label })
|
|
140
132
|
}
|
|
141
133
|
);
|
|
142
134
|
}
|
|
@@ -145,111 +137,115 @@ function ot({
|
|
|
145
137
|
return h.forEach((e) => {
|
|
146
138
|
t.push({
|
|
147
139
|
id: e.id,
|
|
148
|
-
accessorFn: (
|
|
149
|
-
header: ({ column:
|
|
150
|
-
|
|
140
|
+
accessorFn: (i) => i[e.id],
|
|
141
|
+
header: ({ column: i }) => b ? /* @__PURE__ */ n(
|
|
142
|
+
C,
|
|
151
143
|
{
|
|
152
144
|
variant: "ghost",
|
|
153
145
|
size: "sm",
|
|
154
146
|
iconLeft: "ArrowUpDown",
|
|
155
|
-
onClick: b ? () =>
|
|
156
|
-
children: /* @__PURE__ */
|
|
147
|
+
onClick: b ? () => i.toggleSorting(i.getIsSorted() === "asc") : void 0,
|
|
148
|
+
children: /* @__PURE__ */ n(
|
|
149
|
+
E,
|
|
150
|
+
{
|
|
151
|
+
text: e.label,
|
|
152
|
+
className: "w-full max-w-full min-w-0"
|
|
153
|
+
}
|
|
154
|
+
)
|
|
157
155
|
}
|
|
158
|
-
) : /* @__PURE__ */
|
|
159
|
-
|
|
156
|
+
) : /* @__PURE__ */ n(
|
|
157
|
+
E,
|
|
160
158
|
{
|
|
161
159
|
text: e.label,
|
|
162
|
-
|
|
163
|
-
className: "font-medium"
|
|
160
|
+
className: "w-full max-w-full min-w-0 text-center font-medium"
|
|
164
161
|
}
|
|
165
162
|
),
|
|
166
|
-
sortingFn: (
|
|
167
|
-
let
|
|
168
|
-
return
|
|
163
|
+
sortingFn: (i, l, s) => {
|
|
164
|
+
let o = i.getValue(s), a = l.getValue(s);
|
|
165
|
+
return o == null && a == null ? 0 : o == null ? 1 : a == null ? -1 : (o && typeof o == "object" && "value" in o && (o = o.value), a && typeof a == "object" && "value" in a && (a = a.value), typeof o == "number" && typeof a == "number" ? o - a : String(o).localeCompare(String(a)));
|
|
169
166
|
},
|
|
170
|
-
cell: (
|
|
171
|
-
const
|
|
172
|
-
return
|
|
167
|
+
cell: (i) => {
|
|
168
|
+
const l = i.getValue();
|
|
169
|
+
return l ? l.render ? l.render(l.fromId, l.toId, l.id) : /* @__PURE__ */ n("div", { className: "h-full w-full min-w-0 truncate", children: l.value }) : null;
|
|
173
170
|
}
|
|
174
171
|
});
|
|
175
172
|
}), t;
|
|
176
173
|
}, [
|
|
177
174
|
h,
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
K,
|
|
176
|
+
M,
|
|
180
177
|
u,
|
|
181
178
|
b,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
getSortedRowModel: Fe()
|
|
179
|
+
L,
|
|
180
|
+
A
|
|
181
|
+
]), De = Y(() => m.map((t, e) => {
|
|
182
|
+
const i = { item: t };
|
|
183
|
+
return h.forEach((l) => {
|
|
184
|
+
var o;
|
|
185
|
+
const s = p.findIndex((a) => a.id === l.id);
|
|
186
|
+
i[l.id] = s !== -1 ? ((o = v[e]) == null ? void 0 : o[s]) ?? null : null;
|
|
187
|
+
}), i;
|
|
188
|
+
}), [m, h, v, p]), F = $e({
|
|
189
|
+
data: De,
|
|
190
|
+
columns: je,
|
|
191
|
+
state: { sorting: he },
|
|
192
|
+
onSortingChange: ge,
|
|
193
|
+
getCoreRowModel: qe(),
|
|
194
|
+
getSortedRowModel: _e()
|
|
199
195
|
});
|
|
200
196
|
if (!v || v.length === 0)
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
-
if (
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
|
|
197
|
+
return /* @__PURE__ */ n("div", { className: D, children: /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(ae, { colSpan: h.length + 1, children: de || ue }) }) });
|
|
198
|
+
if (ce)
|
|
199
|
+
return /* @__PURE__ */ n(
|
|
200
|
+
Pe,
|
|
205
201
|
{
|
|
206
202
|
headerRow: h.map((t) => t.label),
|
|
207
203
|
rowCount: m.length || 5,
|
|
208
204
|
columnCount: h.length || 5,
|
|
209
|
-
className:
|
|
210
|
-
cornerHeaderFrom:
|
|
211
|
-
cornerHeaderTo:
|
|
205
|
+
className: D,
|
|
206
|
+
cornerHeaderFrom: K,
|
|
207
|
+
cornerHeaderTo: M
|
|
212
208
|
}
|
|
213
209
|
);
|
|
214
|
-
const
|
|
215
|
-
const e = t.column.id === "cross-header",
|
|
216
|
-
e ||
|
|
217
|
-
let
|
|
218
|
-
return e && (
|
|
219
|
-
className:
|
|
220
|
-
style: { boxShadow:
|
|
210
|
+
const Ke = (t) => {
|
|
211
|
+
const e = t.column.id === "cross-header", i = e, l = ["bg-d-secondary"];
|
|
212
|
+
e || l.push("border-r"), e && l.push("sticky left-0"), l.push("sticky top-0 z-20"), i ? l.push("z-40") : e && l.push("z-30");
|
|
213
|
+
let s = "none";
|
|
214
|
+
return e && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
|
|
215
|
+
className: l.join(" "),
|
|
216
|
+
style: { boxShadow: s, width: `${V}px` }
|
|
221
217
|
};
|
|
222
|
-
},
|
|
218
|
+
}, Q = Le(null), Z = Ae({
|
|
223
219
|
count: F.getRowModel().rows.length,
|
|
224
|
-
getScrollElement: () =>
|
|
220
|
+
getScrollElement: () => Q.current,
|
|
225
221
|
estimateSize: () => 40,
|
|
226
222
|
overscan: 5,
|
|
227
223
|
measureElement: typeof window < "u" ? (t) => t.getBoundingClientRect().height : void 0
|
|
228
224
|
});
|
|
229
|
-
return /* @__PURE__ */ d("div", { className: `${
|
|
230
|
-
/* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ d("div", { className: `${I("w-[900px]", D || "")}`, children: [
|
|
226
|
+
/* @__PURE__ */ n(
|
|
231
227
|
"div",
|
|
232
228
|
{
|
|
233
|
-
ref:
|
|
229
|
+
ref: Q,
|
|
234
230
|
className: "border-d-border h-fit max-h-full min-h-0 overflow-auto rounded-md border",
|
|
235
|
-
children: /* @__PURE__ */ d(
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
|
|
231
|
+
children: /* @__PURE__ */ d(We, { className: "relative w-full table-fixed border-collapse", children: [
|
|
232
|
+
/* @__PURE__ */ n(
|
|
233
|
+
Ue,
|
|
238
234
|
{
|
|
239
235
|
className: "bg-d-secondary sticky top-0 z-20 w-full",
|
|
240
236
|
style: { boxShadow: "0 1px 0 0 var(--d-border)" },
|
|
241
|
-
children: F.getHeaderGroups().map((t) => /* @__PURE__ */
|
|
242
|
-
|
|
237
|
+
children: F.getHeaderGroups().map((t) => /* @__PURE__ */ n(
|
|
238
|
+
q,
|
|
243
239
|
{
|
|
244
240
|
className: "bg-d-secondary sticky top-0 z-20",
|
|
245
241
|
children: t.headers.map((e) => {
|
|
246
|
-
const
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
|
|
242
|
+
const i = Ke(e);
|
|
243
|
+
return /* @__PURE__ */ n(
|
|
244
|
+
Xe,
|
|
249
245
|
{
|
|
250
|
-
className:
|
|
251
|
-
style:
|
|
252
|
-
children: e.isPlaceholder ? null :
|
|
246
|
+
className: i.className,
|
|
247
|
+
style: i.style,
|
|
248
|
+
children: e.isPlaceholder ? null : se(
|
|
253
249
|
e.column.columnDef.header,
|
|
254
250
|
e.getContext()
|
|
255
251
|
)
|
|
@@ -262,18 +258,18 @@ function ot({
|
|
|
262
258
|
))
|
|
263
259
|
}
|
|
264
260
|
),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
|
|
261
|
+
/* @__PURE__ */ n(
|
|
262
|
+
Ye,
|
|
267
263
|
{
|
|
268
264
|
style: {
|
|
269
|
-
height: `${
|
|
265
|
+
height: `${Z.getTotalSize()}px`,
|
|
270
266
|
position: "relative",
|
|
271
267
|
width: "100%"
|
|
272
268
|
},
|
|
273
|
-
children:
|
|
269
|
+
children: Z.getVirtualItems().map((t) => {
|
|
274
270
|
const e = F.getRowModel().rows[t.index];
|
|
275
|
-
return /* @__PURE__ */
|
|
276
|
-
|
|
271
|
+
return /* @__PURE__ */ n(
|
|
272
|
+
q,
|
|
277
273
|
{
|
|
278
274
|
"data-index": t.index,
|
|
279
275
|
style: {
|
|
@@ -285,80 +281,95 @@ function ot({
|
|
|
285
281
|
height: `${t.size}px`,
|
|
286
282
|
display: "flex"
|
|
287
283
|
},
|
|
288
|
-
children: e.getVisibleCells().map((
|
|
289
|
-
const
|
|
290
|
-
return /* @__PURE__ */
|
|
291
|
-
|
|
284
|
+
children: e.getVisibleCells().map((i, l) => {
|
|
285
|
+
const s = l === 0, o = i.getValue(), a = s ? "var(--d-secondary)" : (o == null ? void 0 : o.bgColor) || "transparent", g = o.editable ?? !0;
|
|
286
|
+
return /* @__PURE__ */ n(
|
|
287
|
+
ae,
|
|
292
288
|
{
|
|
293
|
-
className:
|
|
289
|
+
className: I(
|
|
290
|
+
"border-d-border text-center",
|
|
291
|
+
s ? "sticky left-0 z-10" : "border-r",
|
|
292
|
+
g && N ? "cursor-pointer" : "pointer-events-none cursor-default"
|
|
293
|
+
),
|
|
294
294
|
style: {
|
|
295
|
-
boxShadow:
|
|
295
|
+
boxShadow: s ? "inset -1px 0 0 0 var(--d-border)" : "none",
|
|
296
296
|
backgroundColor: a,
|
|
297
|
-
color: (
|
|
298
|
-
minWidth: `${
|
|
299
|
-
flex: `1 0 ${
|
|
297
|
+
color: (o == null ? void 0 : o.textColor) || "inherit",
|
|
298
|
+
minWidth: `${V}px`,
|
|
299
|
+
flex: `1 0 ${V}px`,
|
|
300
300
|
display: "flex",
|
|
301
301
|
alignItems: "center",
|
|
302
302
|
justifyContent: "center"
|
|
303
303
|
},
|
|
304
|
-
children:
|
|
304
|
+
children: s || !N || !o ? (
|
|
305
305
|
// Rendering normale per la prima colonna o quando non siamo in modalità edit
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
se(
|
|
307
|
+
i.column.columnDef.cell,
|
|
308
|
+
i.getContext()
|
|
309
309
|
)
|
|
310
310
|
) : (
|
|
311
311
|
// Rendering con cella modificabile
|
|
312
312
|
(() => {
|
|
313
|
-
const
|
|
314
|
-
return /* @__PURE__ */
|
|
313
|
+
const z = `${e.index}-${i.column.id}`, k = z in J ? J[z].value : o.value || "", Me = k !== o.value, le = z in H;
|
|
314
|
+
return /* @__PURE__ */ n(
|
|
315
315
|
"div",
|
|
316
316
|
{
|
|
317
317
|
className: "flex w-full cursor-pointer items-center justify-center",
|
|
318
|
-
onClick: (
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}), T(z), x(!0);
|
|
318
|
+
onClick: (Ve) => {
|
|
319
|
+
const O = Ve.currentTarget.getBoundingClientRect(), ne = 400, re = 164, W = 8;
|
|
320
|
+
let U = O.left + window.scrollX, X = O.bottom + 5;
|
|
321
|
+
const oe = window.innerWidth, Re = window.innerHeight;
|
|
322
|
+
U + ne > oe - W && (U = oe - ne - W), X + re > Re - W && (X = O.bottom - re - 5), Ce({
|
|
323
|
+
cellKey: z,
|
|
324
|
+
value: k,
|
|
325
|
+
originalValue: o.value || "",
|
|
326
|
+
cellData: o,
|
|
327
|
+
position: { top: X, left: U }
|
|
328
|
+
}), T(k), x(!0);
|
|
330
329
|
},
|
|
331
|
-
children: /* @__PURE__ */ d("div", { className: "relative w-full
|
|
332
|
-
|
|
333
|
-
ke && !Z && /* @__PURE__ */ o(
|
|
330
|
+
children: /* @__PURE__ */ d("div", { className: "relative flex h-full max-h-full w-full max-w-full items-center justify-center gap-1", children: [
|
|
331
|
+
Me && !le && /* @__PURE__ */ n(
|
|
334
332
|
"div",
|
|
335
333
|
{
|
|
336
|
-
className: "bg-d-primary absolute top-
|
|
334
|
+
className: "bg-d-primary absolute -top-1.5 -left-1.5 rounded p-1",
|
|
337
335
|
title: "Valore modificato"
|
|
338
336
|
}
|
|
339
337
|
),
|
|
340
|
-
|
|
338
|
+
le && /* @__PURE__ */ n(
|
|
341
339
|
"div",
|
|
342
340
|
{
|
|
343
|
-
className: "bg-d-destructive absolute top-
|
|
341
|
+
className: "bg-d-destructive absolute -top-1.5 -left-1.5 rounded p-1",
|
|
344
342
|
title: "Ripristino richiesto"
|
|
345
343
|
}
|
|
346
344
|
),
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
|
|
345
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ n(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
className: I(
|
|
349
|
+
"h-full min-h-full w-full min-w-full truncate text-center",
|
|
350
|
+
g ? "text-d-muted-foreground" : "text-d-muted"
|
|
351
|
+
),
|
|
352
|
+
children: k || ""
|
|
353
|
+
}
|
|
354
|
+
) }),
|
|
355
|
+
/* @__PURE__ */ n(
|
|
356
|
+
_,
|
|
349
357
|
{
|
|
350
|
-
name: "Pencil",
|
|
358
|
+
name: g ? "Pencil" : "PencilOff",
|
|
351
359
|
size: "sm",
|
|
352
|
-
className:
|
|
360
|
+
className: I(
|
|
361
|
+
"h-3 w-3",
|
|
362
|
+
g ? "text-d-muted-foreground" : "text-d-muted"
|
|
363
|
+
)
|
|
353
364
|
}
|
|
354
|
-
)
|
|
365
|
+
)
|
|
355
366
|
] })
|
|
356
367
|
}
|
|
357
368
|
);
|
|
358
369
|
})()
|
|
359
370
|
)
|
|
360
371
|
},
|
|
361
|
-
|
|
372
|
+
i.id
|
|
362
373
|
);
|
|
363
374
|
})
|
|
364
375
|
},
|
|
@@ -370,69 +381,70 @@ function ot({
|
|
|
370
381
|
] })
|
|
371
382
|
}
|
|
372
383
|
),
|
|
373
|
-
/* @__PURE__ */ d(
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
|
|
384
|
+
/* @__PURE__ */ d(Be, { open: Ne, onOpenChange: Se, children: [
|
|
385
|
+
/* @__PURE__ */ n(Fe, { asChild: !0, children: /* @__PURE__ */ n("div", { style: { display: "none" } }) }),
|
|
386
|
+
/* @__PURE__ */ n(
|
|
387
|
+
Oe,
|
|
377
388
|
{
|
|
378
389
|
className: "w-[400px] p-4",
|
|
390
|
+
sideOffset: 5,
|
|
379
391
|
style: {
|
|
380
|
-
position:
|
|
381
|
-
top: (
|
|
382
|
-
left: (
|
|
383
|
-
|
|
392
|
+
position: "absolute",
|
|
393
|
+
top: ((ee = r == null ? void 0 : r.position) == null ? void 0 : ee.top) ?? 0,
|
|
394
|
+
left: ((te = r == null ? void 0 : r.position) == null ? void 0 : te.left) ?? 0,
|
|
395
|
+
zIndex: 50
|
|
384
396
|
},
|
|
385
397
|
children: /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
386
398
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
|
|
399
|
+
/* @__PURE__ */ n("div", { className: "font-medium", children: "Modifica valore" }),
|
|
400
|
+
r && r.value !== r.originalValue && /* @__PURE__ */ n("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
|
|
389
401
|
] }),
|
|
390
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ n(
|
|
391
403
|
"input",
|
|
392
404
|
{
|
|
393
405
|
type: "text",
|
|
394
406
|
className: "bg-d-secondary w-full rounded border p-2",
|
|
395
407
|
value: S || "",
|
|
396
|
-
onChange:
|
|
408
|
+
onChange: Ee,
|
|
397
409
|
autoFocus: !0
|
|
398
410
|
}
|
|
399
411
|
),
|
|
400
412
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
401
413
|
/* @__PURE__ */ d(
|
|
402
|
-
|
|
414
|
+
C,
|
|
403
415
|
{
|
|
404
416
|
variant: "destructive",
|
|
405
417
|
size: "sm",
|
|
406
|
-
onClick:
|
|
418
|
+
onClick: ke,
|
|
407
419
|
className: "text-xs",
|
|
408
420
|
title: "Ripristina il valore originale e segna la cella come da ripristinare",
|
|
409
421
|
children: [
|
|
410
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ n(_, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
|
|
411
423
|
"Ripristina"
|
|
412
424
|
]
|
|
413
425
|
}
|
|
414
426
|
),
|
|
415
427
|
/* @__PURE__ */ d("div", { className: "flex space-x-2", children: [
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
|
|
428
|
+
/* @__PURE__ */ n(
|
|
429
|
+
C,
|
|
418
430
|
{
|
|
419
431
|
variant: "ghost",
|
|
420
432
|
size: "sm",
|
|
421
|
-
onClick:
|
|
433
|
+
onClick: ze,
|
|
422
434
|
className: "text-xs",
|
|
423
435
|
title: "Annulla le modifiche correnti e chiudi",
|
|
424
436
|
children: "Annulla"
|
|
425
437
|
}
|
|
426
438
|
),
|
|
427
439
|
/* @__PURE__ */ d(
|
|
428
|
-
|
|
440
|
+
C,
|
|
429
441
|
{
|
|
430
442
|
size: "sm",
|
|
431
|
-
onClick:
|
|
443
|
+
onClick: Te,
|
|
432
444
|
className: "text-xs",
|
|
433
445
|
title: "Conferma le modifiche e salva",
|
|
434
446
|
children: [
|
|
435
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ n(_, { name: "Check", className: "mr-1 h-3 w-3" }),
|
|
436
448
|
"Conferma"
|
|
437
449
|
]
|
|
438
450
|
}
|
|
@@ -446,5 +458,5 @@ function ot({
|
|
|
446
458
|
] });
|
|
447
459
|
}
|
|
448
460
|
export {
|
|
449
|
-
|
|
461
|
+
ut as DataCrossTable
|
|
450
462
|
};
|