@deepnoid/ui 0.1.174 → 0.1.175
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 +168 -168
- package/dist/{chunk-QXVGMVCG.mjs → chunk-JPCZROOU.mjs} +21 -10
- package/dist/components/charts/index.mjs +3 -3
- package/dist/components/picker/index.mjs +5 -5
- package/dist/components/table/index.js +43 -32
- package/dist/components/table/index.mjs +3 -3
- package/dist/components/table/table-body.js +13 -2
- package/dist/components/table/table-body.mjs +3 -3
- package/dist/components/table/table-head.js +41 -28
- package/dist/components/table/table-head.mjs +3 -3
- package/dist/components/table/table.js +39 -28
- package/dist/components/table/table.mjs +3 -3
- package/dist/index.js +220 -209
- package/dist/index.mjs +32 -32
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
pagination_default
|
|
4
4
|
} from "./chunk-D4YI5HF2.mjs";
|
|
5
|
-
import {
|
|
6
|
-
checkbox_default
|
|
7
|
-
} from "./chunk-OEIEALIP.mjs";
|
|
8
5
|
import {
|
|
9
6
|
scrollArea_default
|
|
10
7
|
} from "./chunk-EWS3FESG.mjs";
|
|
8
|
+
import {
|
|
9
|
+
checkbox_default
|
|
10
|
+
} from "./chunk-OEIEALIP.mjs";
|
|
11
11
|
import {
|
|
12
12
|
mapPropsVariants
|
|
13
13
|
} from "./chunk-E3G5QXSH.mjs";
|
|
@@ -18,14 +18,15 @@ import {
|
|
|
18
18
|
// src/components/table/table.tsx
|
|
19
19
|
import {
|
|
20
20
|
forwardRef,
|
|
21
|
-
useEffect,
|
|
21
|
+
useEffect as useEffect2,
|
|
22
22
|
useImperativeHandle,
|
|
23
23
|
useMemo,
|
|
24
|
-
useState
|
|
24
|
+
useState as useState2
|
|
25
25
|
} from "react";
|
|
26
26
|
import { tv } from "tailwind-variants";
|
|
27
27
|
|
|
28
28
|
// src/components/table/table-body.tsx
|
|
29
|
+
import { useEffect, useRef, useState } from "react";
|
|
29
30
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
31
|
var TableBody = ({
|
|
31
32
|
slots,
|
|
@@ -42,6 +43,7 @@ var TableBody = ({
|
|
|
42
43
|
classNames,
|
|
43
44
|
className
|
|
44
45
|
}) => {
|
|
46
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
45
47
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ jsx(
|
|
46
48
|
"td",
|
|
47
49
|
{
|
|
@@ -63,11 +65,20 @@ var TableBody = ({
|
|
|
63
65
|
const value = row[column.field];
|
|
64
66
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
65
67
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
68
|
+
const tdRef = useRef(null);
|
|
69
|
+
const [showTitle, setShowTitle] = useState(false);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (tdRef.current) {
|
|
72
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
73
|
+
}
|
|
74
|
+
}, [content]);
|
|
66
75
|
return /* @__PURE__ */ jsx(
|
|
67
76
|
"td",
|
|
68
77
|
{
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
ref: tdRef,
|
|
79
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
80
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
81
|
+
title: showTitle ? String(content) : void 0,
|
|
71
82
|
children: content
|
|
72
83
|
},
|
|
73
84
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -120,7 +131,7 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
120
131
|
} = { ...props, ...variantProps };
|
|
121
132
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
122
133
|
const showPagination = pagination && totalData > 0;
|
|
123
|
-
const [checkedRowIds, setCheckedRowIds] =
|
|
134
|
+
const [checkedRowIds, setCheckedRowIds] = useState2(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
124
135
|
const tableMinWidth = useMemo(() => {
|
|
125
136
|
const columnsWidth = columns.reduce((total, column) => {
|
|
126
137
|
if (column.width) return total + column.width;
|
|
@@ -130,10 +141,10 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
130
141
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
131
142
|
return columnsWidth + checkboxWidth;
|
|
132
143
|
}, [columns, rowCheckbox]);
|
|
133
|
-
|
|
144
|
+
useEffect2(() => {
|
|
134
145
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
135
146
|
}, [checkedRowIds]);
|
|
136
|
-
|
|
147
|
+
useEffect2(() => {
|
|
137
148
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
138
149
|
const ids = Array.from(checkedRowIds);
|
|
139
150
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-3OCNT22V.mjs";
|
|
3
|
-
import {
|
|
4
|
-
simpleBarChart_default
|
|
5
|
-
} from "../../chunk-GWHUQUKA.mjs";
|
|
6
3
|
import {
|
|
7
4
|
areaChart_default
|
|
8
5
|
} from "../../chunk-LH6Z7SDZ.mjs";
|
|
@@ -18,6 +15,9 @@ import {
|
|
|
18
15
|
import {
|
|
19
16
|
radarChart_default
|
|
20
17
|
} from "../../chunk-U7SYKG2C.mjs";
|
|
18
|
+
import {
|
|
19
|
+
simpleBarChart_default
|
|
20
|
+
} from "../../chunk-GWHUQUKA.mjs";
|
|
21
21
|
import "../../chunk-E3G5QXSH.mjs";
|
|
22
22
|
import "../../chunk-U4DJHAM5.mjs";
|
|
23
23
|
import "../../chunk-27Y6K5NK.mjs";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-4VWG4726.mjs";
|
|
3
|
-
import {
|
|
4
|
-
timePicker_default
|
|
5
|
-
} from "../../chunk-BM3MR3JR.mjs";
|
|
6
|
-
import "../../chunk-QCEKPS7U.mjs";
|
|
7
|
-
import "../../chunk-5G6CCE55.mjs";
|
|
8
3
|
import {
|
|
9
4
|
datePicker_default
|
|
10
5
|
} from "../../chunk-52VX5MC2.mjs";
|
|
@@ -12,6 +7,11 @@ import "../../chunk-FWFEKWWD.mjs";
|
|
|
12
7
|
import {
|
|
13
8
|
day_default
|
|
14
9
|
} from "../../chunk-XZYQFBCT.mjs";
|
|
10
|
+
import {
|
|
11
|
+
timePicker_default
|
|
12
|
+
} from "../../chunk-BM3MR3JR.mjs";
|
|
13
|
+
import "../../chunk-QCEKPS7U.mjs";
|
|
14
|
+
import "../../chunk-5G6CCE55.mjs";
|
|
15
15
|
import "../../chunk-2GCSFWHD.mjs";
|
|
16
16
|
import "../../chunk-VNRGOOSY.mjs";
|
|
17
17
|
import "../../chunk-MY5U63QO.mjs";
|
|
@@ -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_react6 = require("react");
|
|
112
112
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
113
113
|
|
|
114
114
|
// src/utils/props.ts
|
|
@@ -675,6 +675,7 @@ var TableHead = ({
|
|
|
675
675
|
var table_head_default = TableHead;
|
|
676
676
|
|
|
677
677
|
// src/components/table/table-body.tsx
|
|
678
|
+
var import_react2 = require("react");
|
|
678
679
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
679
680
|
var TableBody = ({
|
|
680
681
|
slots,
|
|
@@ -691,6 +692,7 @@ var TableBody = ({
|
|
|
691
692
|
classNames,
|
|
692
693
|
className
|
|
693
694
|
}) => {
|
|
695
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
694
696
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
695
697
|
"td",
|
|
696
698
|
{
|
|
@@ -712,11 +714,20 @@ var TableBody = ({
|
|
|
712
714
|
const value = row[column.field];
|
|
713
715
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
714
716
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
717
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
718
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
719
|
+
(0, import_react2.useEffect)(() => {
|
|
720
|
+
if (tdRef.current) {
|
|
721
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
722
|
+
}
|
|
723
|
+
}, [content]);
|
|
715
724
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
716
725
|
"td",
|
|
717
726
|
{
|
|
718
|
-
|
|
719
|
-
|
|
727
|
+
ref: tdRef,
|
|
728
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
729
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
730
|
+
title: showTitle ? String(content) : void 0,
|
|
720
731
|
children: content
|
|
721
732
|
},
|
|
722
733
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -743,18 +754,18 @@ var TableBody = ({
|
|
|
743
754
|
var table_body_default = TableBody;
|
|
744
755
|
|
|
745
756
|
// src/components/pagination/pagination.tsx
|
|
746
|
-
var
|
|
757
|
+
var import_react5 = require("react");
|
|
747
758
|
|
|
748
759
|
// src/components/pagination/usePagination.ts
|
|
749
|
-
var
|
|
760
|
+
var import_react3 = require("react");
|
|
750
761
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
751
|
-
const startPage = (0,
|
|
752
|
-
const endPage = (0,
|
|
753
|
-
const pageList = (0,
|
|
762
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
763
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
764
|
+
const pageList = (0, import_react3.useMemo)(
|
|
754
765
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
755
766
|
[startPage, endPage]
|
|
756
767
|
);
|
|
757
|
-
const handleClickMovePage = (0,
|
|
768
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
758
769
|
(page) => (event) => {
|
|
759
770
|
event.preventDefault();
|
|
760
771
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -771,7 +782,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
771
782
|
var usePagination_default = usePagination;
|
|
772
783
|
|
|
773
784
|
// src/components/input/input.tsx
|
|
774
|
-
var
|
|
785
|
+
var import_react4 = require("react");
|
|
775
786
|
|
|
776
787
|
// src/components/icon/template.tsx
|
|
777
788
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5596,12 +5607,12 @@ var Icon_default = Icon;
|
|
|
5596
5607
|
|
|
5597
5608
|
// src/components/input/input.tsx
|
|
5598
5609
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5599
|
-
var Input = (0,
|
|
5610
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5600
5611
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5601
5612
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5602
|
-
const inputRef = (0,
|
|
5603
|
-
const slots = (0,
|
|
5604
|
-
const getContentProps = (0,
|
|
5613
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5614
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5615
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5605
5616
|
() => ({
|
|
5606
5617
|
className: clsx(
|
|
5607
5618
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5612,13 +5623,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5612
5623
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5613
5624
|
);
|
|
5614
5625
|
const renderStartContent = () => {
|
|
5615
|
-
if ((0,
|
|
5626
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5616
5627
|
const existingProps = startContent.props;
|
|
5617
5628
|
const mergedProps = {
|
|
5618
5629
|
...getContentProps(),
|
|
5619
5630
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5620
5631
|
};
|
|
5621
|
-
return (0,
|
|
5632
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5622
5633
|
} else {
|
|
5623
5634
|
const contentProps = getContentProps();
|
|
5624
5635
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5637,13 +5648,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5637
5648
|
}
|
|
5638
5649
|
);
|
|
5639
5650
|
const renderContentWithIcon = () => {
|
|
5640
|
-
if ((0,
|
|
5651
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5641
5652
|
const existingProps = endContent.props;
|
|
5642
5653
|
const mergedProps = {
|
|
5643
5654
|
...getContentProps(),
|
|
5644
5655
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5645
5656
|
};
|
|
5646
|
-
return (0,
|
|
5657
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5647
5658
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5648
5659
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5649
5660
|
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 }) });
|
|
@@ -5980,7 +5991,7 @@ var inputStyle = tv(
|
|
|
5980
5991
|
|
|
5981
5992
|
// src/components/pagination/pagination.tsx
|
|
5982
5993
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5983
|
-
var Pagination = (0,
|
|
5994
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5984
5995
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5985
5996
|
const {
|
|
5986
5997
|
classNames,
|
|
@@ -5994,12 +6005,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5994
6005
|
variant,
|
|
5995
6006
|
size
|
|
5996
6007
|
} = { ...props, ...variantProps };
|
|
5997
|
-
const [inputPage, setInputPage] = (0,
|
|
6008
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5998
6009
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5999
6010
|
const isPrevPageDisabled = currentPage <= 1;
|
|
6000
6011
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
6001
6012
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
6002
|
-
const slots = (0,
|
|
6013
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6003
6014
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6004
6015
|
currentPage,
|
|
6005
6016
|
totalPage,
|
|
@@ -6367,7 +6378,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6367
6378
|
|
|
6368
6379
|
// src/components/table/table.tsx
|
|
6369
6380
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6370
|
-
var Table = (0,
|
|
6381
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6371
6382
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6372
6383
|
const {
|
|
6373
6384
|
rows,
|
|
@@ -6392,8 +6403,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6392
6403
|
} = { ...props, ...variantProps };
|
|
6393
6404
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6394
6405
|
const showPagination = pagination && totalData > 0;
|
|
6395
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6396
|
-
const tableMinWidth = (0,
|
|
6406
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6407
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6397
6408
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6398
6409
|
if (column.width) return total + column.width;
|
|
6399
6410
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6402,10 +6413,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6402
6413
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6403
6414
|
return columnsWidth + checkboxWidth;
|
|
6404
6415
|
}, [columns, rowCheckbox]);
|
|
6405
|
-
(0,
|
|
6416
|
+
(0, import_react6.useEffect)(() => {
|
|
6406
6417
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6407
6418
|
}, [checkedRowIds]);
|
|
6408
|
-
(0,
|
|
6419
|
+
(0, import_react6.useEffect)(() => {
|
|
6409
6420
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6410
6421
|
const ids = Array.from(checkedRowIds);
|
|
6411
6422
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6413,7 +6424,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6413
6424
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6414
6425
|
}
|
|
6415
6426
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6416
|
-
(0,
|
|
6427
|
+
(0, import_react6.useImperativeHandle)(
|
|
6417
6428
|
ref,
|
|
6418
6429
|
() => ({
|
|
6419
6430
|
checkedRowIds,
|
|
@@ -6440,7 +6451,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6440
6451
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6441
6452
|
};
|
|
6442
6453
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6443
|
-
const slots = (0,
|
|
6454
|
+
const slots = (0, import_react6.useMemo)(
|
|
6444
6455
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6445
6456
|
[variantProps, onRowClick]
|
|
6446
6457
|
);
|
|
@@ -6759,7 +6770,7 @@ var getCellStyle = (column) => {
|
|
|
6759
6770
|
};
|
|
6760
6771
|
|
|
6761
6772
|
// src/components/table/definition-table.tsx
|
|
6762
|
-
var
|
|
6773
|
+
var import_react7 = require("react");
|
|
6763
6774
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6764
6775
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
6765
6776
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
@@ -6852,10 +6863,10 @@ var DefinitionTableRow = ({
|
|
|
6852
6863
|
colIndex
|
|
6853
6864
|
);
|
|
6854
6865
|
}) });
|
|
6855
|
-
var DefinitionTable = (0,
|
|
6866
|
+
var DefinitionTable = (0, import_react7.forwardRef)(
|
|
6856
6867
|
({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
|
|
6857
|
-
const slots = (0,
|
|
6858
|
-
const highlightColumnIndex = (0,
|
|
6868
|
+
const slots = (0, import_react7.useMemo)(() => DefinitionTableStyle(), []);
|
|
6869
|
+
const highlightColumnIndex = (0, import_react7.useMemo)(
|
|
6859
6870
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
6860
6871
|
[rows, highlightColumnKey]
|
|
6861
6872
|
);
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
} from "../../chunk-DS5CGU2X.mjs";
|
|
6
6
|
import {
|
|
7
7
|
table_default
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
9
9
|
import "../../chunk-7B7LRG5J.mjs";
|
|
10
10
|
import "../../chunk-D4YI5HF2.mjs";
|
|
11
11
|
import "../../chunk-F3HENRVM.mjs";
|
|
12
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
12
13
|
import "../../chunk-2GCSFWHD.mjs";
|
|
13
14
|
import "../../chunk-VNRGOOSY.mjs";
|
|
14
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
15
|
-
import "../../chunk-OEIEALIP.mjs";
|
|
16
15
|
import "../../chunk-DQRAFUDA.mjs";
|
|
17
16
|
import "../../chunk-EWS3FESG.mjs";
|
|
17
|
+
import "../../chunk-OEIEALIP.mjs";
|
|
18
18
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
19
19
|
import "../../chunk-R7KUEH3N.mjs";
|
|
20
20
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -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) {
|
|
@@ -6705,6 +6706,7 @@ var TableBody = ({
|
|
|
6705
6706
|
classNames,
|
|
6706
6707
|
className
|
|
6707
6708
|
}) => {
|
|
6709
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
6708
6710
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6709
6711
|
"td",
|
|
6710
6712
|
{
|
|
@@ -6726,11 +6728,20 @@ var TableBody = ({
|
|
|
6726
6728
|
const value = row[column.field];
|
|
6727
6729
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
6728
6730
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
6731
|
+
const tdRef = (0, import_react6.useRef)(null);
|
|
6732
|
+
const [showTitle, setShowTitle] = (0, import_react6.useState)(false);
|
|
6733
|
+
(0, import_react6.useEffect)(() => {
|
|
6734
|
+
if (tdRef.current) {
|
|
6735
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
6736
|
+
}
|
|
6737
|
+
}, [content]);
|
|
6729
6738
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6730
6739
|
"td",
|
|
6731
6740
|
{
|
|
6732
|
-
|
|
6733
|
-
|
|
6741
|
+
ref: tdRef,
|
|
6742
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
6743
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
6744
|
+
title: showTitle ? String(content) : void 0,
|
|
6734
6745
|
children: content
|
|
6735
6746
|
},
|
|
6736
6747
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_body_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
5
5
|
import "../../chunk-7B7LRG5J.mjs";
|
|
6
6
|
import "../../chunk-D4YI5HF2.mjs";
|
|
7
7
|
import "../../chunk-F3HENRVM.mjs";
|
|
8
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
8
9
|
import "../../chunk-2GCSFWHD.mjs";
|
|
9
10
|
import "../../chunk-VNRGOOSY.mjs";
|
|
10
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
11
|
-
import "../../chunk-OEIEALIP.mjs";
|
|
12
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
13
12
|
import "../../chunk-EWS3FESG.mjs";
|
|
13
|
+
import "../../chunk-OEIEALIP.mjs";
|
|
14
14
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
15
15
|
import "../../chunk-R7KUEH3N.mjs";
|
|
16
16
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -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
|
|
|
@@ -643,6 +646,7 @@ var TableBody = ({
|
|
|
643
646
|
classNames,
|
|
644
647
|
className
|
|
645
648
|
}) => {
|
|
649
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
646
650
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
647
651
|
"td",
|
|
648
652
|
{
|
|
@@ -664,11 +668,20 @@ var TableBody = ({
|
|
|
664
668
|
const value = row[column.field];
|
|
665
669
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
666
670
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
671
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
672
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
673
|
+
(0, import_react2.useEffect)(() => {
|
|
674
|
+
if (tdRef.current) {
|
|
675
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
676
|
+
}
|
|
677
|
+
}, [content]);
|
|
667
678
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
668
679
|
"td",
|
|
669
680
|
{
|
|
670
|
-
|
|
671
|
-
|
|
681
|
+
ref: tdRef,
|
|
682
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
683
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
684
|
+
title: showTitle ? String(content) : void 0,
|
|
672
685
|
children: content
|
|
673
686
|
},
|
|
674
687
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -695,18 +708,18 @@ var TableBody = ({
|
|
|
695
708
|
var table_body_default = TableBody;
|
|
696
709
|
|
|
697
710
|
// src/components/pagination/pagination.tsx
|
|
698
|
-
var
|
|
711
|
+
var import_react5 = require("react");
|
|
699
712
|
|
|
700
713
|
// src/components/pagination/usePagination.ts
|
|
701
|
-
var
|
|
714
|
+
var import_react3 = require("react");
|
|
702
715
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
703
|
-
const startPage = (0,
|
|
704
|
-
const endPage = (0,
|
|
705
|
-
const pageList = (0,
|
|
716
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
717
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
718
|
+
const pageList = (0, import_react3.useMemo)(
|
|
706
719
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
707
720
|
[startPage, endPage]
|
|
708
721
|
);
|
|
709
|
-
const handleClickMovePage = (0,
|
|
722
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
710
723
|
(page) => (event) => {
|
|
711
724
|
event.preventDefault();
|
|
712
725
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -723,7 +736,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
723
736
|
var usePagination_default = usePagination;
|
|
724
737
|
|
|
725
738
|
// src/components/input/input.tsx
|
|
726
|
-
var
|
|
739
|
+
var import_react4 = require("react");
|
|
727
740
|
|
|
728
741
|
// src/components/icon/template.tsx
|
|
729
742
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -5548,12 +5561,12 @@ var Icon_default = Icon;
|
|
|
5548
5561
|
|
|
5549
5562
|
// src/components/input/input.tsx
|
|
5550
5563
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5551
|
-
var Input = (0,
|
|
5564
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5552
5565
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5553
5566
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5554
|
-
const inputRef = (0,
|
|
5555
|
-
const slots = (0,
|
|
5556
|
-
const getContentProps = (0,
|
|
5567
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5568
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5569
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5557
5570
|
() => ({
|
|
5558
5571
|
className: clsx(
|
|
5559
5572
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5564,13 +5577,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5564
5577
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5565
5578
|
);
|
|
5566
5579
|
const renderStartContent = () => {
|
|
5567
|
-
if ((0,
|
|
5580
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5568
5581
|
const existingProps = startContent.props;
|
|
5569
5582
|
const mergedProps = {
|
|
5570
5583
|
...getContentProps(),
|
|
5571
5584
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5572
5585
|
};
|
|
5573
|
-
return (0,
|
|
5586
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5574
5587
|
} else {
|
|
5575
5588
|
const contentProps = getContentProps();
|
|
5576
5589
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5589,13 +5602,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5589
5602
|
}
|
|
5590
5603
|
);
|
|
5591
5604
|
const renderContentWithIcon = () => {
|
|
5592
|
-
if ((0,
|
|
5605
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5593
5606
|
const existingProps = endContent.props;
|
|
5594
5607
|
const mergedProps = {
|
|
5595
5608
|
...getContentProps(),
|
|
5596
5609
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5597
5610
|
};
|
|
5598
|
-
return (0,
|
|
5611
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5599
5612
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5600
5613
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5601
5614
|
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 +5945,7 @@ var inputStyle = tv(
|
|
|
5932
5945
|
|
|
5933
5946
|
// src/components/pagination/pagination.tsx
|
|
5934
5947
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5935
|
-
var Pagination = (0,
|
|
5948
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5936
5949
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5937
5950
|
const {
|
|
5938
5951
|
classNames,
|
|
@@ -5946,12 +5959,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5946
5959
|
variant,
|
|
5947
5960
|
size
|
|
5948
5961
|
} = { ...props, ...variantProps };
|
|
5949
|
-
const [inputPage, setInputPage] = (0,
|
|
5962
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5950
5963
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5951
5964
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5952
5965
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5953
5966
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
5954
|
-
const slots = (0,
|
|
5967
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
5955
5968
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
5956
5969
|
currentPage,
|
|
5957
5970
|
totalPage,
|
|
@@ -6319,7 +6332,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6319
6332
|
|
|
6320
6333
|
// src/components/table/table.tsx
|
|
6321
6334
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6322
|
-
var Table = (0,
|
|
6335
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6323
6336
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6324
6337
|
const {
|
|
6325
6338
|
rows,
|
|
@@ -6344,8 +6357,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6344
6357
|
} = { ...props, ...variantProps };
|
|
6345
6358
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6346
6359
|
const showPagination = pagination && totalData > 0;
|
|
6347
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6348
|
-
const tableMinWidth = (0,
|
|
6360
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6361
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6349
6362
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6350
6363
|
if (column.width) return total + column.width;
|
|
6351
6364
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6354,10 +6367,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6354
6367
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6355
6368
|
return columnsWidth + checkboxWidth;
|
|
6356
6369
|
}, [columns, rowCheckbox]);
|
|
6357
|
-
(0,
|
|
6370
|
+
(0, import_react6.useEffect)(() => {
|
|
6358
6371
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6359
6372
|
}, [checkedRowIds]);
|
|
6360
|
-
(0,
|
|
6373
|
+
(0, import_react6.useEffect)(() => {
|
|
6361
6374
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6362
6375
|
const ids = Array.from(checkedRowIds);
|
|
6363
6376
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6365,7 +6378,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6365
6378
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6366
6379
|
}
|
|
6367
6380
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6368
|
-
(0,
|
|
6381
|
+
(0, import_react6.useImperativeHandle)(
|
|
6369
6382
|
ref,
|
|
6370
6383
|
() => ({
|
|
6371
6384
|
checkedRowIds,
|
|
@@ -6392,7 +6405,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6392
6405
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6393
6406
|
};
|
|
6394
6407
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6395
|
-
const slots = (0,
|
|
6408
|
+
const slots = (0, import_react6.useMemo)(
|
|
6396
6409
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6397
6410
|
[variantProps, onRowClick]
|
|
6398
6411
|
);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_head_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
5
5
|
import "../../chunk-7B7LRG5J.mjs";
|
|
6
6
|
import "../../chunk-D4YI5HF2.mjs";
|
|
7
7
|
import "../../chunk-F3HENRVM.mjs";
|
|
8
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
8
9
|
import "../../chunk-2GCSFWHD.mjs";
|
|
9
10
|
import "../../chunk-VNRGOOSY.mjs";
|
|
10
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
11
|
-
import "../../chunk-OEIEALIP.mjs";
|
|
12
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
13
12
|
import "../../chunk-EWS3FESG.mjs";
|
|
13
|
+
import "../../chunk-OEIEALIP.mjs";
|
|
14
14
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
15
15
|
import "../../chunk-R7KUEH3N.mjs";
|
|
16
16
|
import "../../chunk-E3G5QXSH.mjs";
|