@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
|
@@ -691,23 +691,27 @@ var TableHead = ({
|
|
|
691
691
|
e.preventDefault();
|
|
692
692
|
onCheckAll(!isCheckedAll);
|
|
693
693
|
};
|
|
694
|
-
const renderTh = (content, key, column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
694
|
+
const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
695
695
|
"th",
|
|
696
696
|
{
|
|
697
|
-
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
|
|
698
|
-
style: {
|
|
699
|
-
width:
|
|
700
|
-
minWidth:
|
|
701
|
-
maxWidth:
|
|
702
|
-
|
|
703
|
-
|
|
697
|
+
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className),
|
|
698
|
+
style: isCheckbox ? {
|
|
699
|
+
width: "40px",
|
|
700
|
+
minWidth: "40px",
|
|
701
|
+
maxWidth: "40px",
|
|
702
|
+
flexShrink: 0,
|
|
703
|
+
flexGrow: 0,
|
|
704
|
+
boxSizing: "border-box"
|
|
705
|
+
} : column ? getCellStyle(column) : void 0,
|
|
704
706
|
children: content
|
|
705
707
|
},
|
|
706
708
|
key
|
|
707
709
|
);
|
|
708
710
|
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: [
|
|
709
|
-
columns.map(
|
|
710
|
-
|
|
711
|
+
columns.map(
|
|
712
|
+
(column, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`, column)
|
|
713
|
+
),
|
|
714
|
+
rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton", void 0, true)
|
|
711
715
|
] }) });
|
|
712
716
|
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: [
|
|
713
717
|
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
@@ -720,7 +724,9 @@ var TableHead = ({
|
|
|
720
724
|
onChange: (e) => onCheckAll(e.target.checked)
|
|
721
725
|
}
|
|
722
726
|
) }),
|
|
723
|
-
"checkbox"
|
|
727
|
+
"checkbox",
|
|
728
|
+
void 0,
|
|
729
|
+
true
|
|
724
730
|
)
|
|
725
731
|
] }) });
|
|
726
732
|
return isLoading ? renderSkeletonRow() : renderContentRow();
|
|
@@ -744,17 +750,42 @@ var TableBody = ({
|
|
|
744
750
|
classNames,
|
|
745
751
|
className
|
|
746
752
|
}) => {
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
753
|
+
const renderTdSkeleton = (key, column) => {
|
|
754
|
+
const isCheckbox = key.includes("checkbox");
|
|
755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
756
|
+
"td",
|
|
757
|
+
{
|
|
758
|
+
className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
759
|
+
style: isCheckbox ? {
|
|
760
|
+
width: "40px",
|
|
761
|
+
minWidth: "40px",
|
|
762
|
+
maxWidth: "40px",
|
|
763
|
+
flexShrink: 0,
|
|
764
|
+
flexGrow: 0,
|
|
765
|
+
boxSizing: "border-box"
|
|
766
|
+
} : column ? getCellStyle(column) : void 0,
|
|
767
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
|
|
768
|
+
},
|
|
769
|
+
key
|
|
770
|
+
);
|
|
771
|
+
};
|
|
772
|
+
const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
773
|
+
"td",
|
|
774
|
+
{
|
|
775
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
776
|
+
style: {
|
|
777
|
+
width: "40px",
|
|
778
|
+
minWidth: "40px",
|
|
779
|
+
maxWidth: "40px",
|
|
780
|
+
flexShrink: 0,
|
|
781
|
+
flexGrow: 0,
|
|
782
|
+
boxSizing: "border-box"
|
|
783
|
+
},
|
|
784
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
|
|
785
|
+
}
|
|
786
|
+
);
|
|
756
787
|
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
757
|
-
columns.map((
|
|
788
|
+
columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
|
|
758
789
|
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
759
790
|
] }, `skeleton-${rowIndex}`);
|
|
760
791
|
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 }) });
|
|
@@ -6132,6 +6163,15 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6132
6163
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6133
6164
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
6134
6165
|
const [checkedRows, setCheckedRows] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
|
|
6166
|
+
const tableMinWidth = (0, import_react5.useMemo)(() => {
|
|
6167
|
+
const columnsWidth = columns.reduce((total, column) => {
|
|
6168
|
+
if (column.width) return total + column.width;
|
|
6169
|
+
if (column.minWidth) return total + column.minWidth;
|
|
6170
|
+
return total + 100;
|
|
6171
|
+
}, 0);
|
|
6172
|
+
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6173
|
+
return columnsWidth + checkboxWidth;
|
|
6174
|
+
}, [columns, rowCheckbox]);
|
|
6135
6175
|
(0, import_react5.useEffect)(() => {
|
|
6136
6176
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRows));
|
|
6137
6177
|
}, [checkedRows]);
|
|
@@ -6165,43 +6205,54 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6165
6205
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6166
6206
|
const slots = (0, import_react5.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
6167
6207
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
6168
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
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
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6209
|
+
"table",
|
|
6210
|
+
{
|
|
6211
|
+
className: slots.table({ class: classNames == null ? void 0 : classNames.table }),
|
|
6212
|
+
style: {
|
|
6213
|
+
tableLayout: "fixed",
|
|
6214
|
+
width: "100%",
|
|
6215
|
+
minWidth: `${tableMinWidth}px`
|
|
6216
|
+
},
|
|
6217
|
+
children: [
|
|
6218
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6219
|
+
table_head_default,
|
|
6220
|
+
{
|
|
6221
|
+
columns,
|
|
6222
|
+
size,
|
|
6223
|
+
color,
|
|
6224
|
+
rowCheckbox,
|
|
6225
|
+
isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
|
|
6226
|
+
onCheckAll: handleAllRowCheck,
|
|
6227
|
+
isLoading,
|
|
6228
|
+
classNames,
|
|
6229
|
+
slots
|
|
6230
|
+
}
|
|
6231
|
+
),
|
|
6232
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6233
|
+
table_body_default,
|
|
6234
|
+
{
|
|
6235
|
+
slots,
|
|
6236
|
+
rows,
|
|
6237
|
+
columns,
|
|
6238
|
+
size,
|
|
6239
|
+
color,
|
|
6240
|
+
rowCheckbox,
|
|
6241
|
+
checkedRows,
|
|
6242
|
+
onCheckRow: handleRowCheck,
|
|
6243
|
+
emptyContent,
|
|
6244
|
+
isLoading,
|
|
6245
|
+
skeletonRow,
|
|
6246
|
+
className: clsx(
|
|
6247
|
+
"transition-all duration-150 ease-out",
|
|
6248
|
+
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
|
|
6249
|
+
classNames
|
|
6250
|
+
)
|
|
6251
|
+
}
|
|
6201
6252
|
)
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6253
|
+
]
|
|
6254
|
+
}
|
|
6255
|
+
) }),
|
|
6205
6256
|
showPagination && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6206
6257
|
pagination_default,
|
|
6207
6258
|
{
|
|
@@ -6431,6 +6482,21 @@ var tableStyle = (0, import_tailwind_variants7.tv)({
|
|
|
6431
6482
|
height: "narrow"
|
|
6432
6483
|
}
|
|
6433
6484
|
});
|
|
6485
|
+
var getCellStyle = (column) => {
|
|
6486
|
+
const hasFixedWidth = column.width;
|
|
6487
|
+
const hasMinWidth = column.minWidth;
|
|
6488
|
+
return {
|
|
6489
|
+
width: hasFixedWidth ? `${column.width}px` : "auto",
|
|
6490
|
+
minWidth: hasMinWidth ? `${column.minWidth}px` : hasFixedWidth ? `${column.width}px` : void 0,
|
|
6491
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
6492
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
6493
|
+
textAlign: column.align || "center",
|
|
6494
|
+
boxSizing: "border-box",
|
|
6495
|
+
overflow: "hidden",
|
|
6496
|
+
textOverflow: "ellipsis",
|
|
6497
|
+
whiteSpace: "nowrap"
|
|
6498
|
+
};
|
|
6499
|
+
};
|
|
6434
6500
|
|
|
6435
6501
|
// src/components/table/definition-table.tsx
|
|
6436
6502
|
var import_react6 = require("react");
|
|
@@ -5,9 +5,7 @@ import {
|
|
|
5
5
|
} from "../../chunk-KCAGZUYM.mjs";
|
|
6
6
|
import {
|
|
7
7
|
table_default
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-5GBAUDP4.mjs";
|
|
10
|
-
import "../../chunk-TKB2JL2E.mjs";
|
|
8
|
+
} from "../../chunk-UWXCAR5C.mjs";
|
|
11
9
|
import "../../chunk-DQRAFUDA.mjs";
|
|
12
10
|
import "../../chunk-M37VBNB3.mjs";
|
|
13
11
|
import "../../chunk-MZ76AA76.mjs";
|