@deepnoid/ui 0.1.78 → 0.1.80
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/.turbo/turbo-build.log +117 -119
- package/dist/{chunk-YF2N2OBY.mjs → chunk-L65ETSUY.mjs} +1 -1
- package/dist/chunk-UWXCAR5C.mjs +535 -0
- package/dist/components/dateTimePicker/dateTimePicker.mjs +3 -3
- package/dist/components/dateTimePicker/index.mjs +3 -3
- package/dist/components/dateTimePicker/timePicker.mjs +2 -2
- package/dist/components/list/index.mjs +3 -3
- package/dist/components/table/index.js +123 -57
- package/dist/components/table/index.mjs +1 -3
- package/dist/components/table/table-body.js +5814 -45
- package/dist/components/table/table-body.mjs +11 -1
- package/dist/components/table/table-head.js +5815 -41
- package/dist/components/table/table-head.mjs +11 -1
- package/dist/components/table/table.d.mts +3 -2
- package/dist/components/table/table.d.ts +3 -2
- package/dist/components/table/table.js +129 -58
- package/dist/components/table/table.mjs +4 -4
- package/dist/index.js +123 -57
- package/dist/index.mjs +6 -8
- package/package.json +1 -1
- package/dist/chunk-4PU6UC7K.mjs +0 -353
- package/dist/chunk-5GBAUDP4.mjs +0 -72
- package/dist/chunk-TKB2JL2E.mjs +0 -67
- package/dist/{chunk-WYHCK7XL.mjs → chunk-ZYS4NSXT.mjs} +3 -3
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_head_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-UWXCAR5C.mjs";
|
|
5
|
+
import "../../chunk-DQRAFUDA.mjs";
|
|
6
|
+
import "../../chunk-M37VBNB3.mjs";
|
|
5
7
|
import "../../chunk-MZ76AA76.mjs";
|
|
6
8
|
import "../../chunk-6PN3DGOE.mjs";
|
|
9
|
+
import "../../chunk-7B7LRG5J.mjs";
|
|
10
|
+
import "../../chunk-CC2F5HQX.mjs";
|
|
11
|
+
import "../../chunk-F3HENRVM.mjs";
|
|
12
|
+
import "../../chunk-2GCSFWHD.mjs";
|
|
13
|
+
import "../../chunk-5M7UDEMG.mjs";
|
|
7
14
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
8
15
|
import "../../chunk-SKOCUCE5.mjs";
|
|
16
|
+
import "../../chunk-ZYIIXWVY.mjs";
|
|
17
|
+
import "../../chunk-JP4TEWP7.mjs";
|
|
18
|
+
import "../../chunk-RRONV7YA.mjs";
|
|
9
19
|
import "../../chunk-XOPCRI7Z.mjs";
|
|
10
20
|
import "../../chunk-27Y6K5NK.mjs";
|
|
11
21
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode, CSSProperties } from 'react';
|
|
5
5
|
import { SlotsToClasses } from '../../utils/types.mjs';
|
|
6
6
|
|
|
7
7
|
interface TableBaseProps extends Omit<ComponentPropsWithRef<"table">, "ref" | "color" | "slot" | "size" | "height" | "defaultChecked" | "defaultValue"> {
|
|
@@ -189,6 +189,7 @@ declare const tableStyle: tailwind_variants.TVReturnType<{
|
|
|
189
189
|
td: string[];
|
|
190
190
|
empty: string[];
|
|
191
191
|
}, undefined, unknown, unknown, undefined>>;
|
|
192
|
+
declare const getCellStyle: (column: TableColumn) => CSSProperties;
|
|
192
193
|
type TableVariantProps = VariantProps<typeof tableStyle>;
|
|
193
194
|
type TableSlots = keyof ReturnType<typeof tableStyle>;
|
|
194
195
|
type TableReturnType = ReturnType<typeof tableStyle>;
|
|
@@ -220,4 +221,4 @@ type ValueFormatterParams<V = any> = {
|
|
|
220
221
|
value: V;
|
|
221
222
|
};
|
|
222
223
|
|
|
223
|
-
export { type TableColumn, type TableRef, type TableReturnType, type TableRow, type TableSlots, type TableVariantProps, Table as default };
|
|
224
|
+
export { type TableColumn, type TableRef, type TableReturnType, type TableRow, type TableSlots, type TableVariantProps, Table as default, getCellStyle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode, CSSProperties } from 'react';
|
|
5
5
|
import { SlotsToClasses } from '../../utils/types.js';
|
|
6
6
|
|
|
7
7
|
interface TableBaseProps extends Omit<ComponentPropsWithRef<"table">, "ref" | "color" | "slot" | "size" | "height" | "defaultChecked" | "defaultValue"> {
|
|
@@ -189,6 +189,7 @@ declare const tableStyle: tailwind_variants.TVReturnType<{
|
|
|
189
189
|
td: string[];
|
|
190
190
|
empty: string[];
|
|
191
191
|
}, undefined, unknown, unknown, undefined>>;
|
|
192
|
+
declare const getCellStyle: (column: TableColumn) => CSSProperties;
|
|
192
193
|
type TableVariantProps = VariantProps<typeof tableStyle>;
|
|
193
194
|
type TableSlots = keyof ReturnType<typeof tableStyle>;
|
|
194
195
|
type TableReturnType = ReturnType<typeof tableStyle>;
|
|
@@ -220,4 +221,4 @@ type ValueFormatterParams<V = any> = {
|
|
|
220
221
|
value: V;
|
|
221
222
|
};
|
|
222
223
|
|
|
223
|
-
export { type TableColumn, type TableRef, type TableReturnType, type TableRow, type TableSlots, type TableVariantProps, Table as default };
|
|
224
|
+
export { type TableColumn, type TableRef, type TableReturnType, type TableRow, type TableSlots, type TableVariantProps, Table as default, getCellStyle };
|
|
@@ -102,7 +102,8 @@ var require_plugin = __commonJS({
|
|
|
102
102
|
// src/components/table/table.tsx
|
|
103
103
|
var table_exports = {};
|
|
104
104
|
__export(table_exports, {
|
|
105
|
-
default: () => table_default
|
|
105
|
+
default: () => table_default,
|
|
106
|
+
getCellStyle: () => getCellStyle
|
|
106
107
|
});
|
|
107
108
|
module.exports = __toCommonJS(table_exports);
|
|
108
109
|
var import_react5 = require("react");
|
|
@@ -688,23 +689,27 @@ var TableHead = ({
|
|
|
688
689
|
e.preventDefault();
|
|
689
690
|
onCheckAll(!isCheckedAll);
|
|
690
691
|
};
|
|
691
|
-
const renderTh = (content, key, column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
692
|
+
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
692
693
|
"th",
|
|
693
694
|
{
|
|
694
|
-
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
|
|
695
|
-
style: {
|
|
696
|
-
width:
|
|
697
|
-
minWidth:
|
|
698
|
-
maxWidth:
|
|
699
|
-
|
|
700
|
-
|
|
695
|
+
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className),
|
|
696
|
+
style: isCheckbox ? {
|
|
697
|
+
width: "40px",
|
|
698
|
+
minWidth: "40px",
|
|
699
|
+
maxWidth: "40px",
|
|
700
|
+
flexShrink: 0,
|
|
701
|
+
flexGrow: 0,
|
|
702
|
+
boxSizing: "border-box"
|
|
703
|
+
} : column ? getCellStyle(column) : void 0,
|
|
701
704
|
children: content
|
|
702
705
|
},
|
|
703
706
|
key
|
|
704
707
|
);
|
|
705
708
|
const renderSkeletonRow = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
|
|
706
|
-
columns.map(
|
|
707
|
-
|
|
709
|
+
columns.map(
|
|
710
|
+
(column, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`, column)
|
|
711
|
+
),
|
|
712
|
+
rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton", void 0, true)
|
|
708
713
|
] }) });
|
|
709
714
|
const renderContentRow = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
710
715
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
@@ -717,7 +722,9 @@ var TableHead = ({
|
|
|
717
722
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
718
723
|
}
|
|
719
724
|
) }),
|
|
720
|
-
"checkbox"
|
|
725
|
+
"checkbox",
|
|
726
|
+
void 0,
|
|
727
|
+
true
|
|
721
728
|
)
|
|
722
729
|
] }) });
|
|
723
730
|
return isLoading ? renderSkeletonRow() : renderContentRow();
|
|
@@ -741,17 +748,42 @@ var TableBody = ({
|
|
|
741
748
|
classNames,
|
|
742
749
|
className
|
|
743
750
|
}) => {
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
751
|
+
const renderTdSkeleton = (key, column) => {
|
|
752
|
+
const isCheckbox = key.includes("checkbox");
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
754
|
+
"td",
|
|
755
|
+
{
|
|
756
|
+
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
757
|
+
style: isCheckbox ? {
|
|
758
|
+
width: "40px",
|
|
759
|
+
minWidth: "40px",
|
|
760
|
+
maxWidth: "40px",
|
|
761
|
+
flexShrink: 0,
|
|
762
|
+
flexGrow: 0,
|
|
763
|
+
boxSizing: "border-box"
|
|
764
|
+
} : column ? getCellStyle(column) : void 0,
|
|
765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
766
|
+
},
|
|
767
|
+
key
|
|
768
|
+
);
|
|
769
|
+
};
|
|
770
|
+
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
771
|
+
"td",
|
|
772
|
+
{
|
|
773
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
774
|
+
style: {
|
|
775
|
+
width: "40px",
|
|
776
|
+
minWidth: "40px",
|
|
777
|
+
maxWidth: "40px",
|
|
778
|
+
flexShrink: 0,
|
|
779
|
+
flexGrow: 0,
|
|
780
|
+
boxSizing: "border-box"
|
|
781
|
+
},
|
|
782
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
783
|
+
}
|
|
784
|
+
);
|
|
753
785
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
754
|
-
columns.map((
|
|
786
|
+
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
755
787
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
756
788
|
] }, `skeleton-${rowIndex}`);
|
|
757
789
|
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
@@ -6129,6 +6161,15 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6129
6161
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6130
6162
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
6131
6163
|
const [checkedRows, setCheckedRows] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
|
|
6164
|
+
const tableMinWidth = (0, import_react5.useMemo)(() => {
|
|
6165
|
+
const columnsWidth = columns.reduce((total, column) => {
|
|
6166
|
+
if (column.width) return total + column.width;
|
|
6167
|
+
if (column.minWidth) return total + column.minWidth;
|
|
6168
|
+
return total + 100;
|
|
6169
|
+
}, 0);
|
|
6170
|
+
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6171
|
+
return columnsWidth + checkboxWidth;
|
|
6172
|
+
}, [columns, rowCheckbox]);
|
|
6132
6173
|
(0, import_react5.useEffect)(() => {
|
|
6133
6174
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRows));
|
|
6134
6175
|
}, [checkedRows]);
|
|
@@ -6162,43 +6203,54 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6162
6203
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6163
6204
|
const slots = (0, import_react5.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
6164
6205
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
6165
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
{
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6206
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6207
|
+
"table",
|
|
6208
|
+
{
|
|
6209
|
+
className: slots.table({ class: classNames == null ? void 0 : classNames.table }),
|
|
6210
|
+
style: {
|
|
6211
|
+
tableLayout: "fixed",
|
|
6212
|
+
width: "100%",
|
|
6213
|
+
minWidth: `${tableMinWidth}px`
|
|
6214
|
+
},
|
|
6215
|
+
children: [
|
|
6216
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6217
|
+
table_head_default,
|
|
6218
|
+
{
|
|
6219
|
+
columns,
|
|
6220
|
+
size,
|
|
6221
|
+
color,
|
|
6222
|
+
rowCheckbox,
|
|
6223
|
+
isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
|
|
6224
|
+
onCheckAll: handleAllRowCheck,
|
|
6225
|
+
isLoading,
|
|
6226
|
+
classNames,
|
|
6227
|
+
slots
|
|
6228
|
+
}
|
|
6229
|
+
),
|
|
6230
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6231
|
+
table_body_default,
|
|
6232
|
+
{
|
|
6233
|
+
slots,
|
|
6234
|
+
rows,
|
|
6235
|
+
columns,
|
|
6236
|
+
size,
|
|
6237
|
+
color,
|
|
6238
|
+
rowCheckbox,
|
|
6239
|
+
checkedRows,
|
|
6240
|
+
onCheckRow: handleRowCheck,
|
|
6241
|
+
emptyContent,
|
|
6242
|
+
isLoading,
|
|
6243
|
+
skeletonRow,
|
|
6244
|
+
className: clsx(
|
|
6245
|
+
"transition-all duration-150 ease-out",
|
|
6246
|
+
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
|
|
6247
|
+
classNames
|
|
6248
|
+
)
|
|
6249
|
+
}
|
|
6198
6250
|
)
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6251
|
+
]
|
|
6252
|
+
}
|
|
6253
|
+
) }),
|
|
6202
6254
|
showPagination && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6203
6255
|
pagination_default,
|
|
6204
6256
|
{
|
|
@@ -6428,3 +6480,22 @@ var tableStyle = (0, import_tailwind_variants7.tv)({
|
|
|
6428
6480
|
height: "narrow"
|
|
6429
6481
|
}
|
|
6430
6482
|
});
|
|
6483
|
+
var getCellStyle = (column) => {
|
|
6484
|
+
const hasFixedWidth = column.width;
|
|
6485
|
+
const hasMinWidth = column.minWidth;
|
|
6486
|
+
return {
|
|
6487
|
+
width: hasFixedWidth ? `${column.width}px` : "auto",
|
|
6488
|
+
minWidth: hasMinWidth ? `${column.minWidth}px` : hasFixedWidth ? `${column.width}px` : void 0,
|
|
6489
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
6490
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
6491
|
+
textAlign: column.align || "center",
|
|
6492
|
+
boxSizing: "border-box",
|
|
6493
|
+
overflow: "hidden",
|
|
6494
|
+
textOverflow: "ellipsis",
|
|
6495
|
+
whiteSpace: "nowrap"
|
|
6496
|
+
};
|
|
6497
|
+
};
|
|
6498
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
6499
|
+
0 && (module.exports = {
|
|
6500
|
+
getCellStyle
|
|
6501
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
getCellStyle,
|
|
3
4
|
table_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-5GBAUDP4.mjs";
|
|
6
|
-
import "../../chunk-TKB2JL2E.mjs";
|
|
5
|
+
} from "../../chunk-UWXCAR5C.mjs";
|
|
7
6
|
import "../../chunk-DQRAFUDA.mjs";
|
|
8
7
|
import "../../chunk-M37VBNB3.mjs";
|
|
9
8
|
import "../../chunk-MZ76AA76.mjs";
|
|
@@ -23,5 +22,6 @@ import "../../chunk-27Y6K5NK.mjs";
|
|
|
23
22
|
import "../../chunk-E3G5QXSH.mjs";
|
|
24
23
|
import "../../chunk-AC6TWLRT.mjs";
|
|
25
24
|
export {
|
|
26
|
-
table_default as default
|
|
25
|
+
table_default as default,
|
|
26
|
+
getCellStyle
|
|
27
27
|
};
|
package/dist/index.js
CHANGED
|
@@ -7714,23 +7714,27 @@ var TableHead = ({
|
|
|
7714
7714
|
e.preventDefault();
|
|
7715
7715
|
onCheckAll(!isCheckedAll);
|
|
7716
7716
|
};
|
|
7717
|
-
const renderTh = (content, key, column) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7717
|
+
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7718
7718
|
"th",
|
|
7719
7719
|
{
|
|
7720
|
-
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
|
|
7721
|
-
style: {
|
|
7722
|
-
width:
|
|
7723
|
-
minWidth:
|
|
7724
|
-
maxWidth:
|
|
7725
|
-
|
|
7726
|
-
|
|
7720
|
+
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className),
|
|
7721
|
+
style: isCheckbox ? {
|
|
7722
|
+
width: "40px",
|
|
7723
|
+
minWidth: "40px",
|
|
7724
|
+
maxWidth: "40px",
|
|
7725
|
+
flexShrink: 0,
|
|
7726
|
+
flexGrow: 0,
|
|
7727
|
+
boxSizing: "border-box"
|
|
7728
|
+
} : column ? getCellStyle(column) : void 0,
|
|
7727
7729
|
children: content
|
|
7728
7730
|
},
|
|
7729
7731
|
key
|
|
7730
7732
|
);
|
|
7731
7733
|
const renderSkeletonRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
|
|
7732
|
-
columns.map(
|
|
7733
|
-
|
|
7734
|
+
columns.map(
|
|
7735
|
+
(column, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`, column)
|
|
7736
|
+
),
|
|
7737
|
+
rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton", void 0, true)
|
|
7734
7738
|
] }) });
|
|
7735
7739
|
const renderContentRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
7736
7740
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
@@ -7743,7 +7747,9 @@ var TableHead = ({
|
|
|
7743
7747
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
7744
7748
|
}
|
|
7745
7749
|
) }),
|
|
7746
|
-
"checkbox"
|
|
7750
|
+
"checkbox",
|
|
7751
|
+
void 0,
|
|
7752
|
+
true
|
|
7747
7753
|
)
|
|
7748
7754
|
] }) });
|
|
7749
7755
|
return isLoading ? renderSkeletonRow() : renderContentRow();
|
|
@@ -7767,17 +7773,42 @@ var TableBody = ({
|
|
|
7767
7773
|
classNames,
|
|
7768
7774
|
className
|
|
7769
7775
|
}) => {
|
|
7770
|
-
const
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7776
|
+
const renderTdSkeleton = (key, column) => {
|
|
7777
|
+
const isCheckbox = key.includes("checkbox");
|
|
7778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7779
|
+
"td",
|
|
7780
|
+
{
|
|
7781
|
+
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
7782
|
+
style: isCheckbox ? {
|
|
7783
|
+
width: "40px",
|
|
7784
|
+
minWidth: "40px",
|
|
7785
|
+
maxWidth: "40px",
|
|
7786
|
+
flexShrink: 0,
|
|
7787
|
+
flexGrow: 0,
|
|
7788
|
+
boxSizing: "border-box"
|
|
7789
|
+
} : column ? getCellStyle(column) : void 0,
|
|
7790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
7791
|
+
},
|
|
7792
|
+
key
|
|
7793
|
+
);
|
|
7794
|
+
};
|
|
7795
|
+
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7796
|
+
"td",
|
|
7797
|
+
{
|
|
7798
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
7799
|
+
style: {
|
|
7800
|
+
width: "40px",
|
|
7801
|
+
minWidth: "40px",
|
|
7802
|
+
maxWidth: "40px",
|
|
7803
|
+
flexShrink: 0,
|
|
7804
|
+
flexGrow: 0,
|
|
7805
|
+
boxSizing: "border-box"
|
|
7806
|
+
},
|
|
7807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
7808
|
+
}
|
|
7809
|
+
);
|
|
7779
7810
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
7780
|
-
columns.map((
|
|
7811
|
+
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
7781
7812
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
7782
7813
|
] }, `skeleton-${rowIndex}`);
|
|
7783
7814
|
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
@@ -8152,6 +8183,15 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
8152
8183
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
8153
8184
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
8154
8185
|
const [checkedRows, setCheckedRows] = (0, import_react15.useState)(/* @__PURE__ */ new Set());
|
|
8186
|
+
const tableMinWidth = (0, import_react15.useMemo)(() => {
|
|
8187
|
+
const columnsWidth = columns.reduce((total, column) => {
|
|
8188
|
+
if (column.width) return total + column.width;
|
|
8189
|
+
if (column.minWidth) return total + column.minWidth;
|
|
8190
|
+
return total + 100;
|
|
8191
|
+
}, 0);
|
|
8192
|
+
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
8193
|
+
return columnsWidth + checkboxWidth;
|
|
8194
|
+
}, [columns, rowCheckbox]);
|
|
8155
8195
|
(0, import_react15.useEffect)(() => {
|
|
8156
8196
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRows));
|
|
8157
8197
|
}, [checkedRows]);
|
|
@@ -8185,43 +8225,54 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
8185
8225
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
8186
8226
|
const slots = (0, import_react15.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
8187
8227
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
8188
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
{
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8228
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8229
|
+
"table",
|
|
8230
|
+
{
|
|
8231
|
+
className: slots.table({ class: classNames == null ? void 0 : classNames.table }),
|
|
8232
|
+
style: {
|
|
8233
|
+
tableLayout: "fixed",
|
|
8234
|
+
width: "100%",
|
|
8235
|
+
minWidth: `${tableMinWidth}px`
|
|
8236
|
+
},
|
|
8237
|
+
children: [
|
|
8238
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8239
|
+
table_head_default,
|
|
8240
|
+
{
|
|
8241
|
+
columns,
|
|
8242
|
+
size,
|
|
8243
|
+
color,
|
|
8244
|
+
rowCheckbox,
|
|
8245
|
+
isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
|
|
8246
|
+
onCheckAll: handleAllRowCheck,
|
|
8247
|
+
isLoading,
|
|
8248
|
+
classNames,
|
|
8249
|
+
slots
|
|
8250
|
+
}
|
|
8251
|
+
),
|
|
8252
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8253
|
+
table_body_default,
|
|
8254
|
+
{
|
|
8255
|
+
slots,
|
|
8256
|
+
rows,
|
|
8257
|
+
columns,
|
|
8258
|
+
size,
|
|
8259
|
+
color,
|
|
8260
|
+
rowCheckbox,
|
|
8261
|
+
checkedRows,
|
|
8262
|
+
onCheckRow: handleRowCheck,
|
|
8263
|
+
emptyContent,
|
|
8264
|
+
isLoading,
|
|
8265
|
+
skeletonRow,
|
|
8266
|
+
className: clsx(
|
|
8267
|
+
"transition-all duration-150 ease-out",
|
|
8268
|
+
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
|
|
8269
|
+
classNames
|
|
8270
|
+
)
|
|
8271
|
+
}
|
|
8221
8272
|
)
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8273
|
+
]
|
|
8274
|
+
}
|
|
8275
|
+
) }),
|
|
8225
8276
|
showPagination && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8226
8277
|
pagination_default,
|
|
8227
8278
|
{
|
|
@@ -8451,6 +8502,21 @@ var tableStyle = (0, import_tailwind_variants16.tv)({
|
|
|
8451
8502
|
height: "narrow"
|
|
8452
8503
|
}
|
|
8453
8504
|
});
|
|
8505
|
+
var getCellStyle = (column) => {
|
|
8506
|
+
const hasFixedWidth = column.width;
|
|
8507
|
+
const hasMinWidth = column.minWidth;
|
|
8508
|
+
return {
|
|
8509
|
+
width: hasFixedWidth ? `${column.width}px` : "auto",
|
|
8510
|
+
minWidth: hasMinWidth ? `${column.minWidth}px` : hasFixedWidth ? `${column.width}px` : void 0,
|
|
8511
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
8512
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
8513
|
+
textAlign: column.align || "center",
|
|
8514
|
+
boxSizing: "border-box",
|
|
8515
|
+
overflow: "hidden",
|
|
8516
|
+
textOverflow: "ellipsis",
|
|
8517
|
+
whiteSpace: "nowrap"
|
|
8518
|
+
};
|
|
8519
|
+
};
|
|
8454
8520
|
|
|
8455
8521
|
// src/components/table/definition-table.tsx
|
|
8456
8522
|
var import_react16 = require("react");
|
package/dist/index.mjs
CHANGED
|
@@ -28,9 +28,7 @@ import {
|
|
|
28
28
|
} from "./chunk-KCAGZUYM.mjs";
|
|
29
29
|
import {
|
|
30
30
|
table_default
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-5GBAUDP4.mjs";
|
|
33
|
-
import "./chunk-TKB2JL2E.mjs";
|
|
31
|
+
} from "./chunk-UWXCAR5C.mjs";
|
|
34
32
|
import "./chunk-3MY6LO7N.mjs";
|
|
35
33
|
import {
|
|
36
34
|
tabs_default
|
|
@@ -88,15 +86,15 @@ import {
|
|
|
88
86
|
import "./chunk-75HLCORR.mjs";
|
|
89
87
|
import {
|
|
90
88
|
dateTimePicker_default
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
import "./chunk-
|
|
89
|
+
} from "./chunk-L65ETSUY.mjs";
|
|
90
|
+
import "./chunk-ZYS4NSXT.mjs";
|
|
93
91
|
import "./chunk-7MVEAQ7Z.mjs";
|
|
94
|
-
import {
|
|
95
|
-
list_default
|
|
96
|
-
} from "./chunk-B6XJNGQL.mjs";
|
|
97
92
|
import {
|
|
98
93
|
listItem_default
|
|
99
94
|
} from "./chunk-QFIS6N5R.mjs";
|
|
95
|
+
import {
|
|
96
|
+
list_default
|
|
97
|
+
} from "./chunk-B6XJNGQL.mjs";
|
|
100
98
|
import "./chunk-FWJ2ZKH6.mjs";
|
|
101
99
|
import "./chunk-TUXYVNTY.mjs";
|
|
102
100
|
import "./chunk-P732YGHO.mjs";
|