@deepnoid/ui 0.1.174 → 0.1.176
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 +189 -189
- package/dist/{chunk-4XEZQMLU.mjs → chunk-56EB7LGB.mjs} +2 -2
- package/dist/{chunk-52VX5MC2.mjs → chunk-6LEIEAN6.mjs} +2 -2
- package/dist/{chunk-6DOAZ27E.mjs → chunk-DDJBY4E3.mjs} +1 -1
- package/dist/{chunk-BM3MR3JR.mjs → chunk-EJ3W2WO7.mjs} +4 -4
- package/dist/{chunk-4OOHXMJH.mjs → chunk-IQS53D7Q.mjs} +1 -1
- package/dist/{chunk-D4YI5HF2.mjs → chunk-JQ7UTKWA.mjs} +4 -4
- package/dist/{chunk-QXVGMVCG.mjs → chunk-KXQWLBBN.mjs} +56 -26
- package/dist/{chunk-SCQCMQDP.mjs → chunk-Q634VF4Y.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 +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 +4 -4
- 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 +7 -7
- package/dist/components/fileUpload/index.mjs +7 -7
- 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 +5 -5
- package/dist/components/picker/index.mjs +10 -10
- 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 +75 -45
- package/dist/components/table/index.mjs +8 -8
- package/dist/components/table/table-body.js +45 -15
- package/dist/components/table/table-body.mjs +7 -7
- package/dist/components/table/table-head.js +73 -41
- package/dist/components/table/table-head.mjs +7 -7
- package/dist/components/table/table.js +71 -41
- package/dist/components/table/table.mjs +7 -7
- 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 +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 +252 -222
- package/dist/index.mjs +60 -60
- package/package.json +1 -1
- package/dist/{chunk-OEIEALIP.mjs → chunk-3DCUMRYP.mjs} +3 -3
- package/dist/{chunk-3CRSSRCH.mjs → chunk-3HXNAVAN.mjs} +3 -3
- package/dist/{chunk-IH3BJRTV.mjs → chunk-4X35QQTI.mjs} +3 -3
- package/dist/{chunk-KH63CD55.mjs → chunk-ACZ3DQVT.mjs} +3 -3
- package/dist/{chunk-DS5CGU2X.mjs → chunk-BH3I4LIZ.mjs} +3 -3
- package/dist/{chunk-HKLVFMYQ.mjs → chunk-GVXMHCVG.mjs} +3 -3
- package/dist/{chunk-4LUASWAN.mjs → chunk-NDNIAALB.mjs} +3 -3
- package/dist/{chunk-VNRGOOSY.mjs → chunk-ONLUMPWY.mjs} +3 -3
- package/dist/{chunk-WSBUOY2M.mjs → chunk-P56E5QWF.mjs} +3 -3
- package/dist/{chunk-5G6CCE55.mjs → chunk-PYUKZ4RH.mjs} +3 -3
- package/dist/{chunk-6574ITBF.mjs → chunk-WEIIVXUS.mjs} +3 -3
- package/dist/{chunk-PRNE3U26.mjs → chunk-XL6LZDT4.mjs} +3 -3
- package/dist/{chunk-45Y7ANPK.mjs → chunk-ZFC5O2V3.mjs} +3 -3
|
@@ -105,6 +105,7 @@ __export(table_body_exports, {
|
|
|
105
105
|
default: () => table_body_default
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(table_body_exports);
|
|
108
|
+
var import_react6 = require("react");
|
|
108
109
|
|
|
109
110
|
// src/utils/clsx.ts
|
|
110
111
|
function clsx(...args) {
|
|
@@ -6690,6 +6691,38 @@ var getCellStyle = (column) => {
|
|
|
6690
6691
|
|
|
6691
6692
|
// src/components/table/table-body.tsx
|
|
6692
6693
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6694
|
+
function TableCell({
|
|
6695
|
+
row,
|
|
6696
|
+
column,
|
|
6697
|
+
colIdx,
|
|
6698
|
+
rowIndex,
|
|
6699
|
+
slots,
|
|
6700
|
+
classNames
|
|
6701
|
+
}) {
|
|
6702
|
+
var _a;
|
|
6703
|
+
const value = row[column.field];
|
|
6704
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
6705
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
6706
|
+
const tdRef = (0, import_react6.useRef)(null);
|
|
6707
|
+
const [showTitle, setShowTitle] = (0, import_react6.useState)(false);
|
|
6708
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
6709
|
+
(0, import_react6.useEffect)(() => {
|
|
6710
|
+
if (tdRef.current) {
|
|
6711
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
6712
|
+
}
|
|
6713
|
+
}, [content]);
|
|
6714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6715
|
+
"td",
|
|
6716
|
+
{
|
|
6717
|
+
ref: tdRef,
|
|
6718
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
6719
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
6720
|
+
title: showTitle ? String(content) : void 0,
|
|
6721
|
+
children: content
|
|
6722
|
+
},
|
|
6723
|
+
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
6724
|
+
);
|
|
6725
|
+
}
|
|
6693
6726
|
var TableBody = ({
|
|
6694
6727
|
slots,
|
|
6695
6728
|
rows,
|
|
@@ -6721,21 +6754,18 @@ var TableBody = ({
|
|
|
6721
6754
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
6722
6755
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
6723
6756
|
children: [
|
|
6724
|
-
columns.map((column, colIdx) =>
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
6737
|
-
);
|
|
6738
|
-
}),
|
|
6757
|
+
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6758
|
+
TableCell,
|
|
6759
|
+
{
|
|
6760
|
+
row,
|
|
6761
|
+
column,
|
|
6762
|
+
colIdx,
|
|
6763
|
+
rowIndex,
|
|
6764
|
+
slots,
|
|
6765
|
+
classNames
|
|
6766
|
+
},
|
|
6767
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
6768
|
+
)),
|
|
6739
6769
|
rowCheckbox && renderCheckboxCell(row.id, rowIndex)
|
|
6740
6770
|
]
|
|
6741
6771
|
},
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_body_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-KXQWLBBN.mjs";
|
|
5
5
|
import "../../chunk-7B7LRG5J.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-JQ7UTKWA.mjs";
|
|
7
7
|
import "../../chunk-F3HENRVM.mjs";
|
|
8
|
-
import "../../chunk-2GCSFWHD.mjs";
|
|
9
|
-
import "../../chunk-VNRGOOSY.mjs";
|
|
10
8
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
11
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-2GCSFWHD.mjs";
|
|
10
|
+
import "../../chunk-ONLUMPWY.mjs";
|
|
12
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
13
12
|
import "../../chunk-EWS3FESG.mjs";
|
|
13
|
+
import "../../chunk-3DCUMRYP.mjs";
|
|
14
14
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
15
15
|
import "../../chunk-R7KUEH3N.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
17
17
|
import "../../chunk-DDFJMHBC.mjs";
|
|
18
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
18
19
|
import "../../chunk-U4DJHAM5.mjs";
|
|
19
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
20
20
|
import "../../chunk-AC6TWLRT.mjs";
|
|
21
21
|
export {
|
|
22
22
|
table_body_default as default
|
|
@@ -147,7 +147,7 @@ function toVal(mix) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
// src/components/table/table.tsx
|
|
150
|
-
var
|
|
150
|
+
var import_react6 = require("react");
|
|
151
151
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
152
152
|
|
|
153
153
|
// src/utils/props.ts
|
|
@@ -170,6 +170,9 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
// src/components/table/table-body.tsx
|
|
174
|
+
var import_react2 = require("react");
|
|
175
|
+
|
|
173
176
|
// src/components/checkbox/checkbox.tsx
|
|
174
177
|
var import_react = require("react");
|
|
175
178
|
|
|
@@ -628,6 +631,38 @@ var checkboxStyle = tv({
|
|
|
628
631
|
|
|
629
632
|
// src/components/table/table-body.tsx
|
|
630
633
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
634
|
+
function TableCell({
|
|
635
|
+
row,
|
|
636
|
+
column,
|
|
637
|
+
colIdx,
|
|
638
|
+
rowIndex,
|
|
639
|
+
slots,
|
|
640
|
+
classNames
|
|
641
|
+
}) {
|
|
642
|
+
var _a;
|
|
643
|
+
const value = row[column.field];
|
|
644
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
645
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
646
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
647
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
648
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
649
|
+
(0, import_react2.useEffect)(() => {
|
|
650
|
+
if (tdRef.current) {
|
|
651
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
652
|
+
}
|
|
653
|
+
}, [content]);
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
655
|
+
"td",
|
|
656
|
+
{
|
|
657
|
+
ref: tdRef,
|
|
658
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
659
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
660
|
+
title: showTitle ? String(content) : void 0,
|
|
661
|
+
children: content
|
|
662
|
+
},
|
|
663
|
+
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
664
|
+
);
|
|
665
|
+
}
|
|
631
666
|
var TableBody = ({
|
|
632
667
|
slots,
|
|
633
668
|
rows,
|
|
@@ -659,21 +694,18 @@ var TableBody = ({
|
|
|
659
694
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
660
695
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
661
696
|
children: [
|
|
662
|
-
columns.map((column, colIdx) =>
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
675
|
-
);
|
|
676
|
-
}),
|
|
697
|
+
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
698
|
+
TableCell,
|
|
699
|
+
{
|
|
700
|
+
row,
|
|
701
|
+
column,
|
|
702
|
+
colIdx,
|
|
703
|
+
rowIndex,
|
|
704
|
+
slots,
|
|
705
|
+
classNames
|
|
706
|
+
},
|
|
707
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
708
|
+
)),
|
|
677
709
|
rowCheckbox && renderCheckboxCell(row.id, rowIndex)
|
|
678
710
|
]
|
|
679
711
|
},
|
|
@@ -695,18 +727,18 @@ var TableBody = ({
|
|
|
695
727
|
var table_body_default = TableBody;
|
|
696
728
|
|
|
697
729
|
// src/components/pagination/pagination.tsx
|
|
698
|
-
var
|
|
730
|
+
var import_react5 = require("react");
|
|
699
731
|
|
|
700
732
|
// src/components/pagination/usePagination.ts
|
|
701
|
-
var
|
|
733
|
+
var import_react3 = require("react");
|
|
702
734
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
703
|
-
const startPage = (0,
|
|
704
|
-
const endPage = (0,
|
|
705
|
-
const pageList = (0,
|
|
735
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
736
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
737
|
+
const pageList = (0, import_react3.useMemo)(
|
|
706
738
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
707
739
|
[startPage, endPage]
|
|
708
740
|
);
|
|
709
|
-
const handleClickMovePage = (0,
|
|
741
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
710
742
|
(page) => (event) => {
|
|
711
743
|
event.preventDefault();
|
|
712
744
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -723,7 +755,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
723
755
|
var usePagination_default = usePagination;
|
|
724
756
|
|
|
725
757
|
// src/components/input/input.tsx
|
|
726
|
-
var
|
|
758
|
+
var import_react4 = require("react");
|
|
727
759
|
|
|
728
760
|
// src/components/icon/template.tsx
|
|
729
761
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -5548,12 +5580,12 @@ var Icon_default = Icon;
|
|
|
5548
5580
|
|
|
5549
5581
|
// src/components/input/input.tsx
|
|
5550
5582
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5551
|
-
var Input = (0,
|
|
5583
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5552
5584
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5553
5585
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5554
|
-
const inputRef = (0,
|
|
5555
|
-
const slots = (0,
|
|
5556
|
-
const getContentProps = (0,
|
|
5586
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5587
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5588
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5557
5589
|
() => ({
|
|
5558
5590
|
className: clsx(
|
|
5559
5591
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5564,13 +5596,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5564
5596
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5565
5597
|
);
|
|
5566
5598
|
const renderStartContent = () => {
|
|
5567
|
-
if ((0,
|
|
5599
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5568
5600
|
const existingProps = startContent.props;
|
|
5569
5601
|
const mergedProps = {
|
|
5570
5602
|
...getContentProps(),
|
|
5571
5603
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5572
5604
|
};
|
|
5573
|
-
return (0,
|
|
5605
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5574
5606
|
} else {
|
|
5575
5607
|
const contentProps = getContentProps();
|
|
5576
5608
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5589,13 +5621,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5589
5621
|
}
|
|
5590
5622
|
);
|
|
5591
5623
|
const renderContentWithIcon = () => {
|
|
5592
|
-
if ((0,
|
|
5624
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5593
5625
|
const existingProps = endContent.props;
|
|
5594
5626
|
const mergedProps = {
|
|
5595
5627
|
...getContentProps(),
|
|
5596
5628
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5597
5629
|
};
|
|
5598
|
-
return (0,
|
|
5630
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5599
5631
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5600
5632
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5601
5633
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -5932,7 +5964,7 @@ var inputStyle = tv(
|
|
|
5932
5964
|
|
|
5933
5965
|
// src/components/pagination/pagination.tsx
|
|
5934
5966
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5935
|
-
var Pagination = (0,
|
|
5967
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5936
5968
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5937
5969
|
const {
|
|
5938
5970
|
classNames,
|
|
@@ -5946,12 +5978,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5946
5978
|
variant,
|
|
5947
5979
|
size
|
|
5948
5980
|
} = { ...props, ...variantProps };
|
|
5949
|
-
const [inputPage, setInputPage] = (0,
|
|
5981
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5950
5982
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5951
5983
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5952
5984
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5953
5985
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
5954
|
-
const slots = (0,
|
|
5986
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
5955
5987
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
5956
5988
|
currentPage,
|
|
5957
5989
|
totalPage,
|
|
@@ -6319,7 +6351,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6319
6351
|
|
|
6320
6352
|
// src/components/table/table.tsx
|
|
6321
6353
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6322
|
-
var Table = (0,
|
|
6354
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6323
6355
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6324
6356
|
const {
|
|
6325
6357
|
rows,
|
|
@@ -6344,8 +6376,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6344
6376
|
} = { ...props, ...variantProps };
|
|
6345
6377
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6346
6378
|
const showPagination = pagination && totalData > 0;
|
|
6347
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6348
|
-
const tableMinWidth = (0,
|
|
6379
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6380
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6349
6381
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6350
6382
|
if (column.width) return total + column.width;
|
|
6351
6383
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6354,10 +6386,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6354
6386
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6355
6387
|
return columnsWidth + checkboxWidth;
|
|
6356
6388
|
}, [columns, rowCheckbox]);
|
|
6357
|
-
(0,
|
|
6389
|
+
(0, import_react6.useEffect)(() => {
|
|
6358
6390
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6359
6391
|
}, [checkedRowIds]);
|
|
6360
|
-
(0,
|
|
6392
|
+
(0, import_react6.useEffect)(() => {
|
|
6361
6393
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6362
6394
|
const ids = Array.from(checkedRowIds);
|
|
6363
6395
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6365,7 +6397,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6365
6397
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6366
6398
|
}
|
|
6367
6399
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6368
|
-
(0,
|
|
6400
|
+
(0, import_react6.useImperativeHandle)(
|
|
6369
6401
|
ref,
|
|
6370
6402
|
() => ({
|
|
6371
6403
|
checkedRowIds,
|
|
@@ -6392,7 +6424,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6392
6424
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6393
6425
|
};
|
|
6394
6426
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6395
|
-
const slots = (0,
|
|
6427
|
+
const slots = (0, import_react6.useMemo)(
|
|
6396
6428
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6397
6429
|
[variantProps, onRowClick]
|
|
6398
6430
|
);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_head_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-KXQWLBBN.mjs";
|
|
5
5
|
import "../../chunk-7B7LRG5J.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-JQ7UTKWA.mjs";
|
|
7
7
|
import "../../chunk-F3HENRVM.mjs";
|
|
8
|
-
import "../../chunk-2GCSFWHD.mjs";
|
|
9
|
-
import "../../chunk-VNRGOOSY.mjs";
|
|
10
8
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
11
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-2GCSFWHD.mjs";
|
|
10
|
+
import "../../chunk-ONLUMPWY.mjs";
|
|
12
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
13
12
|
import "../../chunk-EWS3FESG.mjs";
|
|
13
|
+
import "../../chunk-3DCUMRYP.mjs";
|
|
14
14
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
15
15
|
import "../../chunk-R7KUEH3N.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
17
17
|
import "../../chunk-DDFJMHBC.mjs";
|
|
18
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
18
19
|
import "../../chunk-U4DJHAM5.mjs";
|
|
19
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
20
20
|
import "../../chunk-AC6TWLRT.mjs";
|
|
21
21
|
export {
|
|
22
22
|
table_head_default as default
|
|
@@ -106,7 +106,7 @@ __export(table_exports, {
|
|
|
106
106
|
getCellStyle: () => getCellStyle
|
|
107
107
|
});
|
|
108
108
|
module.exports = __toCommonJS(table_exports);
|
|
109
|
-
var
|
|
109
|
+
var import_react6 = require("react");
|
|
110
110
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
111
111
|
|
|
112
112
|
// src/utils/props.ts
|
|
@@ -673,7 +673,40 @@ var TableHead = ({
|
|
|
673
673
|
var table_head_default = TableHead;
|
|
674
674
|
|
|
675
675
|
// src/components/table/table-body.tsx
|
|
676
|
+
var import_react2 = require("react");
|
|
676
677
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
678
|
+
function TableCell({
|
|
679
|
+
row,
|
|
680
|
+
column,
|
|
681
|
+
colIdx,
|
|
682
|
+
rowIndex,
|
|
683
|
+
slots,
|
|
684
|
+
classNames
|
|
685
|
+
}) {
|
|
686
|
+
var _a;
|
|
687
|
+
const value = row[column.field];
|
|
688
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
689
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
690
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
691
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
692
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
693
|
+
(0, import_react2.useEffect)(() => {
|
|
694
|
+
if (tdRef.current) {
|
|
695
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
696
|
+
}
|
|
697
|
+
}, [content]);
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
699
|
+
"td",
|
|
700
|
+
{
|
|
701
|
+
ref: tdRef,
|
|
702
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
703
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
704
|
+
title: showTitle ? String(content) : void 0,
|
|
705
|
+
children: content
|
|
706
|
+
},
|
|
707
|
+
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
708
|
+
);
|
|
709
|
+
}
|
|
677
710
|
var TableBody = ({
|
|
678
711
|
slots,
|
|
679
712
|
rows,
|
|
@@ -705,21 +738,18 @@ var TableBody = ({
|
|
|
705
738
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
706
739
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
707
740
|
children: [
|
|
708
|
-
columns.map((column, colIdx) =>
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
721
|
-
);
|
|
722
|
-
}),
|
|
741
|
+
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
742
|
+
TableCell,
|
|
743
|
+
{
|
|
744
|
+
row,
|
|
745
|
+
column,
|
|
746
|
+
colIdx,
|
|
747
|
+
rowIndex,
|
|
748
|
+
slots,
|
|
749
|
+
classNames
|
|
750
|
+
},
|
|
751
|
+
`${row.id}-${column.field}-${colIdx}`
|
|
752
|
+
)),
|
|
723
753
|
rowCheckbox && renderCheckboxCell(row.id, rowIndex)
|
|
724
754
|
]
|
|
725
755
|
},
|
|
@@ -741,18 +771,18 @@ var TableBody = ({
|
|
|
741
771
|
var table_body_default = TableBody;
|
|
742
772
|
|
|
743
773
|
// src/components/pagination/pagination.tsx
|
|
744
|
-
var
|
|
774
|
+
var import_react5 = require("react");
|
|
745
775
|
|
|
746
776
|
// src/components/pagination/usePagination.ts
|
|
747
|
-
var
|
|
777
|
+
var import_react3 = require("react");
|
|
748
778
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
749
|
-
const startPage = (0,
|
|
750
|
-
const endPage = (0,
|
|
751
|
-
const pageList = (0,
|
|
779
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
780
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
781
|
+
const pageList = (0, import_react3.useMemo)(
|
|
752
782
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
753
783
|
[startPage, endPage]
|
|
754
784
|
);
|
|
755
|
-
const handleClickMovePage = (0,
|
|
785
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
756
786
|
(page) => (event) => {
|
|
757
787
|
event.preventDefault();
|
|
758
788
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -769,7 +799,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
769
799
|
var usePagination_default = usePagination;
|
|
770
800
|
|
|
771
801
|
// src/components/input/input.tsx
|
|
772
|
-
var
|
|
802
|
+
var import_react4 = require("react");
|
|
773
803
|
|
|
774
804
|
// src/components/icon/template.tsx
|
|
775
805
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5594,12 +5624,12 @@ var Icon_default = Icon;
|
|
|
5594
5624
|
|
|
5595
5625
|
// src/components/input/input.tsx
|
|
5596
5626
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5597
|
-
var Input = (0,
|
|
5627
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5598
5628
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5599
5629
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5600
|
-
const inputRef = (0,
|
|
5601
|
-
const slots = (0,
|
|
5602
|
-
const getContentProps = (0,
|
|
5630
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5631
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5632
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5603
5633
|
() => ({
|
|
5604
5634
|
className: clsx(
|
|
5605
5635
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5610,13 +5640,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5610
5640
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5611
5641
|
);
|
|
5612
5642
|
const renderStartContent = () => {
|
|
5613
|
-
if ((0,
|
|
5643
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5614
5644
|
const existingProps = startContent.props;
|
|
5615
5645
|
const mergedProps = {
|
|
5616
5646
|
...getContentProps(),
|
|
5617
5647
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5618
5648
|
};
|
|
5619
|
-
return (0,
|
|
5649
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5620
5650
|
} else {
|
|
5621
5651
|
const contentProps = getContentProps();
|
|
5622
5652
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5635,13 +5665,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5635
5665
|
}
|
|
5636
5666
|
);
|
|
5637
5667
|
const renderContentWithIcon = () => {
|
|
5638
|
-
if ((0,
|
|
5668
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5639
5669
|
const existingProps = endContent.props;
|
|
5640
5670
|
const mergedProps = {
|
|
5641
5671
|
...getContentProps(),
|
|
5642
5672
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5643
5673
|
};
|
|
5644
|
-
return (0,
|
|
5674
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5645
5675
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5646
5676
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5647
5677
|
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 }) });
|
|
@@ -5978,7 +6008,7 @@ var inputStyle = tv(
|
|
|
5978
6008
|
|
|
5979
6009
|
// src/components/pagination/pagination.tsx
|
|
5980
6010
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5981
|
-
var Pagination = (0,
|
|
6011
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5982
6012
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5983
6013
|
const {
|
|
5984
6014
|
classNames,
|
|
@@ -5992,12 +6022,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5992
6022
|
variant,
|
|
5993
6023
|
size
|
|
5994
6024
|
} = { ...props, ...variantProps };
|
|
5995
|
-
const [inputPage, setInputPage] = (0,
|
|
6025
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5996
6026
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5997
6027
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5998
6028
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5999
6029
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
6000
|
-
const slots = (0,
|
|
6030
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6001
6031
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6002
6032
|
currentPage,
|
|
6003
6033
|
totalPage,
|
|
@@ -6365,7 +6395,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6365
6395
|
|
|
6366
6396
|
// src/components/table/table.tsx
|
|
6367
6397
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6368
|
-
var Table = (0,
|
|
6398
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6369
6399
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6370
6400
|
const {
|
|
6371
6401
|
rows,
|
|
@@ -6390,8 +6420,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6390
6420
|
} = { ...props, ...variantProps };
|
|
6391
6421
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6392
6422
|
const showPagination = pagination && totalData > 0;
|
|
6393
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6394
|
-
const tableMinWidth = (0,
|
|
6423
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6424
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6395
6425
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6396
6426
|
if (column.width) return total + column.width;
|
|
6397
6427
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6400,10 +6430,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6400
6430
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6401
6431
|
return columnsWidth + checkboxWidth;
|
|
6402
6432
|
}, [columns, rowCheckbox]);
|
|
6403
|
-
(0,
|
|
6433
|
+
(0, import_react6.useEffect)(() => {
|
|
6404
6434
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6405
6435
|
}, [checkedRowIds]);
|
|
6406
|
-
(0,
|
|
6436
|
+
(0, import_react6.useEffect)(() => {
|
|
6407
6437
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6408
6438
|
const ids = Array.from(checkedRowIds);
|
|
6409
6439
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6411,7 +6441,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6411
6441
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6412
6442
|
}
|
|
6413
6443
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6414
|
-
(0,
|
|
6444
|
+
(0, import_react6.useImperativeHandle)(
|
|
6415
6445
|
ref,
|
|
6416
6446
|
() => ({
|
|
6417
6447
|
checkedRowIds,
|
|
@@ -6438,7 +6468,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6438
6468
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6439
6469
|
};
|
|
6440
6470
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6441
|
-
const slots = (0,
|
|
6471
|
+
const slots = (0, import_react6.useMemo)(
|
|
6442
6472
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6443
6473
|
[variantProps, onRowClick]
|
|
6444
6474
|
);
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getCellStyle,
|
|
4
4
|
table_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-KXQWLBBN.mjs";
|
|
6
6
|
import "../../chunk-7B7LRG5J.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-JQ7UTKWA.mjs";
|
|
8
8
|
import "../../chunk-F3HENRVM.mjs";
|
|
9
|
-
import "../../chunk-2GCSFWHD.mjs";
|
|
10
|
-
import "../../chunk-VNRGOOSY.mjs";
|
|
11
9
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
12
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-2GCSFWHD.mjs";
|
|
11
|
+
import "../../chunk-ONLUMPWY.mjs";
|
|
13
12
|
import "../../chunk-DQRAFUDA.mjs";
|
|
14
13
|
import "../../chunk-EWS3FESG.mjs";
|
|
14
|
+
import "../../chunk-3DCUMRYP.mjs";
|
|
15
15
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
16
16
|
import "../../chunk-R7KUEH3N.mjs";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-27Y6K5NK.mjs";
|
|
18
18
|
import "../../chunk-DDFJMHBC.mjs";
|
|
19
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
19
20
|
import "../../chunk-U4DJHAM5.mjs";
|
|
20
|
-
import "../../chunk-27Y6K5NK.mjs";
|
|
21
21
|
import "../../chunk-AC6TWLRT.mjs";
|
|
22
22
|
export {
|
|
23
23
|
table_default as default,
|