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