@ztwoint/z-ui 0.1.107 → 0.1.109
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/column-reorder/column-reorder.hook.js +9 -10
- package/dist/components/column-reorder/components/column-item/column-item.js +40 -81
- package/dist/components/dynamic-table/index.d.ts +4 -0
- package/dist/components/dynamic-table/z2-column-header.js +186 -0
- package/dist/components/dynamic-table/z2-table-context.js +98 -0
- package/dist/components/dynamic-table/z2-table-pagination.js +124 -0
- package/dist/components/dynamic-table/z2-table.d.ts +1 -1
- package/dist/components/dynamic-table/z2-table.js +408 -0
- package/dist/components/skeleton/skeleton.js +16 -0
- package/dist/components/table/components/cell/avatar-cell.js +4 -2
- package/dist/components/table/table-provider.js +2 -0
- package/dist/components/table-card/table-card.js +11 -9
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +207 -180
- package/dist/types/components/dynamic-table/index.d.ts +4 -0
- package/dist/types/components/dynamic-table/z2-table.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { jsxs as p, jsx as n, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as P } from "react";
|
|
3
|
+
import { Z2Checkbox as R } from "../checkbox/checkbox.js";
|
|
4
|
+
import { useZ2Table as g } from "./z2-table-context.js";
|
|
5
|
+
import { flexRender as w } from "@tanstack/react-table";
|
|
6
|
+
import { cva as N } from "class-variance-authority";
|
|
7
|
+
import { cn as m } from "../../lib/utils.js";
|
|
8
|
+
const B = N("", {
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
dense: "p-2 h-8",
|
|
12
|
+
default: "p-3"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "default"
|
|
17
|
+
}
|
|
18
|
+
}), S = N("", {
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
dense: "p-2",
|
|
22
|
+
default: "px-3 py-2.5"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
size: "default"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
function v(l) {
|
|
30
|
+
const e = l.getIsPinned();
|
|
31
|
+
return {
|
|
32
|
+
left: e === "left" ? `${l.getStart("left")}px` : void 0,
|
|
33
|
+
right: e === "right" ? `${l.getAfter("right")}px` : void 0,
|
|
34
|
+
position: e ? "sticky" : "relative",
|
|
35
|
+
width: l.getSize(),
|
|
36
|
+
zIndex: e ? 1 : 0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function I({ children: l }) {
|
|
40
|
+
var t, r, a;
|
|
41
|
+
const { props: e } = g();
|
|
42
|
+
return /* @__PURE__ */ n(
|
|
43
|
+
"table",
|
|
44
|
+
{
|
|
45
|
+
"data-slot": "data-grid-table",
|
|
46
|
+
className: m(
|
|
47
|
+
"w-full align-middle text-left rtl:text-right text-neutral-secondary",
|
|
48
|
+
!((t = e.tableLayout) != null && t.columnsDraggable) && "border-separate border-spacing-0",
|
|
49
|
+
((r = e.tableLayout) == null ? void 0 : r.width) === "fixed" ? "table-fixed" : "table-auto",
|
|
50
|
+
(a = e.tableClassNames) == null ? void 0 : a.base
|
|
51
|
+
),
|
|
52
|
+
children: l
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function T({ children: l }) {
|
|
57
|
+
var t, r, a;
|
|
58
|
+
const { props: e } = g();
|
|
59
|
+
return /* @__PURE__ */ n(
|
|
60
|
+
"thead",
|
|
61
|
+
{
|
|
62
|
+
className: m(
|
|
63
|
+
"",
|
|
64
|
+
(t = e.tableClassNames) == null ? void 0 : t.header,
|
|
65
|
+
((r = e.tableLayout) == null ? void 0 : r.headerSticky) && ((a = e.tableClassNames) == null ? void 0 : a.headerSticky)
|
|
66
|
+
),
|
|
67
|
+
children: l
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function Z({
|
|
72
|
+
children: l,
|
|
73
|
+
headerGroup: e
|
|
74
|
+
}) {
|
|
75
|
+
var r, a, o, d, i;
|
|
76
|
+
const { props: t } = g();
|
|
77
|
+
return /* @__PURE__ */ n(
|
|
78
|
+
"tr",
|
|
79
|
+
{
|
|
80
|
+
className: m(
|
|
81
|
+
"bg-transparent leading-none-medium-sm tracking-wider rounded-xl",
|
|
82
|
+
((r = t.tableLayout) == null ? void 0 : r.headerBorder) && "[&>th]:border-b border-stroke-solid-light",
|
|
83
|
+
((a = t.tableLayout) == null ? void 0 : a.cellBorder) && "[&_>:last-child]:border-e-0",
|
|
84
|
+
((o = t.tableLayout) == null ? void 0 : o.stripped) && "bg-transparent",
|
|
85
|
+
((d = t.tableLayout) == null ? void 0 : d.headerBackground) !== !1 && "bg-background-neutral-medium",
|
|
86
|
+
(i = t.tableClassNames) == null ? void 0 : i.headerRow
|
|
87
|
+
),
|
|
88
|
+
children: l
|
|
89
|
+
},
|
|
90
|
+
e.id
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function D({
|
|
94
|
+
children: l,
|
|
95
|
+
header: e,
|
|
96
|
+
dndRef: t,
|
|
97
|
+
dndStyle: r
|
|
98
|
+
}) {
|
|
99
|
+
var c, b, h, f, y, C, x, k;
|
|
100
|
+
const { props: a } = g(), { column: o } = e, d = o.getIsPinned(), i = d === "left" && o.getIsLastColumn("left"), s = d === "right" && o.getIsFirstColumn("right"), u = B({
|
|
101
|
+
size: (c = a.tableLayout) != null && c.dense ? "dense" : "default"
|
|
102
|
+
});
|
|
103
|
+
return /* @__PURE__ */ n(
|
|
104
|
+
"th",
|
|
105
|
+
{
|
|
106
|
+
ref: t,
|
|
107
|
+
style: {
|
|
108
|
+
...((b = a.tableLayout) == null ? void 0 : b.width) === "fixed" && {
|
|
109
|
+
width: `${e.getSize()}px`
|
|
110
|
+
},
|
|
111
|
+
...((h = a.tableLayout) == null ? void 0 : h.columnsPinnable) && o.getCanPin() && v(o),
|
|
112
|
+
...r || null
|
|
113
|
+
},
|
|
114
|
+
"data-pinned": d || void 0,
|
|
115
|
+
"data-last-col": i ? "left" : s ? "right" : void 0,
|
|
116
|
+
className: m(
|
|
117
|
+
"relative h-10 text-left rtl:text-right align-middle [&:has([role=checkbox])]:pe-0 border-stroke-solid-light leading-none-medium-sm dark:text-inverted-secondary",
|
|
118
|
+
u,
|
|
119
|
+
((f = a.tableLayout) == null ? void 0 : f.cellBorder) && "border-e",
|
|
120
|
+
((y = a.tableLayout) == null ? void 0 : y.columnsResizable) && o.getCanResize() && "truncate",
|
|
121
|
+
((C = a.tableLayout) == null ? void 0 : C.columnsPinnable) && o.getCanPin() && "[&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-muted/90 data-pinned:backdrop-blur-xs",
|
|
122
|
+
(x = e.column.columnDef.meta) == null ? void 0 : x.headerClassName,
|
|
123
|
+
o.getIndex() === 0 || o.getIndex() === e.headerGroup.headers.length - 1 ? (k = a.tableClassNames) == null ? void 0 : k.edgeCell : ""
|
|
124
|
+
),
|
|
125
|
+
children: l
|
|
126
|
+
},
|
|
127
|
+
e.id
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function _({ header: l }) {
|
|
131
|
+
const { column: e } = l;
|
|
132
|
+
return /* @__PURE__ */ n(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
onDoubleClick: () => e.resetSize(),
|
|
136
|
+
onMouseDown: l.getResizeHandler(),
|
|
137
|
+
onTouchStart: l.getResizeHandler(),
|
|
138
|
+
className: "absolute top-0 h-full w-4 cursor-col-resize user-select-none touch-none -end-2 z-10 flex justify-center before:absolute before:w-px before:inset-y-0 before:bg-border before:-translate-x-px"
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
function A() {
|
|
143
|
+
return /* @__PURE__ */ n("tbody", { "aria-hidden": "true", className: "h-2" });
|
|
144
|
+
}
|
|
145
|
+
function V({ children: l }) {
|
|
146
|
+
var t, r;
|
|
147
|
+
const { props: e } = g();
|
|
148
|
+
return /* @__PURE__ */ n(
|
|
149
|
+
"tbody",
|
|
150
|
+
{
|
|
151
|
+
className: m(
|
|
152
|
+
"[&_tr:last-child]:border-0",
|
|
153
|
+
((t = e.tableLayout) == null ? void 0 : t.rowRounded) && "[&_td:first-child]:rounded-s-lg [&_td:last-child]:rounded-e-lg",
|
|
154
|
+
(r = e.tableClassNames) == null ? void 0 : r.body
|
|
155
|
+
),
|
|
156
|
+
children: l
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function F({ children: l }) {
|
|
161
|
+
var r, a, o, d, i;
|
|
162
|
+
const { table: e, props: t } = g();
|
|
163
|
+
return /* @__PURE__ */ n(
|
|
164
|
+
"tr",
|
|
165
|
+
{
|
|
166
|
+
className: m(
|
|
167
|
+
"hover:bg-background-neutral-medium data-[state=selected]:bg-muted/50 border-stroke-solid-light",
|
|
168
|
+
t.onRowClick && "cursor-pointer",
|
|
169
|
+
!((r = t.tableLayout) != null && r.stripped) && ((a = t.tableLayout) == null ? void 0 : a.rowBorder) && "[&:not(:last-child)>td]:border-b [&:not(:last-child)>td]:border-stroke-solid-light",
|
|
170
|
+
((o = t.tableLayout) == null ? void 0 : o.cellBorder) && "[&_>:last-child]:border-e-0",
|
|
171
|
+
((d = t.tableLayout) == null ? void 0 : d.stripped) && "odd:bg-background-neutral-medium hover:bg-transparent odd:hover:bg-background-neutral-medium",
|
|
172
|
+
e.options.enableRowSelection && "[&_>:first-child]:relative",
|
|
173
|
+
(i = t.tableClassNames) == null ? void 0 : i.bodyRow
|
|
174
|
+
),
|
|
175
|
+
children: l
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function H({
|
|
180
|
+
children: l,
|
|
181
|
+
column: e
|
|
182
|
+
}) {
|
|
183
|
+
var o, d, i, s, u, c, b;
|
|
184
|
+
const { props: t, table: r } = g(), a = S({
|
|
185
|
+
size: (o = t.tableLayout) != null && o.dense ? "dense" : "default"
|
|
186
|
+
});
|
|
187
|
+
return /* @__PURE__ */ n(
|
|
188
|
+
"td",
|
|
189
|
+
{
|
|
190
|
+
style: {
|
|
191
|
+
...((d = t.tableLayout) == null ? void 0 : d.width) === "fixed" && {
|
|
192
|
+
width: `${e.getSize()}px`
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
className: m(
|
|
196
|
+
"align-middle",
|
|
197
|
+
a,
|
|
198
|
+
((i = t.tableLayout) == null ? void 0 : i.cellBorder) && "border-e border-stroke-solid-light",
|
|
199
|
+
((s = t.tableLayout) == null ? void 0 : s.columnsResizable) && e.getCanResize() && "truncate",
|
|
200
|
+
(u = e.columnDef.meta) == null ? void 0 : u.cellClassName,
|
|
201
|
+
((c = t.tableLayout) == null ? void 0 : c.columnsPinnable) && e.getCanPin() && '[&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-stroke-solid-light data-pinned:bg-background/90 data-pinned:backdrop-blur-xs"',
|
|
202
|
+
e.getIndex() === 0 || e.getIndex() === r.getVisibleFlatColumns().length - 1 ? (b = t.tableClassNames) == null ? void 0 : b.edgeCell : ""
|
|
203
|
+
),
|
|
204
|
+
children: l
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function M({
|
|
209
|
+
children: l,
|
|
210
|
+
row: e,
|
|
211
|
+
dndRef: t,
|
|
212
|
+
dndStyle: r
|
|
213
|
+
}) {
|
|
214
|
+
var d, i, s, u, c;
|
|
215
|
+
const { props: a, table: o } = g();
|
|
216
|
+
return /* @__PURE__ */ n(
|
|
217
|
+
"tr",
|
|
218
|
+
{
|
|
219
|
+
ref: t,
|
|
220
|
+
style: { ...r || null },
|
|
221
|
+
"data-state": o.options.enableRowSelection && e.getIsSelected() ? "selected" : void 0,
|
|
222
|
+
onClick: () => a.onRowClick && a.onRowClick(e.original),
|
|
223
|
+
className: m(
|
|
224
|
+
"hover:bg-background-neutral-medium data-[state=selected]:bg-muted/50 border-stroke-solid-light",
|
|
225
|
+
a.onRowClick && "cursor-pointer",
|
|
226
|
+
!((d = a.tableLayout) != null && d.stripped) && ((i = a.tableLayout) == null ? void 0 : i.rowBorder) && "border-b [&:not(:last-child)>td]:border-b",
|
|
227
|
+
((s = a.tableLayout) == null ? void 0 : s.cellBorder) && "[&_>:last-child]:border-e-0",
|
|
228
|
+
((u = a.tableLayout) == null ? void 0 : u.stripped) && "odd:bg-background-neutral-medium hover:bg-transparent odd:hover:bg-background-neutral-medium",
|
|
229
|
+
o.options.enableRowSelection && "[&_>:first-child]:relative",
|
|
230
|
+
(c = a.tableClassNames) == null ? void 0 : c.bodyRow
|
|
231
|
+
),
|
|
232
|
+
children: l
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function $({ row: l }) {
|
|
237
|
+
var a, o, d, i, s, u;
|
|
238
|
+
const { props: e, table: t } = g();
|
|
239
|
+
return ((o = (a = t.getAllColumns().find((c) => {
|
|
240
|
+
var b;
|
|
241
|
+
return (b = c.columnDef.meta) == null ? void 0 : b.expandedContent;
|
|
242
|
+
})) == null ? void 0 : a.columnDef.meta) == null ? void 0 : o.expandedContent) ? /* @__PURE__ */ n(
|
|
243
|
+
"tr",
|
|
244
|
+
{
|
|
245
|
+
className: m(
|
|
246
|
+
((d = e.tableLayout) == null ? void 0 : d.rowBorder) && "[&:not(:last-child)>td]:border-b [&:not(:last-child)>td]:border-stroke-solid-light"
|
|
247
|
+
),
|
|
248
|
+
children: /* @__PURE__ */ n("td", { colSpan: l.getVisibleCells().length, children: (u = (s = (i = t.getAllColumns().find((c) => {
|
|
249
|
+
var b;
|
|
250
|
+
return (b = c.columnDef.meta) == null ? void 0 : b.expandedContent;
|
|
251
|
+
})) == null ? void 0 : i.columnDef.meta) == null ? void 0 : s.expandedContent) == null ? void 0 : u.call(s, l.original) })
|
|
252
|
+
}
|
|
253
|
+
) : null;
|
|
254
|
+
}
|
|
255
|
+
function j({
|
|
256
|
+
children: l,
|
|
257
|
+
cell: e,
|
|
258
|
+
dndRef: t,
|
|
259
|
+
dndStyle: r
|
|
260
|
+
}) {
|
|
261
|
+
var b, h, f, y, C, x, k, L;
|
|
262
|
+
const { props: a } = g(), { column: o, row: d } = e, i = o.getIsPinned(), s = i === "left" && o.getIsLastColumn("left"), u = i === "right" && o.getIsFirstColumn("right"), c = S({
|
|
263
|
+
size: (b = a.tableLayout) != null && b.dense ? "dense" : "default"
|
|
264
|
+
});
|
|
265
|
+
return /* @__PURE__ */ n(
|
|
266
|
+
"td",
|
|
267
|
+
{
|
|
268
|
+
ref: t,
|
|
269
|
+
...(h = a.tableLayout) != null && h.columnsDraggable && !i ? { cell: e } : {},
|
|
270
|
+
style: {
|
|
271
|
+
...((f = a.tableLayout) == null ? void 0 : f.columnsPinnable) && o.getCanPin() && v(o),
|
|
272
|
+
...r || null
|
|
273
|
+
},
|
|
274
|
+
"data-pinned": i || void 0,
|
|
275
|
+
"data-last-col": s ? "left" : u ? "right" : void 0,
|
|
276
|
+
className: m(
|
|
277
|
+
"align-middle border-stroke-solid-light leading-none-medium-sm text-neutral-primary dark:text-inverted-primary",
|
|
278
|
+
c,
|
|
279
|
+
((y = a.tableLayout) == null ? void 0 : y.cellBorder) && "border-e border-stroke-solid-light",
|
|
280
|
+
((C = a.tableLayout) == null ? void 0 : C.columnsResizable) && o.getCanResize() && "truncate",
|
|
281
|
+
(x = e.column.columnDef.meta) == null ? void 0 : x.cellClassName,
|
|
282
|
+
((k = a.tableLayout) == null ? void 0 : k.columnsPinnable) && o.getCanPin() && '[&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs"',
|
|
283
|
+
o.getIndex() === 0 || o.getIndex() === d.getVisibleCells().length - 1 ? (L = a.tableClassNames) == null ? void 0 : L.edgeCell : ""
|
|
284
|
+
),
|
|
285
|
+
children: l
|
|
286
|
+
},
|
|
287
|
+
e.id
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
function E() {
|
|
291
|
+
const { table: l, props: e } = g(), t = l.getAllColumns().length;
|
|
292
|
+
return /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: e.emptyMessage || "No data available" }) });
|
|
293
|
+
}
|
|
294
|
+
function G() {
|
|
295
|
+
const { table: l, props: e } = g(), t = l.getAllColumns().length;
|
|
296
|
+
return /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: /* @__PURE__ */ p("div", { className: "text-muted-foreground bg-card flex items-center gap-2 px-4 py-2 font-medium leading-none text-sm", children: [
|
|
297
|
+
/* @__PURE__ */ p(
|
|
298
|
+
"svg",
|
|
299
|
+
{
|
|
300
|
+
className: "animate-spin -ml-1 h-5 w-5 text-muted-foreground",
|
|
301
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
302
|
+
fill: "none",
|
|
303
|
+
viewBox: "0 0 24 24",
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ n(
|
|
306
|
+
"circle",
|
|
307
|
+
{
|
|
308
|
+
className: "opacity-25",
|
|
309
|
+
cx: "12",
|
|
310
|
+
cy: "12",
|
|
311
|
+
r: "10",
|
|
312
|
+
stroke: "currentColor",
|
|
313
|
+
strokeWidth: "3"
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ n(
|
|
317
|
+
"path",
|
|
318
|
+
{
|
|
319
|
+
className: "opacity-75",
|
|
320
|
+
fill: "currentColor",
|
|
321
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
e.loadingMessage || "Loading..."
|
|
328
|
+
] }) }) });
|
|
329
|
+
}
|
|
330
|
+
function X({
|
|
331
|
+
row: l
|
|
332
|
+
// size,
|
|
333
|
+
}) {
|
|
334
|
+
return /* @__PURE__ */ p(z, { children: [
|
|
335
|
+
/* @__PURE__ */ n(
|
|
336
|
+
"div",
|
|
337
|
+
{
|
|
338
|
+
className: m(
|
|
339
|
+
"hidden absolute top-0 bottom-0 start-0 w-[2px] bg-primary",
|
|
340
|
+
l.getIsSelected() && "block"
|
|
341
|
+
)
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ n(
|
|
345
|
+
R,
|
|
346
|
+
{
|
|
347
|
+
checked: l.getIsSelected(),
|
|
348
|
+
onCheckedChange: (e) => l.toggleSelected(!!e),
|
|
349
|
+
"aria-label": "Select row",
|
|
350
|
+
className: "align-[inherit]"
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
function Y(l) {
|
|
356
|
+
const { table: e, recordCount: t, isLoading: r } = g();
|
|
357
|
+
return /* @__PURE__ */ n(
|
|
358
|
+
R,
|
|
359
|
+
{
|
|
360
|
+
checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
|
|
361
|
+
disabled: r || t === 0,
|
|
362
|
+
onCheckedChange: (a) => e.toggleAllPageRowsSelected(!!a),
|
|
363
|
+
"aria-label": "Select all",
|
|
364
|
+
className: "align-[inherit]"
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
function ee() {
|
|
369
|
+
var a, o;
|
|
370
|
+
const { table: l, isLoading: e, props: t } = g(), r = l.getState().pagination;
|
|
371
|
+
return /* @__PURE__ */ p(I, { children: [
|
|
372
|
+
/* @__PURE__ */ n(T, { children: l.getHeaderGroups().map((d, i) => /* @__PURE__ */ n(Z, { headerGroup: d, children: d.headers.map((s, u) => {
|
|
373
|
+
var b;
|
|
374
|
+
const { column: c } = s;
|
|
375
|
+
return /* @__PURE__ */ p(D, { header: s, children: [
|
|
376
|
+
s.isPlaceholder ? null : w(s.column.columnDef.header, s.getContext()),
|
|
377
|
+
((b = t.tableLayout) == null ? void 0 : b.columnsResizable) && c.getCanResize() && /* @__PURE__ */ n(_, { header: s })
|
|
378
|
+
] }, u);
|
|
379
|
+
}) }, i)) }),
|
|
380
|
+
(((a = t.tableLayout) == null ? void 0 : a.stripped) || !((o = t.tableLayout) != null && o.rowBorder)) && /* @__PURE__ */ n(A, {}),
|
|
381
|
+
/* @__PURE__ */ n(V, { children: e && (r != null && r.pageSize) ? t.loadingMode === "skeleton" ? Array.from({ length: r.pageSize }).map((d, i) => /* @__PURE__ */ n(F, { children: l.getVisibleFlatColumns().map((s, u) => {
|
|
382
|
+
var c;
|
|
383
|
+
return /* @__PURE__ */ n(H, { column: s, children: (c = s.columnDef.meta) == null ? void 0 : c.skeleton }, u);
|
|
384
|
+
}) }, i)) : /* @__PURE__ */ n(G, {}) : l.getRowModel().rows.length ? l.getRowModel().rows.map((d, i) => /* @__PURE__ */ p(P, { children: [
|
|
385
|
+
/* @__PURE__ */ n(M, { row: d, children: d.getVisibleCells().map((s, u) => /* @__PURE__ */ n(j, { cell: s, children: w(s.column.columnDef.cell, s.getContext()) }, u)) }, i),
|
|
386
|
+
d.getIsExpanded() && /* @__PURE__ */ n($, { row: d })
|
|
387
|
+
] }, d.id)) : /* @__PURE__ */ n(E, {}) })
|
|
388
|
+
] });
|
|
389
|
+
}
|
|
390
|
+
export {
|
|
391
|
+
ee as Z2Table,
|
|
392
|
+
I as Z2TableBase,
|
|
393
|
+
V as Z2TableBody,
|
|
394
|
+
M as Z2TableBodyRow,
|
|
395
|
+
j as Z2TableBodyRowCell,
|
|
396
|
+
$ as Z2TableBodyRowExpandded,
|
|
397
|
+
F as Z2TableBodyRowSkeleton,
|
|
398
|
+
H as Z2TableBodyRowSkeletonCell,
|
|
399
|
+
E as Z2TableEmpty,
|
|
400
|
+
T as Z2TableHead,
|
|
401
|
+
Z as Z2TableHeadRow,
|
|
402
|
+
D as Z2TableHeadRowCell,
|
|
403
|
+
_ as Z2TableHeadRowCellResize,
|
|
404
|
+
G as Z2TableLoader,
|
|
405
|
+
X as Z2TableRowSelect,
|
|
406
|
+
Y as Z2TableRowSelectAll,
|
|
407
|
+
A as Z2TableRowSpacer
|
|
408
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as n } from "../../lib/utils.js";
|
|
4
|
+
function i({ className: t, ...e }) {
|
|
5
|
+
return /* @__PURE__ */ o(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "skeleton",
|
|
9
|
+
className: n("bg-accent animate-pulse rounded-md", t),
|
|
10
|
+
...e
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
i as Z2Skeleton
|
|
16
|
+
};
|
|
@@ -42,7 +42,9 @@ import "@radix-ui/react-slot";
|
|
|
42
42
|
import "@radix-ui/react-radio-group";
|
|
43
43
|
import "../../../segmented-control/item.js";
|
|
44
44
|
import "@radix-ui/react-popover";
|
|
45
|
-
|
|
45
|
+
import "../../../dynamic-table/z2-table.js";
|
|
46
|
+
import "../../../dynamic-table/z2-table-context.js";
|
|
47
|
+
const mt = ({
|
|
46
48
|
avatar: m,
|
|
47
49
|
value: a,
|
|
48
50
|
rightIcon: o,
|
|
@@ -80,5 +82,5 @@ const it = ({
|
|
|
80
82
|
}
|
|
81
83
|
);
|
|
82
84
|
export {
|
|
83
|
-
|
|
85
|
+
mt as AvatarCell
|
|
84
86
|
};
|
|
@@ -47,6 +47,8 @@ import "@radix-ui/react-slot";
|
|
|
47
47
|
import "@radix-ui/react-radio-group";
|
|
48
48
|
import "../segmented-control/item.js";
|
|
49
49
|
import "@radix-ui/react-popover";
|
|
50
|
+
import "../dynamic-table/z2-table.js";
|
|
51
|
+
import "../dynamic-table/z2-table-context.js";
|
|
50
52
|
import { TableHeaderWrapper as T } from "./components/table-header-wrapper.js";
|
|
51
53
|
import { TableHeaderContent as b } from "./components/table-header-content.js";
|
|
52
54
|
import { TableFooter as s } from "./components/table-footer.js";
|
|
@@ -31,7 +31,7 @@ import "../stepper/stepper.js";
|
|
|
31
31
|
import "../stepper-item/stepper-item.js";
|
|
32
32
|
import "@radix-ui/react-tabs";
|
|
33
33
|
import "../tooltip/tooltip.js";
|
|
34
|
-
import { Filter as
|
|
34
|
+
import { Filter as x } from "../table-filter/index.js";
|
|
35
35
|
import "../badge/badge.js";
|
|
36
36
|
import "../avatar/avatar.js";
|
|
37
37
|
import "../text-preset/text-preset.js";
|
|
@@ -42,8 +42,10 @@ import "@radix-ui/react-slot";
|
|
|
42
42
|
import "@radix-ui/react-radio-group";
|
|
43
43
|
import "../segmented-control/item.js";
|
|
44
44
|
import "@radix-ui/react-popover";
|
|
45
|
+
import "../dynamic-table/z2-table.js";
|
|
46
|
+
import "../dynamic-table/z2-table-context.js";
|
|
45
47
|
import "../table/table.context.js";
|
|
46
|
-
const
|
|
48
|
+
const He = ({
|
|
47
49
|
dataSource: w,
|
|
48
50
|
schema: B,
|
|
49
51
|
loading: b,
|
|
@@ -67,17 +69,17 @@ const be = ({
|
|
|
67
69
|
pagination: o,
|
|
68
70
|
paginationInfo: i,
|
|
69
71
|
paginationQuickJumper: a,
|
|
70
|
-
error:
|
|
72
|
+
error: p = !1,
|
|
71
73
|
dataSourceError: _ = !1
|
|
72
74
|
}) => {
|
|
73
75
|
var F;
|
|
74
|
-
if (
|
|
76
|
+
if (p)
|
|
75
77
|
return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
|
|
76
78
|
/* @__PURE__ */ e(S, { className: "mt-1.5" }),
|
|
77
79
|
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
78
80
|
/* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
|
|
79
81
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
|
|
80
|
-
typeof
|
|
82
|
+
typeof p == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: p })
|
|
81
83
|
] })
|
|
82
84
|
] }) });
|
|
83
85
|
const C = a && a.totalPage && a.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!i || C, v = m || t || h || u, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
|
|
@@ -108,7 +110,7 @@ const be = ({
|
|
|
108
110
|
}
|
|
109
111
|
),
|
|
110
112
|
t && /* @__PURE__ */ s(
|
|
111
|
-
|
|
113
|
+
x,
|
|
112
114
|
{
|
|
113
115
|
filterSchema: t.filterSchema,
|
|
114
116
|
filter: {
|
|
@@ -119,8 +121,8 @@ const be = ({
|
|
|
119
121
|
loading: t.loading
|
|
120
122
|
},
|
|
121
123
|
children: [
|
|
122
|
-
R && /* @__PURE__ */ e(
|
|
123
|
-
(F = t == null ? void 0 : t.quickFilters) == null ? void 0 : F.map((f) => /* @__PURE__ */ e(
|
|
124
|
+
R && /* @__PURE__ */ e(x.FilterButton, {}),
|
|
125
|
+
(F = t == null ? void 0 : t.quickFilters) == null ? void 0 : F.map((f) => /* @__PURE__ */ e(x.FilterColumnButton, { filterName: f }, f))
|
|
124
126
|
]
|
|
125
127
|
}
|
|
126
128
|
)
|
|
@@ -199,5 +201,5 @@ const be = ({
|
|
|
199
201
|
] });
|
|
200
202
|
};
|
|
201
203
|
export {
|
|
202
|
-
|
|
204
|
+
He as default
|
|
203
205
|
};
|