@deepnoid/ui 0.1.182 → 0.1.184
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 +176 -176
- package/dist/{chunk-SX2FQY4L.mjs → chunk-2H5EBNCD.mjs} +4 -4
- package/dist/{chunk-XZTVXEOD.mjs → chunk-7C7RHDHV.mjs} +4 -4
- package/dist/{chunk-KDBM7UVG.mjs → chunk-GG7QANQF.mjs} +1 -1
- package/dist/{chunk-M5ZLURXE.mjs → chunk-K6AKMFZH.mjs} +5 -5
- package/dist/{chunk-YTW5HJJH.mjs → chunk-LZRLIXM6.mjs} +120 -37
- package/dist/{chunk-W67QZ4OB.mjs → chunk-MU6QDNYC.mjs} +1 -1
- package/dist/{chunk-GPJVGQ5W.mjs → chunk-NPVMCUZ4.mjs} +2 -2
- package/dist/{chunk-6NO7GQHG.mjs → chunk-ROXKJQSJ.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 +3 -3
- package/dist/components/button/text-button.mjs +2 -2
- package/dist/components/charts/areaChart.mjs +1 -1
- package/dist/components/charts/index.mjs +1 -1
- 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/drawer/drawer.mjs +2 -2
- package/dist/components/drawer/index.mjs +2 -2
- package/dist/components/fileUpload/fileUpload.mjs +6 -6
- package/dist/components/fileUpload/index.mjs +6 -6
- 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/picker/datePicker.mjs +6 -6
- package/dist/components/picker/index.mjs +8 -8
- package/dist/components/picker/timePicker.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/starRating/index.mjs +1 -1
- package/dist/components/starRating/starRating.mjs +1 -1
- package/dist/components/table/definition-table.mjs +2 -2
- package/dist/components/table/index.js +149 -66
- package/dist/components/table/index.mjs +9 -9
- package/dist/components/table/table-body.js +145 -62
- package/dist/components/table/table-body.mjs +6 -6
- package/dist/components/table/table-head.js +113 -32
- package/dist/components/table/table-head.mjs +6 -6
- package/dist/components/table/table.js +145 -62
- 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/timePicker/calendar.mjs +1 -1
- package/dist/components/toast/index.mjs +5 -5
- 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 +327 -244
- package/dist/index.mjs +54 -54
- package/package.json +1 -1
- package/dist/{chunk-3HXNAVAN.mjs → chunk-3CRSSRCH.mjs} +3 -3
- package/dist/{chunk-ZFC5O2V3.mjs → chunk-45Y7ANPK.mjs} +3 -3
- package/dist/{chunk-LE7PGMCV.mjs → chunk-4EELFA6L.mjs} +3 -3
- package/dist/{chunk-NDNIAALB.mjs → chunk-4LUASWAN.mjs} +3 -3
- package/dist/{chunk-UINFH5AT.mjs → chunk-A3WPBLOW.mjs} +3 -3
- package/dist/{chunk-BH3I4LIZ.mjs → chunk-DS5CGU2X.mjs} +3 -3
- package/dist/{chunk-GVTYOGSV.mjs → chunk-GS5X67UB.mjs} +3 -3
- package/dist/{chunk-4X35QQTI.mjs → chunk-IH3BJRTV.mjs} +3 -3
- package/dist/{chunk-ACZ3DQVT.mjs → chunk-KH63CD55.mjs} +3 -3
- package/dist/{chunk-NKF2TQMA.mjs → chunk-MWUA62VL.mjs} +3 -3
- package/dist/{chunk-3DCUMRYP.mjs → chunk-OEIEALIP.mjs} +3 -3
- package/dist/{chunk-XL6LZDT4.mjs → chunk-PRNE3U26.mjs} +3 -3
- package/dist/{chunk-7H6U5XJA.mjs → chunk-RXDRG6MC.mjs} +3 -3
|
@@ -108,7 +108,7 @@ __export(table_exports, {
|
|
|
108
108
|
module.exports = __toCommonJS(table_exports);
|
|
109
109
|
|
|
110
110
|
// src/components/table/table.tsx
|
|
111
|
-
var
|
|
111
|
+
var import_react7 = require("react");
|
|
112
112
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
113
113
|
|
|
114
114
|
// src/utils/props.ts
|
|
@@ -131,6 +131,9 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
// src/components/table/table-head.tsx
|
|
135
|
+
var import_react2 = require("react");
|
|
136
|
+
|
|
134
137
|
// src/utils/clsx.ts
|
|
135
138
|
function clsx(...args) {
|
|
136
139
|
var i = 0, tmp, x, str = "";
|
|
@@ -629,20 +632,51 @@ var checkboxStyle = tv({
|
|
|
629
632
|
|
|
630
633
|
// src/components/table/table-head.tsx
|
|
631
634
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
632
|
-
|
|
635
|
+
function TableHeaderCell({
|
|
636
|
+
content,
|
|
637
|
+
column,
|
|
638
|
+
isCheckbox = false,
|
|
633
639
|
slots,
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
|
|
640
|
+
classNames
|
|
641
|
+
}) {
|
|
642
|
+
const thRef = (0, import_react2.useRef)(null);
|
|
643
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
644
|
+
const checkOverflow = (el) => {
|
|
645
|
+
if (el.scrollWidth > el.clientWidth) {
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
const children = Array.from(el.children);
|
|
649
|
+
for (const child of children) {
|
|
650
|
+
if (child.scrollWidth > child.clientWidth) {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return false;
|
|
655
|
+
};
|
|
656
|
+
const extractTextFromContent = (node) => {
|
|
657
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
658
|
+
return String(node);
|
|
659
|
+
}
|
|
660
|
+
if ((0, import_react2.isValidElement)(node)) {
|
|
661
|
+
return String(node.props.children || "");
|
|
662
|
+
}
|
|
663
|
+
return "";
|
|
664
|
+
};
|
|
665
|
+
(0, import_react2.useEffect)(() => {
|
|
666
|
+
if (thRef.current && !isCheckbox) {
|
|
667
|
+
setTimeout(() => {
|
|
668
|
+
if (thRef.current) {
|
|
669
|
+
setShowTitle(checkOverflow(thRef.current));
|
|
670
|
+
}
|
|
671
|
+
}, 0);
|
|
672
|
+
}
|
|
673
|
+
}, [content, isCheckbox]);
|
|
674
|
+
const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
|
|
675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
643
676
|
"th",
|
|
644
677
|
{
|
|
645
|
-
|
|
678
|
+
ref: thRef,
|
|
679
|
+
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className, !isCheckbox && "truncate"),
|
|
646
680
|
style: isCheckbox ? {
|
|
647
681
|
width: "40px",
|
|
648
682
|
minWidth: "40px",
|
|
@@ -651,31 +685,55 @@ var TableHead = ({
|
|
|
651
685
|
flexGrow: 0,
|
|
652
686
|
boxSizing: "border-box"
|
|
653
687
|
} : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
|
|
688
|
+
title: titleText,
|
|
654
689
|
children: content
|
|
655
|
-
}
|
|
656
|
-
key
|
|
690
|
+
}
|
|
657
691
|
);
|
|
692
|
+
}
|
|
693
|
+
var TableHead = ({
|
|
694
|
+
slots,
|
|
695
|
+
columns,
|
|
696
|
+
color,
|
|
697
|
+
size,
|
|
698
|
+
rowCheckbox = false,
|
|
699
|
+
hasCheckedRows,
|
|
700
|
+
classNames,
|
|
701
|
+
onCheckAll
|
|
702
|
+
}) => {
|
|
658
703
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
659
|
-
columns.map((column, idx) =>
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
704
|
+
columns.map((column, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
705
|
+
TableHeaderCell,
|
|
706
|
+
{
|
|
707
|
+
content: column.headerName,
|
|
708
|
+
column,
|
|
709
|
+
slots,
|
|
710
|
+
classNames
|
|
711
|
+
},
|
|
712
|
+
`${column.field}-${idx}`
|
|
713
|
+
)),
|
|
714
|
+
rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
715
|
+
TableHeaderCell,
|
|
716
|
+
{
|
|
717
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
718
|
+
checkbox_default,
|
|
719
|
+
{
|
|
720
|
+
size,
|
|
721
|
+
checked: hasCheckedRows,
|
|
722
|
+
onChange: (e) => onCheckAll(e.target.checked)
|
|
723
|
+
}
|
|
724
|
+
) }),
|
|
725
|
+
isCheckbox: true,
|
|
726
|
+
slots,
|
|
727
|
+
classNames
|
|
728
|
+
},
|
|
729
|
+
"checkbox"
|
|
672
730
|
)
|
|
673
731
|
] }) });
|
|
674
732
|
};
|
|
675
733
|
var table_head_default = TableHead;
|
|
676
734
|
|
|
677
735
|
// src/components/table/table-body.tsx
|
|
678
|
-
var
|
|
736
|
+
var import_react3 = require("react");
|
|
679
737
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
680
738
|
function TableCell({
|
|
681
739
|
row,
|
|
@@ -685,25 +743,50 @@ function TableCell({
|
|
|
685
743
|
slots,
|
|
686
744
|
classNames
|
|
687
745
|
}) {
|
|
688
|
-
var _a;
|
|
746
|
+
var _a, _b;
|
|
689
747
|
const value = row[column.field];
|
|
690
748
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
691
749
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
692
|
-
const tdRef = (0,
|
|
693
|
-
const [showTitle, setShowTitle] = (0,
|
|
694
|
-
const checkOverflow = (el) =>
|
|
695
|
-
|
|
750
|
+
const tdRef = (0, import_react3.useRef)(null);
|
|
751
|
+
const [showTitle, setShowTitle] = (0, import_react3.useState)(false);
|
|
752
|
+
const checkOverflow = (el) => {
|
|
753
|
+
if (el.scrollWidth > el.clientWidth) {
|
|
754
|
+
return true;
|
|
755
|
+
}
|
|
756
|
+
const children = Array.from(el.children);
|
|
757
|
+
for (const child of children) {
|
|
758
|
+
if (child.scrollWidth > child.clientWidth) {
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return false;
|
|
763
|
+
};
|
|
764
|
+
(0, import_react3.useEffect)(() => {
|
|
696
765
|
if (tdRef.current) {
|
|
697
|
-
|
|
766
|
+
setTimeout(() => {
|
|
767
|
+
if (tdRef.current) {
|
|
768
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
769
|
+
}
|
|
770
|
+
}, 0);
|
|
698
771
|
}
|
|
699
772
|
}, [content]);
|
|
700
773
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
701
774
|
"td",
|
|
702
775
|
{
|
|
703
776
|
ref: tdRef,
|
|
704
|
-
className: clsx(
|
|
705
|
-
|
|
706
|
-
|
|
777
|
+
className: clsx(
|
|
778
|
+
slots.td(),
|
|
779
|
+
classNames == null ? void 0 : classNames.td,
|
|
780
|
+
column.className,
|
|
781
|
+
"truncate",
|
|
782
|
+
"[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate"
|
|
783
|
+
),
|
|
784
|
+
style: {
|
|
785
|
+
...getCellStyle(column),
|
|
786
|
+
maxWidth: column.width || "150px",
|
|
787
|
+
textAlign: column.align || "center"
|
|
788
|
+
},
|
|
789
|
+
title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
|
|
707
790
|
children: content
|
|
708
791
|
},
|
|
709
792
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -773,18 +856,18 @@ var TableBody = ({
|
|
|
773
856
|
var table_body_default = TableBody;
|
|
774
857
|
|
|
775
858
|
// src/components/pagination/pagination.tsx
|
|
776
|
-
var
|
|
859
|
+
var import_react6 = require("react");
|
|
777
860
|
|
|
778
861
|
// src/components/pagination/usePagination.ts
|
|
779
|
-
var
|
|
862
|
+
var import_react4 = require("react");
|
|
780
863
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
781
|
-
const startPage = (0,
|
|
782
|
-
const endPage = (0,
|
|
783
|
-
const pageList = (0,
|
|
864
|
+
const startPage = (0, import_react4.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
865
|
+
const endPage = (0, import_react4.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
866
|
+
const pageList = (0, import_react4.useMemo)(
|
|
784
867
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
785
868
|
[startPage, endPage]
|
|
786
869
|
);
|
|
787
|
-
const handleClickMovePage = (0,
|
|
870
|
+
const handleClickMovePage = (0, import_react4.useCallback)(
|
|
788
871
|
(page) => (event) => {
|
|
789
872
|
event.preventDefault();
|
|
790
873
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -801,7 +884,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
801
884
|
var usePagination_default = usePagination;
|
|
802
885
|
|
|
803
886
|
// src/components/input/input.tsx
|
|
804
|
-
var
|
|
887
|
+
var import_react5 = require("react");
|
|
805
888
|
|
|
806
889
|
// src/components/icon/template.tsx
|
|
807
890
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5536,12 +5619,12 @@ var Icon_default = Icon;
|
|
|
5536
5619
|
|
|
5537
5620
|
// src/components/input/input.tsx
|
|
5538
5621
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5539
|
-
var Input = (0,
|
|
5622
|
+
var Input = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5540
5623
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5541
5624
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5542
|
-
const inputRef = (0,
|
|
5543
|
-
const slots = (0,
|
|
5544
|
-
const getContentProps = (0,
|
|
5625
|
+
const inputRef = (0, import_react5.useRef)(null);
|
|
5626
|
+
const slots = (0, import_react5.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5627
|
+
const getContentProps = (0, import_react5.useCallback)(
|
|
5545
5628
|
() => ({
|
|
5546
5629
|
className: clsx(
|
|
5547
5630
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5552,13 +5635,13 @@ var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5552
5635
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5553
5636
|
);
|
|
5554
5637
|
const renderStartContent = () => {
|
|
5555
|
-
if ((0,
|
|
5638
|
+
if ((0, import_react5.isValidElement)(startContent)) {
|
|
5556
5639
|
const existingProps = startContent.props;
|
|
5557
5640
|
const mergedProps = {
|
|
5558
5641
|
...getContentProps(),
|
|
5559
5642
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5560
5643
|
};
|
|
5561
|
-
return (0,
|
|
5644
|
+
return (0, import_react5.cloneElement)(startContent, mergedProps);
|
|
5562
5645
|
} else {
|
|
5563
5646
|
const contentProps = getContentProps();
|
|
5564
5647
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5577,13 +5660,13 @@ var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5577
5660
|
}
|
|
5578
5661
|
);
|
|
5579
5662
|
const renderContentWithIcon = () => {
|
|
5580
|
-
if ((0,
|
|
5663
|
+
if ((0, import_react5.isValidElement)(endContent)) {
|
|
5581
5664
|
const existingProps = endContent.props;
|
|
5582
5665
|
const mergedProps = {
|
|
5583
5666
|
...getContentProps(),
|
|
5584
5667
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5585
5668
|
};
|
|
5586
|
-
return (0,
|
|
5669
|
+
return (0, import_react5.cloneElement)(endContent, mergedProps);
|
|
5587
5670
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5588
5671
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5589
5672
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -5920,7 +6003,7 @@ var inputStyle = tv(
|
|
|
5920
6003
|
|
|
5921
6004
|
// src/components/pagination/pagination.tsx
|
|
5922
6005
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5923
|
-
var Pagination = (0,
|
|
6006
|
+
var Pagination = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
5924
6007
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5925
6008
|
const {
|
|
5926
6009
|
classNames,
|
|
@@ -5934,12 +6017,12 @@ var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5934
6017
|
variant,
|
|
5935
6018
|
size
|
|
5936
6019
|
} = { ...props, ...variantProps };
|
|
5937
|
-
const [inputPage, setInputPage] = (0,
|
|
6020
|
+
const [inputPage, setInputPage] = (0, import_react6.useState)(currentPage);
|
|
5938
6021
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5939
6022
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5940
6023
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5941
6024
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
5942
|
-
const slots = (0,
|
|
6025
|
+
const slots = (0, import_react6.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
5943
6026
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
5944
6027
|
currentPage,
|
|
5945
6028
|
totalPage,
|
|
@@ -6307,7 +6390,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6307
6390
|
|
|
6308
6391
|
// src/components/table/table.tsx
|
|
6309
6392
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6310
|
-
var Table = (0,
|
|
6393
|
+
var Table = (0, import_react7.forwardRef)((originalProps, ref) => {
|
|
6311
6394
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6312
6395
|
const {
|
|
6313
6396
|
rows,
|
|
@@ -6332,8 +6415,8 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
6332
6415
|
} = { ...props, ...variantProps };
|
|
6333
6416
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6334
6417
|
const showPagination = pagination && totalData > 0;
|
|
6335
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6336
|
-
const tableMinWidth = (0,
|
|
6418
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react7.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6419
|
+
const tableMinWidth = (0, import_react7.useMemo)(() => {
|
|
6337
6420
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6338
6421
|
if (column.width) return total + column.width;
|
|
6339
6422
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6342,10 +6425,10 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
6342
6425
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6343
6426
|
return columnsWidth + checkboxWidth;
|
|
6344
6427
|
}, [columns, rowCheckbox]);
|
|
6345
|
-
(0,
|
|
6428
|
+
(0, import_react7.useEffect)(() => {
|
|
6346
6429
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6347
6430
|
}, [checkedRowIds]);
|
|
6348
|
-
(0,
|
|
6431
|
+
(0, import_react7.useEffect)(() => {
|
|
6349
6432
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6350
6433
|
const ids = Array.from(checkedRowIds);
|
|
6351
6434
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6353,7 +6436,7 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
6353
6436
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6354
6437
|
}
|
|
6355
6438
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6356
|
-
(0,
|
|
6439
|
+
(0, import_react7.useImperativeHandle)(
|
|
6357
6440
|
ref,
|
|
6358
6441
|
() => ({
|
|
6359
6442
|
checkedRowIds,
|
|
@@ -6380,7 +6463,7 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
6380
6463
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6381
6464
|
};
|
|
6382
6465
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6383
|
-
const slots = (0,
|
|
6466
|
+
const slots = (0, import_react7.useMemo)(
|
|
6384
6467
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6385
6468
|
[variantProps, onRowClick]
|
|
6386
6469
|
);
|
|
@@ -6699,7 +6782,7 @@ var getCellStyle = (column) => {
|
|
|
6699
6782
|
};
|
|
6700
6783
|
|
|
6701
6784
|
// src/components/table/definition-table.tsx
|
|
6702
|
-
var
|
|
6785
|
+
var import_react8 = require("react");
|
|
6703
6786
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6704
6787
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
6705
6788
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
@@ -6792,10 +6875,10 @@ var DefinitionTableRow = ({
|
|
|
6792
6875
|
colIndex
|
|
6793
6876
|
);
|
|
6794
6877
|
}) });
|
|
6795
|
-
var DefinitionTable = (0,
|
|
6878
|
+
var DefinitionTable = (0, import_react8.forwardRef)(
|
|
6796
6879
|
({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
|
|
6797
|
-
const slots = (0,
|
|
6798
|
-
const highlightColumnIndex = (0,
|
|
6880
|
+
const slots = (0, import_react8.useMemo)(() => DefinitionTableStyle(), []);
|
|
6881
|
+
const highlightColumnIndex = (0, import_react8.useMemo)(
|
|
6799
6882
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
6800
6883
|
[rows, highlightColumnKey]
|
|
6801
6884
|
);
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-DX3KXNP6.mjs";
|
|
3
|
-
import {
|
|
4
|
-
definition_table_default
|
|
5
|
-
} from "../../chunk-BH3I4LIZ.mjs";
|
|
6
3
|
import {
|
|
7
4
|
table_default
|
|
8
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-LZRLIXM6.mjs";
|
|
6
|
+
import {
|
|
7
|
+
definition_table_default
|
|
8
|
+
} from "../../chunk-DS5CGU2X.mjs";
|
|
9
9
|
import "../../chunk-7B7LRG5J.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-7C7RHDHV.mjs";
|
|
11
11
|
import "../../chunk-F3HENRVM.mjs";
|
|
12
12
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
13
13
|
import "../../chunk-2GCSFWHD.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-RXDRG6MC.mjs";
|
|
15
15
|
import "../../chunk-DQRAFUDA.mjs";
|
|
16
16
|
import "../../chunk-EWS3FESG.mjs";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-OEIEALIP.mjs";
|
|
18
18
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
19
19
|
import "../../chunk-B4YBLIBE.mjs";
|
|
20
|
-
import "../../chunk-R54J7VHL.mjs";
|
|
21
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
22
20
|
import "../../chunk-E3G5QXSH.mjs";
|
|
21
|
+
import "../../chunk-R54J7VHL.mjs";
|
|
23
22
|
import "../../chunk-U4DJHAM5.mjs";
|
|
23
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
24
24
|
import "../../chunk-AC6TWLRT.mjs";
|
|
25
25
|
export {
|
|
26
26
|
definition_table_default as DefinitionTable,
|