laif-ds 0.1.64 → 0.1.66
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.
|
@@ -6,15 +6,15 @@ import { useVirtualizer as Ae } from "../../../../node_modules/@tanstack/react-v
|
|
|
6
6
|
import { TableSkeleton as Pe } from "../../table-skeleton.js";
|
|
7
7
|
import { TruncatedText as E } from "./truncated-text.js";
|
|
8
8
|
import { useDataCrossTable as He } from "./data-cross-table-context.js";
|
|
9
|
-
import { cn as
|
|
9
|
+
import { cn as j } from "../../../../lib/utils.js";
|
|
10
10
|
import { Button as C } from "../../button.js";
|
|
11
11
|
import { Icon as _ } from "../../icon.js";
|
|
12
12
|
import { Popover as Be, PopoverTrigger as Fe, PopoverContent as Oe } from "../../popover.js";
|
|
13
13
|
import { TableRow as q, TableCell as ae, Table as We, TableHeader as Ue, TableHead as Xe, TableBody as Ye } from "../../table.js";
|
|
14
14
|
import { getSortedRowModel as _e, getCoreRowModel as qe } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
15
15
|
function ut({
|
|
16
|
-
crossTableData:
|
|
17
|
-
filterable:
|
|
16
|
+
crossTableData: I,
|
|
17
|
+
filterable: w = !1,
|
|
18
18
|
loading: ce = !1,
|
|
19
19
|
emptyComponent: de,
|
|
20
20
|
className: D,
|
|
@@ -30,7 +30,7 @@ function ut({
|
|
|
30
30
|
rowSortAsc: pe = !0
|
|
31
31
|
}) {
|
|
32
32
|
var ee, te;
|
|
33
|
-
const [he, ge] = f([]), p =
|
|
33
|
+
const [he, ge] = f([]), p = I.headerTop, m = I.headerLeft, v = I.data, [b, L] = f(
|
|
34
34
|
(u == null ? void 0 : u.id) ?? null
|
|
35
35
|
), [$, A] = f(pe);
|
|
36
36
|
let c = null;
|
|
@@ -39,7 +39,7 @@ function ut({
|
|
|
39
39
|
} catch {
|
|
40
40
|
c = null;
|
|
41
41
|
}
|
|
42
|
-
const [ve, Ge] = f(fe && me), [xe,
|
|
42
|
+
const [ve, Ge] = f(fe && me), [xe, we] = f({}), [be, ye] = f({}), N = (c == null ? void 0 : c.editMode) ?? ve, J = (c == null ? void 0 : c.editedCells) ?? xe, P = (c == null ? void 0 : c.setEditedCells) ?? we, H = (c == null ? void 0 : c.toDefaultCells) ?? be, B = (c == null ? void 0 : c.setToDefaultCells) ?? ye;
|
|
43
43
|
ie(() => {
|
|
44
44
|
R && R(!!N);
|
|
45
45
|
}, [N, R]), ie(() => {
|
|
@@ -87,15 +87,15 @@ function ut({
|
|
|
87
87
|
T(t.target.value);
|
|
88
88
|
},
|
|
89
89
|
[]
|
|
90
|
-
),
|
|
91
|
-
if (!
|
|
90
|
+
), je = (t) => t && typeof t == "object" && "value" in t ? t.value : t, h = Y(() => {
|
|
91
|
+
if (!b || !m.find((l) => l.id === b)) return p;
|
|
92
92
|
const e = m.findIndex(
|
|
93
|
-
(l) => l.id ===
|
|
93
|
+
(l) => l.id === b
|
|
94
94
|
);
|
|
95
95
|
if (e === -1) return p;
|
|
96
96
|
const i = p.map((l, s) => {
|
|
97
97
|
var g;
|
|
98
|
-
const o = ((g = v[e]) == null ? void 0 : g[s]) ?? null, a =
|
|
98
|
+
const o = ((g = v[e]) == null ? void 0 : g[s]) ?? null, a = je(o);
|
|
99
99
|
return { header: l, value: a };
|
|
100
100
|
});
|
|
101
101
|
return i.sort((l, s) => {
|
|
@@ -104,7 +104,7 @@ function ut({
|
|
|
104
104
|
const o = String(l.value ?? ""), a = String(s.value ?? "");
|
|
105
105
|
return $ ? o.localeCompare(a) : a.localeCompare(o);
|
|
106
106
|
}), i.map((l) => l.header);
|
|
107
|
-
}, [p, m, v,
|
|
107
|
+
}, [p, m, v, b, $]), Ie = Y(() => {
|
|
108
108
|
const t = [
|
|
109
109
|
{
|
|
110
110
|
id: "cross-header",
|
|
@@ -115,9 +115,9 @@ function ut({
|
|
|
115
115
|
accessorFn: (e) => e.item,
|
|
116
116
|
cell: (e) => {
|
|
117
117
|
const i = e.getValue();
|
|
118
|
-
if (!
|
|
118
|
+
if (!w)
|
|
119
119
|
return /* @__PURE__ */ n(E, { text: i.label, className: "w-full" });
|
|
120
|
-
const l =
|
|
120
|
+
const l = b === i.id;
|
|
121
121
|
return /* @__PURE__ */ n(
|
|
122
122
|
C,
|
|
123
123
|
{
|
|
@@ -126,7 +126,7 @@ function ut({
|
|
|
126
126
|
iconLeft: "ArrowLeftRight",
|
|
127
127
|
className: "text-right",
|
|
128
128
|
onClick: () => {
|
|
129
|
-
|
|
129
|
+
w && (l ? A((s) => !s) : (L(m[e.row.index].id), A(!0), G && G(m[e.row.index])));
|
|
130
130
|
},
|
|
131
131
|
children: /* @__PURE__ */ n(E, { text: i.label })
|
|
132
132
|
}
|
|
@@ -138,13 +138,13 @@ function ut({
|
|
|
138
138
|
t.push({
|
|
139
139
|
id: e.id,
|
|
140
140
|
accessorFn: (i) => i[e.id],
|
|
141
|
-
header: ({ column: i }) =>
|
|
141
|
+
header: ({ column: i }) => w ? /* @__PURE__ */ n(
|
|
142
142
|
C,
|
|
143
143
|
{
|
|
144
144
|
variant: "ghost",
|
|
145
145
|
size: "sm",
|
|
146
146
|
iconLeft: "ArrowUpDown",
|
|
147
|
-
onClick:
|
|
147
|
+
onClick: w ? () => i.toggleSorting(i.getIsSorted() === "asc") : void 0,
|
|
148
148
|
children: /* @__PURE__ */ n(
|
|
149
149
|
E,
|
|
150
150
|
{
|
|
@@ -166,7 +166,7 @@ function ut({
|
|
|
166
166
|
},
|
|
167
167
|
cell: (i) => {
|
|
168
168
|
const l = i.getValue();
|
|
169
|
-
return l ? l.render ? l.render(l.fromId, l.toId, l.id) : /* @__PURE__ */ n("div", { className: "h-full w-full min-w-0 truncate", children: l.value }) : null;
|
|
169
|
+
return l ? l.render ? l.render(l.fromId, l.toId, l.id) : /* @__PURE__ */ n("div", { className: "flex h-full w-full min-w-0 items-center justify-center", children: /* @__PURE__ */ n("div", { className: "h-5 w-full max-w-full min-w-0 truncate text-center", children: l.value }) }) : null;
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
}), t;
|
|
@@ -175,7 +175,7 @@ function ut({
|
|
|
175
175
|
K,
|
|
176
176
|
M,
|
|
177
177
|
u,
|
|
178
|
-
|
|
178
|
+
w,
|
|
179
179
|
L,
|
|
180
180
|
A
|
|
181
181
|
]), De = Y(() => m.map((t, e) => {
|
|
@@ -187,7 +187,7 @@ function ut({
|
|
|
187
187
|
}), i;
|
|
188
188
|
}), [m, h, v, p]), F = $e({
|
|
189
189
|
data: De,
|
|
190
|
-
columns:
|
|
190
|
+
columns: Ie,
|
|
191
191
|
state: { sorting: he },
|
|
192
192
|
onSortingChange: ge,
|
|
193
193
|
getCoreRowModel: qe(),
|
|
@@ -222,7 +222,7 @@ function ut({
|
|
|
222
222
|
overscan: 5,
|
|
223
223
|
measureElement: typeof window < "u" ? (t) => t.getBoundingClientRect().height : void 0
|
|
224
224
|
});
|
|
225
|
-
return /* @__PURE__ */ d("div", { className: `${
|
|
225
|
+
return /* @__PURE__ */ d("div", { className: `${j("w-[900px]", D || "")}`, children: [
|
|
226
226
|
/* @__PURE__ */ n(
|
|
227
227
|
"div",
|
|
228
228
|
{
|
|
@@ -286,7 +286,7 @@ function ut({
|
|
|
286
286
|
return /* @__PURE__ */ n(
|
|
287
287
|
ae,
|
|
288
288
|
{
|
|
289
|
-
className:
|
|
289
|
+
className: j(
|
|
290
290
|
"border-d-border text-center",
|
|
291
291
|
s ? "sticky left-0 z-10" : "border-r",
|
|
292
292
|
g && N ? "cursor-pointer" : "pointer-events-none cursor-default"
|
|
@@ -345,7 +345,7 @@ function ut({
|
|
|
345
345
|
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ n(
|
|
346
346
|
"div",
|
|
347
347
|
{
|
|
348
|
-
className:
|
|
348
|
+
className: j(
|
|
349
349
|
"h-full min-h-full w-full min-w-full truncate text-center",
|
|
350
350
|
g ? "text-d-muted-foreground" : "text-d-muted"
|
|
351
351
|
),
|
|
@@ -357,7 +357,7 @@ function ut({
|
|
|
357
357
|
{
|
|
358
358
|
name: g ? "Pencil" : "PencilOff",
|
|
359
359
|
size: "sm",
|
|
360
|
-
className:
|
|
360
|
+
className: j(
|
|
361
361
|
"h-3 w-3",
|
|
362
362
|
g ? "text-d-muted-foreground" : "text-d-muted"
|
|
363
363
|
)
|