@deepnoid/ui 0.1.92 → 0.1.94
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 +133 -133
- package/dist/{chunk-Q3JMHIW5.mjs → chunk-IY4AY6JJ.mjs} +1 -1
- package/dist/{chunk-D6OJWEZM.mjs → chunk-SGOE2HGI.mjs} +1 -1
- package/dist/{chunk-ZFKQOPMK.mjs → chunk-UFAY3EIU.mjs} +57 -56
- package/dist/{chunk-V5OCV42N.mjs → chunk-Z4YJ274G.mjs} +7 -1
- package/dist/components/breadcrumb/breadcrumb.mjs +1 -1
- package/dist/components/breadcrumb/index.mjs +1 -1
- package/dist/components/button/button.js +7 -1
- package/dist/components/button/button.mjs +1 -1
- package/dist/components/button/index.js +7 -1
- package/dist/components/button/index.mjs +1 -1
- package/dist/components/fileUpload/fileUpload.js +7 -1
- package/dist/components/fileUpload/fileUpload.mjs +2 -2
- package/dist/components/fileUpload/index.js +7 -1
- package/dist/components/fileUpload/index.mjs +2 -2
- package/dist/components/modal/index.js +7 -1
- package/dist/components/modal/index.mjs +2 -2
- package/dist/components/modal/modal.js +7 -1
- package/dist/components/modal/modal.mjs +2 -2
- package/dist/components/table/index.js +57 -56
- package/dist/components/table/index.mjs +1 -1
- 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 +57 -56
- package/dist/components/table/table-body.mjs +1 -1
- 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 +57 -56
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.d.mts +16 -0
- package/dist/components/table/table.d.ts +16 -0
- package/dist/components/table/table.js +57 -56
- package/dist/components/table/table.mjs +1 -1
- package/dist/index.js +64 -57
- package/dist/index.mjs +15 -15
- package/package.json +1 -1
|
@@ -39,6 +39,7 @@ var TableBody = ({
|
|
|
39
39
|
rowCheckbox = false,
|
|
40
40
|
checkedRows,
|
|
41
41
|
onCheckRow,
|
|
42
|
+
onRowClick,
|
|
42
43
|
isLoading = false,
|
|
43
44
|
emptyContent,
|
|
44
45
|
skeletonRow,
|
|
@@ -47,67 +48,54 @@ var TableBody = ({
|
|
|
47
48
|
}) => {
|
|
48
49
|
const renderTdSkeleton = (key, column) => {
|
|
49
50
|
const isCheckbox = key.includes("checkbox");
|
|
50
|
-
return /* @__PURE__ */ jsx(
|
|
51
|
-
"td",
|
|
52
|
-
{
|
|
53
|
-
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
54
|
-
style: isCheckbox ? {
|
|
55
|
-
width: "40px",
|
|
56
|
-
minWidth: "40px",
|
|
57
|
-
maxWidth: "40px",
|
|
58
|
-
flexShrink: 0,
|
|
59
|
-
flexGrow: 0,
|
|
60
|
-
boxSizing: "border-box"
|
|
61
|
-
} : column ? getCellStyle(column) : void 0,
|
|
62
|
-
children: /* @__PURE__ */ jsx(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
63
|
-
},
|
|
64
|
-
key
|
|
65
|
-
);
|
|
51
|
+
return /* @__PURE__ */ jsx("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), style: column ? getCellStyle(column) : {}, children: /* @__PURE__ */ jsx(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
66
52
|
};
|
|
67
53
|
const renderCheckboxCell = (rowId) => /* @__PURE__ */ jsx(
|
|
68
54
|
"td",
|
|
69
55
|
{
|
|
70
56
|
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
71
|
-
style: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
flexShrink: 0,
|
|
76
|
-
flexGrow: 0,
|
|
77
|
-
boxSizing: "border-box"
|
|
78
|
-
},
|
|
79
|
-
children: /* @__PURE__ */ jsx(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
80
|
-
}
|
|
57
|
+
style: { width: "40px", minWidth: "40px", textAlign: "center" },
|
|
58
|
+
children: /* @__PURE__ */ jsx("div", { "data-checkbox": true, children: /* @__PURE__ */ jsx(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) }) })
|
|
59
|
+
},
|
|
60
|
+
`checkbox-${rowId}`
|
|
81
61
|
);
|
|
82
62
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
83
63
|
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
84
64
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
85
65
|
] }, `skeleton-${rowIndex}`);
|
|
86
66
|
const renderEmptyRow = () => /* @__PURE__ */ jsx("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ jsx("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
87
|
-
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ jsxs(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
67
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ jsxs(
|
|
68
|
+
"tr",
|
|
69
|
+
{
|
|
70
|
+
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
71
|
+
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
72
|
+
children: [
|
|
73
|
+
columns.map((column, colIdx) => {
|
|
74
|
+
var _a;
|
|
75
|
+
const value = row[column.field];
|
|
76
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
77
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"td",
|
|
80
|
+
{
|
|
81
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className),
|
|
82
|
+
style: getCellStyle(column),
|
|
83
|
+
children: content
|
|
84
|
+
},
|
|
85
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
86
|
+
);
|
|
87
|
+
}),
|
|
88
|
+
rowCheckbox && renderCheckboxCell(row.id)
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
row.id
|
|
92
|
+
);
|
|
105
93
|
const renderRows = () => {
|
|
106
94
|
if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ jsx(Fragment, {});
|
|
107
95
|
if (!rows.length && emptyContent) return renderEmptyRow();
|
|
108
96
|
return rows.map((row, index) => renderDataRow(row, index));
|
|
109
97
|
};
|
|
110
|
-
return /* @__PURE__ */ jsx("tbody", { className:
|
|
98
|
+
return /* @__PURE__ */ jsx("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: renderRows() });
|
|
111
99
|
};
|
|
112
100
|
var table_body_default = TableBody;
|
|
113
101
|
|
|
@@ -129,7 +117,8 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
129
117
|
color,
|
|
130
118
|
size,
|
|
131
119
|
skeletonRow,
|
|
132
|
-
onCheckedRowsChange
|
|
120
|
+
onCheckedRowsChange,
|
|
121
|
+
onRowClick
|
|
133
122
|
} = { ...props, ...variantProps };
|
|
134
123
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
135
124
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -173,8 +162,18 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
173
162
|
return updated;
|
|
174
163
|
});
|
|
175
164
|
};
|
|
165
|
+
const handleRowClick = (row, index, event) => {
|
|
166
|
+
const target = event.target;
|
|
167
|
+
if (target.closest('input[type="checkbox"]') || target.closest("[data-checkbox]")) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
171
|
+
};
|
|
176
172
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
177
|
-
const slots = useMemo(
|
|
173
|
+
const slots = useMemo(
|
|
174
|
+
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
175
|
+
[variantProps, onRowClick]
|
|
176
|
+
);
|
|
178
177
|
return /* @__PURE__ */ jsxs2("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
179
178
|
/* @__PURE__ */ jsx2(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ jsxs2(
|
|
180
179
|
"table",
|
|
@@ -193,7 +192,7 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
193
192
|
size,
|
|
194
193
|
color,
|
|
195
194
|
rowCheckbox,
|
|
196
|
-
|
|
195
|
+
hasCheckedRows: checkedRows.size > 0,
|
|
197
196
|
onCheckAll: handleAllRowCheck,
|
|
198
197
|
isLoading,
|
|
199
198
|
classNames,
|
|
@@ -211,8 +210,9 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
211
210
|
rowCheckbox,
|
|
212
211
|
checkedRows,
|
|
213
212
|
onCheckRow: handleRowCheck,
|
|
214
|
-
|
|
213
|
+
onRowClick: handleRowClick,
|
|
215
214
|
isLoading,
|
|
215
|
+
emptyContent,
|
|
216
216
|
skeletonRow,
|
|
217
217
|
className: clsx(
|
|
218
218
|
"transition-all duration-150 ease-out",
|
|
@@ -322,6 +322,11 @@ var tableStyle = tv({
|
|
|
322
322
|
height: {
|
|
323
323
|
narrow: {},
|
|
324
324
|
wide: {}
|
|
325
|
+
},
|
|
326
|
+
rowClickable: {
|
|
327
|
+
true: {
|
|
328
|
+
tr: ["cursor-pointer"]
|
|
329
|
+
}
|
|
325
330
|
}
|
|
326
331
|
},
|
|
327
332
|
compoundVariants: [
|
|
@@ -479,15 +484,11 @@ var TableHead = ({
|
|
|
479
484
|
color,
|
|
480
485
|
size,
|
|
481
486
|
rowCheckbox = false,
|
|
482
|
-
|
|
487
|
+
hasCheckedRows,
|
|
483
488
|
isLoading = false,
|
|
484
489
|
classNames,
|
|
485
490
|
onCheckAll
|
|
486
491
|
}) => {
|
|
487
|
-
const handleClickCheckAll = (e) => {
|
|
488
|
-
e.preventDefault();
|
|
489
|
-
onCheckAll(!isCheckedAll);
|
|
490
|
-
};
|
|
491
492
|
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ jsx3(
|
|
492
493
|
"th",
|
|
493
494
|
{
|
|
@@ -513,11 +514,11 @@ var TableHead = ({
|
|
|
513
514
|
const renderContentRow = () => /* @__PURE__ */ jsx3("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs3("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
514
515
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
515
516
|
rowCheckbox && renderTh(
|
|
516
|
-
/* @__PURE__ */ jsx3("div", {
|
|
517
|
+
/* @__PURE__ */ jsx3("div", { "data-checkbox": true, children: /* @__PURE__ */ jsx3(
|
|
517
518
|
checkbox_default,
|
|
518
519
|
{
|
|
519
520
|
size,
|
|
520
|
-
checked:
|
|
521
|
+
checked: hasCheckedRows,
|
|
521
522
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
522
523
|
}
|
|
523
524
|
) }),
|
|
@@ -103,7 +103,13 @@ var Button = forwardRef((originalProps, ref) => {
|
|
|
103
103
|
var _a, _b, _c;
|
|
104
104
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
105
105
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
106
|
-
}
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ jsx(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
+
startContent && renderContent(startContent),
|
|
109
|
+
childElement.props.children,
|
|
110
|
+
endContent && renderContent(endContent),
|
|
111
|
+
!disableRipple && /* @__PURE__ */ jsx(ripple_default, { ...getRippleProps() })
|
|
112
|
+
] }) })
|
|
107
113
|
};
|
|
108
114
|
return cloneElement(childElement, mergedProps);
|
|
109
115
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import "../../chunk-MY5U63QO.mjs";
|
|
6
6
|
import "../../chunk-JBSV7GCL.mjs";
|
|
7
7
|
import "../../chunk-ITWKPTSD.mjs";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
9
9
|
import "../../chunk-P6CRHHI3.mjs";
|
|
10
10
|
import "../../chunk-6WSACUIB.mjs";
|
|
11
11
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import "../../chunk-MY5U63QO.mjs";
|
|
7
7
|
import "../../chunk-JBSV7GCL.mjs";
|
|
8
8
|
import "../../chunk-ITWKPTSD.mjs";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
10
10
|
import "../../chunk-P6CRHHI3.mjs";
|
|
11
11
|
import "../../chunk-6WSACUIB.mjs";
|
|
12
12
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -5150,7 +5150,13 @@ var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
5150
5150
|
var _a, _b, _c;
|
|
5151
5151
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5152
5152
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5153
|
-
}
|
|
5153
|
+
},
|
|
5154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5155
|
+
startContent && renderContent(startContent),
|
|
5156
|
+
childElement.props.children,
|
|
5157
|
+
endContent && renderContent(endContent),
|
|
5158
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5159
|
+
] }) })
|
|
5154
5160
|
};
|
|
5155
5161
|
return (0, import_react2.cloneElement)(childElement, mergedProps);
|
|
5156
5162
|
}
|
|
@@ -5155,7 +5155,13 @@ var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
5155
5155
|
var _a, _b, _c;
|
|
5156
5156
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5157
5157
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5158
|
-
}
|
|
5158
|
+
},
|
|
5159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5160
|
+
startContent && renderContent(startContent),
|
|
5161
|
+
childElement.props.children,
|
|
5162
|
+
endContent && renderContent(endContent),
|
|
5163
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5164
|
+
] }) })
|
|
5159
5165
|
};
|
|
5160
5166
|
return (0, import_react2.cloneElement)(childElement, mergedProps);
|
|
5161
5167
|
}
|
|
@@ -5563,7 +5563,13 @@ var Button = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5563
5563
|
var _a, _b, _c;
|
|
5564
5564
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5565
5565
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5566
|
-
}
|
|
5566
|
+
},
|
|
5567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
5568
|
+
startContent && renderContent(startContent),
|
|
5569
|
+
childElement.props.children,
|
|
5570
|
+
endContent && renderContent(endContent),
|
|
5571
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ripple_default, { ...getRippleProps() })
|
|
5572
|
+
] }) })
|
|
5567
5573
|
};
|
|
5568
5574
|
return (0, import_react3.cloneElement)(childElement, mergedProps);
|
|
5569
5575
|
}
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
FileUpload,
|
|
4
4
|
fileUploadStyle,
|
|
5
5
|
fileUpload_default
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-IY4AY6JJ.mjs";
|
|
7
7
|
import "../../chunk-2GCSFWHD.mjs";
|
|
8
8
|
import "../../chunk-MVL7HJSH.mjs";
|
|
9
9
|
import "../../chunk-MY5U63QO.mjs";
|
|
10
10
|
import "../../chunk-JBSV7GCL.mjs";
|
|
11
11
|
import "../../chunk-ITWKPTSD.mjs";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
13
13
|
import "../../chunk-P6CRHHI3.mjs";
|
|
14
14
|
import "../../chunk-6WSACUIB.mjs";
|
|
15
15
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -5563,7 +5563,13 @@ var Button = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5563
5563
|
var _a, _b, _c;
|
|
5564
5564
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5565
5565
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5566
|
-
}
|
|
5566
|
+
},
|
|
5567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
5568
|
+
startContent && renderContent(startContent),
|
|
5569
|
+
childElement.props.children,
|
|
5570
|
+
endContent && renderContent(endContent),
|
|
5571
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ripple_default, { ...getRippleProps() })
|
|
5572
|
+
] }) })
|
|
5567
5573
|
};
|
|
5568
5574
|
return (0, import_react3.cloneElement)(childElement, mergedProps);
|
|
5569
5575
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import "../../chunk-RLXOHILK.mjs";
|
|
3
3
|
import {
|
|
4
4
|
fileUpload_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-IY4AY6JJ.mjs";
|
|
6
6
|
import "../../chunk-2GCSFWHD.mjs";
|
|
7
7
|
import "../../chunk-MVL7HJSH.mjs";
|
|
8
8
|
import "../../chunk-MY5U63QO.mjs";
|
|
9
9
|
import "../../chunk-JBSV7GCL.mjs";
|
|
10
10
|
import "../../chunk-ITWKPTSD.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
12
12
|
import "../../chunk-P6CRHHI3.mjs";
|
|
13
13
|
import "../../chunk-6WSACUIB.mjs";
|
|
14
14
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -5156,7 +5156,13 @@ var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
5156
5156
|
var _a, _b, _c;
|
|
5157
5157
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5158
5158
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5159
|
-
}
|
|
5159
|
+
},
|
|
5160
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5161
|
+
startContent && renderContent(startContent),
|
|
5162
|
+
childElement.props.children,
|
|
5163
|
+
endContent && renderContent(endContent),
|
|
5164
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5165
|
+
] }) })
|
|
5160
5166
|
};
|
|
5161
5167
|
return (0, import_react2.cloneElement)(childElement, mergedProps);
|
|
5162
5168
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import "../../chunk-DJOG6Z35.mjs";
|
|
3
3
|
import {
|
|
4
4
|
modal_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-SGOE2HGI.mjs";
|
|
6
6
|
import "../../chunk-SE5TU755.mjs";
|
|
7
7
|
import "../../chunk-AF4I7ZQS.mjs";
|
|
8
8
|
import "../../chunk-MY5U63QO.mjs";
|
|
9
9
|
import "../../chunk-JBSV7GCL.mjs";
|
|
10
10
|
import "../../chunk-ITWKPTSD.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
12
12
|
import "../../chunk-P6CRHHI3.mjs";
|
|
13
13
|
import "../../chunk-6WSACUIB.mjs";
|
|
14
14
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -5154,7 +5154,13 @@ var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
5154
5154
|
var _a, _b, _c;
|
|
5155
5155
|
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5156
5156
|
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5157
|
-
}
|
|
5157
|
+
},
|
|
5158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5159
|
+
startContent && renderContent(startContent),
|
|
5160
|
+
childElement.props.children,
|
|
5161
|
+
endContent && renderContent(endContent),
|
|
5162
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5163
|
+
] }) })
|
|
5158
5164
|
};
|
|
5159
5165
|
return (0, import_react2.cloneElement)(childElement, mergedProps);
|
|
5160
5166
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
modal_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-SGOE2HGI.mjs";
|
|
5
5
|
import "../../chunk-SE5TU755.mjs";
|
|
6
6
|
import "../../chunk-AF4I7ZQS.mjs";
|
|
7
7
|
import "../../chunk-MY5U63QO.mjs";
|
|
8
8
|
import "../../chunk-JBSV7GCL.mjs";
|
|
9
9
|
import "../../chunk-ITWKPTSD.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-Z4YJ274G.mjs";
|
|
11
11
|
import "../../chunk-P6CRHHI3.mjs";
|
|
12
12
|
import "../../chunk-6WSACUIB.mjs";
|
|
13
13
|
import "../../chunk-LXHUO6VM.mjs";
|
|
@@ -697,15 +697,11 @@ var TableHead = ({
|
|
|
697
697
|
color,
|
|
698
698
|
size,
|
|
699
699
|
rowCheckbox = false,
|
|
700
|
-
|
|
700
|
+
hasCheckedRows,
|
|
701
701
|
isLoading = false,
|
|
702
702
|
classNames,
|
|
703
703
|
onCheckAll
|
|
704
704
|
}) => {
|
|
705
|
-
const handleClickCheckAll = (e) => {
|
|
706
|
-
e.preventDefault();
|
|
707
|
-
onCheckAll(!isCheckedAll);
|
|
708
|
-
};
|
|
709
705
|
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
710
706
|
"th",
|
|
711
707
|
{
|
|
@@ -731,11 +727,11 @@ var TableHead = ({
|
|
|
731
727
|
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: [
|
|
732
728
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
733
729
|
rowCheckbox && renderTh(
|
|
734
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", {
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
735
731
|
checkbox_default,
|
|
736
732
|
{
|
|
737
733
|
size,
|
|
738
|
-
checked:
|
|
734
|
+
checked: hasCheckedRows,
|
|
739
735
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
740
736
|
}
|
|
741
737
|
) }),
|
|
@@ -759,6 +755,7 @@ var TableBody = ({
|
|
|
759
755
|
rowCheckbox = false,
|
|
760
756
|
checkedRows,
|
|
761
757
|
onCheckRow,
|
|
758
|
+
onRowClick,
|
|
762
759
|
isLoading = false,
|
|
763
760
|
emptyContent,
|
|
764
761
|
skeletonRow,
|
|
@@ -767,67 +764,54 @@ var TableBody = ({
|
|
|
767
764
|
}) => {
|
|
768
765
|
const renderTdSkeleton = (key, column) => {
|
|
769
766
|
const isCheckbox = key.includes("checkbox");
|
|
770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
771
|
-
"td",
|
|
772
|
-
{
|
|
773
|
-
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
774
|
-
style: isCheckbox ? {
|
|
775
|
-
width: "40px",
|
|
776
|
-
minWidth: "40px",
|
|
777
|
-
maxWidth: "40px",
|
|
778
|
-
flexShrink: 0,
|
|
779
|
-
flexGrow: 0,
|
|
780
|
-
boxSizing: "border-box"
|
|
781
|
-
} : column ? getCellStyle(column) : void 0,
|
|
782
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
783
|
-
},
|
|
784
|
-
key
|
|
785
|
-
);
|
|
767
|
+
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);
|
|
786
768
|
};
|
|
787
769
|
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
788
770
|
"td",
|
|
789
771
|
{
|
|
790
772
|
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
791
|
-
style: {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
flexShrink: 0,
|
|
796
|
-
flexGrow: 0,
|
|
797
|
-
boxSizing: "border-box"
|
|
798
|
-
},
|
|
799
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
800
|
-
}
|
|
773
|
+
style: { width: "40px", minWidth: "40px", textAlign: "center" },
|
|
774
|
+
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) }) })
|
|
775
|
+
},
|
|
776
|
+
`checkbox-${rowId}`
|
|
801
777
|
);
|
|
802
778
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
803
779
|
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
804
780
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
805
781
|
] }, `skeleton-${rowIndex}`);
|
|
806
782
|
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 }) });
|
|
807
|
-
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
783
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
784
|
+
"tr",
|
|
785
|
+
{
|
|
786
|
+
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
787
|
+
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
788
|
+
children: [
|
|
789
|
+
columns.map((column, colIdx) => {
|
|
790
|
+
var _a;
|
|
791
|
+
const value = row[column.field];
|
|
792
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
793
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
795
|
+
"td",
|
|
796
|
+
{
|
|
797
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className),
|
|
798
|
+
style: getCellStyle(column),
|
|
799
|
+
children: content
|
|
800
|
+
},
|
|
801
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
802
|
+
);
|
|
803
|
+
}),
|
|
804
|
+
rowCheckbox && renderCheckboxCell(row.id)
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
row.id
|
|
808
|
+
);
|
|
825
809
|
const renderRows = () => {
|
|
826
810
|
if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, {});
|
|
827
811
|
if (!rows.length && emptyContent) return renderEmptyRow();
|
|
828
812
|
return rows.map((row, index) => renderDataRow(row, index));
|
|
829
813
|
};
|
|
830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { className:
|
|
814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: renderRows() });
|
|
831
815
|
};
|
|
832
816
|
var table_body_default = TableBody;
|
|
833
817
|
|
|
@@ -6174,7 +6158,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6174
6158
|
color,
|
|
6175
6159
|
size,
|
|
6176
6160
|
skeletonRow,
|
|
6177
|
-
onCheckedRowsChange
|
|
6161
|
+
onCheckedRowsChange,
|
|
6162
|
+
onRowClick
|
|
6178
6163
|
} = { ...props, ...variantProps };
|
|
6179
6164
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6180
6165
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -6218,8 +6203,18 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6218
6203
|
return updated;
|
|
6219
6204
|
});
|
|
6220
6205
|
};
|
|
6206
|
+
const handleRowClick = (row, index, event) => {
|
|
6207
|
+
const target = event.target;
|
|
6208
|
+
if (target.closest('input[type="checkbox"]') || target.closest("[data-checkbox]")) {
|
|
6209
|
+
return;
|
|
6210
|
+
}
|
|
6211
|
+
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6212
|
+
};
|
|
6221
6213
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6222
|
-
const slots = (0, import_react5.useMemo)(
|
|
6214
|
+
const slots = (0, import_react5.useMemo)(
|
|
6215
|
+
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6216
|
+
[variantProps, onRowClick]
|
|
6217
|
+
);
|
|
6223
6218
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
6224
6219
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6225
6220
|
"table",
|
|
@@ -6238,7 +6233,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6238
6233
|
size,
|
|
6239
6234
|
color,
|
|
6240
6235
|
rowCheckbox,
|
|
6241
|
-
|
|
6236
|
+
hasCheckedRows: checkedRows.size > 0,
|
|
6242
6237
|
onCheckAll: handleAllRowCheck,
|
|
6243
6238
|
isLoading,
|
|
6244
6239
|
classNames,
|
|
@@ -6256,8 +6251,9 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6256
6251
|
rowCheckbox,
|
|
6257
6252
|
checkedRows,
|
|
6258
6253
|
onCheckRow: handleRowCheck,
|
|
6259
|
-
|
|
6254
|
+
onRowClick: handleRowClick,
|
|
6260
6255
|
isLoading,
|
|
6256
|
+
emptyContent,
|
|
6261
6257
|
skeletonRow,
|
|
6262
6258
|
className: clsx(
|
|
6263
6259
|
"transition-all duration-150 ease-out",
|
|
@@ -6367,6 +6363,11 @@ var tableStyle = (0, import_tailwind_variants7.tv)({
|
|
|
6367
6363
|
height: {
|
|
6368
6364
|
narrow: {},
|
|
6369
6365
|
wide: {}
|
|
6366
|
+
},
|
|
6367
|
+
rowClickable: {
|
|
6368
|
+
true: {
|
|
6369
|
+
tr: ["cursor-pointer"]
|
|
6370
|
+
}
|
|
6370
6371
|
}
|
|
6371
6372
|
},
|
|
6372
6373
|
compoundVariants: [
|