laif-ds 0.2.22 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.js +3 -5
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index4.js +5 -3
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -5
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/alert-dialog.js +6 -6
- package/dist/components/ui/app-multiple-select-dropdown.js +34 -34
- package/dist/components/ui/app-select.js +127 -124
- package/dist/components/ui/badge.js +13 -12
- package/dist/components/ui/button.js +20 -18
- package/dist/components/ui/calendar.js +6 -6
- package/dist/components/ui/checkbox.js +9 -9
- package/dist/components/ui/confirmer.js +45 -19
- package/dist/components/ui/context-menu.js +4 -4
- package/dist/components/ui/input-otp.js +16 -16
- package/dist/components/ui/input-selector.js +19 -19
- package/dist/components/ui/input.js +19 -19
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/pagination.js +90 -77
- package/dist/components/ui/radio-group.js +14 -14
- package/dist/components/ui/select.js +27 -27
- package/dist/components/ui/switch.js +8 -6
- package/dist/components/ui/table.js +16 -16
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +6 -6
- package/dist/components/ui/tables/data-table/components/data-table-actions.js +51 -0
- package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +470 -0
- package/dist/components/ui/tables/data-table/components/data-table-body.js +340 -0
- package/dist/components/ui/tables/data-table/components/data-table-column-visibility.js +274 -0
- package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +177 -0
- package/dist/components/ui/tables/data-table/components/data-table-filters.js +286 -0
- package/dist/components/ui/tables/data-table/components/data-table-pagination.js +131 -0
- package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +112 -0
- package/dist/components/ui/tables/data-table/components/data-table-simple-filters.js +263 -0
- package/dist/components/ui/tables/data-table/components/data-table-sorting.js +128 -0
- package/dist/components/ui/tables/data-table/data-table-constants.js +58 -0
- package/dist/components/ui/tables/data-table/data-table-i18n.js +138 -0
- package/dist/components/ui/tables/data-table/data-table.js +549 -0
- package/dist/components/ui/tables/data-table/data-table.service.js +254 -0
- package/dist/components/ui/tabs.js +33 -33
- package/dist/components/ui/textarea.js +18 -15
- package/dist/components/ui/tooltip.js +10 -10
- package/dist/css-for-template.css +57 -0
- package/dist/index.d.ts +247 -76
- package/dist/index.js +64 -64
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +5 -3
- package/dist/components/ui/data-table.js +0 -461
- package/dist/components/ui/data-table.service.js +0 -62
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
3
|
-
import { useReactTable as ce, flexRender as G } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
-
import { useRef as v, useState as u, useMemo as se, useEffect as z } from "react";
|
|
5
|
-
import { cn as de } from "../../lib/utils.js";
|
|
6
|
-
import { createCustomFilterFns as re, ELogicalFilterOperator as ue, debounce as me, createMultiValueFilterFn as fe, updatePageSizeFromContainer as he } from "./data-table.service.js";
|
|
7
|
-
import { Pagination as pe, PaginationContent as xe, PaginationItem as w, PaginationFirst as be, PaginationPrevious as Ce, PaginationLink as we, PaginationNext as Pe, PaginationLast as Se } from "./pagination.js";
|
|
8
|
-
import { Checkbox as E } from "./checkbox.js";
|
|
9
|
-
import { Input as Ie } from "./input.js";
|
|
10
|
-
import { ScrollArea as W, ScrollBar as F } from "./scroll-area.js";
|
|
11
|
-
import { AppMultipleSelectDropdown as ze } from "./app-multiple-select-dropdown.js";
|
|
12
|
-
import { Table as Re, TableHeader as Ne, TableRow as R, TableHead as Me, TableBody as ye, TableCell as H } from "./table.js";
|
|
13
|
-
import { Skeleton as ke } from "./skeleton.js";
|
|
14
|
-
import { getPaginationRowModel as Fe, getFilteredRowModel as He, getSortedRowModel as De, getCoreRowModel as Ve } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
15
|
-
function Ue({
|
|
16
|
-
columns: P,
|
|
17
|
-
data: D,
|
|
18
|
-
loading: J = !1,
|
|
19
|
-
emptyComponent: _,
|
|
20
|
-
className: K,
|
|
21
|
-
rowSelection: q = {},
|
|
22
|
-
onRowSelectionChange: V,
|
|
23
|
-
checkable: S = !1,
|
|
24
|
-
onCheckedRowsChange: N,
|
|
25
|
-
notFoundMessage: Q = "Nessun risultato trovato.",
|
|
26
|
-
searchBar: m = void 0,
|
|
27
|
-
dropdownFilters: r = void 0,
|
|
28
|
-
totalItems: M = void 0,
|
|
29
|
-
datatableSizes: p = {
|
|
30
|
-
rowHeight: 32.5,
|
|
31
|
-
// default table row height in pixels
|
|
32
|
-
headerHeight: 40,
|
|
33
|
-
// default table header height in pixels
|
|
34
|
-
containerHeight: 600
|
|
35
|
-
// default container height in pixels
|
|
36
|
-
},
|
|
37
|
-
paginationPlaceholders: x = void 0,
|
|
38
|
-
serverOptions: g = void 0,
|
|
39
|
-
setServerOptions: c = void 0
|
|
40
|
-
}) {
|
|
41
|
-
const y = v(null), A = v(void 0), [U, X] = u([]), [Y, Z] = u([]), [B, O] = u({}), [C, ee] = u(""), [b, k] = u({
|
|
42
|
-
pageIndex: 0,
|
|
43
|
-
pageSize: 10
|
|
44
|
-
}), [te, j] = u(0), [ne, ie] = u({}), L = V ? q : ne, ae = V || ie, [I, le] = u({}), s = !!g, oe = se(() => S ? [
|
|
45
|
-
{
|
|
46
|
-
id: "select",
|
|
47
|
-
header: ({ table: e }) => /* @__PURE__ */ n(
|
|
48
|
-
E,
|
|
49
|
-
{
|
|
50
|
-
checked: e.getIsAllPageRowsSelected(),
|
|
51
|
-
onCheckedChange: (t) => e.toggleAllPageRowsSelected(!!t),
|
|
52
|
-
"aria-label": "Seleziona tutti"
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
cell: ({ row: e }) => /* @__PURE__ */ n("div", { className: "text-center", children: /* @__PURE__ */ n(
|
|
56
|
-
E,
|
|
57
|
-
{
|
|
58
|
-
checked: e.getIsSelected(),
|
|
59
|
-
onCheckedChange: (t) => e.toggleSelected(!!t),
|
|
60
|
-
"aria-label": "Seleziona riga"
|
|
61
|
-
}
|
|
62
|
-
) }),
|
|
63
|
-
enableSorting: !1,
|
|
64
|
-
enableHiding: !1
|
|
65
|
-
},
|
|
66
|
-
...P
|
|
67
|
-
] : P, [P, S]).map((e) => {
|
|
68
|
-
const t = r?.find(
|
|
69
|
-
(i) => i.column === e?.accessorKey
|
|
70
|
-
);
|
|
71
|
-
return {
|
|
72
|
-
...e,
|
|
73
|
-
filterFn: t?.filterFn ? t.column : "multiValue"
|
|
74
|
-
};
|
|
75
|
-
}), ge = {
|
|
76
|
-
data: D,
|
|
77
|
-
columns: oe,
|
|
78
|
-
getCoreRowModel: Ve(),
|
|
79
|
-
onSortingChange: X,
|
|
80
|
-
getSortedRowModel: De(),
|
|
81
|
-
onColumnVisibilityChange: O,
|
|
82
|
-
onRowSelectionChange: ae,
|
|
83
|
-
getFilteredRowModel: He(),
|
|
84
|
-
globalFilterFn: (e, t, i) => s || !i ? !0 : m?.columns.some((o) => {
|
|
85
|
-
const l = e.getValue(o);
|
|
86
|
-
return String(l).toLowerCase().includes(i.toLowerCase());
|
|
87
|
-
}) ?? !1,
|
|
88
|
-
filterFns: {
|
|
89
|
-
multiValue: (e, t, i) => fe(
|
|
90
|
-
e,
|
|
91
|
-
t,
|
|
92
|
-
i,
|
|
93
|
-
r,
|
|
94
|
-
g
|
|
95
|
-
),
|
|
96
|
-
...re(r ?? [], g)
|
|
97
|
-
},
|
|
98
|
-
onPaginationChange: (e) => {
|
|
99
|
-
s ? typeof e == "object" && c && c?.((t) => ({
|
|
100
|
-
...t,
|
|
101
|
-
pagination: g.disableAutoPageSize ? {
|
|
102
|
-
...t.pagination,
|
|
103
|
-
pageIndex: e.pageIndex
|
|
104
|
-
} : {
|
|
105
|
-
...t.pagination,
|
|
106
|
-
pageIndex: e.pageIndex,
|
|
107
|
-
pageSize: e.pageSize
|
|
108
|
-
}
|
|
109
|
-
})) : k(e);
|
|
110
|
-
},
|
|
111
|
-
getPaginationRowModel: Fe(),
|
|
112
|
-
manualPagination: s,
|
|
113
|
-
pageCount: te,
|
|
114
|
-
state: {
|
|
115
|
-
sorting: U,
|
|
116
|
-
columnFilters: Y,
|
|
117
|
-
columnVisibility: B,
|
|
118
|
-
rowSelection: L,
|
|
119
|
-
globalFilter: C,
|
|
120
|
-
pagination: g?.pagination ?? b
|
|
121
|
-
}
|
|
122
|
-
}, a = ce(ge);
|
|
123
|
-
z(() => {
|
|
124
|
-
let e;
|
|
125
|
-
if (m && C && (e || (e = {}), e.searchbarFilters = {
|
|
126
|
-
value: C,
|
|
127
|
-
columns: m.columns
|
|
128
|
-
}), r && Object.keys(I).length > 0) {
|
|
129
|
-
const l = {};
|
|
130
|
-
for (const d of r) {
|
|
131
|
-
const f = I[d.column];
|
|
132
|
-
f && f.length > 0 && (l[d.column] = {
|
|
133
|
-
column: d.column,
|
|
134
|
-
value: f,
|
|
135
|
-
logic: d.innerFiltersMode || ue.OR
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
Object.keys(l).length > 0 && (e || (e = {}), e.dropdownFilters = l);
|
|
139
|
-
}
|
|
140
|
-
const t = A.current, i = e;
|
|
141
|
-
JSON.stringify(t ?? {}) !== JSON.stringify(i ?? {}) && c && (A.current = i, c((l) => ({
|
|
142
|
-
...l,
|
|
143
|
-
pagination: {
|
|
144
|
-
pageIndex: 0,
|
|
145
|
-
pageSize: g?.pagination.pageSize ?? 10
|
|
146
|
-
},
|
|
147
|
-
filters: i
|
|
148
|
-
})));
|
|
149
|
-
}, [
|
|
150
|
-
r,
|
|
151
|
-
I,
|
|
152
|
-
m,
|
|
153
|
-
C,
|
|
154
|
-
g,
|
|
155
|
-
c
|
|
156
|
-
]);
|
|
157
|
-
const T = a.getFilteredRowModel();
|
|
158
|
-
return z(() => {
|
|
159
|
-
if (s)
|
|
160
|
-
j(
|
|
161
|
-
Math.ceil(
|
|
162
|
-
(M ?? 0) / (g.pagination?.pageSize || b.pageSize || 10)
|
|
163
|
-
)
|
|
164
|
-
);
|
|
165
|
-
else {
|
|
166
|
-
const e = T.rows.length;
|
|
167
|
-
j(Math.ceil(e / b.pageSize));
|
|
168
|
-
}
|
|
169
|
-
}, [
|
|
170
|
-
s,
|
|
171
|
-
M,
|
|
172
|
-
g?.pagination.pageSize,
|
|
173
|
-
g?.pagination.pageIndex,
|
|
174
|
-
a,
|
|
175
|
-
T,
|
|
176
|
-
b.pageSize
|
|
177
|
-
]), z(() => {
|
|
178
|
-
const e = me(() => {
|
|
179
|
-
const t = y.current;
|
|
180
|
-
t && he(t, {
|
|
181
|
-
rowHeight: p.rowHeight,
|
|
182
|
-
headerHeight: p.headerHeight,
|
|
183
|
-
containerHeight: p.containerHeight,
|
|
184
|
-
onPageChange: s ? (i, o) => {
|
|
185
|
-
c?.((l) => ({
|
|
186
|
-
...l,
|
|
187
|
-
pagination: g.disableAutoPageSize ? {
|
|
188
|
-
...l.pagination,
|
|
189
|
-
pageIndex: i
|
|
190
|
-
} : {
|
|
191
|
-
...l.pagination,
|
|
192
|
-
pageIndex: i,
|
|
193
|
-
pageSize: o
|
|
194
|
-
}
|
|
195
|
-
}));
|
|
196
|
-
} : (i, o) => {
|
|
197
|
-
k({ pageIndex: i, pageSize: o });
|
|
198
|
-
},
|
|
199
|
-
setPagination: (i) => {
|
|
200
|
-
const o = typeof i == "function" ? i({ pageIndex: 0, pageSize: 10 }) : i;
|
|
201
|
-
s ? c?.((l) => ({
|
|
202
|
-
...l,
|
|
203
|
-
pagination: g.disableAutoPageSize ? {
|
|
204
|
-
...l.pagination,
|
|
205
|
-
pageIndex: o.pageIndex
|
|
206
|
-
} : {
|
|
207
|
-
...l.pagination,
|
|
208
|
-
pageIndex: o.pageIndex,
|
|
209
|
-
pageSize: o.pageSize
|
|
210
|
-
}
|
|
211
|
-
})) : k({
|
|
212
|
-
pageIndex: o.pageIndex,
|
|
213
|
-
pageSize: o.pageSize
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}, 200);
|
|
218
|
-
return e(), window.addEventListener("resize", e), () => {
|
|
219
|
-
window.removeEventListener("resize", e);
|
|
220
|
-
};
|
|
221
|
-
}, [
|
|
222
|
-
s,
|
|
223
|
-
p.containerHeight,
|
|
224
|
-
p.headerHeight,
|
|
225
|
-
p.rowHeight,
|
|
226
|
-
y,
|
|
227
|
-
c
|
|
228
|
-
// should be stable, but include for clarity
|
|
229
|
-
]), z(() => {
|
|
230
|
-
if (N && S) {
|
|
231
|
-
const e = a.getFilteredSelectedRowModel().rows.map((t) => t.original);
|
|
232
|
-
N(e);
|
|
233
|
-
}
|
|
234
|
-
}, [a, N, S, L]), /* @__PURE__ */ h(
|
|
235
|
-
"div",
|
|
236
|
-
{
|
|
237
|
-
className: de(
|
|
238
|
-
"flex h-full max-h-full min-h-0 w-full max-w-full flex-col gap-2",
|
|
239
|
-
K
|
|
240
|
-
),
|
|
241
|
-
children: [
|
|
242
|
-
(m || r?.length) && /* @__PURE__ */ h("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
|
|
243
|
-
m && /* @__PURE__ */ n(
|
|
244
|
-
Ie,
|
|
245
|
-
{
|
|
246
|
-
iconLeft: "Search",
|
|
247
|
-
placeholder: m.placeholder ?? "Cerca...",
|
|
248
|
-
value: C,
|
|
249
|
-
onChange: (e) => {
|
|
250
|
-
ee(e.target.value);
|
|
251
|
-
},
|
|
252
|
-
className: "w-60"
|
|
253
|
-
}
|
|
254
|
-
),
|
|
255
|
-
/* @__PURE__ */ n("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: r && r.length > 0 && /* @__PURE__ */ h(W, { className: "h-full w-full", children: [
|
|
256
|
-
/* @__PURE__ */ n(F, { orientation: "horizontal" }),
|
|
257
|
-
/* @__PURE__ */ n("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 p-0.5 sm:justify-end", children: r.map((e, t) => {
|
|
258
|
-
const i = I[e.column] ?? [];
|
|
259
|
-
return /* @__PURE__ */ n(
|
|
260
|
-
ze,
|
|
261
|
-
{
|
|
262
|
-
className: "w-60",
|
|
263
|
-
options: e.items,
|
|
264
|
-
value: i,
|
|
265
|
-
placeholder: e.placeholder,
|
|
266
|
-
label: e.label,
|
|
267
|
-
onChange: (o) => {
|
|
268
|
-
le((l) => ({
|
|
269
|
-
...l,
|
|
270
|
-
[e.column]: o
|
|
271
|
-
})), Z((l) => {
|
|
272
|
-
const d = l.filter(
|
|
273
|
-
(f) => f.id !== e.column
|
|
274
|
-
);
|
|
275
|
-
return o.length === 0 ? d : [
|
|
276
|
-
...d,
|
|
277
|
-
{ id: e.column, value: o }
|
|
278
|
-
];
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
t
|
|
283
|
-
);
|
|
284
|
-
}) })
|
|
285
|
-
] }) })
|
|
286
|
-
] }),
|
|
287
|
-
/* @__PURE__ */ n(
|
|
288
|
-
"div",
|
|
289
|
-
{
|
|
290
|
-
className: "flex max-h-full min-h-0 max-w-full min-w-0 flex-1",
|
|
291
|
-
ref: y,
|
|
292
|
-
children: /* @__PURE__ */ h(W, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
|
|
293
|
-
/* @__PURE__ */ n(F, { orientation: "horizontal" }),
|
|
294
|
-
/* @__PURE__ */ n(F, { orientation: "vertical" }),
|
|
295
|
-
/* @__PURE__ */ h(Re, { children: [
|
|
296
|
-
/* @__PURE__ */ n(Ne, { children: a.getHeaderGroups().map((e) => /* @__PURE__ */ n(R, { children: e.headers.map((t) => /* @__PURE__ */ n(
|
|
297
|
-
Me,
|
|
298
|
-
{
|
|
299
|
-
className: `bg-d-secondary sticky top-0 z-10 ${t.column.columnDef.sticky ? "left-0" : ""}`,
|
|
300
|
-
children: t.isPlaceholder ? null : G(
|
|
301
|
-
t.column.columnDef.header,
|
|
302
|
-
t.getContext()
|
|
303
|
-
)
|
|
304
|
-
},
|
|
305
|
-
t.id
|
|
306
|
-
)) }, e.id)) }),
|
|
307
|
-
/* @__PURE__ */ n(ye, { children: J ? Array.from({ length: D.length || 8 }).map((e, t) => /* @__PURE__ */ n(R, { children: a.getHeaderGroups()[0].headers.map((i, o) => /* @__PURE__ */ n(
|
|
308
|
-
H,
|
|
309
|
-
{
|
|
310
|
-
className: `w-full ${i.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
|
|
311
|
-
children: /* @__PURE__ */ n(ke, { className: "h-6 w-full" })
|
|
312
|
-
},
|
|
313
|
-
`skeleton-cell-${t}-${o}`
|
|
314
|
-
)) }, `skeleton-row-${t}`)) : a.getRowModel().rows?.length ? a.getRowModel().rows.map((e) => /* @__PURE__ */ n(
|
|
315
|
-
R,
|
|
316
|
-
{
|
|
317
|
-
"data-state": e.getIsSelected() && "selected",
|
|
318
|
-
children: e.getVisibleCells().map((t) => /* @__PURE__ */ n(
|
|
319
|
-
H,
|
|
320
|
-
{
|
|
321
|
-
className: `${t.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
|
|
322
|
-
children: G(
|
|
323
|
-
t.column.columnDef.cell,
|
|
324
|
-
t.getContext()
|
|
325
|
-
)
|
|
326
|
-
},
|
|
327
|
-
t.id
|
|
328
|
-
))
|
|
329
|
-
},
|
|
330
|
-
e.id
|
|
331
|
-
)) : /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
|
|
332
|
-
H,
|
|
333
|
-
{
|
|
334
|
-
colSpan: P.length,
|
|
335
|
-
className: "pt-4 text-center",
|
|
336
|
-
children: _ || Q
|
|
337
|
-
}
|
|
338
|
-
) }) })
|
|
339
|
-
] })
|
|
340
|
-
] })
|
|
341
|
-
}
|
|
342
|
-
),
|
|
343
|
-
/* @__PURE__ */ h(pe, { className: "h-9", children: [
|
|
344
|
-
/* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-center align-middle", children: /* @__PURE__ */ n("div", { className: "text-d-foreground hidden text-sm md:flex", children: Math.min(
|
|
345
|
-
g?.pagination?.pageSize ?? b.pageSize,
|
|
346
|
-
a.getFilteredRowModel().rows.length ?? 9999
|
|
347
|
-
) + " / " + (g ? M ?? "missing totalItems" : a.getFilteredRowModel().rows.length) + " " + (x?.rows ?? "Righe") }) }),
|
|
348
|
-
/* @__PURE__ */ h(xe, { children: [
|
|
349
|
-
/* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
|
|
350
|
-
be,
|
|
351
|
-
{
|
|
352
|
-
size: "sm",
|
|
353
|
-
isDisabled: !a.getCanPreviousPage(),
|
|
354
|
-
label: x?.first,
|
|
355
|
-
onClick: () => {
|
|
356
|
-
s ? c?.((e) => ({
|
|
357
|
-
...e,
|
|
358
|
-
pagination: {
|
|
359
|
-
...e.pagination,
|
|
360
|
-
pageIndex: 0
|
|
361
|
-
}
|
|
362
|
-
})) : a.setPageIndex(0);
|
|
363
|
-
},
|
|
364
|
-
"aria-label": "Go to first page"
|
|
365
|
-
}
|
|
366
|
-
) }),
|
|
367
|
-
/* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
|
|
368
|
-
Ce,
|
|
369
|
-
{
|
|
370
|
-
size: "sm",
|
|
371
|
-
isDisabled: !a.getCanPreviousPage(),
|
|
372
|
-
label: x?.previous,
|
|
373
|
-
onClick: () => {
|
|
374
|
-
if (a.getCanPreviousPage())
|
|
375
|
-
if (s) {
|
|
376
|
-
const e = g?.pagination.pageIndex ?? b.pageIndex, t = Math.max(e - 1, 0);
|
|
377
|
-
c?.((i) => ({
|
|
378
|
-
...i,
|
|
379
|
-
pagination: {
|
|
380
|
-
...i.pagination,
|
|
381
|
-
pageIndex: t
|
|
382
|
-
}
|
|
383
|
-
}));
|
|
384
|
-
} else
|
|
385
|
-
a.previousPage();
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
) }),
|
|
389
|
-
(() => {
|
|
390
|
-
const e = a.getState().pagination.pageIndex, t = a.getPageCount(), i = 5;
|
|
391
|
-
let o = Math.max(
|
|
392
|
-
0,
|
|
393
|
-
e - Math.floor(i / 2)
|
|
394
|
-
), l = o + i;
|
|
395
|
-
return l > t && (l = t, o = Math.max(0, l - i)), a.getPageOptions().slice(o, l).map((d, f) => /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
|
|
396
|
-
we,
|
|
397
|
-
{
|
|
398
|
-
size: "icon",
|
|
399
|
-
isActive: e === d,
|
|
400
|
-
onClick: () => {
|
|
401
|
-
if (s) {
|
|
402
|
-
if (e === d) return;
|
|
403
|
-
c?.(($) => ({
|
|
404
|
-
...$,
|
|
405
|
-
pagination: {
|
|
406
|
-
...$.pagination,
|
|
407
|
-
pageIndex: d
|
|
408
|
-
}
|
|
409
|
-
}));
|
|
410
|
-
} else
|
|
411
|
-
a.setPageIndex(d);
|
|
412
|
-
},
|
|
413
|
-
children: d + 1
|
|
414
|
-
}
|
|
415
|
-
) }, f));
|
|
416
|
-
})(),
|
|
417
|
-
/* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
|
|
418
|
-
Pe,
|
|
419
|
-
{
|
|
420
|
-
size: "sm",
|
|
421
|
-
isDisabled: !a.getCanNextPage(),
|
|
422
|
-
label: x?.next,
|
|
423
|
-
onClick: () => {
|
|
424
|
-
a.getCanNextPage() && (s ? c?.((e) => ({
|
|
425
|
-
...e,
|
|
426
|
-
pagination: {
|
|
427
|
-
...e.pagination,
|
|
428
|
-
pageIndex: e.pagination.pageIndex + 1
|
|
429
|
-
}
|
|
430
|
-
})) : a.nextPage());
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
) }),
|
|
434
|
-
/* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
|
|
435
|
-
Se,
|
|
436
|
-
{
|
|
437
|
-
size: "sm",
|
|
438
|
-
isDisabled: !a.getCanNextPage(),
|
|
439
|
-
label: x?.last,
|
|
440
|
-
onClick: () => {
|
|
441
|
-
s ? c?.((e) => ({
|
|
442
|
-
...e,
|
|
443
|
-
pagination: {
|
|
444
|
-
...e.pagination,
|
|
445
|
-
pageIndex: a.getPageCount() - 1
|
|
446
|
-
}
|
|
447
|
-
})) : a.setPageIndex(a.getPageCount() - 1);
|
|
448
|
-
},
|
|
449
|
-
"aria-label": "Go to last page"
|
|
450
|
-
}
|
|
451
|
-
) })
|
|
452
|
-
] }),
|
|
453
|
-
/* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-center justify-end align-middle", children: /* @__PURE__ */ n("div", { className: "text-d-foreground hidden text-sm md:flex", children: (a.getPageCount() ? a.getState().pagination.pageIndex + 1 : 0) + " / " + a.getPageCount() + " " + (x?.pages ?? "Pagine") }) })
|
|
454
|
-
] })
|
|
455
|
-
]
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
export {
|
|
460
|
-
Ue as DataTable
|
|
461
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var f = /* @__PURE__ */ ((n) => (n.AND = "AND", n.OR = "OR", n))(f || {});
|
|
3
|
-
function d(n, o, t, r, c) {
|
|
4
|
-
const i = n.getValue(o), u = r?.find((e) => e.column === o)?.innerFiltersMode ?? "OR";
|
|
5
|
-
if (c) return !0;
|
|
6
|
-
if (Array.isArray(i))
|
|
7
|
-
return u === "AND" ? t.every((e) => i.includes(e)) : t.some((e) => i.includes(e));
|
|
8
|
-
switch (u) {
|
|
9
|
-
case "AND":
|
|
10
|
-
return t.every((e) => String(i) === e);
|
|
11
|
-
case "OR":
|
|
12
|
-
default:
|
|
13
|
-
return t.some((e) => String(i) === e);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function m(n, o) {
|
|
17
|
-
return n.reduce(
|
|
18
|
-
(t, r) => (r.filterFn && (t[r.column] = (c, i, a) => {
|
|
19
|
-
if (o) return !0;
|
|
20
|
-
const u = c.getValue(i);
|
|
21
|
-
switch (r.innerFiltersMode ?? "OR") {
|
|
22
|
-
case "AND":
|
|
23
|
-
return a.every(
|
|
24
|
-
(s) => r.filterFn(u, [s])
|
|
25
|
-
);
|
|
26
|
-
case "OR":
|
|
27
|
-
default:
|
|
28
|
-
return a.some(
|
|
29
|
-
(s) => r.filterFn(u, [s])
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}), t),
|
|
33
|
-
{}
|
|
34
|
-
) || {};
|
|
35
|
-
}
|
|
36
|
-
function h(n, o) {
|
|
37
|
-
const {
|
|
38
|
-
rowHeight: t = 1,
|
|
39
|
-
headerHeight: r = 1,
|
|
40
|
-
containerHeight: c = 1,
|
|
41
|
-
onPageChange: i,
|
|
42
|
-
setPagination: a
|
|
43
|
-
} = o, u = n?.offsetHeight || c, e = Math.floor(
|
|
44
|
-
(u - r) / t
|
|
45
|
-
), s = e > 1 ? e : 1;
|
|
46
|
-
a((g) => g.pageSize !== s ? (i && i(0, s), { ...g, pageSize: s }) : g);
|
|
47
|
-
}
|
|
48
|
-
function l(n, o) {
|
|
49
|
-
let t;
|
|
50
|
-
return function(...r) {
|
|
51
|
-
clearTimeout(t), t = setTimeout(() => {
|
|
52
|
-
n(...r);
|
|
53
|
-
}, o);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
f as ELogicalFilterOperator,
|
|
58
|
-
m as createCustomFilterFns,
|
|
59
|
-
d as createMultiValueFilterFn,
|
|
60
|
-
l as debounce,
|
|
61
|
-
h as updatePageSizeFromContainer
|
|
62
|
-
};
|