@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
|
@@ -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,6 +673,7 @@ 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");
|
|
677
678
|
var TableBody = ({
|
|
678
679
|
slots,
|
|
@@ -689,6 +690,7 @@ var TableBody = ({
|
|
|
689
690
|
classNames,
|
|
690
691
|
className
|
|
691
692
|
}) => {
|
|
693
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
692
694
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
693
695
|
"td",
|
|
694
696
|
{
|
|
@@ -710,11 +712,20 @@ var TableBody = ({
|
|
|
710
712
|
const value = row[column.field];
|
|
711
713
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
712
714
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
715
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
716
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
717
|
+
(0, import_react2.useEffect)(() => {
|
|
718
|
+
if (tdRef.current) {
|
|
719
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
720
|
+
}
|
|
721
|
+
}, [content]);
|
|
713
722
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
714
723
|
"td",
|
|
715
724
|
{
|
|
716
|
-
|
|
717
|
-
|
|
725
|
+
ref: tdRef,
|
|
726
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
727
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
728
|
+
title: showTitle ? String(content) : void 0,
|
|
718
729
|
children: content
|
|
719
730
|
},
|
|
720
731
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -741,18 +752,18 @@ var TableBody = ({
|
|
|
741
752
|
var table_body_default = TableBody;
|
|
742
753
|
|
|
743
754
|
// src/components/pagination/pagination.tsx
|
|
744
|
-
var
|
|
755
|
+
var import_react5 = require("react");
|
|
745
756
|
|
|
746
757
|
// src/components/pagination/usePagination.ts
|
|
747
|
-
var
|
|
758
|
+
var import_react3 = require("react");
|
|
748
759
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
749
|
-
const startPage = (0,
|
|
750
|
-
const endPage = (0,
|
|
751
|
-
const pageList = (0,
|
|
760
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
761
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
762
|
+
const pageList = (0, import_react3.useMemo)(
|
|
752
763
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
753
764
|
[startPage, endPage]
|
|
754
765
|
);
|
|
755
|
-
const handleClickMovePage = (0,
|
|
766
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
756
767
|
(page) => (event) => {
|
|
757
768
|
event.preventDefault();
|
|
758
769
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -769,7 +780,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
769
780
|
var usePagination_default = usePagination;
|
|
770
781
|
|
|
771
782
|
// src/components/input/input.tsx
|
|
772
|
-
var
|
|
783
|
+
var import_react4 = require("react");
|
|
773
784
|
|
|
774
785
|
// src/components/icon/template.tsx
|
|
775
786
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5594,12 +5605,12 @@ var Icon_default = Icon;
|
|
|
5594
5605
|
|
|
5595
5606
|
// src/components/input/input.tsx
|
|
5596
5607
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5597
|
-
var Input = (0,
|
|
5608
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5598
5609
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5599
5610
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5600
|
-
const inputRef = (0,
|
|
5601
|
-
const slots = (0,
|
|
5602
|
-
const getContentProps = (0,
|
|
5611
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5612
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5613
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5603
5614
|
() => ({
|
|
5604
5615
|
className: clsx(
|
|
5605
5616
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5610,13 +5621,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5610
5621
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5611
5622
|
);
|
|
5612
5623
|
const renderStartContent = () => {
|
|
5613
|
-
if ((0,
|
|
5624
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5614
5625
|
const existingProps = startContent.props;
|
|
5615
5626
|
const mergedProps = {
|
|
5616
5627
|
...getContentProps(),
|
|
5617
5628
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5618
5629
|
};
|
|
5619
|
-
return (0,
|
|
5630
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5620
5631
|
} else {
|
|
5621
5632
|
const contentProps = getContentProps();
|
|
5622
5633
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5635,13 +5646,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5635
5646
|
}
|
|
5636
5647
|
);
|
|
5637
5648
|
const renderContentWithIcon = () => {
|
|
5638
|
-
if ((0,
|
|
5649
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5639
5650
|
const existingProps = endContent.props;
|
|
5640
5651
|
const mergedProps = {
|
|
5641
5652
|
...getContentProps(),
|
|
5642
5653
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5643
5654
|
};
|
|
5644
|
-
return (0,
|
|
5655
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5645
5656
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5646
5657
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5647
5658
|
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 +5989,7 @@ var inputStyle = tv(
|
|
|
5978
5989
|
|
|
5979
5990
|
// src/components/pagination/pagination.tsx
|
|
5980
5991
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5981
|
-
var Pagination = (0,
|
|
5992
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5982
5993
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5983
5994
|
const {
|
|
5984
5995
|
classNames,
|
|
@@ -5992,12 +6003,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5992
6003
|
variant,
|
|
5993
6004
|
size
|
|
5994
6005
|
} = { ...props, ...variantProps };
|
|
5995
|
-
const [inputPage, setInputPage] = (0,
|
|
6006
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5996
6007
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5997
6008
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5998
6009
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5999
6010
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
6000
|
-
const slots = (0,
|
|
6011
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6001
6012
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6002
6013
|
currentPage,
|
|
6003
6014
|
totalPage,
|
|
@@ -6365,7 +6376,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6365
6376
|
|
|
6366
6377
|
// src/components/table/table.tsx
|
|
6367
6378
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6368
|
-
var Table = (0,
|
|
6379
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6369
6380
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6370
6381
|
const {
|
|
6371
6382
|
rows,
|
|
@@ -6390,8 +6401,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6390
6401
|
} = { ...props, ...variantProps };
|
|
6391
6402
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6392
6403
|
const showPagination = pagination && totalData > 0;
|
|
6393
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6394
|
-
const tableMinWidth = (0,
|
|
6404
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6405
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6395
6406
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6396
6407
|
if (column.width) return total + column.width;
|
|
6397
6408
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6400,10 +6411,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6400
6411
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6401
6412
|
return columnsWidth + checkboxWidth;
|
|
6402
6413
|
}, [columns, rowCheckbox]);
|
|
6403
|
-
(0,
|
|
6414
|
+
(0, import_react6.useEffect)(() => {
|
|
6404
6415
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6405
6416
|
}, [checkedRowIds]);
|
|
6406
|
-
(0,
|
|
6417
|
+
(0, import_react6.useEffect)(() => {
|
|
6407
6418
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6408
6419
|
const ids = Array.from(checkedRowIds);
|
|
6409
6420
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6411,7 +6422,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6411
6422
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6412
6423
|
}
|
|
6413
6424
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6414
|
-
(0,
|
|
6425
|
+
(0, import_react6.useImperativeHandle)(
|
|
6415
6426
|
ref,
|
|
6416
6427
|
() => ({
|
|
6417
6428
|
checkedRowIds,
|
|
@@ -6438,7 +6449,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6438
6449
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6439
6450
|
};
|
|
6440
6451
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6441
|
-
const slots = (0,
|
|
6452
|
+
const slots = (0, import_react6.useMemo)(
|
|
6442
6453
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6443
6454
|
[variantProps, onRowClick]
|
|
6444
6455
|
);
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getCellStyle,
|
|
4
4
|
table_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
6
6
|
import "../../chunk-7B7LRG5J.mjs";
|
|
7
7
|
import "../../chunk-D4YI5HF2.mjs";
|
|
8
8
|
import "../../chunk-F3HENRVM.mjs";
|
|
9
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
9
10
|
import "../../chunk-2GCSFWHD.mjs";
|
|
10
11
|
import "../../chunk-VNRGOOSY.mjs";
|
|
11
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
12
|
-
import "../../chunk-OEIEALIP.mjs";
|
|
13
12
|
import "../../chunk-DQRAFUDA.mjs";
|
|
14
13
|
import "../../chunk-EWS3FESG.mjs";
|
|
14
|
+
import "../../chunk-OEIEALIP.mjs";
|
|
15
15
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
16
16
|
import "../../chunk-R7KUEH3N.mjs";
|
|
17
17
|
import "../../chunk-E3G5QXSH.mjs";
|