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