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