@deepnoid/ui 0.1.91 → 0.1.93
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 +169 -169
- package/dist/{chunk-XGY54NSJ.mjs → chunk-4HCQMYHI.mjs} +3 -3
- package/dist/{chunk-BOFOJQMD.mjs → chunk-AJUOSLYC.mjs} +3 -3
- package/dist/{chunk-Q3JMHIW5.mjs → chunk-APKDCFD4.mjs} +1 -1
- package/dist/{chunk-LMHSWLH2.mjs → chunk-CTEQVIV4.mjs} +4 -4
- package/dist/{chunk-Y4M2F6VZ.mjs → chunk-FCKMEDUD.mjs} +1 -1
- package/dist/{chunk-XVV6JM5I.mjs → chunk-LYAPVC26.mjs} +64 -61
- package/dist/{chunk-7FQEGLQG.mjs → chunk-V57ADP5P.mjs} +1 -1
- package/dist/{chunk-D3HZG3CH.mjs → chunk-XK4JSX7G.mjs} +1 -1
- package/dist/components/accordion/index.mjs +3 -3
- package/dist/components/backdrop/backdrop.mjs +2 -2
- package/dist/components/backdrop/index.mjs +2 -2
- package/dist/components/breadcrumb/breadcrumb.mjs +4 -4
- package/dist/components/breadcrumb/index.mjs +4 -4
- package/dist/components/button/button.mjs +1 -1
- package/dist/components/button/icon-button.mjs +1 -1
- package/dist/components/button/index.mjs +5 -5
- package/dist/components/button/text-button.mjs +2 -2
- package/dist/components/checkbox/checkbox.mjs +2 -2
- package/dist/components/checkbox/index.mjs +2 -2
- package/dist/components/chip/chip.mjs +1 -1
- package/dist/components/chip/index.mjs +1 -1
- package/dist/components/dateTimePicker/calendar.mjs +1 -1
- package/dist/components/dateTimePicker/dateTimePicker.mjs +4 -4
- package/dist/components/dateTimePicker/index.mjs +4 -4
- package/dist/components/dateTimePicker/timePicker.mjs +3 -3
- package/dist/components/drawer/drawer.mjs +2 -2
- package/dist/components/drawer/index.mjs +2 -2
- package/dist/components/fileUpload/fileUpload.mjs +5 -5
- package/dist/components/fileUpload/index.mjs +5 -5
- package/dist/components/input/index.mjs +3 -3
- package/dist/components/input/input.mjs +3 -3
- package/dist/components/list/index.mjs +2 -2
- package/dist/components/list/listItem.mjs +2 -2
- package/dist/components/modal/index.mjs +5 -5
- package/dist/components/modal/modal.mjs +5 -5
- package/dist/components/pagination/index.mjs +4 -4
- package/dist/components/pagination/pagination.mjs +4 -4
- package/dist/components/progress/index.mjs +2 -2
- package/dist/components/progress/progress.mjs +2 -2
- package/dist/components/radio/index.mjs +2 -2
- package/dist/components/radio/radio.mjs +2 -2
- package/dist/components/select/index.mjs +3 -3
- package/dist/components/select/select.mjs +3 -3
- package/dist/components/table/definition-table.mjs +2 -2
- package/dist/components/table/index.js +59 -56
- package/dist/components/table/index.mjs +7 -7
- package/dist/components/table/table-body.d.mts +2 -1
- package/dist/components/table/table-body.d.ts +2 -1
- package/dist/components/table/table-body.js +59 -56
- package/dist/components/table/table-body.mjs +6 -6
- package/dist/components/table/table-head.d.mts +2 -2
- package/dist/components/table/table-head.d.ts +2 -2
- package/dist/components/table/table-head.js +59 -56
- package/dist/components/table/table-head.mjs +6 -6
- package/dist/components/table/table.d.mts +16 -0
- package/dist/components/table/table.d.ts +16 -0
- package/dist/components/table/table.js +59 -56
- package/dist/components/table/table.mjs +6 -6
- package/dist/components/textarea/index.mjs +2 -2
- package/dist/components/textarea/textarea.mjs +2 -2
- package/dist/components/toast/index.mjs +4 -4
- package/dist/components/toast/toast.mjs +3 -3
- package/dist/components/toast/use-toast.mjs +4 -4
- package/dist/components/tree/index.mjs +2 -2
- package/dist/components/tree/tree.mjs +2 -2
- package/dist/index.js +59 -56
- package/dist/index.mjs +38 -38
- package/package.json +1 -1
- package/dist/{chunk-5FFTHFBX.mjs → chunk-2KS64V6J.mjs} +3 -3
- package/dist/{chunk-XZ5DXOJQ.mjs → chunk-36SVU53P.mjs} +3 -3
- package/dist/{chunk-6Q2BXHJL.mjs → chunk-4EIGHKUO.mjs} +3 -3
- package/dist/{chunk-GH4EPD35.mjs → chunk-BJMVYWOZ.mjs} +3 -3
- package/dist/{chunk-MPZKOT6P.mjs → chunk-CZKOYVZM.mjs} +3 -3
- package/dist/{chunk-MVL7HJSH.mjs → chunk-I4NXNQWS.mjs} +3 -3
- package/dist/{chunk-JBSV7GCL.mjs → chunk-JF7JH3YN.mjs} +3 -3
- package/dist/{chunk-4BJPJ54Q.mjs → chunk-JI3IYCXH.mjs} +3 -3
- package/dist/{chunk-3M6VYLOU.mjs → chunk-KY3W7MBV.mjs} +3 -3
- package/dist/{chunk-Y5QV7T6D.mjs → chunk-MUNZ6PTR.mjs} +3 -3
- package/dist/{chunk-S7Y7XUBL.mjs → chunk-NO6RDCY7.mjs} +3 -3
- package/dist/{chunk-AF4I7ZQS.mjs → chunk-NUELPELQ.mjs} +3 -3
- package/dist/{chunk-I3ORSDFO.mjs → chunk-O54WOM66.mjs} +3 -3
|
@@ -695,15 +695,11 @@ var TableHead = ({
|
|
|
695
695
|
color,
|
|
696
696
|
size,
|
|
697
697
|
rowCheckbox = false,
|
|
698
|
-
|
|
698
|
+
hasCheckedRows,
|
|
699
699
|
isLoading = false,
|
|
700
700
|
classNames,
|
|
701
701
|
onCheckAll
|
|
702
702
|
}) => {
|
|
703
|
-
const handleClickCheckAll = (e) => {
|
|
704
|
-
e.preventDefault();
|
|
705
|
-
onCheckAll(!isCheckedAll);
|
|
706
|
-
};
|
|
707
703
|
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
708
704
|
"th",
|
|
709
705
|
{
|
|
@@ -729,11 +725,11 @@ var TableHead = ({
|
|
|
729
725
|
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: [
|
|
730
726
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
731
727
|
rowCheckbox && renderTh(
|
|
732
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", {
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
733
729
|
checkbox_default,
|
|
734
730
|
{
|
|
735
731
|
size,
|
|
736
|
-
checked:
|
|
732
|
+
checked: hasCheckedRows,
|
|
737
733
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
738
734
|
}
|
|
739
735
|
) }),
|
|
@@ -757,6 +753,7 @@ var TableBody = ({
|
|
|
757
753
|
rowCheckbox = false,
|
|
758
754
|
checkedRows,
|
|
759
755
|
onCheckRow,
|
|
756
|
+
onRowClick,
|
|
760
757
|
isLoading = false,
|
|
761
758
|
emptyContent,
|
|
762
759
|
skeletonRow,
|
|
@@ -765,67 +762,54 @@ var TableBody = ({
|
|
|
765
762
|
}) => {
|
|
766
763
|
const renderTdSkeleton = (key, column) => {
|
|
767
764
|
const isCheckbox = key.includes("checkbox");
|
|
768
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
769
|
-
"td",
|
|
770
|
-
{
|
|
771
|
-
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
772
|
-
style: isCheckbox ? {
|
|
773
|
-
width: "40px",
|
|
774
|
-
minWidth: "40px",
|
|
775
|
-
maxWidth: "40px",
|
|
776
|
-
flexShrink: 0,
|
|
777
|
-
flexGrow: 0,
|
|
778
|
-
boxSizing: "border-box"
|
|
779
|
-
} : column ? getCellStyle(column) : void 0,
|
|
780
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
781
|
-
},
|
|
782
|
-
key
|
|
783
|
-
);
|
|
765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), style: column ? getCellStyle(column) : {}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
784
766
|
};
|
|
785
767
|
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
786
768
|
"td",
|
|
787
769
|
{
|
|
788
770
|
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
789
|
-
style: {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
flexShrink: 0,
|
|
794
|
-
flexGrow: 0,
|
|
795
|
-
boxSizing: "border-box"
|
|
796
|
-
},
|
|
797
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
798
|
-
}
|
|
771
|
+
style: { width: "40px", minWidth: "40px", textAlign: "center" },
|
|
772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) }) })
|
|
773
|
+
},
|
|
774
|
+
`checkbox-${rowId}`
|
|
799
775
|
);
|
|
800
776
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
801
777
|
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
802
778
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
803
779
|
] }, `skeleton-${rowIndex}`);
|
|
804
780
|
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 }) });
|
|
805
|
-
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
781
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
782
|
+
"tr",
|
|
783
|
+
{
|
|
784
|
+
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
785
|
+
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
786
|
+
children: [
|
|
787
|
+
columns.map((column, colIdx) => {
|
|
788
|
+
var _a;
|
|
789
|
+
const value = row[column.field];
|
|
790
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
791
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
793
|
+
"td",
|
|
794
|
+
{
|
|
795
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className),
|
|
796
|
+
style: getCellStyle(column),
|
|
797
|
+
children: content
|
|
798
|
+
},
|
|
799
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
800
|
+
);
|
|
801
|
+
}),
|
|
802
|
+
rowCheckbox && renderCheckboxCell(row.id)
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
row.id
|
|
806
|
+
);
|
|
823
807
|
const renderRows = () => {
|
|
824
808
|
if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, {});
|
|
825
809
|
if (!rows.length && emptyContent) return renderEmptyRow();
|
|
826
810
|
return rows.map((row, index) => renderDataRow(row, index));
|
|
827
811
|
};
|
|
828
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { className:
|
|
812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: renderRows() });
|
|
829
813
|
};
|
|
830
814
|
var table_body_default = TableBody;
|
|
831
815
|
|
|
@@ -6168,10 +6152,12 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6168
6152
|
emptyContent,
|
|
6169
6153
|
isLoading = false,
|
|
6170
6154
|
classNames,
|
|
6155
|
+
variant,
|
|
6171
6156
|
color,
|
|
6172
6157
|
size,
|
|
6173
6158
|
skeletonRow,
|
|
6174
|
-
onCheckedRowsChange
|
|
6159
|
+
onCheckedRowsChange,
|
|
6160
|
+
onRowClick
|
|
6175
6161
|
} = { ...props, ...variantProps };
|
|
6176
6162
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6177
6163
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -6215,8 +6201,18 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6215
6201
|
return updated;
|
|
6216
6202
|
});
|
|
6217
6203
|
};
|
|
6204
|
+
const handleRowClick = (row, index, event) => {
|
|
6205
|
+
const target = event.target;
|
|
6206
|
+
if (target.closest('input[type="checkbox"]') || target.closest("[data-checkbox]")) {
|
|
6207
|
+
return;
|
|
6208
|
+
}
|
|
6209
|
+
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6210
|
+
};
|
|
6218
6211
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6219
|
-
const slots = (0, import_react5.useMemo)(
|
|
6212
|
+
const slots = (0, import_react5.useMemo)(
|
|
6213
|
+
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6214
|
+
[variantProps, onRowClick]
|
|
6215
|
+
);
|
|
6220
6216
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
6221
6217
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6222
6218
|
"table",
|
|
@@ -6235,7 +6231,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6235
6231
|
size,
|
|
6236
6232
|
color,
|
|
6237
6233
|
rowCheckbox,
|
|
6238
|
-
|
|
6234
|
+
hasCheckedRows: checkedRows.size > 0,
|
|
6239
6235
|
onCheckAll: handleAllRowCheck,
|
|
6240
6236
|
isLoading,
|
|
6241
6237
|
classNames,
|
|
@@ -6253,8 +6249,9 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6253
6249
|
rowCheckbox,
|
|
6254
6250
|
checkedRows,
|
|
6255
6251
|
onCheckRow: handleRowCheck,
|
|
6256
|
-
|
|
6252
|
+
onRowClick: handleRowClick,
|
|
6257
6253
|
isLoading,
|
|
6254
|
+
emptyContent,
|
|
6258
6255
|
skeletonRow,
|
|
6259
6256
|
className: clsx(
|
|
6260
6257
|
"transition-all duration-150 ease-out",
|
|
@@ -6269,6 +6266,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6269
6266
|
showPagination && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6270
6267
|
pagination_default,
|
|
6271
6268
|
{
|
|
6269
|
+
variant: variant === "outline" ? "solid" : variant,
|
|
6272
6270
|
color,
|
|
6273
6271
|
currentPage: page,
|
|
6274
6272
|
totalPage: Math.ceil(totalData / perPage),
|
|
@@ -6363,6 +6361,11 @@ var tableStyle = (0, import_tailwind_variants7.tv)({
|
|
|
6363
6361
|
height: {
|
|
6364
6362
|
narrow: {},
|
|
6365
6363
|
wide: {}
|
|
6364
|
+
},
|
|
6365
|
+
rowClickable: {
|
|
6366
|
+
true: {
|
|
6367
|
+
tr: ["cursor-pointer"]
|
|
6368
|
+
}
|
|
6366
6369
|
}
|
|
6367
6370
|
},
|
|
6368
6371
|
compoundVariants: [
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getCellStyle,
|
|
4
4
|
table_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-LYAPVC26.mjs";
|
|
6
6
|
import "../../chunk-MZ76AA76.mjs";
|
|
7
7
|
import "../../chunk-6PN3DGOE.mjs";
|
|
8
8
|
import "../../chunk-DQRAFUDA.mjs";
|
|
9
9
|
import "../../chunk-M37VBNB3.mjs";
|
|
10
10
|
import "../../chunk-7B7LRG5J.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-CTEQVIV4.mjs";
|
|
12
12
|
import "../../chunk-F3HENRVM.mjs";
|
|
13
13
|
import "../../chunk-2GCSFWHD.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-I4NXNQWS.mjs";
|
|
15
15
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-36SVU53P.mjs";
|
|
17
17
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
18
18
|
import "../../chunk-JP4TEWP7.mjs";
|
|
19
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
20
20
|
import "../../chunk-RRONV7YA.mjs";
|
|
21
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
21
22
|
import "../../chunk-CDXBML6O.mjs";
|
|
22
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
23
23
|
import "../../chunk-AC6TWLRT.mjs";
|
|
24
24
|
export {
|
|
25
25
|
table_default as default,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import "../../chunk-RRAZM5D3.mjs";
|
|
3
3
|
import {
|
|
4
4
|
textarea_default
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-E3G5QXSH.mjs";
|
|
5
|
+
} from "../../chunk-4EIGHKUO.mjs";
|
|
7
6
|
import "../../chunk-27Y6K5NK.mjs";
|
|
7
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
8
8
|
import "../../chunk-AC6TWLRT.mjs";
|
|
9
9
|
export {
|
|
10
10
|
textarea_default as Textarea
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
textarea_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-E3G5QXSH.mjs";
|
|
4
|
+
} from "../../chunk-4EIGHKUO.mjs";
|
|
6
5
|
import "../../chunk-27Y6K5NK.mjs";
|
|
6
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
7
7
|
import "../../chunk-AC6TWLRT.mjs";
|
|
8
8
|
export {
|
|
9
9
|
textarea_default as default
|
|
@@ -3,17 +3,17 @@ import "../../chunk-LUWGOKLG.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
ToastProvider,
|
|
5
5
|
useToast
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-XK4JSX7G.mjs";
|
|
7
7
|
import "../../chunk-ZOTHPHXA.mjs";
|
|
8
8
|
import {
|
|
9
9
|
toast_default
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-JI3IYCXH.mjs";
|
|
11
11
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
12
12
|
import "../../chunk-JP4TEWP7.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
14
14
|
import "../../chunk-RRONV7YA.mjs";
|
|
15
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
15
16
|
import "../../chunk-CDXBML6O.mjs";
|
|
16
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
17
17
|
import "../../chunk-AC6TWLRT.mjs";
|
|
18
18
|
export {
|
|
19
19
|
toast_default as Toast,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
toast_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JI3IYCXH.mjs";
|
|
5
5
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
6
6
|
import "../../chunk-JP4TEWP7.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
8
8
|
import "../../chunk-RRONV7YA.mjs";
|
|
9
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
9
10
|
import "../../chunk-CDXBML6O.mjs";
|
|
10
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
11
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
12
12
|
export {
|
|
13
13
|
toast_default as default
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ToastProvider,
|
|
4
4
|
useToast
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-XK4JSX7G.mjs";
|
|
6
6
|
import "../../chunk-ZOTHPHXA.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-JI3IYCXH.mjs";
|
|
8
8
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
9
9
|
import "../../chunk-JP4TEWP7.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
11
11
|
import "../../chunk-RRONV7YA.mjs";
|
|
12
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
12
13
|
import "../../chunk-CDXBML6O.mjs";
|
|
13
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
14
14
|
import "../../chunk-AC6TWLRT.mjs";
|
|
15
15
|
export {
|
|
16
16
|
ToastProvider,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import "../../chunk-MBLZYQCN.mjs";
|
|
3
3
|
import {
|
|
4
4
|
tree_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-MUNZ6PTR.mjs";
|
|
6
6
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
7
7
|
import "../../chunk-JP4TEWP7.mjs";
|
|
8
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
8
9
|
import "../../chunk-RRONV7YA.mjs";
|
|
9
10
|
import "../../chunk-CDXBML6O.mjs";
|
|
10
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
11
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
12
12
|
export {
|
|
13
13
|
tree_default as Tree
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Tree,
|
|
4
4
|
tree_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-MUNZ6PTR.mjs";
|
|
6
6
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
7
7
|
import "../../chunk-JP4TEWP7.mjs";
|
|
8
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
8
9
|
import "../../chunk-RRONV7YA.mjs";
|
|
9
10
|
import "../../chunk-CDXBML6O.mjs";
|
|
10
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
11
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
12
12
|
export {
|
|
13
13
|
Tree,
|
package/dist/index.js
CHANGED
|
@@ -8034,15 +8034,11 @@ var TableHead = ({
|
|
|
8034
8034
|
color,
|
|
8035
8035
|
size,
|
|
8036
8036
|
rowCheckbox = false,
|
|
8037
|
-
|
|
8037
|
+
hasCheckedRows,
|
|
8038
8038
|
isLoading = false,
|
|
8039
8039
|
classNames,
|
|
8040
8040
|
onCheckAll
|
|
8041
8041
|
}) => {
|
|
8042
|
-
const handleClickCheckAll = (e) => {
|
|
8043
|
-
e.preventDefault();
|
|
8044
|
-
onCheckAll(!isCheckedAll);
|
|
8045
|
-
};
|
|
8046
8042
|
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8047
8043
|
"th",
|
|
8048
8044
|
{
|
|
@@ -8068,11 +8064,11 @@ var TableHead = ({
|
|
|
8068
8064
|
const renderContentRow = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
8069
8065
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
8070
8066
|
rowCheckbox && renderTh(
|
|
8071
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", {
|
|
8067
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8072
8068
|
checkbox_default,
|
|
8073
8069
|
{
|
|
8074
8070
|
size,
|
|
8075
|
-
checked:
|
|
8071
|
+
checked: hasCheckedRows,
|
|
8076
8072
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
8077
8073
|
}
|
|
8078
8074
|
) }),
|
|
@@ -8096,6 +8092,7 @@ var TableBody = ({
|
|
|
8096
8092
|
rowCheckbox = false,
|
|
8097
8093
|
checkedRows,
|
|
8098
8094
|
onCheckRow,
|
|
8095
|
+
onRowClick,
|
|
8099
8096
|
isLoading = false,
|
|
8100
8097
|
emptyContent,
|
|
8101
8098
|
skeletonRow,
|
|
@@ -8104,67 +8101,54 @@ var TableBody = ({
|
|
|
8104
8101
|
}) => {
|
|
8105
8102
|
const renderTdSkeleton = (key, column) => {
|
|
8106
8103
|
const isCheckbox = key.includes("checkbox");
|
|
8107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8108
|
-
"td",
|
|
8109
|
-
{
|
|
8110
|
-
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
8111
|
-
style: isCheckbox ? {
|
|
8112
|
-
width: "40px",
|
|
8113
|
-
minWidth: "40px",
|
|
8114
|
-
maxWidth: "40px",
|
|
8115
|
-
flexShrink: 0,
|
|
8116
|
-
flexGrow: 0,
|
|
8117
|
-
boxSizing: "border-box"
|
|
8118
|
-
} : column ? getCellStyle(column) : void 0,
|
|
8119
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
8120
|
-
},
|
|
8121
|
-
key
|
|
8122
|
-
);
|
|
8104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), style: column ? getCellStyle(column) : {}, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
8123
8105
|
};
|
|
8124
8106
|
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8125
8107
|
"td",
|
|
8126
8108
|
{
|
|
8127
8109
|
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
8128
|
-
style: {
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
flexShrink: 0,
|
|
8133
|
-
flexGrow: 0,
|
|
8134
|
-
boxSizing: "border-box"
|
|
8135
|
-
},
|
|
8136
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
8137
|
-
}
|
|
8110
|
+
style: { width: "40px", minWidth: "40px", textAlign: "center" },
|
|
8111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) }) })
|
|
8112
|
+
},
|
|
8113
|
+
`checkbox-${rowId}`
|
|
8138
8114
|
);
|
|
8139
8115
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
8140
8116
|
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
8141
8117
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
8142
8118
|
] }, `skeleton-${rowIndex}`);
|
|
8143
8119
|
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
8144
|
-
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8120
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8121
|
+
"tr",
|
|
8122
|
+
{
|
|
8123
|
+
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
8124
|
+
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
8125
|
+
children: [
|
|
8126
|
+
columns.map((column, colIdx) => {
|
|
8127
|
+
var _a;
|
|
8128
|
+
const value = row[column.field];
|
|
8129
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
8130
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
8131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8132
|
+
"td",
|
|
8133
|
+
{
|
|
8134
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className),
|
|
8135
|
+
style: getCellStyle(column),
|
|
8136
|
+
children: content
|
|
8137
|
+
},
|
|
8138
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
8139
|
+
);
|
|
8140
|
+
}),
|
|
8141
|
+
rowCheckbox && renderCheckboxCell(row.id)
|
|
8142
|
+
]
|
|
8143
|
+
},
|
|
8144
|
+
row.id
|
|
8145
|
+
);
|
|
8162
8146
|
const renderRows = () => {
|
|
8163
8147
|
if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {});
|
|
8164
8148
|
if (!rows.length && emptyContent) return renderEmptyRow();
|
|
8165
8149
|
return rows.map((row, index) => renderDataRow(row, index));
|
|
8166
8150
|
};
|
|
8167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { className:
|
|
8151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: renderRows() });
|
|
8168
8152
|
};
|
|
8169
8153
|
var table_body_default = TableBody;
|
|
8170
8154
|
|
|
@@ -8504,10 +8488,12 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8504
8488
|
emptyContent,
|
|
8505
8489
|
isLoading = false,
|
|
8506
8490
|
classNames,
|
|
8491
|
+
variant,
|
|
8507
8492
|
color,
|
|
8508
8493
|
size,
|
|
8509
8494
|
skeletonRow,
|
|
8510
|
-
onCheckedRowsChange
|
|
8495
|
+
onCheckedRowsChange,
|
|
8496
|
+
onRowClick
|
|
8511
8497
|
} = { ...props, ...variantProps };
|
|
8512
8498
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
8513
8499
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -8551,8 +8537,18 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8551
8537
|
return updated;
|
|
8552
8538
|
});
|
|
8553
8539
|
};
|
|
8540
|
+
const handleRowClick = (row, index, event) => {
|
|
8541
|
+
const target = event.target;
|
|
8542
|
+
if (target.closest('input[type="checkbox"]') || target.closest("[data-checkbox]")) {
|
|
8543
|
+
return;
|
|
8544
|
+
}
|
|
8545
|
+
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
8546
|
+
};
|
|
8554
8547
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
8555
|
-
const slots = (0, import_react17.useMemo)(
|
|
8548
|
+
const slots = (0, import_react17.useMemo)(
|
|
8549
|
+
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
8550
|
+
[variantProps, onRowClick]
|
|
8551
|
+
);
|
|
8556
8552
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
8557
8553
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8558
8554
|
"table",
|
|
@@ -8571,7 +8567,7 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8571
8567
|
size,
|
|
8572
8568
|
color,
|
|
8573
8569
|
rowCheckbox,
|
|
8574
|
-
|
|
8570
|
+
hasCheckedRows: checkedRows.size > 0,
|
|
8575
8571
|
onCheckAll: handleAllRowCheck,
|
|
8576
8572
|
isLoading,
|
|
8577
8573
|
classNames,
|
|
@@ -8589,8 +8585,9 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8589
8585
|
rowCheckbox,
|
|
8590
8586
|
checkedRows,
|
|
8591
8587
|
onCheckRow: handleRowCheck,
|
|
8592
|
-
|
|
8588
|
+
onRowClick: handleRowClick,
|
|
8593
8589
|
isLoading,
|
|
8590
|
+
emptyContent,
|
|
8594
8591
|
skeletonRow,
|
|
8595
8592
|
className: clsx(
|
|
8596
8593
|
"transition-all duration-150 ease-out",
|
|
@@ -8605,6 +8602,7 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8605
8602
|
showPagination && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8606
8603
|
pagination_default,
|
|
8607
8604
|
{
|
|
8605
|
+
variant: variant === "outline" ? "solid" : variant,
|
|
8608
8606
|
color,
|
|
8609
8607
|
currentPage: page,
|
|
8610
8608
|
totalPage: Math.ceil(totalData / perPage),
|
|
@@ -8699,6 +8697,11 @@ var tableStyle = (0, import_tailwind_variants18.tv)({
|
|
|
8699
8697
|
height: {
|
|
8700
8698
|
narrow: {},
|
|
8701
8699
|
wide: {}
|
|
8700
|
+
},
|
|
8701
|
+
rowClickable: {
|
|
8702
|
+
true: {
|
|
8703
|
+
tr: ["cursor-pointer"]
|
|
8704
|
+
}
|
|
8702
8705
|
}
|
|
8703
8706
|
},
|
|
8704
8707
|
compoundVariants: [
|