laif-ds 0.2.74 → 0.2.76

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.
Files changed (155) hide show
  1. package/dist/CHANGELOG.md +446 -0
  2. package/dist/agent-docs/adoption-report.json +615 -0
  3. package/dist/agent-docs/components/Accordion.md +46 -16
  4. package/dist/agent-docs/components/Alert.md +90 -95
  5. package/dist/agent-docs/components/AlertDialog.md +132 -126
  6. package/dist/agent-docs/components/AppEditor.md +90 -90
  7. package/dist/agent-docs/components/AppRadioGroup.md +18 -18
  8. package/dist/agent-docs/components/AppSidebar.md +129 -122
  9. package/dist/agent-docs/components/AppStepper.md +81 -77
  10. package/dist/agent-docs/components/AspectRatio.md +70 -62
  11. package/dist/agent-docs/components/AudioVisualizer.md +5 -5
  12. package/dist/agent-docs/components/Avatar.md +112 -113
  13. package/dist/agent-docs/components/Badge.md +123 -118
  14. package/dist/agent-docs/components/Breadcrumb.md +8 -1
  15. package/dist/agent-docs/components/Button.md +131 -129
  16. package/dist/agent-docs/components/Card.md +172 -147
  17. package/dist/agent-docs/components/Carousel.md +148 -129
  18. package/dist/agent-docs/components/Chat.md +121 -109
  19. package/dist/agent-docs/components/ChatMessage.md +72 -61
  20. package/dist/agent-docs/components/Checkbox.md +150 -135
  21. package/dist/agent-docs/components/CircularProgress.md +53 -49
  22. package/dist/agent-docs/components/CodeHighlighter.md +4 -4
  23. package/dist/agent-docs/components/Collapsible.md +114 -95
  24. package/dist/agent-docs/components/Command.md +141 -142
  25. package/dist/agent-docs/components/Confirmer.md +182 -175
  26. package/dist/agent-docs/components/ContextMenu.md +196 -191
  27. package/dist/agent-docs/components/DataCrossTable.md +114 -94
  28. package/dist/agent-docs/components/DataTable.md +32 -24
  29. package/dist/agent-docs/components/Dialog.md +130 -125
  30. package/dist/agent-docs/components/Drawer.md +141 -127
  31. package/dist/agent-docs/components/FilePreviewer.md +138 -139
  32. package/dist/agent-docs/components/FileUploader.md +149 -129
  33. package/dist/agent-docs/components/Form.md +3 -1
  34. package/dist/agent-docs/components/FormComposer.md +163 -137
  35. package/dist/agent-docs/components/GanttChart.md +125 -122
  36. package/dist/agent-docs/components/HoverCard.md +1 -1
  37. package/dist/agent-docs/components/Icon.md +98 -99
  38. package/dist/agent-docs/components/Input.md +173 -138
  39. package/dist/agent-docs/components/InputOtp.md +6 -1
  40. package/dist/agent-docs/components/InputSelector.md +94 -97
  41. package/dist/agent-docs/components/InterruptPrompt.md +4 -4
  42. package/dist/agent-docs/components/MarkdownRenderer.md +5 -2
  43. package/dist/agent-docs/components/Menubar.md +60 -57
  44. package/dist/agent-docs/components/MessageInput.md +134 -131
  45. package/dist/agent-docs/components/MessageList.md +110 -96
  46. package/dist/agent-docs/components/MultipleSelector.md +147 -146
  47. package/dist/agent-docs/components/NavigationMenu.md +6 -2
  48. package/dist/agent-docs/components/Popover.md +112 -103
  49. package/dist/agent-docs/components/PromptSuggestions.md +5 -5
  50. package/dist/agent-docs/components/RadioGroup.md +97 -90
  51. package/dist/agent-docs/components/Resizable.md +4 -1
  52. package/dist/agent-docs/components/ResizePrompt.md +12 -13
  53. package/dist/agent-docs/components/ScrollArea.md +6 -2
  54. package/dist/agent-docs/components/SecurePdfViewer.md +10 -6
  55. package/dist/agent-docs/components/Select.md +131 -132
  56. package/dist/agent-docs/components/Sheet.md +8 -1
  57. package/dist/agent-docs/components/ShikiHighlighter.md +5 -5
  58. package/dist/agent-docs/components/Sidebar.md +94 -85
  59. package/dist/agent-docs/components/Slider.md +62 -58
  60. package/dist/agent-docs/components/Sonner.md +1 -0
  61. package/dist/agent-docs/components/Spinner.md +14 -14
  62. package/dist/agent-docs/components/Stepper.md +93 -67
  63. package/dist/agent-docs/components/Switch.md +41 -42
  64. package/dist/agent-docs/components/TableSkeleton.md +8 -8
  65. package/dist/agent-docs/components/Tabs.md +106 -86
  66. package/dist/agent-docs/components/TextArea.md +51 -52
  67. package/dist/agent-docs/components/ThemeSwitcher.md +72 -69
  68. package/dist/agent-docs/components/Toaster.md +1 -0
  69. package/dist/agent-docs/components/Tooltip.md +102 -91
  70. package/dist/agent-docs/components/Typo.md +68 -65
  71. package/dist/agent-docs/components/WeeklyCalendar.md +63 -64
  72. package/dist/agent-docs/components-list.md +1 -0
  73. package/dist/agent-docs/manifest.json +5981 -0
  74. package/dist/agent-docs/truncated-cell.md +342 -0
  75. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  76. package/dist/components/editor/plugins/actions/counter-character-plugin.js +6 -6
  77. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +18 -18
  78. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +10 -10
  79. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +9 -9
  80. package/dist/components/ui/app-checkbox.js +1 -1
  81. package/dist/components/ui/app-dialog.js +70 -64
  82. package/dist/components/ui/app-editor.js +51 -51
  83. package/dist/components/ui/app-form.js +81 -81
  84. package/dist/components/ui/app-multiple-select-dropdown.js +36 -36
  85. package/dist/components/ui/app-select.js +109 -104
  86. package/dist/components/ui/app-sidebar.js +41 -41
  87. package/dist/components/ui/app-stepper.js +1 -1
  88. package/dist/components/ui/app-time-picker.js +18 -18
  89. package/dist/components/ui/app-tooltip.js +1 -1
  90. package/dist/components/ui/async-select.js +5 -5
  91. package/dist/components/ui/audio-visualizer.js +61 -58
  92. package/dist/components/ui/card.js +1 -1
  93. package/dist/components/ui/carousel.js +2 -2
  94. package/dist/components/ui/chart.js +1 -1
  95. package/dist/components/ui/chat-message.js +8 -8
  96. package/dist/components/ui/chat.js +86 -88
  97. package/dist/components/ui/command.js +2 -2
  98. package/dist/components/ui/copy-button.js +4 -4
  99. package/dist/components/ui/date-picker.js +20 -20
  100. package/dist/components/ui/file-preview/index.js +13 -13
  101. package/dist/components/ui/file-previewer.js +12 -11
  102. package/dist/components/ui/file-uploader.js +86 -78
  103. package/dist/components/ui/form.js +2 -2
  104. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +56 -56
  105. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +12 -12
  106. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +1 -1
  107. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +4 -4
  108. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +2 -2
  109. package/dist/components/ui/gantt/components/Chart/Chart.js +23 -23
  110. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +1 -1
  111. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +34 -34
  112. package/dist/components/ui/gantt/components/Controls/Controls.js +5 -5
  113. package/dist/components/ui/gantt/components/Gantt/Gantt.js +4 -4
  114. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +25 -18
  115. package/dist/components/ui/input-selector.js +1 -1
  116. package/dist/components/ui/input.js +23 -23
  117. package/dist/components/ui/kanban.js +8 -9
  118. package/dist/components/ui/markdown-renderer.js +41 -35
  119. package/dist/components/ui/message-input.js +45 -44
  120. package/dist/components/ui/multiple-selector.js +91 -82
  121. package/dist/components/ui/secure-pdf-viewer.js +19 -7
  122. package/dist/components/ui/sidebar.js +1 -1
  123. package/dist/components/ui/slider.js +1 -1
  124. package/dist/components/ui/spinner.js +4 -4
  125. package/dist/components/ui/stepper.js +157 -138
  126. package/dist/components/ui/tables/data-cross-table/data-cross-table-buttons.js +29 -29
  127. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +258 -246
  128. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +4 -1
  129. package/dist/components/ui/tables/data-table/components/data-table-body.js +211 -367
  130. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +114 -112
  131. package/dist/components/ui/tables/data-table/components/data-table-filters.js +116 -96
  132. package/dist/components/ui/tables/data-table/components/data-table-header.js +211 -0
  133. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +8 -8
  134. package/dist/components/ui/tables/data-table/components/data-table-skeleton-rows.js +33 -0
  135. package/dist/components/ui/tables/data-table/data-table.js +258 -250
  136. package/dist/components/ui/tables/data-table/data-table.service.js +112 -97
  137. package/dist/components/ui/tables/data-table/data-table.utils.js +25 -15
  138. package/dist/components/ui/textarea.js +2 -2
  139. package/dist/components/ui/theme-switcher.js +1 -1
  140. package/dist/components/ui/toggle-group.js +2 -2
  141. package/dist/components/ui/truncated-cell.js +100 -0
  142. package/dist/components/ui/weekly-calendar/appointment-card.js +16 -16
  143. package/dist/components/ui/weekly-calendar/calendar-context.js +6 -6
  144. package/dist/components/ui/weekly-calendar/calendar-header.js +12 -12
  145. package/dist/components/ui/weekly-calendar/day-column.js +16 -16
  146. package/dist/components/ui/weekly-calendar/time-column.js +4 -4
  147. package/dist/components/ui/weekly-calendar/weekly-calendar.js +4 -4
  148. package/dist/hooks/use-audio-recording.js +1 -1
  149. package/dist/hooks/use-auto-scroll.js +18 -18
  150. package/dist/hooks/use-autosize-textarea.js +12 -13
  151. package/dist/index.d.ts +100 -45
  152. package/dist/index.js +362 -360
  153. package/dist/lib/utils.js +6 -6
  154. package/dist/styles.v3.css +1 -1
  155. package/package.json +14 -4
@@ -1,143 +1,149 @@
1
1
  "use client";
2
2
  import { jsxs as c, jsx as l } from "react/jsx-runtime";
3
- import { useState as d, useEffect as re, useCallback as S, useMemo as Y, useRef as Le } from "react";
4
- import { useReactTable as Pe, flexRender as _ } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
3
+ import { useReactTable as Pe, flexRender as q } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
5
4
  import { useVirtualizer as $e } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
6
- import { TableSkeleton as Ae } from "../../table-skeleton.js";
7
- import { TruncatedText as x } from "./truncated-text.js";
5
+ import { useState as u, useEffect as re, useCallback as V, useMemo as G, useRef as Ae } from "react";
6
+ import { cn as k } from "../../../../lib/utils.js";
7
+ import { TableSkeleton as Le } from "../../table-skeleton.js";
8
8
  import { useDataCrossTable as He } from "./data-cross-table-context.js";
9
- import { cn as V } from "../../../../lib/utils.js";
10
- import { Button as k } from "../../button.js";
11
- import { Icon as q } from "../../icon.js";
9
+ import { TruncatedText as b } from "./truncated-text.js";
10
+ import { Button as z } from "../../button.js";
11
+ import { Icon as J } from "../../icon.js";
12
12
  import { Popover as Be, PopoverTrigger as Fe, PopoverContent as Oe } from "../../popover.js";
13
13
  import { getSortedRowModel as We, getCoreRowModel as Ue } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
14
- import { Table as ie, TableHeader as ae, TableRow as G, TableHead as ce, TableBody as Xe, TableCell as Ye } from "../../table.js";
15
- function ct({
16
- crossTableData: E,
17
- filterable: v = !1,
14
+ import { Table as ie, TableHeader as ae, TableRow as Q, TableHead as ce, TableBody as Xe, TableCell as Ye } from "../../table.js";
15
+ function at({
16
+ crossTableData: I,
17
+ filterable: y = !1,
18
18
  loading: de = !1,
19
19
  emptyComponent: ue,
20
- className: j,
20
+ className: K,
21
21
  notFoundMessage: fe = "Nessun risultato trovato.",
22
- cornerHeaderFrom: I = "Da",
23
- cornerHeaderTo: K = "A",
24
- minWidthCell: M = 160,
22
+ cornerHeaderFrom: M = "Da",
23
+ cornerHeaderTo: P = "A",
24
+ minWidthCell: $ = 160,
25
25
  editable: me = !1,
26
26
  editMode: pe = !1,
27
- onEditModeChange: L,
28
- onSelectedRow: J,
29
- selectedRow: w,
27
+ onEditModeChange: A,
28
+ onSelectedRow: L,
29
+ selectedRow: T,
30
30
  rowSortAsc: he = !0
31
31
  }) {
32
- const [ge, xe] = d([]), f = E.headerTop, u = E.headerLeft, p = E.data, [b, P] = d(
33
- w?.id ?? null
34
- ), [$, A] = d(he), y = He(), [ve, _e] = d(me && pe), [we, be] = d({}), [ye, Ce] = d({}), C = y?.editMode ?? ve, Q = y?.editedCells ?? we, H = y?.setEditedCells ?? be, B = y?.toDefaultCells ?? ye, F = y?.setToDefaultCells ?? Ce;
32
+ const [ge, xe] = u([]), f = I.headerTop, d = I.headerLeft, p = I.data, [h, H] = u(
33
+ T?.id ?? null
34
+ ), [B, F] = u(he), C = He(), [ve] = u(me && pe), [we, be] = u({}), [ye, Ce] = u({}), N = C?.editMode ?? ve, Z = C?.editedCells ?? we, g = C?.setEditedCells ?? be, O = C?.toDefaultCells ?? ye, x = C?.setToDefaultCells ?? Ce;
35
35
  re(() => {
36
- L && L(!!C);
37
- }, [C, L]), re(() => {
38
- w?.id && P(w.id);
39
- }, [w]);
40
- const [s, Ne] = d(null), [Se, h] = d(!1), [z, T] = d(null), Ve = S(
36
+ A && A(!!N);
37
+ }, [N, A]), re(() => {
38
+ T?.id && H(T.id);
39
+ }, [T]);
40
+ const [s, Ne] = u(null), [Se, v] = u(!1), [R, D] = u(null), Ve = V(
41
41
  (t) => {
42
- t && s && T(s.value), h(t);
42
+ t && s && D(s.value), v(t);
43
43
  },
44
44
  [s]
45
- ), ke = S(() => {
46
- s && z !== null ? (H((t) => ({
45
+ ), ke = V(() => {
46
+ s && R !== null ? (g((t) => ({
47
47
  ...t,
48
48
  [s.cellKey]: {
49
- value: z,
49
+ value: R,
50
50
  cell: s.cellData
51
51
  }
52
- })), B[s.cellKey] && F((t) => {
52
+ })), O[s.cellKey] && x((t) => {
53
53
  const e = { ...t };
54
54
  return delete e[s.cellKey], e;
55
55
  }), setTimeout(() => {
56
- h(!1);
57
- }, 300)) : h(!1);
58
- }, [s, z, B]), ze = S(() => {
59
- s && (T(s.originalValue), H((t) => {
56
+ v(!1);
57
+ }, 300)) : v(!1);
58
+ }, [
59
+ s,
60
+ R,
61
+ O,
62
+ g,
63
+ x
64
+ ]), ze = V(() => {
65
+ s && (D(s.originalValue), g((t) => {
60
66
  const e = { ...t };
61
67
  return e[s.cellKey] && delete e[s.cellKey], e;
62
- }), F((t) => {
68
+ }), x((t) => {
63
69
  const e = { ...t };
64
70
  return e[s.cellKey] && delete e[s.cellKey], e;
65
- })), h(!1);
66
- }, [s]), Te = S(() => {
67
- s && (H((t) => {
71
+ })), v(!1);
72
+ }, [s, g, x]), Te = V(() => {
73
+ s && (g((t) => {
68
74
  const e = { ...t };
69
75
  return e[s.cellKey] && delete e[s.cellKey], e;
70
- }), F((t) => ({
76
+ }), x((t) => ({
71
77
  ...t,
72
78
  [s.cellKey]: {
73
79
  value: s.originalValue,
74
80
  cell: s.cellData
75
81
  }
76
- }))), h(!1);
77
- }, [s]), Re = S(
82
+ }))), v(!1);
83
+ }, [s, g, x]), Re = V(
78
84
  (t) => {
79
- T(t.target.value);
85
+ D(t.target.value);
80
86
  },
81
87
  []
82
- ), De = (t) => t && typeof t == "object" && "value" in t ? t.value : t, g = Y(() => {
83
- if (!b || !u.find((o) => o.id === b)) return f;
84
- const e = u.findIndex(
85
- (o) => o.id === b
88
+ ), De = (t) => t && typeof t == "object" && "value" in t ? t.value : t, w = G(() => {
89
+ if (!h || !d.find((n) => n.id === h)) return f;
90
+ const e = d.findIndex(
91
+ (n) => n.id === h
86
92
  );
87
93
  if (e === -1) return f;
88
- const n = f.map((o, i) => {
94
+ const o = f.map((n, i) => {
89
95
  const r = p[e]?.[i] ?? null, a = De(r);
90
- return { header: o, value: a };
96
+ return { header: n, value: a };
91
97
  });
92
- return n.sort((o, i) => {
93
- if (typeof o.value == "number" && typeof i.value == "number")
94
- return $ ? o.value - i.value : i.value - o.value;
95
- const r = String(o.value ?? ""), a = String(i.value ?? "");
96
- return $ ? r.localeCompare(a) : a.localeCompare(r);
97
- }), n.map((o) => o.header);
98
- }, [f, u, p, b, $]), Ee = Y(() => {
98
+ return o.sort((n, i) => {
99
+ if (typeof n.value == "number" && typeof i.value == "number")
100
+ return B ? n.value - i.value : i.value - n.value;
101
+ const r = String(n.value ?? ""), a = String(i.value ?? "");
102
+ return B ? r.localeCompare(a) : a.localeCompare(r);
103
+ }), o.map((n) => n.header);
104
+ }, [f, d, p, h, B]), je = G(() => {
99
105
  const t = [
100
106
  {
101
107
  id: "cross-header",
102
108
  header: () => /* @__PURE__ */ c("div", { className: "relative", children: [
103
- /* @__PURE__ */ l("div", { className: "absolute top-0 left-2 text-xs", children: I }),
104
- /* @__PURE__ */ l("div", { className: "absolute right-2 bottom-0 text-xs", children: K })
109
+ /* @__PURE__ */ l("div", { className: "absolute top-0 left-2 text-xs", children: M }),
110
+ /* @__PURE__ */ l("div", { className: "absolute right-2 bottom-0 text-xs", children: P })
105
111
  ] }),
106
112
  accessorFn: (e) => e.item,
107
113
  cell: (e) => {
108
- const n = e.getValue();
109
- if (!v)
110
- return /* @__PURE__ */ l(x, { text: n.label, className: "w-full" });
111
- const o = b === n.id;
114
+ const o = e.getValue();
115
+ if (!y)
116
+ return /* @__PURE__ */ l(b, { text: o.label, className: "w-full" });
117
+ const n = h === o.id;
112
118
  return /* @__PURE__ */ l(
113
- k,
119
+ z,
114
120
  {
115
121
  variant: "ghost",
116
122
  size: "sm",
117
123
  iconLeft: "ArrowLeftRight",
118
124
  className: "text-right",
119
125
  onClick: () => {
120
- v && (o ? A((i) => !i) : (P(u[e.row.index].id), A(!0), J && J(u[e.row.index])));
126
+ y && (n ? F((i) => !i) : (H(d[e.row.index].id), F(!0), L && L(d[e.row.index])));
121
127
  },
122
- children: /* @__PURE__ */ l(x, { text: n.label })
128
+ children: /* @__PURE__ */ l(b, { text: o.label })
123
129
  }
124
130
  );
125
131
  }
126
132
  }
127
133
  ];
128
- return g.forEach((e) => {
134
+ return w.forEach((e) => {
129
135
  t.push({
130
136
  id: e.id,
131
- accessorFn: (n) => n[e.id],
132
- header: ({ column: n }) => v ? /* @__PURE__ */ l(
133
- k,
137
+ accessorFn: (o) => o[e.id],
138
+ header: ({ column: o }) => y ? /* @__PURE__ */ l(
139
+ z,
134
140
  {
135
141
  variant: "ghost",
136
142
  size: "sm",
137
143
  iconLeft: "ArrowUpDown",
138
- onClick: v ? () => n.toggleSorting(n.getIsSorted() === "asc") : void 0,
144
+ onClick: y ? () => o.toggleSorting(o.getIsSorted() === "asc") : void 0,
139
145
  children: /* @__PURE__ */ l(
140
- x,
146
+ b,
141
147
  {
142
148
  text: e.label,
143
149
  className: "w-full max-w-full min-w-0"
@@ -145,77 +151,79 @@ function ct({
145
151
  )
146
152
  }
147
153
  ) : /* @__PURE__ */ l(
148
- x,
154
+ b,
149
155
  {
150
156
  text: e.label,
151
157
  className: "w-full max-w-full min-w-0 text-center font-medium"
152
158
  }
153
159
  ),
154
- sortingFn: (n, o, i) => {
155
- let r = n.getValue(i), a = o.getValue(i);
160
+ sortingFn: (o, n, i) => {
161
+ let r = o.getValue(i), a = n.getValue(i);
156
162
  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)));
157
163
  },
158
- cell: (n) => {
159
- const o = n.getValue();
160
- return o ? o.render ? o.render(o.fromId, o.toId, o.id) : /* @__PURE__ */ l("div", { className: "flex h-full w-full min-w-0 items-center justify-center", children: /* @__PURE__ */ l(x, { text: String(o?.value ?? "") }) }) : null;
164
+ cell: (o) => {
165
+ const n = o.getValue();
166
+ return n ? n.render ? n.render(n.fromId, n.toId, n.id) : /* @__PURE__ */ l("div", { className: "flex h-full w-full min-w-0 items-center justify-center", children: /* @__PURE__ */ l(b, { text: String(n?.value ?? "") }) }) : null;
161
167
  }
162
168
  });
163
169
  }), t;
164
170
  }, [
165
- g,
166
- I,
167
- K,
171
+ d,
168
172
  w,
169
- v,
173
+ M,
170
174
  P,
171
- A
172
- ]), je = Y(() => u.map((t, e) => {
173
- const n = { item: t };
174
- return g.forEach((o) => {
175
- const i = f.findIndex((r) => r.id === o.id);
176
- n[o.id] = i !== -1 ? p[e]?.[i] ?? null : null;
177
- }), n;
178
- }), [u, g, p, f]), R = Pe({
179
- data: je,
180
- columns: Ee,
175
+ L,
176
+ h,
177
+ y,
178
+ H,
179
+ F
180
+ ]), Ee = G(() => d.map((t, e) => {
181
+ const o = { item: t };
182
+ return w.forEach((n) => {
183
+ const i = f.findIndex((r) => r.id === n.id);
184
+ o[n.id] = i !== -1 ? p[e]?.[i] ?? null : null;
185
+ }), o;
186
+ }), [d, w, p, f]), j = Pe({
187
+ data: Ee,
188
+ columns: je,
181
189
  state: { sorting: ge },
182
190
  onSortingChange: xe,
183
191
  getCoreRowModel: Ue(),
184
192
  getSortedRowModel: We()
185
- }), Z = Le(null), ee = $e({
186
- count: R.getRowModel().rows.length,
187
- getScrollElement: () => Z.current,
193
+ }), _ = Ae(null), ee = $e({
194
+ count: j.getRowModel().rows.length,
195
+ getScrollElement: () => _.current,
188
196
  estimateSize: () => 40,
189
197
  overscan: 5,
190
198
  measureElement: typeof window < "u" ? (t) => t.getBoundingClientRect().height : void 0
191
199
  });
192
200
  if (de)
193
201
  return /* @__PURE__ */ l(
194
- Ae,
202
+ Le,
195
203
  {
196
- headerRow: g.map((t) => t.label),
197
- rowCount: u.length || 5,
198
- columnCount: g.length || 5,
199
- className: j,
200
- cornerHeaderFrom: I,
201
- cornerHeaderTo: K
204
+ headerRow: w.map((t) => t.label),
205
+ rowCount: d.length || 5,
206
+ columnCount: w.length || 5,
207
+ className: K,
208
+ cornerHeaderFrom: M,
209
+ cornerHeaderTo: P
202
210
  }
203
211
  );
204
212
  const te = (t) => {
205
- const e = t.column.id === "cross-header", n = e, o = ["bg-d-secondary"];
206
- e || o.push("border-r"), e && o.push("sticky left-0"), o.push("sticky top-0 z-20"), n ? o.push("z-40") : e && o.push("z-30");
213
+ const e = t.column.id === "cross-header", o = e, n = ["bg-d-secondary"];
214
+ e || n.push("border-r"), e && n.push("sticky left-0"), n.push("sticky top-0 z-20"), o ? n.push("z-40") : e && n.push("z-30");
207
215
  let i = "none";
208
216
  return e && (i = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
209
- className: o.join(" "),
210
- style: { boxShadow: i, width: `${M}px` }
217
+ className: n.join(" "),
218
+ style: { boxShadow: i, width: `${$}px` }
211
219
  };
212
220
  };
213
221
  return !p || p.length === 0 ? /* @__PURE__ */ c(
214
222
  "div",
215
223
  {
216
- className: V(
224
+ className: k(
217
225
  "flex h-full w-full flex-col overflow-auto",
218
- j ?? ""
226
+ K ?? ""
219
227
  ),
220
228
  children: [
221
229
  /* @__PURE__ */ l(ie, { className: "relative w-full table-fixed border-collapse", children: /* @__PURE__ */ l(
@@ -223,18 +231,18 @@ function ct({
223
231
  {
224
232
  className: "bg-d-secondary sticky top-0 z-20 w-full",
225
233
  style: { boxShadow: "0 1px 0 0 var(--d-border)" },
226
- children: (R.getHeaderGroups() ?? []).map((t) => /* @__PURE__ */ l(
227
- G,
234
+ children: (j.getHeaderGroups() ?? []).map((t) => /* @__PURE__ */ l(
235
+ Q,
228
236
  {
229
237
  className: "bg-d-secondary sticky top-0 z-20",
230
238
  children: t.headers.map((e) => {
231
- const n = te(e);
239
+ const o = te(e);
232
240
  return /* @__PURE__ */ l(
233
241
  ce,
234
242
  {
235
- className: n.className,
236
- style: n.style,
237
- children: e.isPlaceholder ? null : _(
243
+ className: o.className,
244
+ style: o.style,
245
+ children: e.isPlaceholder ? null : q(
238
246
  e.column.columnDef.header,
239
247
  e.getContext()
240
248
  )
@@ -250,11 +258,11 @@ function ct({
250
258
  /* @__PURE__ */ l("div", { className: "sticky top-0 left-0 flex flex-1", children: ue || fe })
251
259
  ]
252
260
  }
253
- ) : /* @__PURE__ */ c("div", { className: `${V("w-[900px]", j || "")}`, children: [
261
+ ) : /* @__PURE__ */ c("div", { className: `${k("w-[900px]", K || "")}`, children: [
254
262
  /* @__PURE__ */ l(
255
263
  "div",
256
264
  {
257
- ref: Z,
265
+ ref: _,
258
266
  className: "border-d-border h-fit max-h-full min-h-0 overflow-auto rounded-md border",
259
267
  children: /* @__PURE__ */ c(ie, { className: "relative w-full table-fixed border-collapse", children: [
260
268
  /* @__PURE__ */ l(
@@ -262,18 +270,18 @@ function ct({
262
270
  {
263
271
  className: "bg-d-secondary sticky top-0 z-20 w-full",
264
272
  style: { boxShadow: "0 1px 0 0 var(--d-border)" },
265
- children: R.getHeaderGroups().map((t) => /* @__PURE__ */ l(
266
- G,
273
+ children: j.getHeaderGroups().map((t) => /* @__PURE__ */ l(
274
+ Q,
267
275
  {
268
276
  className: "bg-d-secondary sticky top-0 z-20",
269
277
  children: t.headers.map((e) => {
270
- const n = te(e);
278
+ const o = te(e);
271
279
  return /* @__PURE__ */ l(
272
280
  ce,
273
281
  {
274
- className: n.className,
275
- style: n.style,
276
- children: e.isPlaceholder ? null : _(
282
+ className: o.className,
283
+ style: o.style,
284
+ children: e.isPlaceholder ? null : q(
277
285
  e.column.columnDef.header,
278
286
  e.getContext()
279
287
  )
@@ -294,125 +302,129 @@ function ct({
294
302
  position: "relative",
295
303
  width: "100%"
296
304
  },
297
- children: ee.getVirtualItems().map((t) => {
298
- const e = R.getRowModel().rows[t.index];
299
- return /* @__PURE__ */ l(
300
- G,
301
- {
302
- "data-index": t.index,
303
- style: {
304
- position: "absolute",
305
- top: 0,
306
- left: 0,
307
- transform: `translateY(${t.start}px)`,
308
- width: "100%",
309
- height: `${t.size}px`,
310
- display: "flex"
311
- },
312
- children: e.getVisibleCells().map((n, o) => {
313
- const i = o === 0, r = n.getValue(), a = i ? "var(--d-secondary)" : r?.bgColor || "transparent", N = r.editable ?? !0;
314
- return /* @__PURE__ */ l(
315
- Ye,
316
- {
317
- onClick: (m) => {
318
- !N || !C || (m.stopPropagation(), m.preventDefault());
319
- },
320
- className: V(
321
- "border-d-border text-center",
322
- i ? "sticky left-0 z-10" : "border-r",
323
- N && C && "cursor-pointer"
324
- ),
325
- style: {
326
- boxShadow: i ? "inset -1px 0 0 0 var(--d-border)" : "none",
327
- backgroundColor: a,
328
- color: r?.textColor || "inherit",
329
- minWidth: `${M}px`,
330
- flex: `1 0 ${M}px`,
331
- display: "flex",
332
- alignItems: "center",
333
- justifyContent: "center"
334
- },
335
- children: i || !C || !r ? (
336
- // Rendering normale per la prima colonna o quando non siamo in modalità edit
337
- _(
338
- n.column.columnDef.cell,
339
- n.getContext()
305
+ children: ee.getVirtualItems().map(
306
+ (t) => {
307
+ const e = j.getRowModel().rows[t.index];
308
+ return /* @__PURE__ */ l(
309
+ Q,
310
+ {
311
+ "data-index": t.index,
312
+ style: {
313
+ position: "absolute",
314
+ top: 0,
315
+ left: 0,
316
+ transform: `translateY(${t.start}px)`,
317
+ width: "100%",
318
+ height: `${t.size}px`,
319
+ display: "flex"
320
+ },
321
+ children: e.getVisibleCells().map((o, n) => {
322
+ const i = n === 0, r = o.getValue(), a = i ? "var(--d-secondary)" : r?.bgColor || "transparent", S = r.editable ?? !0;
323
+ return /* @__PURE__ */ l(
324
+ Ye,
325
+ {
326
+ onClick: (m) => {
327
+ !S || !N || (m.stopPropagation(), m.preventDefault());
328
+ },
329
+ className: k(
330
+ "border-d-border text-center",
331
+ i ? "sticky left-0 z-10" : "border-r",
332
+ S && N && "cursor-pointer"
333
+ ),
334
+ style: {
335
+ boxShadow: i ? "inset -1px 0 0 0 var(--d-border)" : "none",
336
+ backgroundColor: a,
337
+ color: r?.textColor || "inherit",
338
+ minWidth: `${$}px`,
339
+ flex: `1 0 ${$}px`,
340
+ display: "flex",
341
+ alignItems: "center",
342
+ justifyContent: "center"
343
+ },
344
+ children: i || !N || !r ? (
345
+ // Rendering normale per la prima colonna o quando non siamo in modalità edit
346
+ q(
347
+ o.column.columnDef.cell,
348
+ o.getContext()
349
+ )
350
+ ) : (
351
+ // Rendering con cella modificabile
352
+ (() => {
353
+ const m = `${e.index}-${o.column.id}`, E = m in Z ? Z[m].value : r.value || "", Ie = E !== r.value, le = m in O;
354
+ return /* @__PURE__ */ l(
355
+ "div",
356
+ {
357
+ className: "flex w-full cursor-pointer items-center justify-center",
358
+ onClick: (Ke) => {
359
+ const W = Ke.currentTarget.getBoundingClientRect(), ne = 400, oe = 164, U = 8;
360
+ let X = W.left + window.scrollX, Y = W.bottom + 5;
361
+ const se = window.innerWidth, Me = window.innerHeight;
362
+ X + ne > se - U && (X = se - ne - U), Y + oe > Me - U && (Y = W.bottom - oe - 5), Ne({
363
+ cellKey: m,
364
+ value: E,
365
+ originalValue: r.value || "",
366
+ cellData: r,
367
+ position: { top: Y, left: X }
368
+ }), D(
369
+ E
370
+ ), v(!0);
371
+ },
372
+ children: /* @__PURE__ */ c("div", { className: "relative flex h-full max-h-full w-full max-w-full items-center justify-center gap-1", children: [
373
+ Ie && !le && /* @__PURE__ */ l(
374
+ "div",
375
+ {
376
+ className: "bg-d-primary absolute -top-1.5 -left-1.5 rounded p-1",
377
+ title: "Valore modificato"
378
+ }
379
+ ),
380
+ le && /* @__PURE__ */ l(
381
+ "div",
382
+ {
383
+ className: "bg-d-destructive absolute -top-1.5 -left-1.5 rounded p-1",
384
+ title: "Ripristino richiesto"
385
+ }
386
+ ),
387
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ l(
388
+ "div",
389
+ {
390
+ className: k(
391
+ "h-full min-h-full w-full min-w-full truncate text-center",
392
+ S ? "text-d-muted-foreground" : "text-d-muted"
393
+ ),
394
+ children: /* @__PURE__ */ l(
395
+ b,
396
+ {
397
+ text: String(E),
398
+ className: "w-full"
399
+ }
400
+ )
401
+ }
402
+ ) }),
403
+ /* @__PURE__ */ l(
404
+ J,
405
+ {
406
+ name: S ? "Pencil" : "PencilOff",
407
+ size: "sm",
408
+ className: k(
409
+ "h-3 w-3",
410
+ S ? "text-d-muted-foreground" : "text-d-muted"
411
+ )
412
+ }
413
+ )
414
+ ] })
415
+ }
416
+ );
417
+ })()
340
418
  )
341
- ) : (
342
- // Rendering con cella modificabile
343
- (() => {
344
- const m = `${e.index}-${n.column.id}`, D = m in Q ? Q[m].value : r.value || "", Ie = D !== r.value, le = m in B;
345
- return /* @__PURE__ */ l(
346
- "div",
347
- {
348
- className: "flex w-full cursor-pointer items-center justify-center",
349
- onClick: (Ke) => {
350
- const O = Ke.currentTarget.getBoundingClientRect(), oe = 400, ne = 164, W = 8;
351
- let U = O.left + window.scrollX, X = O.bottom + 5;
352
- const se = window.innerWidth, Me = window.innerHeight;
353
- U + oe > se - W && (U = se - oe - W), X + ne > Me - W && (X = O.bottom - ne - 5), Ne({
354
- cellKey: m,
355
- value: D,
356
- originalValue: r.value || "",
357
- cellData: r,
358
- position: { top: X, left: U }
359
- }), T(D), h(!0);
360
- },
361
- children: /* @__PURE__ */ c("div", { className: "relative flex h-full max-h-full w-full max-w-full items-center justify-center gap-1", children: [
362
- Ie && !le && /* @__PURE__ */ l(
363
- "div",
364
- {
365
- className: "bg-d-primary absolute -top-1.5 -left-1.5 rounded p-1",
366
- title: "Valore modificato"
367
- }
368
- ),
369
- le && /* @__PURE__ */ l(
370
- "div",
371
- {
372
- className: "bg-d-destructive absolute -top-1.5 -left-1.5 rounded p-1",
373
- title: "Ripristino richiesto"
374
- }
375
- ),
376
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ l(
377
- "div",
378
- {
379
- className: V(
380
- "h-full min-h-full w-full min-w-full truncate text-center",
381
- N ? "text-d-muted-foreground" : "text-d-muted"
382
- ),
383
- children: /* @__PURE__ */ l(
384
- x,
385
- {
386
- text: D,
387
- className: "w-full"
388
- }
389
- )
390
- }
391
- ) }),
392
- /* @__PURE__ */ l(
393
- q,
394
- {
395
- name: N ? "Pencil" : "PencilOff",
396
- size: "sm",
397
- className: V(
398
- "h-3 w-3",
399
- N ? "text-d-muted-foreground" : "text-d-muted"
400
- )
401
- }
402
- )
403
- ] })
404
- }
405
- );
406
- })()
407
- )
408
- },
409
- n.id
410
- );
411
- })
412
- },
413
- e.id
414
- );
415
- })
419
+ },
420
+ o.id
421
+ );
422
+ })
423
+ },
424
+ e.id
425
+ );
426
+ }
427
+ )
416
428
  }
417
429
  )
418
430
  ] })
@@ -441,14 +453,14 @@ function ct({
441
453
  {
442
454
  type: "text",
443
455
  className: "bg-d-secondary w-full rounded border p-2",
444
- value: z || "",
456
+ value: R || "",
445
457
  onChange: Re,
446
458
  autoFocus: !0
447
459
  }
448
460
  ),
449
461
  /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
450
462
  /* @__PURE__ */ c(
451
- k,
463
+ z,
452
464
  {
453
465
  variant: "destructive",
454
466
  size: "sm",
@@ -456,14 +468,14 @@ function ct({
456
468
  className: "text-xs",
457
469
  title: "Ripristina il valore originale e segna la cella come da ripristinare",
458
470
  children: [
459
- /* @__PURE__ */ l(q, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
471
+ /* @__PURE__ */ l(J, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
460
472
  "Ripristina"
461
473
  ]
462
474
  }
463
475
  ),
464
476
  /* @__PURE__ */ c("div", { className: "flex space-x-2", children: [
465
477
  /* @__PURE__ */ l(
466
- k,
478
+ z,
467
479
  {
468
480
  variant: "ghost",
469
481
  size: "sm",
@@ -474,14 +486,14 @@ function ct({
474
486
  }
475
487
  ),
476
488
  /* @__PURE__ */ c(
477
- k,
489
+ z,
478
490
  {
479
491
  size: "sm",
480
492
  onClick: ke,
481
493
  className: "text-xs",
482
494
  title: "Conferma le modifiche e salva",
483
495
  children: [
484
- /* @__PURE__ */ l(q, { name: "Check", className: "mr-1 h-3 w-3" }),
496
+ /* @__PURE__ */ l(J, { name: "Check", className: "mr-1 h-3 w-3" }),
485
497
  "Conferma"
486
498
  ]
487
499
  }
@@ -495,5 +507,5 @@ function ct({
495
507
  ] });
496
508
  }
497
509
  export {
498
- ct as DataCrossTable
510
+ at as DataCrossTable
499
511
  };