laif-ds 0.1.67 → 0.1.69

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,9 +1,9 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
2
+ import { jsx as t, jsxs as b } from "react/jsx-runtime";
3
3
  import { useReactTable as ue, flexRender as J } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { useState as h, useRef as _, useMemo as de, useEffect as M } from "react";
4
+ import { useState as x, useRef as _, useMemo as de, useEffect as M } from "react";
5
5
  import { cn as fe } from "../../lib/utils.js";
6
- import { createCustomFilterFns as xe, ELogicalFilterOperator as he, debounce as se, createMultiValueFilterFn as Ce, updatePageSizeFromContainer as be } from "./data-table.service.js";
6
+ import { createCustomFilterFns as he, ELogicalFilterOperator as xe, debounce as Ce, createMultiValueFilterFn as be, updatePageSizeFromContainer as se } from "./data-table.service.js";
7
7
  import { Pagination as we, PaginationContent as re, PaginationItem as I, PaginationFirst as Ie, PaginationPrevious as Re, PaginationLink as ze, PaginationNext as Ne, PaginationLast as Me } from "./pagination.js";
8
8
  import { Checkbox as K } from "./checkbox.js";
9
9
  import { Input as ye } from "./input.js";
@@ -23,10 +23,10 @@ function pe({
23
23
  checkable: z = !1,
24
24
  onCheckedRowsChange: k,
25
25
  notFoundMessage: Z = "Nessun risultato trovato.",
26
- searchBar: x = void 0,
26
+ searchBar: h = void 0,
27
27
  dropdownFilters: u = void 0,
28
28
  totalItems: P = void 0,
29
- datatableSizes: b = {
29
+ datatableSizes: s = {
30
30
  rowHeight: 32.5,
31
31
  // default table row height in pixels
32
32
  headerHeight: 40,
@@ -39,10 +39,10 @@ function pe({
39
39
  setServerOptions: i = void 0
40
40
  }) {
41
41
  var S, E;
42
- const [p, B] = h([]), [v, O] = h([]), [ee, le] = h({}), [r, te] = h(""), [ae, ne] = h({}), T = L ? Y : ae, ie = L || ne, [N, ge] = h({}), d = !!g, [w, H] = h({
42
+ const [p, B] = x([]), [v, O] = x([]), [ee, le] = x({}), [r, te] = x(""), [ae, ne] = x({}), T = L ? Y : ae, ie = L || ne, [N, ge] = x({}), d = !!g, [w, H] = x({
43
43
  pageIndex: 0,
44
44
  pageSize: 10
45
- }), [oe, A] = h(0), D = _(null), $ = _(void 0), ce = de(() => z ? [
45
+ }), [oe, A] = x(0), D = _(null), $ = _(void 0), ce = de(() => z ? [
46
46
  {
47
47
  id: "select",
48
48
  header: ({ table: e }) => /* @__PURE__ */ t(
@@ -82,19 +82,19 @@ function pe({
82
82
  onColumnVisibilityChange: le,
83
83
  onRowSelectionChange: ie,
84
84
  getFilteredRowModel: Le(),
85
- globalFilterFn: (e, l, n) => d || !n ? !0 : (x == null ? void 0 : x.columns.some((o) => {
85
+ globalFilterFn: (e, l, n) => d || !n ? !0 : (h == null ? void 0 : h.columns.some((o) => {
86
86
  const c = e.getValue(o);
87
87
  return String(c).toLowerCase().includes(n.toLowerCase());
88
88
  })) ?? !1,
89
89
  filterFns: {
90
- multiValue: (e, l, n) => Ce(
90
+ multiValue: (e, l, n) => be(
91
91
  e,
92
92
  l,
93
93
  n,
94
94
  u,
95
95
  g
96
96
  ),
97
- ...xe(u ?? [], g)
97
+ ...he(u ?? [], g)
98
98
  },
99
99
  onPaginationChange: (e) => {
100
100
  d ? typeof e == "object" && i && i((l) => ({
@@ -119,17 +119,17 @@ function pe({
119
119
  }, a = ue(me);
120
120
  M(() => {
121
121
  let e;
122
- if (x && r && (e || (e = {}), e.searchbarFilters = {
122
+ if (h && r && (e || (e = {}), e.searchbarFilters = {
123
123
  value: r,
124
- columns: x.columns
124
+ columns: h.columns
125
125
  }), u && Object.keys(N).length > 0) {
126
126
  const c = {};
127
127
  for (const f of u) {
128
- const s = N[f.column];
129
- s && s.length > 0 && (c[f.column] = {
128
+ const C = N[f.column];
129
+ C && C.length > 0 && (c[f.column] = {
130
130
  column: f.column,
131
- value: s,
132
- logic: f.innerFiltersMode || he.OR
131
+ value: C,
132
+ logic: f.innerFiltersMode || xe.OR
133
133
  });
134
134
  }
135
135
  Object.keys(c).length > 0 && (e || (e = {}), e.dropdownFilters = c);
@@ -146,7 +146,7 @@ function pe({
146
146
  }, [
147
147
  u,
148
148
  N,
149
- x,
149
+ h,
150
150
  r,
151
151
  g,
152
152
  i
@@ -172,12 +172,12 @@ function pe({
172
172
  G,
173
173
  w.pageSize
174
174
  ]), M(() => {
175
- const e = se(() => {
175
+ const e = Ce(() => {
176
176
  const l = D.current;
177
- l && be(l, {
178
- rowHeight: b.rowHeight,
179
- headerHeight: b.headerHeight,
180
- containerHeight: b.containerHeight,
177
+ l && se(l, {
178
+ rowHeight: s.rowHeight,
179
+ headerHeight: s.headerHeight,
180
+ containerHeight: s.containerHeight,
181
181
  onPageChange: d ? (n, o) => {
182
182
  i == null || i((c) => ({
183
183
  ...c,
@@ -207,9 +207,9 @@ function pe({
207
207
  };
208
208
  }, [
209
209
  d,
210
- b.containerHeight,
211
- b.headerHeight,
212
- b.rowHeight,
210
+ s.containerHeight,
211
+ s.headerHeight,
212
+ s.rowHeight,
213
213
  D,
214
214
  i
215
215
  // should be stable, but include for clarity
@@ -218,7 +218,7 @@ function pe({
218
218
  const e = a.getFilteredSelectedRowModel().rows.map((l) => l.original);
219
219
  k(e);
220
220
  }
221
- }, [a, k, z, T]), /* @__PURE__ */ C(
221
+ }, [a, k, z, T]), /* @__PURE__ */ b(
222
222
  "div",
223
223
  {
224
224
  className: fe(
@@ -226,12 +226,12 @@ function pe({
226
226
  X
227
227
  ),
228
228
  children: [
229
- (x || (u == null ? void 0 : u.length)) && /* @__PURE__ */ C("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
230
- x && /* @__PURE__ */ t(
229
+ (h || (u == null ? void 0 : u.length)) && /* @__PURE__ */ b("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
230
+ h && /* @__PURE__ */ t(
231
231
  ye,
232
232
  {
233
233
  iconLeft: "Search",
234
- placeholder: x.placeholder ?? "Cerca...",
234
+ placeholder: h.placeholder ?? "Cerca...",
235
235
  value: r,
236
236
  onChange: (e) => {
237
237
  te(e.target.value);
@@ -239,7 +239,7 @@ function pe({
239
239
  className: "w-60"
240
240
  }
241
241
  ),
242
- /* @__PURE__ */ t("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: u && u.length > 0 && /* @__PURE__ */ C(q, { className: "h-full w-full", children: [
242
+ /* @__PURE__ */ t("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: u && u.length > 0 && /* @__PURE__ */ b(q, { className: "h-full w-full", children: [
243
243
  /* @__PURE__ */ t(F, { orientation: "horizontal" }),
244
244
  /* @__PURE__ */ t("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 sm:justify-end", children: u.map((e, l) => {
245
245
  const n = N[e.column] ?? [];
@@ -257,7 +257,7 @@ function pe({
257
257
  [e.column]: o
258
258
  })), O((c) => {
259
259
  const f = c.filter(
260
- (s) => s.id !== e.column
260
+ (C) => C.id !== e.column
261
261
  );
262
262
  return o.length === 0 ? f : [
263
263
  ...f,
@@ -276,10 +276,10 @@ function pe({
276
276
  {
277
277
  className: "flex max-h-full min-h-0 max-w-full min-w-0 flex-1",
278
278
  ref: D,
279
- children: /* @__PURE__ */ C(q, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
279
+ children: /* @__PURE__ */ b(q, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
280
280
  /* @__PURE__ */ t(F, { orientation: "horizontal" }),
281
281
  /* @__PURE__ */ t(F, { orientation: "vertical" }),
282
- /* @__PURE__ */ C(Pe, { children: [
282
+ /* @__PURE__ */ b(Pe, { children: [
283
283
  /* @__PURE__ */ t(He, { children: a.getHeaderGroups().map((e) => /* @__PURE__ */ t(y, { children: e.headers.map((l) => /* @__PURE__ */ t(
284
284
  De,
285
285
  {
@@ -327,12 +327,12 @@ function pe({
327
327
  ] })
328
328
  }
329
329
  ),
330
- /* @__PURE__ */ C(we, { className: "h-9", children: [
330
+ /* @__PURE__ */ b(we, { className: "h-9", children: [
331
331
  /* @__PURE__ */ t("div", { className: "flex h-full flex-1 items-center align-middle", children: /* @__PURE__ */ t("div", { className: "text-d-foreground hidden text-sm md:flex", children: Math.min(
332
332
  ((E = g == null ? void 0 : g.pagination) == null ? void 0 : E.pageSize) ?? w.pageSize,
333
333
  a.getFilteredRowModel().rows.length ?? 9999
334
- ) + " / " + (g ? P ?? "missing totalItems" : a.getFilteredRowModel().rows.length) + " " + ((m == null ? void 0 : m.rows) ?? "Rows") }) }),
335
- /* @__PURE__ */ C(re, { children: [
334
+ ) + " / " + (g ? P ?? "missing totalItems" : a.getFilteredRowModel().rows.length) + " " + ((m == null ? void 0 : m.rows) ?? "Righe") }) }),
335
+ /* @__PURE__ */ b(re, { children: [
336
336
  /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
337
337
  Ie,
338
338
  {
@@ -379,7 +379,7 @@ function pe({
379
379
  0,
380
380
  e - Math.floor(n / 2)
381
381
  ), c = o + n;
382
- return c > l && (c = l, o = Math.max(0, c - n)), a.getPageOptions().slice(o, c).map((f, s) => /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
382
+ return c > l && (c = l, o = Math.max(0, c - n)), a.getPageOptions().slice(o, c).map((f, C) => /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
383
383
  ze,
384
384
  {
385
385
  size: "icon",
@@ -399,7 +399,7 @@ function pe({
399
399
  },
400
400
  children: f + 1
401
401
  }
402
- ) }, s));
402
+ ) }, C));
403
403
  })(),
404
404
  /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
405
405
  Ne,
@@ -437,7 +437,7 @@ function pe({
437
437
  }
438
438
  ) })
439
439
  ] }),
440
- /* @__PURE__ */ t("div", { className: "flex h-full flex-1 items-center justify-end align-middle", children: /* @__PURE__ */ t("div", { className: "text-d-foreground hidden text-sm md:flex", children: (a.getPageCount() ? a.getState().pagination.pageIndex + 1 : 0) + " / " + a.getPageCount() + " " + ((m == null ? void 0 : m.pages) ?? "Pages") }) })
440
+ /* @__PURE__ */ t("div", { className: "flex h-full flex-1 items-center justify-end align-middle", children: /* @__PURE__ */ t("div", { className: "text-d-foreground hidden text-sm md:flex", children: (a.getPageCount() ? a.getState().pagination.pageIndex + 1 : 0) + " / " + a.getPageCount() + " " + ((m == null ? void 0 : m.pages) ?? "Pagine") }) })
441
441
  ] })
442
442
  ]
443
443
  }
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { jsx as i, jsxs as o } from "react/jsx-runtime";
3
- import { cn as e } from "../../lib/utils.js";
3
+ import { cn as t } from "../../lib/utils.js";
4
4
  import { buttonVariants as c } from "./button.js";
5
5
  import p from "../../node_modules/lucide-react/dist/esm/icons/ellipsis.js";
6
6
  import m from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
7
7
  import u from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
8
- import g from "../../node_modules/lucide-react/dist/esm/icons/chevron-first.js";
9
- import d from "../../node_modules/lucide-react/dist/esm/icons/chevron-last.js";
8
+ import d from "../../node_modules/lucide-react/dist/esm/icons/chevron-first.js";
9
+ import g from "../../node_modules/lucide-react/dist/esm/icons/chevron-last.js";
10
10
  function C({ className: a, ...n }) {
11
11
  return /* @__PURE__ */ i(
12
12
  "nav",
@@ -14,12 +14,12 @@ function C({ className: a, ...n }) {
14
14
  role: "navigation",
15
15
  "aria-label": "pagination",
16
16
  "data-slot": "pagination",
17
- className: e("mx-auto flex w-full justify-center", a),
17
+ className: t("mx-auto flex w-full justify-center", a),
18
18
  ...n
19
19
  }
20
20
  );
21
21
  }
22
- function L({
22
+ function j({
23
23
  className: a,
24
24
  ...n
25
25
  }) {
@@ -27,18 +27,18 @@ function L({
27
27
  "ul",
28
28
  {
29
29
  "data-slot": "pagination-content",
30
- className: e("flex flex-row items-center gap-1", a),
30
+ className: t("flex flex-row items-center gap-1", a),
31
31
  ...n
32
32
  }
33
33
  );
34
34
  }
35
- function j({ ...a }) {
35
+ function y({ ...a }) {
36
36
  return /* @__PURE__ */ i("li", { "data-slot": "pagination-item", ...a });
37
37
  }
38
38
  function r({
39
39
  className: a,
40
40
  isActive: n,
41
- isDisabled: t,
41
+ isDisabled: e,
42
42
  size: s = "icon",
43
43
  ...l
44
44
  }) {
@@ -48,51 +48,51 @@ function r({
48
48
  "aria-current": n ? "page" : void 0,
49
49
  "data-slot": "pagination-link",
50
50
  "data-active": n,
51
- className: e(
51
+ className: t(
52
52
  c({
53
53
  variant: n ? "outline" : "ghost",
54
54
  // variant: isDisabled ? "disabled" : isActive ? "outline" : "ghost",
55
55
  size: s
56
56
  }),
57
- t && "pointer-events-none cursor-not-allowed opacity-40",
57
+ e && "pointer-events-none cursor-not-allowed opacity-40",
58
58
  a
59
59
  ),
60
60
  ...l
61
61
  }
62
62
  );
63
63
  }
64
- function y({
64
+ function G({
65
65
  className: a,
66
66
  label: n,
67
- ...t
67
+ ...e
68
68
  }) {
69
69
  return /* @__PURE__ */ o(
70
70
  r,
71
71
  {
72
72
  "aria-label": "Go to previous page",
73
- className: e("gap-1 px-2.5 sm:pl-2.5", a),
74
- ...t,
73
+ className: t("gap-1 px-2.5 sm:pl-2.5", a),
74
+ ...e,
75
75
  children: [
76
- /* @__PURE__ */ i(g, {}),
77
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "First" })
76
+ /* @__PURE__ */ i(d, {}),
77
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Primo" })
78
78
  ]
79
79
  }
80
80
  );
81
81
  }
82
- function G({
82
+ function L({
83
83
  className: a,
84
84
  label: n,
85
- ...t
85
+ ...e
86
86
  }) {
87
87
  return /* @__PURE__ */ o(
88
88
  r,
89
89
  {
90
90
  "aria-label": "Go to previous page",
91
- className: e("gap-1 px-2.5 sm:pl-2.5", a),
92
- ...t,
91
+ className: t("gap-1 px-2.5 sm:pl-2.5", a),
92
+ ...e,
93
93
  children: [
94
94
  /* @__PURE__ */ i(u, {}),
95
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Previous" })
95
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Precedente" })
96
96
  ]
97
97
  }
98
98
  );
@@ -100,40 +100,40 @@ function G({
100
100
  function w({
101
101
  className: a,
102
102
  label: n,
103
- ...t
103
+ ...e
104
104
  }) {
105
105
  return /* @__PURE__ */ o(
106
106
  r,
107
107
  {
108
108
  "aria-label": "Go to next page",
109
- className: e("gap-1 px-2.5 sm:pr-2.5", a),
110
- ...t,
109
+ className: t("gap-1 px-2.5 sm:pr-2.5", a),
110
+ ...e,
111
111
  children: [
112
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Next" }),
112
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Prossimo" }),
113
113
  /* @__PURE__ */ i(m, {})
114
114
  ]
115
115
  }
116
116
  );
117
117
  }
118
- function F({
118
+ function z({
119
119
  className: a,
120
120
  label: n,
121
- ...t
121
+ ...e
122
122
  }) {
123
123
  return /* @__PURE__ */ o(
124
124
  r,
125
125
  {
126
126
  "aria-label": "Go to next page",
127
- className: e("gap-1 px-2.5 sm:pr-2.5", a),
128
- ...t,
127
+ className: t("gap-1 px-2.5 sm:pr-2.5", a),
128
+ ...e,
129
129
  children: [
130
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Last" }),
131
- /* @__PURE__ */ i(d, {})
130
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Ultimo" }),
131
+ /* @__PURE__ */ i(g, {})
132
132
  ]
133
133
  }
134
134
  );
135
135
  }
136
- function z({
136
+ function E({
137
137
  className: a,
138
138
  ...n
139
139
  }) {
@@ -142,7 +142,7 @@ function z({
142
142
  {
143
143
  "aria-hidden": !0,
144
144
  "data-slot": "pagination-ellipsis",
145
- className: e("flex size-9 items-center justify-center", a),
145
+ className: t("flex size-9 items-center justify-center", a),
146
146
  ...n,
147
147
  children: [
148
148
  /* @__PURE__ */ i(p, { className: "size-4" }),
@@ -153,12 +153,12 @@ function z({
153
153
  }
154
154
  export {
155
155
  C as Pagination,
156
- L as PaginationContent,
157
- z as PaginationEllipsis,
158
- y as PaginationFirst,
159
- j as PaginationItem,
160
- F as PaginationLast,
156
+ j as PaginationContent,
157
+ E as PaginationEllipsis,
158
+ G as PaginationFirst,
159
+ y as PaginationItem,
160
+ z as PaginationLast,
161
161
  r as PaginationLink,
162
162
  w as PaginationNext,
163
- G as PaginationPrevious
163
+ L as PaginationPrevious
164
164
  };
@@ -29,81 +29,74 @@ function ut({
29
29
  selectedRow: u,
30
30
  rowSortAsc: ve = !0
31
31
  }) {
32
- var le, re;
32
+ var le, ne;
33
33
  const [xe, be] = f([]), p = I.headerTop, m = I.headerLeft, g = I.data, [w, $] = f(
34
34
  (u == null ? void 0 : u.id) ?? null
35
- ), [A, P] = f(ve);
36
- let c = null;
37
- try {
38
- c = Fe();
39
- } catch {
40
- c = null;
41
- }
42
- const [we, Ge] = f(he && ge), [ye, Ce] = f({}), [Ne, Se] = f({}), S = (c == null ? void 0 : c.editMode) ?? we, Q = (c == null ? void 0 : c.editedCells) ?? ye, H = (c == null ? void 0 : c.setEditedCells) ?? Ce, B = (c == null ? void 0 : c.toDefaultCells) ?? Ne, F = (c == null ? void 0 : c.setToDefaultCells) ?? Se;
35
+ ), [A, P] = f(ve), c = Fe(), [we, Ge] = f(he && ge), [ye, Ce] = f({}), [Ne, Se] = f({}), S = (c == null ? void 0 : c.editMode) ?? we, Q = (c == null ? void 0 : c.editedCells) ?? ye, H = (c == null ? void 0 : c.setEditedCells) ?? Ce, B = (c == null ? void 0 : c.toDefaultCells) ?? Ne, F = (c == null ? void 0 : c.setToDefaultCells) ?? Se;
43
36
  ae(() => {
44
37
  L && L(!!S);
45
38
  }, [S, L]), ae(() => {
46
39
  u != null && u.id && $(u.id);
47
40
  }, [u]);
48
- const [n, ze] = f(null), [ke, v] = f(!1), [z, k] = f(null), Te = y(
41
+ const [r, ze] = f(null), [ke, v] = f(!1), [z, k] = f(null), Te = y(
49
42
  (t) => {
50
- t && n && k(n.value), v(t);
43
+ t && r && k(r.value), v(t);
51
44
  },
52
- [n]
45
+ [r]
53
46
  ), Ee = y(() => {
54
- n && z !== null ? (H((t) => ({
47
+ r && z !== null ? (H((t) => ({
55
48
  ...t,
56
- [n.cellKey]: {
49
+ [r.cellKey]: {
57
50
  value: z,
58
- cell: n.cellData
51
+ cell: r.cellData
59
52
  }
60
- })), B[n.cellKey] && F((t) => {
53
+ })), B[r.cellKey] && F((t) => {
61
54
  const e = { ...t };
62
- return delete e[n.cellKey], e;
55
+ return delete e[r.cellKey], e;
63
56
  }), setTimeout(() => {
64
57
  v(!1);
65
58
  }, 300)) : v(!1);
66
- }, [n, z, B]), je = y(() => {
67
- n && (k(n.originalValue), H((t) => {
59
+ }, [r, z, B]), je = y(() => {
60
+ r && (k(r.originalValue), H((t) => {
68
61
  const e = { ...t };
69
- return e[n.cellKey] && delete e[n.cellKey], e;
62
+ return e[r.cellKey] && delete e[r.cellKey], e;
70
63
  }), F((t) => {
71
64
  const e = { ...t };
72
- return e[n.cellKey] && delete e[n.cellKey], e;
65
+ return e[r.cellKey] && delete e[r.cellKey], e;
73
66
  })), v(!1);
74
- }, [n]), De = y(() => {
75
- n && (H((t) => {
67
+ }, [r]), De = y(() => {
68
+ r && (H((t) => {
76
69
  const e = { ...t };
77
- return e[n.cellKey] && delete e[n.cellKey], e;
70
+ return e[r.cellKey] && delete e[r.cellKey], e;
78
71
  }), F((t) => ({
79
72
  ...t,
80
- [n.cellKey]: {
81
- value: n.originalValue,
82
- cell: n.cellData
73
+ [r.cellKey]: {
74
+ value: r.originalValue,
75
+ cell: r.cellData
83
76
  }
84
77
  }))), v(!1);
85
- }, [n]), Ie = y(
78
+ }, [r]), Ie = y(
86
79
  (t) => {
87
80
  k(t.target.value);
88
81
  },
89
82
  []
90
83
  ), Ke = (t) => t && typeof t == "object" && "value" in t ? t.value : t, x = Y(() => {
91
- if (!w || !m.find((r) => r.id === w)) return p;
84
+ if (!w || !m.find((n) => n.id === w)) return p;
92
85
  const e = m.findIndex(
93
- (r) => r.id === w
86
+ (n) => n.id === w
94
87
  );
95
88
  if (e === -1) return p;
96
- const o = p.map((r, i) => {
89
+ const o = p.map((n, i) => {
97
90
  var h;
98
91
  const s = ((h = g[e]) == null ? void 0 : h[i]) ?? null, a = Ke(s);
99
- return { header: r, value: a };
92
+ return { header: n, value: a };
100
93
  });
101
- return o.sort((r, i) => {
102
- if (typeof r.value == "number" && typeof i.value == "number")
103
- return A ? r.value - i.value : i.value - r.value;
104
- const s = String(r.value ?? ""), a = String(i.value ?? "");
94
+ return o.sort((n, i) => {
95
+ if (typeof n.value == "number" && typeof i.value == "number")
96
+ return A ? n.value - i.value : i.value - n.value;
97
+ const s = String(n.value ?? ""), a = String(i.value ?? "");
105
98
  return A ? s.localeCompare(a) : a.localeCompare(s);
106
- }), o.map((r) => r.header);
99
+ }), o.map((n) => n.header);
107
100
  }, [p, m, g, w, A]), Me = Y(() => {
108
101
  const t = [
109
102
  {
@@ -117,7 +110,7 @@ function ut({
117
110
  const o = e.getValue();
118
111
  if (!b)
119
112
  return /* @__PURE__ */ l(D, { text: o.label, className: "w-full" });
120
- const r = w === o.id;
113
+ const n = w === o.id;
121
114
  return /* @__PURE__ */ l(
122
115
  N,
123
116
  {
@@ -126,7 +119,7 @@ function ut({
126
119
  iconLeft: "ArrowLeftRight",
127
120
  className: "text-right",
128
121
  onClick: () => {
129
- b && (r ? P((i) => !i) : ($(m[e.row.index].id), P(!0), J && J(m[e.row.index])));
122
+ b && (n ? P((i) => !i) : ($(m[e.row.index].id), P(!0), J && J(m[e.row.index])));
130
123
  },
131
124
  children: /* @__PURE__ */ l(D, { text: o.label })
132
125
  }
@@ -160,13 +153,13 @@ function ut({
160
153
  className: "w-full max-w-full min-w-0 text-center font-medium"
161
154
  }
162
155
  ),
163
- sortingFn: (o, r, i) => {
164
- let s = o.getValue(i), a = r.getValue(i);
156
+ sortingFn: (o, n, i) => {
157
+ let s = o.getValue(i), a = n.getValue(i);
165
158
  return s == null && a == null ? 0 : s == null ? 1 : a == null ? -1 : (s && typeof s == "object" && "value" in s && (s = s.value), a && typeof a == "object" && "value" in a && (a = a.value), typeof s == "number" && typeof a == "number" ? s - a : String(s).localeCompare(String(a)));
166
159
  },
167
160
  cell: (o) => {
168
- const r = o.getValue();
169
- return r ? r.render ? r.render(r.fromId, r.toId, r.id) : /* @__PURE__ */ l("div", { className: "flex h-full w-full min-w-0 items-center justify-center", children: /* @__PURE__ */ l("div", { className: "h-5 w-full max-w-full min-w-0 truncate text-center", children: r.value }) }) : null;
161
+ const n = o.getValue();
162
+ 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("div", { className: "h-5 w-full max-w-full min-w-0 truncate text-center", children: n.value }) }) : null;
170
163
  }
171
164
  });
172
165
  }), t;
@@ -180,10 +173,10 @@ function ut({
180
173
  P
181
174
  ]), Ve = Y(() => m.map((t, e) => {
182
175
  const o = { item: t };
183
- return x.forEach((r) => {
176
+ return x.forEach((n) => {
184
177
  var s;
185
- const i = p.findIndex((a) => a.id === r.id);
186
- o[r.id] = i !== -1 ? ((s = g[e]) == null ? void 0 : s[i]) ?? null : null;
178
+ const i = p.findIndex((a) => a.id === n.id);
179
+ o[n.id] = i !== -1 ? ((s = g[e]) == null ? void 0 : s[i]) ?? null : null;
187
180
  }), o;
188
181
  }), [m, x, g, p]), T = Pe({
189
182
  data: Ve,
@@ -192,6 +185,12 @@ function ut({
192
185
  onSortingChange: be,
193
186
  getCoreRowModel: qe(),
194
187
  getSortedRowModel: _e()
188
+ }), Z = Ae(null), ee = He({
189
+ count: T.getRowModel().rows.length,
190
+ getScrollElement: () => Z.current,
191
+ estimateSize: () => 40,
192
+ overscan: 5,
193
+ measureElement: typeof window < "u" ? (t) => t.getBoundingClientRect().height : void 0
195
194
  });
196
195
  if (fe)
197
196
  return /* @__PURE__ */ l(
@@ -205,69 +204,60 @@ function ut({
205
204
  cornerHeaderTo: V
206
205
  }
207
206
  );
208
- const Z = (t) => {
209
- const e = t.column.id === "cross-header", o = e, r = ["bg-d-secondary"];
210
- e || r.push("border-r"), e && r.push("sticky left-0"), r.push("sticky top-0 z-20"), o ? r.push("z-40") : e && r.push("z-30");
207
+ const te = (t) => {
208
+ const e = t.column.id === "cross-header", o = e, n = ["bg-d-secondary"];
209
+ 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");
211
210
  let i = "none";
212
211
  return e && (i = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
213
- className: r.join(" "),
212
+ className: n.join(" "),
214
213
  style: { boxShadow: i, width: `${R}px` }
215
214
  };
216
215
  };
217
- if (!g || g.length === 0)
218
- return /* @__PURE__ */ d(
219
- "div",
220
- {
221
- className: C(
222
- "flex h-full w-full flex-col overflow-auto",
223
- K ?? ""
224
- ),
225
- children: [
226
- /* @__PURE__ */ l(ce, { className: "relative w-full table-fixed border-collapse", children: /* @__PURE__ */ l(
227
- de,
228
- {
229
- className: "bg-d-secondary sticky top-0 z-20 w-full",
230
- style: { boxShadow: "0 1px 0 0 var(--d-border)" },
231
- children: (T.getHeaderGroups() ?? []).map((t) => /* @__PURE__ */ l(
232
- G,
233
- {
234
- className: "bg-d-secondary sticky top-0 z-20",
235
- children: t.headers.map((e) => {
236
- const o = Z(e);
237
- return /* @__PURE__ */ l(
238
- ue,
239
- {
240
- className: o.className,
241
- style: o.style,
242
- children: e.isPlaceholder ? null : _(
243
- e.column.columnDef.header,
244
- e.getContext()
245
- )
246
- },
247
- e.id
248
- );
249
- })
250
- },
251
- t.id
252
- ))
253
- }
254
- ) }),
255
- /* @__PURE__ */ l("div", { className: "sticky top-0 left-0 flex flex-1", children: me || pe })
256
- ]
257
- }
258
- );
259
- const ee = Ae(null), te = He({
260
- count: T.getRowModel().rows.length,
261
- getScrollElement: () => ee.current,
262
- estimateSize: () => 40,
263
- overscan: 5,
264
- measureElement: typeof window < "u" ? (t) => t.getBoundingClientRect().height : void 0
265
- });
266
- return /* @__PURE__ */ d("div", { className: `${C("w-[900px]", K || "")}`, children: [
216
+ return !g || g.length === 0 ? /* @__PURE__ */ d(
217
+ "div",
218
+ {
219
+ className: C(
220
+ "flex h-full w-full flex-col overflow-auto",
221
+ K ?? ""
222
+ ),
223
+ children: [
224
+ /* @__PURE__ */ l(ce, { className: "relative w-full table-fixed border-collapse", children: /* @__PURE__ */ l(
225
+ de,
226
+ {
227
+ className: "bg-d-secondary sticky top-0 z-20 w-full",
228
+ style: { boxShadow: "0 1px 0 0 var(--d-border)" },
229
+ children: (T.getHeaderGroups() ?? []).map((t) => /* @__PURE__ */ l(
230
+ G,
231
+ {
232
+ className: "bg-d-secondary sticky top-0 z-20",
233
+ children: t.headers.map((e) => {
234
+ const o = te(e);
235
+ return /* @__PURE__ */ l(
236
+ ue,
237
+ {
238
+ className: o.className,
239
+ style: o.style,
240
+ children: e.isPlaceholder ? null : _(
241
+ e.column.columnDef.header,
242
+ e.getContext()
243
+ )
244
+ },
245
+ e.id
246
+ );
247
+ })
248
+ },
249
+ t.id
250
+ ))
251
+ }
252
+ ) }),
253
+ /* @__PURE__ */ l("div", { className: "sticky top-0 left-0 flex flex-1", children: me || pe })
254
+ ]
255
+ }
256
+ ) : /* @__PURE__ */ d("div", { className: `${C("w-[900px]", K || "")}`, children: [
267
257
  /* @__PURE__ */ l(
268
258
  "div",
269
259
  {
270
- ref: ee,
260
+ ref: Z,
271
261
  className: "border-d-border h-fit max-h-full min-h-0 overflow-auto rounded-md border",
272
262
  children: /* @__PURE__ */ d(ce, { className: "relative w-full table-fixed border-collapse", children: [
273
263
  /* @__PURE__ */ l(
@@ -280,7 +270,7 @@ function ut({
280
270
  {
281
271
  className: "bg-d-secondary sticky top-0 z-20",
282
272
  children: t.headers.map((e) => {
283
- const o = Z(e);
273
+ const o = te(e);
284
274
  return /* @__PURE__ */ l(
285
275
  ue,
286
276
  {
@@ -303,11 +293,11 @@ function ut({
303
293
  Xe,
304
294
  {
305
295
  style: {
306
- height: `${te.getTotalSize()}px`,
296
+ height: `${ee.getTotalSize()}px`,
307
297
  position: "relative",
308
298
  width: "100%"
309
299
  },
310
- children: te.getVirtualItems().map((t) => {
300
+ children: ee.getVirtualItems().map((t) => {
311
301
  const e = T.getRowModel().rows[t.index];
312
302
  return /* @__PURE__ */ l(
313
303
  G,
@@ -322,8 +312,8 @@ function ut({
322
312
  height: `${t.size}px`,
323
313
  display: "flex"
324
314
  },
325
- children: e.getVisibleCells().map((o, r) => {
326
- const i = r === 0, s = o.getValue(), a = i ? "var(--d-secondary)" : (s == null ? void 0 : s.bgColor) || "transparent", h = s.editable ?? !0;
315
+ children: e.getVisibleCells().map((o, n) => {
316
+ const i = n === 0, s = o.getValue(), a = i ? "var(--d-secondary)" : (s == null ? void 0 : s.bgColor) || "transparent", h = s.editable ?? !0;
327
317
  return /* @__PURE__ */ l(
328
318
  Ye,
329
319
  {
@@ -351,7 +341,7 @@ function ut({
351
341
  ) : (
352
342
  // Rendering con cella modificabile
353
343
  (() => {
354
- const E = `${e.index}-${o.column.id}`, j = E in Q ? Q[E].value : s.value || "", Re = j !== s.value, ne = E in B;
344
+ const E = `${e.index}-${o.column.id}`, j = E in Q ? Q[E].value : s.value || "", Re = j !== s.value, re = E in B;
355
345
  return /* @__PURE__ */ l(
356
346
  "div",
357
347
  {
@@ -369,14 +359,14 @@ function ut({
369
359
  }), k(j), v(!0);
370
360
  },
371
361
  children: /* @__PURE__ */ d("div", { className: "relative flex h-full max-h-full w-full max-w-full items-center justify-center gap-1", children: [
372
- Re && !ne && /* @__PURE__ */ l(
362
+ Re && !re && /* @__PURE__ */ l(
373
363
  "div",
374
364
  {
375
365
  className: "bg-d-primary absolute -top-1.5 -left-1.5 rounded p-1",
376
366
  title: "Valore modificato"
377
367
  }
378
368
  ),
379
- ne && /* @__PURE__ */ l(
369
+ re && /* @__PURE__ */ l(
380
370
  "div",
381
371
  {
382
372
  className: "bg-d-destructive absolute -top-1.5 -left-1.5 rounded p-1",
@@ -431,14 +421,14 @@ function ut({
431
421
  sideOffset: 5,
432
422
  style: {
433
423
  position: "absolute",
434
- top: ((le = n == null ? void 0 : n.position) == null ? void 0 : le.top) ?? 0,
435
- left: ((re = n == null ? void 0 : n.position) == null ? void 0 : re.left) ?? 0,
424
+ top: ((le = r == null ? void 0 : r.position) == null ? void 0 : le.top) ?? 0,
425
+ left: ((ne = r == null ? void 0 : r.position) == null ? void 0 : ne.left) ?? 0,
436
426
  zIndex: 50
437
427
  },
438
428
  children: /* @__PURE__ */ d("div", { className: "space-y-4", children: [
439
429
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
440
430
  /* @__PURE__ */ l("div", { className: "font-medium", children: "Modifica valore" }),
441
- n && n.value !== n.originalValue && /* @__PURE__ */ l("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
431
+ r && r.value !== r.originalValue && /* @__PURE__ */ l("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
442
432
  ] }),
443
433
  /* @__PURE__ */ l(
444
434
  "input",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.1.67",
4
+ "version": "0.1.69",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",