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.
@@ -1,142 +1,134 @@
1
1
  "use client";
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 $e } from "react";
4
- import { useReactTable as je, flexRender as ee } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
5
- import { useVirtualizer as De } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
6
- import { TableSkeleton as Ie } from "../../table-skeleton.js";
7
- import { TruncatedText as k } from "./truncated-text.js";
8
- import { useDataCrossTable as Ke } from "./data-cross-table-context.js";
9
- import { cn as te } from "../../../../lib/utils.js";
10
- import { Button as N } from "../../button.js";
11
- import { Icon as Y } from "../../icon.js";
12
- import { Popover as Me, PopoverTrigger as Ve, PopoverContent as Re } from "../../popover.js";
13
- import { TableRow as U, TableCell as le, Table as Le, TableHeader as Ae, TableHead as Pe, TableBody as Be } from "../../table.js";
14
- import { getSortedRowModel as Fe, getCoreRowModel as Oe } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
15
- function ot({
16
- crossTableData: E,
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: re = !1,
19
- emptyComponent: oe,
20
- className: $,
21
- notFoundMessage: ne = "Nessun risultato trovato.",
22
- cornerHeaderFrom: j = "Da",
23
- cornerHeaderTo: D = "A",
24
- maxHeaderLength: y = 15,
25
- minWidthCell: I = 160,
26
- editable: se = !1,
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: X,
28
+ onSelectedRow: _,
30
29
  selectedRow: u,
31
- rowSortAsc: ae = !0
30
+ rowSortAsc: me = !0
32
31
  }) {
33
- var J, Q;
34
- const [ce, de] = f([]), p = E.headerTop, m = E.headerLeft, v = E.data, [C, M] = f(
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, R] = f(ae);
35
+ ), [V, $] = f(me);
37
36
  let c = null;
38
37
  try {
39
- c = Ke();
38
+ c = Pe();
40
39
  } catch {
41
40
  c = null;
42
41
  }
43
- const [ue, Ye] = f(se && ie), [fe, me] = f({}), [pe, he] = f({}), L = (c == null ? void 0 : c.editMode) ?? ue, _ = (c == null ? void 0 : c.editedCells) ?? fe, A = (c == null ? void 0 : c.setEditedCells) ?? me, P = (c == null ? void 0 : c.toDefaultCells) ?? pe, B = (c == null ? void 0 : c.setToDefaultCells) ?? he;
44
- W(() => {
45
- K && K(!!L);
46
- }, [L, K]), W(() => {
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 [l, ge] = f(null), [ve, x] = f(!1), [S, T] = f(null), xe = w(
48
+ const [o, Ce] = f(null), [we, x] = f(!1), [N, S] = f(null), Ne = C(
50
49
  (t) => {
51
- t && l && T(l.value), x(t);
50
+ t && o && S(o.value), x(t);
52
51
  },
53
- [l]
54
- ), be = w(() => {
55
- l && S !== null ? (A((t) => ({
52
+ [o]
53
+ ), Se = C(() => {
54
+ o && N !== null ? (L((t) => ({
56
55
  ...t,
57
- [l.cellKey]: {
58
- value: S,
59
- cell: l.cellData
56
+ [o.cellKey]: {
57
+ value: N,
58
+ cell: o.cellData
60
59
  }
61
- })), P[l.cellKey] && B((t) => {
60
+ })), A[o.cellKey] && P((t) => {
62
61
  const e = { ...t };
63
- return delete e[l.cellKey], e;
62
+ return delete e[o.cellKey], e;
64
63
  }), setTimeout(() => {
65
64
  x(!1);
66
65
  }, 300)) : x(!1);
67
- }, [l, S, P]), ye = w(() => {
68
- l && (T(l.originalValue), A((t) => {
66
+ }, [o, N, A]), Te = C(() => {
67
+ o && (S(o.originalValue), L((t) => {
69
68
  const e = { ...t };
70
- return e[l.cellKey] && delete e[l.cellKey], e;
71
- }), B((t) => {
69
+ return e[o.cellKey] && delete e[o.cellKey], e;
70
+ }), P((t) => {
72
71
  const e = { ...t };
73
- return e[l.cellKey] && delete e[l.cellKey], e;
72
+ return e[o.cellKey] && delete e[o.cellKey], e;
74
73
  })), x(!1);
75
- }, [l]), Ce = w(() => {
76
- l && (A((t) => {
74
+ }, [o]), ze = C(() => {
75
+ o && (L((t) => {
77
76
  const e = { ...t };
78
- return e[l.cellKey] && delete e[l.cellKey], e;
79
- }), B((t) => ({
77
+ return e[o.cellKey] && delete e[o.cellKey], e;
78
+ }), P((t) => ({
80
79
  ...t,
81
- [l.cellKey]: {
82
- value: l.originalValue,
83
- cell: l.cellData
80
+ [o.cellKey]: {
81
+ value: o.originalValue,
82
+ cell: o.cellData
84
83
  }
85
84
  }))), x(!1);
86
- }, [l]), we = w(
85
+ }, [o]), ke = C(
87
86
  (t) => {
88
- T(t.target.value);
87
+ S(t.target.value);
89
88
  },
90
89
  []
91
- ), Ne = (t) => t && typeof t == "object" && "value" in t ? t.value : t, h = O(() => {
92
- if (!C || !m.find((r) => r.id === C)) return p;
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
- (r) => r.id === C
93
+ (l) => l.id === y
95
94
  );
96
95
  if (e === -1) return p;
97
- const s = p.map((r, i) => {
96
+ const i = p.map((l, s) => {
98
97
  var g;
99
- const n = ((g = v[e]) == null ? void 0 : g[i]) ?? null, a = Ne(n);
100
- return { header: r, value: a };
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 s.sort((r, i) => {
103
- if (typeof r.value == "number" && typeof i.value == "number")
104
- return V ? r.value - i.value : i.value - r.value;
105
- const n = String(r.value ?? ""), a = String(i.value ?? "");
106
- return V ? n.localeCompare(a) : a.localeCompare(n);
107
- }), s.map((r) => r.header);
108
- }, [p, m, v, C, V]), Se = O(() => {
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__ */ o("div", { className: "absolute top-0 left-2 text-xs", children: j }),
114
- /* @__PURE__ */ o("div", { className: "absolute right-2 bottom-0 text-xs", children: D })
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 s = e.getValue();
117
+ const i = e.getValue();
119
118
  if (!b)
120
- return /* @__PURE__ */ o(
121
- k,
122
- {
123
- text: s.label,
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 && (r ? R((i) => !i) : (M(m[e.row.index].id), R(!0), X && X(m[e.row.index])));
129
+ b && (l ? $((s) => !s) : (M(m[e.row.index].id), $(!0), _ && _(m[e.row.index])));
138
130
  },
139
- children: /* @__PURE__ */ o(k, { text: s.label, maxLength: y })
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: (s) => s[e.id],
149
- header: ({ column: s }) => b ? /* @__PURE__ */ o(
150
- N,
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 ? () => s.toggleSorting(s.getIsSorted() === "asc") : void 0,
156
- children: /* @__PURE__ */ o(k, { text: e.label, maxLength: y })
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__ */ o(
159
- k,
156
+ ) : /* @__PURE__ */ n(
157
+ z,
160
158
  {
161
159
  text: e.label,
162
- maxLength: y,
163
- className: "font-medium"
160
+ className: "w-full max-w-full min-w-0 text-center font-medium"
164
161
  }
165
162
  ),
166
- sortingFn: (s, r, i) => {
167
- let n = s.getValue(i), a = r.getValue(i);
168
- return n == null && a == null ? 0 : n == null ? 1 : a == null ? -1 : (n && typeof n == "object" && "value" in n && (n = n.value), a && typeof a == "object" && "value" in a && (a = a.value), typeof n == "number" && typeof a == "number" ? n - a : String(n).localeCompare(String(a)));
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: (s) => {
171
- const r = s.getValue();
172
- return r ? r.render ? r.render(r.fromId, r.toId, r.id) : /* @__PURE__ */ o("div", { children: r.value }) : null;
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
- R
185
- ]), Te = O(() => m.map((t, e) => {
186
- const s = { item: t };
187
- return h.forEach((r) => {
188
- var n;
189
- const i = p.findIndex((a) => a.id === r.id);
190
- s[r.id] = i !== -1 ? ((n = v[e]) == null ? void 0 : n[i]) ?? null : null;
191
- }), s;
192
- }), [m, h, v, p]), F = je({
193
- data: Te,
194
- columns: Se,
195
- state: { sorting: ce },
196
- onSortingChange: de,
197
- getCoreRowModel: Oe(),
198
- getSortedRowModel: Fe()
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__ */ o("div", { className: $, children: /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(le, { colSpan: h.length + 1, children: oe || ne }) }) });
202
- if (re)
203
- return /* @__PURE__ */ o(
204
- Ie,
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: j,
211
- cornerHeaderTo: D
205
+ className: E,
206
+ cornerHeaderFrom: I,
207
+ cornerHeaderTo: j
212
208
  }
213
209
  );
214
- const ze = (t) => {
215
- const e = t.column.id === "cross-header", s = e, r = ["bg-d-secondary"];
216
- e || r.push("border-r"), e && r.push("sticky left-0"), r.push("sticky top-0 z-20"), s ? r.push("z-40") : e && r.push("z-30");
217
- let i = "none";
218
- return e && (i = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
219
- className: r.join(" "),
220
- style: { boxShadow: i, width: `${I}px` }
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
- }, q = $e(null), G = De({
223
- count: F.getRowModel().rows.length,
224
- getScrollElement: () => q.current,
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: `${te("w-[900px]", $ || "")}`, children: [
230
- /* @__PURE__ */ o(
225
+ return /* @__PURE__ */ d("div", { className: `${ie("w-[900px]", E || "")}`, children: [
226
+ /* @__PURE__ */ n(
231
227
  "div",
232
228
  {
233
- ref: q,
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(Le, { className: "relative w-full table-fixed border-collapse", children: [
236
- /* @__PURE__ */ o(
237
- Ae,
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: F.getHeaderGroups().map((t) => /* @__PURE__ */ o(
242
- U,
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 s = ze(e);
247
- return /* @__PURE__ */ o(
248
- Pe,
242
+ const i = De(e);
243
+ return /* @__PURE__ */ n(
244
+ Ye,
249
245
  {
250
- className: s.className,
251
- style: s.style,
252
- children: e.isPlaceholder ? null : ee(
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__ */ o(
266
- Be,
261
+ /* @__PURE__ */ n(
262
+ Ue,
267
263
  {
268
264
  style: {
269
- height: `${G.getTotalSize()}px`,
265
+ height: `${J.getTotalSize()}px`,
270
266
  position: "relative",
271
267
  width: "100%"
272
268
  },
273
- children: G.getVirtualItems().map((t) => {
274
- const e = F.getRowModel().rows[t.index];
275
- return /* @__PURE__ */ o(
276
- U,
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((s, r) => {
289
- const i = r === 0, n = s.getValue(), a = i ? "var(--d-secondary)" : (n == null ? void 0 : n.bgColor) || "transparent";
290
- return /* @__PURE__ */ o(
291
- le,
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: `${te("border-d-border text-center", i ? "sticky left-0 z-10" : "border-r")}`,
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: i ? "inset -1px 0 0 0 var(--d-border)" : "none",
291
+ boxShadow: s ? "inset -1px 0 0 0 var(--d-border)" : "none",
296
292
  backgroundColor: a,
297
- color: (n == null ? void 0 : n.textColor) || "inherit",
298
- minWidth: `${I}px`,
299
- flex: `1 0 ${I}px`,
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: i || !L || !n ? (
300
+ children: s || !R || !r ? (
305
301
  // Rendering normale per la prima colonna o quando non siamo in modalità edit
306
- ee(
307
- s.column.columnDef.cell,
308
- s.getContext()
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}-${s.column.id}`, z = g in _ ? _[g].value : n.value || "", ke = z !== n.value, Z = g in P;
314
- return /* @__PURE__ */ o(
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: (Ee) => {
319
- const H = Ee.currentTarget.getBoundingClientRect();
320
- ge({
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: z,
323
- originalValue: n.value || "",
324
- cellData: n,
325
- position: {
326
- top: H.bottom + window.scrollY + 5,
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
- z || "",
333
- ke && !Z && /* @__PURE__ */ o(
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
- Z && /* @__PURE__ */ o(
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__ */ o("span", { className: "text-d-muted-foreground ml-1 inline-flex items-center", children: /* @__PURE__ */ o(
348
- Y,
342
+ /* @__PURE__ */ n(
343
+ "span",
349
344
  {
350
- name: "Pencil",
351
- size: "sm",
352
- className: "h-3 w-3"
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
- s.id
362
+ i.id
362
363
  );
363
364
  })
364
365
  },
@@ -370,69 +371,70 @@ function ot({
370
371
  ] })
371
372
  }
372
373
  ),
373
- /* @__PURE__ */ d(Me, { open: ve, onOpenChange: xe, children: [
374
- /* @__PURE__ */ o(Ve, { asChild: !0, children: /* @__PURE__ */ o("div", { style: { display: "none" } }) }),
375
- /* @__PURE__ */ o(
376
- Re,
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: l != null && l.position ? "absolute" : "fixed",
381
- top: (J = l == null ? void 0 : l.position) != null && J.top ? `${l.position.top}px` : "50%",
382
- left: (Q = l == null ? void 0 : l.position) != null && Q.left ? `${l.position.left}px` : "50%",
383
- transform: l != null && l.position ? "none" : "translate(-50%, -50%)"
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__ */ o("div", { className: "font-medium", children: "Modifica valore" }),
388
- l && l.value !== l.originalValue && /* @__PURE__ */ o("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
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__ */ o(
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: S || "",
396
- onChange: we,
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
- N,
404
+ w,
403
405
  {
404
406
  variant: "destructive",
405
407
  size: "sm",
406
- onClick: Ce,
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__ */ o(Y, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
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__ */ o(
417
- N,
418
+ /* @__PURE__ */ n(
419
+ w,
418
420
  {
419
421
  variant: "ghost",
420
422
  size: "sm",
421
- onClick: ye,
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
- N,
430
+ w,
429
431
  {
430
432
  size: "sm",
431
- onClick: be,
433
+ onClick: Se,
432
434
  className: "text-xs",
433
435
  title: "Conferma le modifiche e salva",
434
436
  children: [
435
- /* @__PURE__ */ o(Y, { name: "Check", className: "mr-1 h-3 w-3" }),
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
- ot as DataCrossTable
451
+ dt as DataCrossTable
450
452
  };