laif-ds 0.1.62 → 0.1.64

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