laif-ds 0.1.29 → 0.1.31
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/components/ui/app-multiple-select-dropdown.js +77 -69
- package/dist/components/ui/data-cross-table.js +145 -172
- package/dist/components/ui/dropdown-menu.js +131 -0
- package/dist/components/ui/table.js +3 -10
- package/dist/index.d.ts +18 -3
- package/dist/index.js +168 -161
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +217 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +138 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +625 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +221 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +184 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,87 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as l, Fragment as
|
|
2
|
+
import { jsx as r, jsxs as l, Fragment as R } from "react/jsx-runtime";
|
|
3
3
|
import * as a from "react";
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { Badge as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { Command as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
import { useEffect as A } from "react";
|
|
5
|
+
import { cn as N } from "../../lib/utils.js";
|
|
6
|
+
import { Label as B } from "./label.js";
|
|
7
|
+
import { Badge as D } from "./badge.js";
|
|
8
|
+
import { Button as p } from "./button.js";
|
|
9
|
+
import { Command as F, CommandList as P, CommandEmpty as G, CommandGroup as X, CommandItem as q } from "./command.js";
|
|
10
|
+
import { Input as H } from "./input.js";
|
|
11
|
+
import { Checkbox as I } from "./checkbox.js";
|
|
12
|
+
import J from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
13
|
+
import K from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
14
|
+
import Q from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
15
|
+
const T = a.createContext({ size: "default" });
|
|
16
|
+
function ne({
|
|
17
|
+
options: o,
|
|
16
18
|
value: t,
|
|
17
|
-
onChange:
|
|
19
|
+
onChange: i,
|
|
18
20
|
placeholder: C = "Seleziona...",
|
|
19
21
|
disabled: k = !1,
|
|
20
|
-
size:
|
|
22
|
+
size: d = "default",
|
|
21
23
|
label: g,
|
|
22
|
-
labelClassName:
|
|
23
|
-
emptyMessage:
|
|
24
|
-
className:
|
|
24
|
+
labelClassName: y,
|
|
25
|
+
emptyMessage: L = "Nessun risultato trovato",
|
|
26
|
+
className: M,
|
|
25
27
|
filterPlaceholder: z = "Cerca...",
|
|
26
28
|
cancelLabel: E = "Cancella selezione",
|
|
27
29
|
cancelButtonLabel: O = "Cancella",
|
|
28
30
|
maxSelectedItems: s
|
|
29
31
|
}) {
|
|
30
|
-
const f = a.useId(), [
|
|
31
|
-
|
|
32
|
+
const f = a.useId(), [c, b] = a.useState(!1), [m, v] = a.useState(""), h = a.useRef(null);
|
|
33
|
+
A(() => {
|
|
32
34
|
const e = (n) => {
|
|
33
|
-
|
|
35
|
+
h.current && !h.current.contains(n.target) && c && b(!1);
|
|
34
36
|
};
|
|
35
37
|
return document.addEventListener("mousedown", e), () => {
|
|
36
38
|
document.removeEventListener("mousedown", e);
|
|
37
39
|
};
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
40
|
+
}, [c]);
|
|
41
|
+
const S = a.useCallback((e) => {
|
|
40
42
|
if (t.includes(e))
|
|
41
|
-
|
|
43
|
+
i(t.filter((n) => n !== e));
|
|
42
44
|
else {
|
|
43
45
|
if (s && t.length >= s)
|
|
44
46
|
return;
|
|
45
|
-
|
|
47
|
+
i([...t, e]);
|
|
46
48
|
}
|
|
47
|
-
}, [t,
|
|
48
|
-
|
|
49
|
-
}, [
|
|
49
|
+
}, [t, i, s]), w = a.useCallback(() => {
|
|
50
|
+
i([]), v("");
|
|
51
|
+
}, [i]), u = a.useMemo(() => o.filter((e) => t.includes(e.value)), [o, t]), j = a.useMemo(() => m ? o.filter(
|
|
50
52
|
(e) => e.label.toLowerCase().includes(m.toLowerCase())
|
|
51
|
-
) :
|
|
52
|
-
return /* @__PURE__ */ r(
|
|
53
|
+
) : o, [o, m]), x = a.useMemo(() => s ? t.length >= s : !1, [t, s]);
|
|
54
|
+
return /* @__PURE__ */ r(T.Provider, { value: { size: d, id: f }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
53
55
|
g && /* @__PURE__ */ r(
|
|
54
|
-
|
|
56
|
+
B,
|
|
55
57
|
{
|
|
56
58
|
htmlFor: f,
|
|
57
|
-
className:
|
|
59
|
+
className: y,
|
|
58
60
|
children: g
|
|
59
61
|
}
|
|
60
62
|
),
|
|
61
|
-
/* @__PURE__ */ l("div", { ref:
|
|
63
|
+
/* @__PURE__ */ l("div", { ref: h, className: "relative w-full", "data-slot": "app-multiple-select-dropdown", children: [
|
|
62
64
|
/* @__PURE__ */ l(
|
|
63
|
-
|
|
65
|
+
p,
|
|
64
66
|
{
|
|
65
67
|
id: f,
|
|
66
68
|
type: "button",
|
|
67
69
|
variant: "outline",
|
|
68
70
|
role: "combobox",
|
|
69
|
-
"aria-expanded":
|
|
71
|
+
"aria-expanded": c,
|
|
70
72
|
disabled: k,
|
|
71
|
-
className:
|
|
73
|
+
className: N(
|
|
72
74
|
"relative w-full justify-between font-normal border",
|
|
73
75
|
"flex items-center whitespace-nowrap rounded-md border border-d-input bg-transparent shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
74
76
|
"aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
d === "default" && "h-9 px-3 py-2 text-sm",
|
|
78
|
+
d === "sm" && "h-8 px-2 py-1 text-xs",
|
|
79
|
+
d === "lg" && "h-10 px-4 py-2 text-lg",
|
|
80
|
+
M
|
|
79
81
|
),
|
|
80
|
-
onClick: () =>
|
|
82
|
+
onClick: () => b(!c),
|
|
81
83
|
children: [
|
|
82
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 w-full overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(
|
|
84
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 w-full overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(R, { children: [
|
|
83
85
|
/* @__PURE__ */ l(
|
|
84
|
-
|
|
86
|
+
D,
|
|
85
87
|
{
|
|
86
88
|
variant: "secondary",
|
|
87
89
|
className: "flex items-center gap-1",
|
|
@@ -92,68 +94,74 @@ function te({
|
|
|
92
94
|
}
|
|
93
95
|
),
|
|
94
96
|
/* @__PURE__ */ l(
|
|
95
|
-
|
|
97
|
+
p,
|
|
96
98
|
{
|
|
97
99
|
variant: "ghost",
|
|
98
100
|
size: "sm",
|
|
99
101
|
className: "h-5 w-5 p-0 hover:bg-d-secondary/20 rounded-full",
|
|
100
102
|
onClick: (e) => {
|
|
101
|
-
e.stopPropagation(),
|
|
103
|
+
e.stopPropagation(), w();
|
|
102
104
|
},
|
|
103
105
|
children: [
|
|
104
|
-
/* @__PURE__ */ r(
|
|
106
|
+
/* @__PURE__ */ r(J, { className: "h-3 w-3" }),
|
|
105
107
|
/* @__PURE__ */ r("span", { className: "sr-only", children: E })
|
|
106
108
|
]
|
|
107
109
|
}
|
|
108
110
|
)
|
|
109
111
|
] }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: C }) }),
|
|
110
|
-
/* @__PURE__ */ r(
|
|
112
|
+
/* @__PURE__ */ r(K, { className: "h-4 w-4 opacity-50 shrink-0 ml-1" })
|
|
111
113
|
]
|
|
112
114
|
}
|
|
113
115
|
),
|
|
114
|
-
|
|
115
|
-
/* @__PURE__ */ l("div", { className: "flex items-center border-b
|
|
116
|
+
c && /* @__PURE__ */ r("div", { className: "absolute z-50 w-full mt-1", children: /* @__PURE__ */ l(F, { className: "w-full rounded-md shadow-md bg-d-popover", children: [
|
|
117
|
+
/* @__PURE__ */ l("div", { className: "flex items-center px-3 border-b", children: [
|
|
116
118
|
/* @__PURE__ */ r(
|
|
117
|
-
|
|
119
|
+
H,
|
|
118
120
|
{
|
|
121
|
+
iconLeft: "Search",
|
|
119
122
|
placeholder: z,
|
|
120
123
|
value: m,
|
|
121
|
-
|
|
122
|
-
className: "
|
|
124
|
+
onChange: (e) => v(e.target.value),
|
|
125
|
+
className: "w-full !border-0 !border-none !outline-none focus-visible:ring-0 shadow-none"
|
|
123
126
|
}
|
|
124
127
|
),
|
|
125
128
|
u.length > 0 && /* @__PURE__ */ r(
|
|
126
|
-
|
|
129
|
+
p,
|
|
127
130
|
{
|
|
128
131
|
variant: "ghost",
|
|
129
132
|
size: "sm",
|
|
130
133
|
className: "h-6 px-2 text-xs",
|
|
131
|
-
onClick:
|
|
134
|
+
onClick: w,
|
|
132
135
|
children: O
|
|
133
136
|
}
|
|
134
137
|
)
|
|
135
138
|
] }),
|
|
136
|
-
/* @__PURE__ */ l(
|
|
137
|
-
/* @__PURE__ */ r(
|
|
138
|
-
/* @__PURE__ */ r(
|
|
139
|
+
/* @__PURE__ */ l(P, { className: "w-full max-h-60 overflow-auto", children: [
|
|
140
|
+
/* @__PURE__ */ r(G, { children: L }),
|
|
141
|
+
/* @__PURE__ */ r(X, { children: j.map((e) => {
|
|
139
142
|
const n = t.includes(e.value);
|
|
140
143
|
return /* @__PURE__ */ l(
|
|
141
|
-
|
|
144
|
+
q,
|
|
142
145
|
{
|
|
143
146
|
value: e.value,
|
|
144
|
-
disabled: e.disabled || !n &&
|
|
145
|
-
onSelect: () =>
|
|
146
|
-
className:
|
|
147
|
+
disabled: e.disabled || !n && x,
|
|
148
|
+
onSelect: () => S(e.value),
|
|
149
|
+
className: N(
|
|
147
150
|
"flex items-center gap-2 px-2 py-1.5 aria-selected:bg-d-accent aria-selected:text-d-accent-foreground cursor-pointer",
|
|
148
|
-
(e.disabled || !n &&
|
|
151
|
+
(e.disabled || !n && x) && "cursor-not-allowed opacity-50"
|
|
149
152
|
),
|
|
150
153
|
children: [
|
|
151
|
-
/* @__PURE__ */ r(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
/* @__PURE__ */ r(
|
|
155
|
+
I,
|
|
156
|
+
{
|
|
157
|
+
checked: n,
|
|
158
|
+
className: "flex-shrink-0 mr-2",
|
|
159
|
+
onCheckedChange: () => {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ r("span", { className: "truncate flex-1", children: e.label }),
|
|
164
|
+
n && /* @__PURE__ */ r(Q, { className: "h-4 w-4 flex-shrink-0 ml-auto text-d-primary" })
|
|
157
165
|
]
|
|
158
166
|
},
|
|
159
167
|
e.value
|
|
@@ -165,5 +173,5 @@ function te({
|
|
|
165
173
|
] }) });
|
|
166
174
|
}
|
|
167
175
|
export {
|
|
168
|
-
|
|
176
|
+
ne as AppMultipleSelectDropdown
|
|
169
177
|
};
|
|
@@ -1,219 +1,192 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useReactTable as
|
|
5
|
-
import { TableSkeleton as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { TooltipProvider as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
m.substring(0, c),
|
|
2
|
+
import { jsxs as b, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as C, useMemo as S } from "react";
|
|
4
|
+
import { useReactTable as P, flexRender as V } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
5
|
+
import { TableSkeleton as U } from "./table-skeleton.js";
|
|
6
|
+
import { Button as j } from "./button.js";
|
|
7
|
+
import { TooltipProvider as q, Tooltip as G, TooltipTrigger as J, TooltipContent as K } from "./tooltip.js";
|
|
8
|
+
import { TableRow as T, TableCell as A, Table as Q, TableHeader as X, TableHead as Y, TableBody as Z } from "./table.js";
|
|
9
|
+
import { getSortedRowModel as _, getCoreRowModel as W } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
10
|
+
function v({ text: c, maxLength: a, className: h = "" }) {
|
|
11
|
+
return !c || c.length <= a ? /* @__PURE__ */ o("div", { className: h, children: c }) : /* @__PURE__ */ o(q, { children: /* @__PURE__ */ b(G, { children: [
|
|
12
|
+
/* @__PURE__ */ o(J, { asChild: !0, children: /* @__PURE__ */ b("div", { className: `truncate ${h} cursor-pointer`, children: [
|
|
13
|
+
c.substring(0, a),
|
|
15
14
|
"..."
|
|
16
15
|
] }) }),
|
|
17
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ o(K, { children: /* @__PURE__ */ o("p", { children: c }) })
|
|
18
17
|
] }) });
|
|
19
18
|
}
|
|
20
|
-
function
|
|
21
|
-
crossTableData:
|
|
22
|
-
filterable:
|
|
23
|
-
loading:
|
|
24
|
-
emptyComponent:
|
|
25
|
-
className:
|
|
26
|
-
notFoundMessage:
|
|
27
|
-
cornerHeaderFrom:
|
|
28
|
-
cornerHeaderTo:
|
|
29
|
-
maxHeaderLength:
|
|
30
|
-
minWidthCell:
|
|
31
|
-
initialFreezeColumn: P = !0,
|
|
32
|
-
initialFreezeRow: U = !1,
|
|
33
|
-
showFreezeControls: q = !0
|
|
19
|
+
function ie({
|
|
20
|
+
crossTableData: c,
|
|
21
|
+
filterable: a = !1,
|
|
22
|
+
loading: h = !1,
|
|
23
|
+
emptyComponent: D,
|
|
24
|
+
className: N,
|
|
25
|
+
notFoundMessage: M = "Nessun risultato trovato.",
|
|
26
|
+
cornerHeaderFrom: x = "Da",
|
|
27
|
+
cornerHeaderTo: w = "A",
|
|
28
|
+
maxHeaderLength: g = 15,
|
|
29
|
+
minWidthCell: R = 160
|
|
34
30
|
}) {
|
|
35
|
-
const [
|
|
36
|
-
if (!
|
|
37
|
-
const n =
|
|
38
|
-
if (n === -1) return
|
|
39
|
-
const
|
|
31
|
+
const [L, $] = C([]), { headerTop: d, headerLeft: m, data: f } = c, [p, I] = C(null), [y, k] = C(!0), B = (n) => n && typeof n == "object" && "value" in n ? n.value : n, u = S(() => {
|
|
32
|
+
if (!p) return d;
|
|
33
|
+
const n = m.indexOf(p);
|
|
34
|
+
if (n === -1) return d;
|
|
35
|
+
const r = d.map((e, t) => {
|
|
40
36
|
var i;
|
|
41
|
-
const
|
|
42
|
-
return { header:
|
|
37
|
+
const s = ((i = f[n]) == null ? void 0 : i[t]) ?? null, l = B(s);
|
|
38
|
+
return { header: e, value: l };
|
|
43
39
|
});
|
|
44
|
-
return
|
|
45
|
-
if (typeof
|
|
46
|
-
return
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
}),
|
|
50
|
-
}, [
|
|
40
|
+
return r.sort((e, t) => {
|
|
41
|
+
if (typeof e.value == "number" && typeof t.value == "number")
|
|
42
|
+
return y ? e.value - t.value : t.value - e.value;
|
|
43
|
+
const s = String(e.value ?? ""), l = String(t.value ?? "");
|
|
44
|
+
return y ? s.localeCompare(l) : l.localeCompare(s);
|
|
45
|
+
}), r.map((e) => e.header);
|
|
46
|
+
}, [d, m, f, p, y]), F = S(() => {
|
|
51
47
|
const n = [
|
|
52
48
|
{
|
|
53
49
|
id: "cross-header",
|
|
54
|
-
header: () => /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
50
|
+
header: () => /* @__PURE__ */ b("div", { className: "relative", children: [
|
|
51
|
+
/* @__PURE__ */ o("div", { className: "absolute top-0 left-2 text-xs", children: x }),
|
|
52
|
+
/* @__PURE__ */ o("div", { className: "absolute bottom-0 right-2 text-xs", children: w })
|
|
57
53
|
] }),
|
|
58
|
-
accessorFn: (
|
|
59
|
-
cell: (
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
const
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
54
|
+
accessorFn: (r) => r.item,
|
|
55
|
+
cell: (r) => {
|
|
56
|
+
const e = r.getValue();
|
|
57
|
+
if (!a)
|
|
58
|
+
return /* @__PURE__ */ o(v, { text: e, maxLength: g, className: "text-left" });
|
|
59
|
+
const t = p === e;
|
|
60
|
+
return /* @__PURE__ */ o(
|
|
61
|
+
j,
|
|
66
62
|
{
|
|
67
63
|
variant: "ghost",
|
|
68
64
|
size: "sm",
|
|
69
65
|
iconLeft: "ArrowLeftRight",
|
|
70
66
|
className: "text-right",
|
|
71
67
|
onClick: () => {
|
|
72
|
-
|
|
68
|
+
a && (t ? k((s) => !s) : (I(e), k(!0)));
|
|
73
69
|
},
|
|
74
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ o(v, { text: e, maxLength: g })
|
|
75
71
|
}
|
|
76
72
|
);
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
];
|
|
80
|
-
return
|
|
76
|
+
return u.forEach((r) => {
|
|
81
77
|
n.push({
|
|
82
|
-
id:
|
|
83
|
-
accessorFn: (
|
|
84
|
-
header: ({ column:
|
|
85
|
-
|
|
78
|
+
id: r,
|
|
79
|
+
accessorFn: (e) => e[r],
|
|
80
|
+
header: ({ column: e }) => a ? /* @__PURE__ */ o(
|
|
81
|
+
j,
|
|
86
82
|
{
|
|
87
83
|
variant: "ghost",
|
|
88
84
|
size: "sm",
|
|
89
85
|
iconLeft: "ArrowUpDown",
|
|
90
|
-
onClick:
|
|
91
|
-
children: /* @__PURE__ */
|
|
86
|
+
onClick: a ? () => e.toggleSorting(e.getIsSorted() === "asc") : void 0,
|
|
87
|
+
children: /* @__PURE__ */ o(v, { text: r, maxLength: g })
|
|
92
88
|
}
|
|
93
|
-
) : /* @__PURE__ */
|
|
94
|
-
sortingFn: (
|
|
95
|
-
let
|
|
96
|
-
return
|
|
89
|
+
) : /* @__PURE__ */ o(v, { text: r, maxLength: g, className: "font-medium" }),
|
|
90
|
+
sortingFn: (e, t, s) => {
|
|
91
|
+
let l = e.getValue(s), i = t.getValue(s);
|
|
92
|
+
return l == null && i == null ? 0 : l == null ? 1 : i == null ? -1 : (l && typeof l == "object" && "value" in l && (l = l.value), i && typeof i == "object" && "value" in i && (i = i.value), typeof l == "number" && typeof i == "number" ? l - i : String(l).localeCompare(String(i)));
|
|
97
93
|
},
|
|
98
94
|
//NOTE Cell is responsible for rendering the cell of his column
|
|
99
|
-
cell: (
|
|
100
|
-
const
|
|
101
|
-
return
|
|
95
|
+
cell: (e) => {
|
|
96
|
+
const t = e.getValue();
|
|
97
|
+
return t ? t.render ? t.render(t.fromId, t.toId) : /* @__PURE__ */ o("div", { children: t.value }) : null;
|
|
102
98
|
}
|
|
103
99
|
});
|
|
104
100
|
}), n;
|
|
105
|
-
}, [
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
var
|
|
109
|
-
const
|
|
110
|
-
t
|
|
111
|
-
}),
|
|
112
|
-
}), [
|
|
113
|
-
data:
|
|
114
|
-
columns:
|
|
115
|
-
state: { sorting:
|
|
116
|
-
onSortingChange:
|
|
117
|
-
getCoreRowModel:
|
|
118
|
-
getSortedRowModel:
|
|
101
|
+
}, [u, x, w, p, a]), E = S(() => m.map((n, r) => {
|
|
102
|
+
const e = { item: n };
|
|
103
|
+
return u.forEach((t) => {
|
|
104
|
+
var l;
|
|
105
|
+
const s = d.indexOf(t);
|
|
106
|
+
e[t] = s !== -1 ? ((l = f[r]) == null ? void 0 : l[s]) ?? null : null;
|
|
107
|
+
}), e;
|
|
108
|
+
}), [m, u, f, d]), z = P({
|
|
109
|
+
data: E,
|
|
110
|
+
columns: F,
|
|
111
|
+
state: { sorting: L },
|
|
112
|
+
onSortingChange: $,
|
|
113
|
+
getCoreRowModel: W(),
|
|
114
|
+
getSortedRowModel: _()
|
|
119
115
|
});
|
|
120
|
-
if (!
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
if (
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
|
|
116
|
+
if (!f || f.length === 0)
|
|
117
|
+
return /* @__PURE__ */ o(T, { children: /* @__PURE__ */ o(A, { colSpan: u.length + 1, children: D || M }) });
|
|
118
|
+
if (h)
|
|
119
|
+
return /* @__PURE__ */ o(
|
|
120
|
+
U,
|
|
125
121
|
{
|
|
126
|
-
headerRow:
|
|
127
|
-
rowCount:
|
|
128
|
-
columnCount:
|
|
129
|
-
className:
|
|
130
|
-
cornerHeaderFrom:
|
|
131
|
-
cornerHeaderTo:
|
|
122
|
+
headerRow: u,
|
|
123
|
+
rowCount: m.length || 5,
|
|
124
|
+
columnCount: u.length || 5,
|
|
125
|
+
className: N,
|
|
126
|
+
cornerHeaderFrom: x,
|
|
127
|
+
cornerHeaderTo: w
|
|
132
128
|
}
|
|
133
129
|
);
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
let
|
|
138
|
-
return
|
|
139
|
-
className:
|
|
140
|
-
style: { boxShadow:
|
|
130
|
+
const O = (n) => {
|
|
131
|
+
const r = n.column.id === "cross-header", e = r, t = ["bg-d-secondary"];
|
|
132
|
+
r || t.push("border-r"), r && t.push("sticky left-0"), t.push("sticky top-0 z-20"), e ? t.push("z-40") : r && t.push("z-30");
|
|
133
|
+
let s = "none";
|
|
134
|
+
return r && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
|
|
135
|
+
className: t.join(" "),
|
|
136
|
+
style: { boxShadow: s, width: `${R}px` }
|
|
141
137
|
};
|
|
142
138
|
};
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
className: `p-0.5 h-6 ${a ? "font-medium" : "text-d-muted-foreground"}`,
|
|
152
|
-
onClick: () => Q(!a),
|
|
153
|
-
children: /* @__PURE__ */ e(F, { name: "ArrowLeftRight", size: "xs" })
|
|
154
|
-
}
|
|
155
|
-
) }),
|
|
156
|
-
/* @__PURE__ */ e(D, { side: "top", align: "center", children: a ? "Sblocca colonna sinistra" : "Blocca colonna sinistra" })
|
|
157
|
-
] }) }),
|
|
158
|
-
/* @__PURE__ */ e(k, { children: /* @__PURE__ */ d(A, { children: [
|
|
159
|
-
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
160
|
-
w,
|
|
139
|
+
return /* @__PURE__ */ o("div", { className: `w-[900px] ${N || ""}`, children: /* @__PURE__ */ o("div", { className: "rounded-md border overflow-auto max-h-[600px]", children: /* @__PURE__ */ b(Q, { className: "w-full table-fixed relative border-collapse", children: [
|
|
140
|
+
/* @__PURE__ */ o(
|
|
141
|
+
X,
|
|
142
|
+
{
|
|
143
|
+
className: "sticky top-0 z-20 bg-d-secondary",
|
|
144
|
+
style: { boxShadow: "0 1px 0 0 var(--d-border)" },
|
|
145
|
+
children: z.getHeaderGroups().map((n) => /* @__PURE__ */ o(
|
|
146
|
+
T,
|
|
161
147
|
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
148
|
+
className: "sticky top-0 z-20 bg-d-secondary",
|
|
149
|
+
children: n.headers.map((r) => {
|
|
150
|
+
const e = O(r);
|
|
151
|
+
return /* @__PURE__ */ o(
|
|
152
|
+
Y,
|
|
153
|
+
{
|
|
154
|
+
className: e.className,
|
|
155
|
+
style: e.style,
|
|
156
|
+
children: r.isPlaceholder ? null : V(
|
|
157
|
+
r.column.columnDef.header,
|
|
158
|
+
r.getContext()
|
|
159
|
+
)
|
|
160
|
+
},
|
|
161
|
+
r.id
|
|
162
|
+
);
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
n.id
|
|
166
|
+
))
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ o(Z, { children: z.getRowModel().rows.map((n) => /* @__PURE__ */ o(T, { children: n.getVisibleCells().map((r, e) => {
|
|
170
|
+
const t = e === 0, s = r.getValue(), l = t ? "var(--d-secondary)" : (s == null ? void 0 : s.color) || "transparent";
|
|
171
|
+
return /* @__PURE__ */ o(
|
|
172
|
+
A,
|
|
175
173
|
{
|
|
176
|
-
className:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
className: t.className,
|
|
183
|
-
style: t.style,
|
|
184
|
-
children: o.isPlaceholder ? null : B(
|
|
185
|
-
o.column.columnDef.header,
|
|
186
|
-
o.getContext()
|
|
187
|
-
)
|
|
188
|
-
},
|
|
189
|
-
o.id
|
|
190
|
-
);
|
|
191
|
-
})
|
|
192
|
-
},
|
|
193
|
-
n.id
|
|
194
|
-
)) }),
|
|
195
|
-
/* @__PURE__ */ e(ne, { children: M.getRowModel().rows.map((n) => /* @__PURE__ */ e(z, { children: n.getVisibleCells().map((o, t) => {
|
|
196
|
-
const r = t === 0, l = o.getValue(), s = r && a ? "var(--d-secondary)" : (l == null ? void 0 : l.color) || "transparent";
|
|
197
|
-
return /* @__PURE__ */ e(
|
|
198
|
-
I,
|
|
199
|
-
{
|
|
200
|
-
className: `text-center ${r && a ? "sticky left-0 z-10" : "border-r"}`,
|
|
201
|
-
style: {
|
|
202
|
-
boxShadow: r && a ? "inset -1px 0 0 0 var(--d-border)" : "none",
|
|
203
|
-
backgroundColor: s,
|
|
204
|
-
width: `${$}px`
|
|
205
|
-
},
|
|
206
|
-
children: B(
|
|
207
|
-
o.column.columnDef.cell,
|
|
208
|
-
o.getContext()
|
|
209
|
-
)
|
|
174
|
+
className: `text-center ${t ? "sticky left-0 z-10" : "border-r"}`,
|
|
175
|
+
style: {
|
|
176
|
+
boxShadow: t ? "inset -1px 0 0 0 var(--d-border)" : "none",
|
|
177
|
+
backgroundColor: l,
|
|
178
|
+
width: `${R}px`
|
|
210
179
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
180
|
+
children: V(
|
|
181
|
+
r.column.columnDef.cell,
|
|
182
|
+
r.getContext()
|
|
183
|
+
)
|
|
184
|
+
},
|
|
185
|
+
r.id
|
|
186
|
+
);
|
|
187
|
+
}) }, n.id)) })
|
|
188
|
+
] }) }) });
|
|
216
189
|
}
|
|
217
190
|
export {
|
|
218
|
-
|
|
191
|
+
ie as DataCrossTable
|
|
219
192
|
};
|