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