@ztwoint/z-ui 0.1.118 → 0.1.120
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/dynamic-table/z2-table.js +35 -45
- package/dist/components/table/table.type.d.ts +2 -2
- package/dist/components/table-filter/table-filter.type.d.ts +1 -1
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/table/table.type.d.ts +2 -2
- package/dist/types/components/table-filter/table-filter.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as R, jsx as o, Fragment as z } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment as P } from "react";
|
|
3
|
-
import { Z2Checkbox as
|
|
3
|
+
import { Z2Checkbox as k } from "../checkbox/checkbox.js";
|
|
4
4
|
import { useZ2Table as g } from "./z2-table-context.js";
|
|
5
|
-
import { flexRender as
|
|
5
|
+
import { flexRender as w } from "@tanstack/react-table";
|
|
6
6
|
import { cva as v } from "class-variance-authority";
|
|
7
7
|
import { cn as p } from "../../lib/utils.js";
|
|
8
8
|
import { Z2Skeleton as Z } from "../skeleton/skeleton.js";
|
|
@@ -97,7 +97,7 @@ function D({
|
|
|
97
97
|
dndRef: t,
|
|
98
98
|
dndStyle: r
|
|
99
99
|
}) {
|
|
100
|
-
var c, b, h, f, C, y, x
|
|
100
|
+
var c, b, m, h, f, C, y, x;
|
|
101
101
|
const { props: a } = g(), { column: n } = e, d = n.getIsPinned(), s = d === "left" && n.getIsLastColumn("left"), i = d === "right" && n.getIsFirstColumn("right"), u = B({
|
|
102
102
|
size: (c = a.tableLayout) != null && c.dense ? "dense" : "default"
|
|
103
103
|
});
|
|
@@ -105,11 +105,12 @@ function D({
|
|
|
105
105
|
"th",
|
|
106
106
|
{
|
|
107
107
|
ref: t,
|
|
108
|
+
colSpan: e.colSpan,
|
|
108
109
|
style: {
|
|
109
110
|
...((b = a.tableLayout) == null ? void 0 : b.width) === "fixed" && {
|
|
110
111
|
width: `${e.getSize()}px`
|
|
111
112
|
},
|
|
112
|
-
...((
|
|
113
|
+
...((m = a.tableLayout) == null ? void 0 : m.columnsPinnable) && n.getCanPin() && N(n),
|
|
113
114
|
...r || null
|
|
114
115
|
},
|
|
115
116
|
"data-pinned": d || void 0,
|
|
@@ -117,11 +118,11 @@ function D({
|
|
|
117
118
|
className: p(
|
|
118
119
|
"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",
|
|
119
120
|
u,
|
|
120
|
-
((
|
|
121
|
-
((
|
|
122
|
-
((
|
|
123
|
-
(
|
|
124
|
-
n.getIndex() === 0 || n.getIndex() === e.headerGroup.headers.length - 1 ? (
|
|
121
|
+
((h = a.tableLayout) == null ? void 0 : h.cellBorder) && "border-e",
|
|
122
|
+
((f = a.tableLayout) == null ? void 0 : f.columnsResizable) && n.getCanResize() && "truncate",
|
|
123
|
+
((C = a.tableLayout) == null ? void 0 : C.columnsPinnable) && n.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",
|
|
124
|
+
(y = e.column.columnDef.meta) == null ? void 0 : y.headerClassName,
|
|
125
|
+
n.getIndex() === 0 || n.getIndex() === e.headerGroup.headers.length - 1 ? (x = a.tableClassNames) == null ? void 0 : x.edgeCell : ""
|
|
125
126
|
),
|
|
126
127
|
children: l
|
|
127
128
|
},
|
|
@@ -259,7 +260,7 @@ function $({
|
|
|
259
260
|
dndRef: t,
|
|
260
261
|
dndStyle: r
|
|
261
262
|
}) {
|
|
262
|
-
var b, h, f, C, y, x,
|
|
263
|
+
var b, m, h, f, C, y, x, L;
|
|
263
264
|
const { props: a } = g(), { column: n, row: d } = e, s = n.getIsPinned(), i = s === "left" && n.getIsLastColumn("left"), u = s === "right" && n.getIsFirstColumn("right"), c = S({
|
|
264
265
|
size: (b = a.tableLayout) != null && b.dense ? "dense" : "default"
|
|
265
266
|
});
|
|
@@ -267,9 +268,9 @@ function $({
|
|
|
267
268
|
"td",
|
|
268
269
|
{
|
|
269
270
|
ref: t,
|
|
270
|
-
...(
|
|
271
|
+
...(m = a.tableLayout) != null && m.columnsDraggable && !s ? { cell: e } : {},
|
|
271
272
|
style: {
|
|
272
|
-
...((
|
|
273
|
+
...((h = a.tableLayout) == null ? void 0 : h.columnsPinnable) && n.getCanPin() && N(n),
|
|
273
274
|
...r || null
|
|
274
275
|
},
|
|
275
276
|
"data-pinned": s || void 0,
|
|
@@ -277,10 +278,10 @@ function $({
|
|
|
277
278
|
className: p(
|
|
278
279
|
"align-middle",
|
|
279
280
|
c,
|
|
280
|
-
((
|
|
281
|
-
((
|
|
282
|
-
(
|
|
283
|
-
((
|
|
281
|
+
((f = a.tableLayout) == null ? void 0 : f.cellBorder) && "border-e border-stroke-solid-light",
|
|
282
|
+
((C = a.tableLayout) == null ? void 0 : C.columnsResizable) && n.getCanResize() && "truncate",
|
|
283
|
+
(y = e.column.columnDef.meta) == null ? void 0 : y.cellClassName,
|
|
284
|
+
((x = a.tableLayout) == null ? void 0 : x.columnsPinnable) && n.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"',
|
|
284
285
|
n.getIndex() === 0 || n.getIndex() === d.getVisibleCells().length - 1 ? (L = a.tableClassNames) == null ? void 0 : L.edgeCell : ""
|
|
285
286
|
),
|
|
286
287
|
children: l
|
|
@@ -294,8 +295,8 @@ function G() {
|
|
|
294
295
|
}
|
|
295
296
|
function O() {
|
|
296
297
|
const { table: l, props: e } = g(), t = l.getAllColumns().length;
|
|
297
|
-
return /* @__PURE__ */ o("tr", { style: { height: l.getState().pagination.pageSize * 43 }, children: /* @__PURE__ */ o("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: /* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ o("tr", { style: { height: l.getState().pagination.pageSize * 43 }, children: /* @__PURE__ */ o("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: /* @__PURE__ */ R("div", { className: "text-neutral-muted flex items-center gap-2 px-4 py-2 leading-none-medium-sm justify-center", children: [
|
|
299
|
+
/* @__PURE__ */ R(
|
|
299
300
|
"svg",
|
|
300
301
|
{
|
|
301
302
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -356,31 +357,20 @@ function ee({
|
|
|
356
357
|
row: l
|
|
357
358
|
// size,
|
|
358
359
|
}) {
|
|
359
|
-
return /* @__PURE__ */
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
),
|
|
369
|
-
/* @__PURE__ */ o(
|
|
370
|
-
w,
|
|
371
|
-
{
|
|
372
|
-
checked: l.getIsSelected(),
|
|
373
|
-
onCheckedChange: (e) => l.toggleSelected(!!e),
|
|
374
|
-
"aria-label": "Select row",
|
|
375
|
-
className: "align-[inherit]"
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
] });
|
|
360
|
+
return /* @__PURE__ */ o(z, { children: /* @__PURE__ */ o(
|
|
361
|
+
k,
|
|
362
|
+
{
|
|
363
|
+
checked: l.getIsSelected(),
|
|
364
|
+
onCheckedChange: (e) => l.toggleSelected(!!e),
|
|
365
|
+
"aria-label": "Select row",
|
|
366
|
+
className: "align-[inherit]"
|
|
367
|
+
}
|
|
368
|
+
) });
|
|
379
369
|
}
|
|
380
370
|
function te(l) {
|
|
381
371
|
const { table: e, recordCount: t, isLoading: r } = g();
|
|
382
372
|
return /* @__PURE__ */ o(
|
|
383
|
-
|
|
373
|
+
k,
|
|
384
374
|
{
|
|
385
375
|
checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
|
|
386
376
|
disabled: r || t === 0,
|
|
@@ -393,20 +383,20 @@ function te(l) {
|
|
|
393
383
|
function ae() {
|
|
394
384
|
var a, n;
|
|
395
385
|
const { table: l, isLoading: e, props: t } = g(), r = l.getState().pagination;
|
|
396
|
-
return /* @__PURE__ */
|
|
386
|
+
return /* @__PURE__ */ R(_, { children: [
|
|
397
387
|
(((a = t.tableLayout) == null ? void 0 : a.stripped) || !((n = t.tableLayout) != null && n.rowBorder)) && /* @__PURE__ */ o(M, {}),
|
|
398
388
|
/* @__PURE__ */ o(V, { children: e && (r != null && r.pageSize) ? t.loadingMode === "skeleton" ? Array.from({ length: r.pageSize }).map((d, s) => /* @__PURE__ */ o(F, { children: l.getVisibleFlatColumns().map((i, u) => {
|
|
399
389
|
var c;
|
|
400
390
|
return /* @__PURE__ */ o(H, { column: i, children: ((c = i.columnDef.meta) == null ? void 0 : c.skeleton) || /* @__PURE__ */ o(Z, { className: "h-4 w-full" }) }, u);
|
|
401
|
-
}) }, s)) : /* @__PURE__ */ o(O, {}) : l.getRowModel().rows.length ? l.getRowModel().rows.map((d, s) => /* @__PURE__ */
|
|
402
|
-
/* @__PURE__ */ o(E, { row: d, children: d.getVisibleCells().map((i, u) => /* @__PURE__ */ o($, { cell: i, children:
|
|
391
|
+
}) }, s)) : /* @__PURE__ */ o(O, {}) : l.getRowModel().rows.length ? l.getRowModel().rows.map((d, s) => /* @__PURE__ */ R(P, { children: [
|
|
392
|
+
/* @__PURE__ */ o(E, { row: d, children: d.getVisibleCells().map((i, u) => /* @__PURE__ */ o($, { cell: i, children: w(i.column.columnDef.cell, i.getContext()) }, u)) }, s),
|
|
403
393
|
d.getIsExpanded() && /* @__PURE__ */ o(j, { row: d })
|
|
404
394
|
] }, d.id)) : /* @__PURE__ */ o(G, {}) }),
|
|
405
395
|
/* @__PURE__ */ o(I, { children: l.getHeaderGroups().map((d, s) => /* @__PURE__ */ o(T, { headerGroup: d, children: d.headers.map((i, u) => {
|
|
406
396
|
var b;
|
|
407
397
|
const { column: c } = i;
|
|
408
|
-
return /* @__PURE__ */
|
|
409
|
-
i.isPlaceholder ? null :
|
|
398
|
+
return /* @__PURE__ */ R(D, { header: i, children: [
|
|
399
|
+
i.isPlaceholder ? null : w(i.column.columnDef.header, i.getContext()),
|
|
410
400
|
((b = t.tableLayout) == null ? void 0 : b.columnsResizable) && c.getCanResize() && /* @__PURE__ */ o(A, { header: i })
|
|
411
401
|
] }, u);
|
|
412
402
|
}) }, s)) })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
2
|
import { NumberCellProps } from './components/cell/number-cell';
|
|
3
3
|
import { BooleanCellProps } from './components/cell/boolean-cell';
|
|
4
4
|
import { LinkCellProps } from './components/cell/link-cell';
|
|
@@ -49,7 +49,7 @@ type CellPropsByType = {
|
|
|
49
49
|
};
|
|
50
50
|
type ColumnBase<T extends CellType> = {
|
|
51
51
|
key: string;
|
|
52
|
-
title: string;
|
|
52
|
+
title: string | React.ReactNode;
|
|
53
53
|
cellType: T;
|
|
54
54
|
cellRenderer?: CellRenderer;
|
|
55
55
|
hideable?: boolean;
|
|
@@ -13,7 +13,7 @@ export type FilterOption = {
|
|
|
13
13
|
export type FilterFieldType = 'string' | 'number' | 'boolean' | 'checkbox';
|
|
14
14
|
export type FilterSchemaField = {
|
|
15
15
|
filterKey: string;
|
|
16
|
-
title: string;
|
|
16
|
+
title: string | React.ReactNode;
|
|
17
17
|
helperText?: string;
|
|
18
18
|
type: FilterFieldType;
|
|
19
19
|
options?: Record<string, number>;
|