@deepnoid/ui 0.1.202 → 0.1.203

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.
@@ -16,12 +16,12 @@ import {
16
16
  } from "./chunk-27Y6K5NK.mjs";
17
17
 
18
18
  // src/components/table/table-head.tsx
19
- import { isValidElement, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
19
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState3 } from "react";
20
20
 
21
21
  // src/components/table/table.tsx
22
22
  import {
23
23
  forwardRef,
24
- useEffect as useEffect2,
24
+ useEffect,
25
25
  useImperativeHandle,
26
26
  useMemo,
27
27
  useState as useState2
@@ -29,7 +29,7 @@ import {
29
29
  import { tv } from "tailwind-variants";
30
30
 
31
31
  // src/components/table/table-body.tsx
32
- import { useEffect, useRef, useState } from "react";
32
+ import { useLayoutEffect, useRef, useState } from "react";
33
33
  import { jsx, jsxs } from "react/jsx-runtime";
34
34
  function TableCell({
35
35
  row,
@@ -41,53 +41,31 @@ function TableCell({
41
41
  }) {
42
42
  var _a, _b;
43
43
  const value = row[column.field];
44
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
44
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
45
45
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
46
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
46
47
  const tdRef = useRef(null);
47
48
  const [showTitle, setShowTitle] = useState(false);
48
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
49
- const checkOverflow = (el) => {
50
- if (el.scrollWidth > el.clientWidth) {
51
- return true;
52
- }
53
- const children = Array.from(el.children);
54
- for (const child of children) {
55
- if (child.scrollWidth > child.clientWidth) {
56
- return true;
57
- }
58
- }
59
- return false;
60
- };
61
- useEffect(() => {
49
+ useLayoutEffect(() => {
62
50
  if (tdRef.current && isTextContent) {
63
- setTimeout(() => {
64
- if (tdRef.current) {
65
- setShowTitle(checkOverflow(tdRef.current));
66
- }
67
- }, 0);
51
+ const el = tdRef.current;
52
+ setShowTitle(el.scrollWidth > el.clientWidth);
68
53
  }
69
54
  }, [content, isTextContent]);
70
55
  return /* @__PURE__ */ jsx(
71
56
  "td",
72
57
  {
73
58
  ref: tdRef,
74
- className: clsx(
75
- slots.td(),
76
- classNames == null ? void 0 : classNames.td,
77
- column.className,
78
- isTextContent && "truncate",
79
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
80
- ),
59
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
81
60
  style: {
82
61
  ...getCellStyle(column),
83
62
  maxWidth: column.width || "150px",
84
63
  textAlign: column.align || "center",
85
- ...!isTextContent && {
86
- overflow: "visible",
87
- whiteSpace: "normal"
88
- }
64
+ whiteSpace: isTextContent ? "nowrap" : "normal",
65
+ overflow: isTextContent ? "hidden" : "visible",
66
+ textOverflow: isTextContent ? "ellipsis" : void 0
89
67
  },
90
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
68
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
91
69
  children: content
92
70
  },
93
71
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -194,10 +172,10 @@ var Table = forwardRef((originalProps, ref) => {
194
172
  const checkboxWidth = rowCheckbox ? 40 : 0;
195
173
  return columnsWidth + checkboxWidth;
196
174
  }, [columns, rowCheckbox]);
197
- useEffect2(() => {
175
+ useEffect(() => {
198
176
  onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
199
177
  }, [checkedRowIds]);
200
- useEffect2(() => {
178
+ useEffect(() => {
201
179
  const currentRowIds = new Set(rows.map((row) => row.id));
202
180
  const ids = Array.from(checkedRowIds);
203
181
  const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
@@ -561,37 +539,13 @@ function TableHeaderCell({
561
539
  }) {
562
540
  const thRef = useRef2(null);
563
541
  const [showTitle, setShowTitle] = useState3(false);
564
- const checkOverflow = (el) => {
565
- if (el.scrollWidth > el.clientWidth) {
566
- return true;
567
- }
568
- const children = Array.from(el.children);
569
- for (const child of children) {
570
- if (child.scrollWidth > child.clientWidth) {
571
- return true;
572
- }
573
- }
574
- return false;
575
- };
576
- const extractTextFromContent = (node) => {
577
- if (typeof node === "string" || typeof node === "number") {
578
- return String(node);
579
- }
580
- if (isValidElement(node)) {
581
- return String(node.props.children || "");
582
- }
583
- return "";
584
- };
585
- useEffect3(() => {
586
- if (thRef.current && !isCheckbox) {
587
- setTimeout(() => {
588
- if (thRef.current) {
589
- setShowTitle(checkOverflow(thRef.current));
590
- }
591
- }, 0);
542
+ useLayoutEffect2(() => {
543
+ if (!isCheckbox && thRef.current) {
544
+ const el = thRef.current;
545
+ setShowTitle(el.scrollWidth > el.clientWidth);
592
546
  }
593
547
  }, [content, isCheckbox]);
594
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
548
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
595
549
  return /* @__PURE__ */ jsx3(
596
550
  "th",
597
551
  {
@@ -604,7 +558,10 @@ function TableHeaderCell({
604
558
  flexShrink: 0,
605
559
  flexGrow: 0,
606
560
  boxSizing: "border-box"
607
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
561
+ } : column ? {
562
+ ...getCellStyle(column),
563
+ textAlign: "center"
564
+ } : void 0,
608
565
  title: titleText,
609
566
  children: content
610
567
  }
@@ -613,7 +570,6 @@ function TableHeaderCell({
613
570
  var TableHead = ({
614
571
  slots,
615
572
  columns,
616
- color,
617
573
  size,
618
574
  rowCheckbox = false,
619
575
  hasCheckedRows,
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import "../../chunk-7MVEAQ7Z.mjs";
3
- import {
4
- listItem_default
5
- } from "../../chunk-K3M3QEEV.mjs";
6
3
  import {
7
4
  list_default
8
5
  } from "../../chunk-NGRGAY42.mjs";
6
+ import {
7
+ listItem_default
8
+ } from "../../chunk-K3M3QEEV.mjs";
9
9
  import "../../chunk-ZYIIXWVY.mjs";
10
10
  import "../../chunk-YEYUS6DW.mjs";
11
11
  import "../../chunk-E3G5QXSH.mjs";
@@ -1,10 +1,5 @@
1
1
  "use client";
2
2
  import "../../chunk-4VWG4726.mjs";
3
- import {
4
- timePicker_default
5
- } from "../../chunk-COGGK5Q6.mjs";
6
- import "../../chunk-QCEKPS7U.mjs";
7
- import "../../chunk-K2RW5KLO.mjs";
8
3
  import {
9
4
  datePicker_default
10
5
  } from "../../chunk-2EUKWA4W.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-COGGK5Q6.mjs";
13
+ import "../../chunk-QCEKPS7U.mjs";
14
+ import "../../chunk-K2RW5KLO.mjs";
15
15
  import "../../chunk-2GCSFWHD.mjs";
16
16
  import "../../chunk-3RTVVQA3.mjs";
17
17
  import "../../chunk-MY5U63QO.mjs";
@@ -641,37 +641,13 @@ function TableHeaderCell({
641
641
  }) {
642
642
  const thRef = (0, import_react2.useRef)(null);
643
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);
644
+ (0, import_react2.useLayoutEffect)(() => {
645
+ if (!isCheckbox && thRef.current) {
646
+ const el = thRef.current;
647
+ setShowTitle(el.scrollWidth > el.clientWidth);
672
648
  }
673
649
  }, [content, isCheckbox]);
674
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
650
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
675
651
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
676
652
  "th",
677
653
  {
@@ -684,7 +660,10 @@ function TableHeaderCell({
684
660
  flexShrink: 0,
685
661
  flexGrow: 0,
686
662
  boxSizing: "border-box"
687
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
663
+ } : column ? {
664
+ ...getCellStyle(column),
665
+ textAlign: "center"
666
+ } : void 0,
688
667
  title: titleText,
689
668
  children: content
690
669
  }
@@ -693,7 +672,6 @@ function TableHeaderCell({
693
672
  var TableHead = ({
694
673
  slots,
695
674
  columns,
696
- color,
697
675
  size,
698
676
  rowCheckbox = false,
699
677
  hasCheckedRows,
@@ -745,53 +723,31 @@ function TableCell({
745
723
  }) {
746
724
  var _a, _b;
747
725
  const value = row[column.field];
748
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
726
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
749
727
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
728
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
750
729
  const tdRef = (0, import_react3.useRef)(null);
751
730
  const [showTitle, setShowTitle] = (0, import_react3.useState)(false);
752
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
753
- const checkOverflow = (el) => {
754
- if (el.scrollWidth > el.clientWidth) {
755
- return true;
756
- }
757
- const children = Array.from(el.children);
758
- for (const child of children) {
759
- if (child.scrollWidth > child.clientWidth) {
760
- return true;
761
- }
762
- }
763
- return false;
764
- };
765
- (0, import_react3.useEffect)(() => {
731
+ (0, import_react3.useLayoutEffect)(() => {
766
732
  if (tdRef.current && isTextContent) {
767
- setTimeout(() => {
768
- if (tdRef.current) {
769
- setShowTitle(checkOverflow(tdRef.current));
770
- }
771
- }, 0);
733
+ const el = tdRef.current;
734
+ setShowTitle(el.scrollWidth > el.clientWidth);
772
735
  }
773
736
  }, [content, isTextContent]);
774
737
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
775
738
  "td",
776
739
  {
777
740
  ref: tdRef,
778
- className: clsx(
779
- slots.td(),
780
- classNames == null ? void 0 : classNames.td,
781
- column.className,
782
- isTextContent && "truncate",
783
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
784
- ),
741
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
785
742
  style: {
786
743
  ...getCellStyle(column),
787
744
  maxWidth: column.width || "150px",
788
745
  textAlign: column.align || "center",
789
- ...!isTextContent && {
790
- overflow: "visible",
791
- whiteSpace: "normal"
792
- }
746
+ whiteSpace: isTextContent ? "nowrap" : "normal",
747
+ overflow: isTextContent ? "hidden" : "visible",
748
+ textOverflow: isTextContent ? "ellipsis" : void 0
793
749
  },
794
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
750
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
795
751
  children: content
796
752
  },
797
753
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import "../../chunk-DX3KXNP6.mjs";
3
- import {
4
- table_default
5
- } from "../../chunk-KYWCJIXI.mjs";
6
3
  import {
7
4
  definition_table_default
8
5
  } from "../../chunk-DS5CGU2X.mjs";
6
+ import {
7
+ table_default
8
+ } from "../../chunk-W3V4SZV5.mjs";
9
9
  import "../../chunk-7B7LRG5J.mjs";
10
10
  import "../../chunk-VVCSY7DG.mjs";
11
11
  import "../../chunk-F3HENRVM.mjs";
12
+ import "../../chunk-QZ3LVYJW.mjs";
12
13
  import "../../chunk-2GCSFWHD.mjs";
13
14
  import "../../chunk-3RTVVQA3.mjs";
14
- import "../../chunk-QZ3LVYJW.mjs";
15
15
  import "../../chunk-DQRAFUDA.mjs";
16
16
  import "../../chunk-EWS3FESG.mjs";
17
17
  import "../../chunk-OEIEALIP.mjs";
@@ -641,37 +641,13 @@ function TableHeaderCell({
641
641
  }) {
642
642
  const thRef = (0, import_react2.useRef)(null);
643
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);
644
+ (0, import_react2.useLayoutEffect)(() => {
645
+ if (!isCheckbox && thRef.current) {
646
+ const el = thRef.current;
647
+ setShowTitle(el.scrollWidth > el.clientWidth);
672
648
  }
673
649
  }, [content, isCheckbox]);
674
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
650
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
675
651
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
676
652
  "th",
677
653
  {
@@ -684,7 +660,10 @@ function TableHeaderCell({
684
660
  flexShrink: 0,
685
661
  flexGrow: 0,
686
662
  boxSizing: "border-box"
687
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
663
+ } : column ? {
664
+ ...getCellStyle(column),
665
+ textAlign: "center"
666
+ } : void 0,
688
667
  title: titleText,
689
668
  children: content
690
669
  }
@@ -693,7 +672,6 @@ function TableHeaderCell({
693
672
  var TableHead = ({
694
673
  slots,
695
674
  columns,
696
- color,
697
675
  size,
698
676
  rowCheckbox = false,
699
677
  hasCheckedRows,
@@ -6719,53 +6697,31 @@ function TableCell({
6719
6697
  }) {
6720
6698
  var _a, _b;
6721
6699
  const value = row[column.field];
6722
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
6700
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
6723
6701
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
6702
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
6724
6703
  const tdRef = (0, import_react7.useRef)(null);
6725
6704
  const [showTitle, setShowTitle] = (0, import_react7.useState)(false);
6726
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
6727
- const checkOverflow = (el) => {
6728
- if (el.scrollWidth > el.clientWidth) {
6729
- return true;
6730
- }
6731
- const children = Array.from(el.children);
6732
- for (const child of children) {
6733
- if (child.scrollWidth > child.clientWidth) {
6734
- return true;
6735
- }
6736
- }
6737
- return false;
6738
- };
6739
- (0, import_react7.useEffect)(() => {
6705
+ (0, import_react7.useLayoutEffect)(() => {
6740
6706
  if (tdRef.current && isTextContent) {
6741
- setTimeout(() => {
6742
- if (tdRef.current) {
6743
- setShowTitle(checkOverflow(tdRef.current));
6744
- }
6745
- }, 0);
6707
+ const el = tdRef.current;
6708
+ setShowTitle(el.scrollWidth > el.clientWidth);
6746
6709
  }
6747
6710
  }, [content, isTextContent]);
6748
6711
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6749
6712
  "td",
6750
6713
  {
6751
6714
  ref: tdRef,
6752
- className: clsx(
6753
- slots.td(),
6754
- classNames == null ? void 0 : classNames.td,
6755
- column.className,
6756
- isTextContent && "truncate",
6757
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
6758
- ),
6715
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
6759
6716
  style: {
6760
6717
  ...getCellStyle(column),
6761
6718
  maxWidth: column.width || "150px",
6762
6719
  textAlign: column.align || "center",
6763
- ...!isTextContent && {
6764
- overflow: "visible",
6765
- whiteSpace: "normal"
6766
- }
6720
+ whiteSpace: isTextContent ? "nowrap" : "normal",
6721
+ overflow: isTextContent ? "hidden" : "visible",
6722
+ textOverflow: isTextContent ? "ellipsis" : void 0
6767
6723
  },
6768
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
6724
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
6769
6725
  children: content
6770
6726
  },
6771
6727
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  table_body_default
4
- } from "../../chunk-KYWCJIXI.mjs";
4
+ } from "../../chunk-W3V4SZV5.mjs";
5
5
  import "../../chunk-7B7LRG5J.mjs";
6
6
  import "../../chunk-VVCSY7DG.mjs";
7
7
  import "../../chunk-F3HENRVM.mjs";
8
+ import "../../chunk-QZ3LVYJW.mjs";
8
9
  import "../../chunk-2GCSFWHD.mjs";
9
10
  import "../../chunk-3RTVVQA3.mjs";
10
- import "../../chunk-QZ3LVYJW.mjs";
11
11
  import "../../chunk-DQRAFUDA.mjs";
12
12
  import "../../chunk-EWS3FESG.mjs";
13
13
  import "../../chunk-OEIEALIP.mjs";
@@ -14,6 +14,6 @@ type TableHeadProps = {
14
14
  classNames?: SlotsToClasses<TableSlots>;
15
15
  onCheckAll: (isChecked: boolean) => void;
16
16
  };
17
- declare const TableHead: ({ slots, columns, color, size, rowCheckbox, hasCheckedRows, classNames, onCheckAll, }: TableHeadProps) => react_jsx_runtime.JSX.Element;
17
+ declare const TableHead: ({ slots, columns, size, rowCheckbox, hasCheckedRows, classNames, onCheckAll, }: TableHeadProps) => react_jsx_runtime.JSX.Element;
18
18
 
19
19
  export { TableHead as default };
@@ -14,6 +14,6 @@ type TableHeadProps = {
14
14
  classNames?: SlotsToClasses<TableSlots>;
15
15
  onCheckAll: (isChecked: boolean) => void;
16
16
  };
17
- declare const TableHead: ({ slots, columns, color, size, rowCheckbox, hasCheckedRows, classNames, onCheckAll, }: TableHeadProps) => react_jsx_runtime.JSX.Element;
17
+ declare const TableHead: ({ slots, columns, size, rowCheckbox, hasCheckedRows, classNames, onCheckAll, }: TableHeadProps) => react_jsx_runtime.JSX.Element;
18
18
 
19
19
  export { TableHead as default };
@@ -642,53 +642,31 @@ function TableCell({
642
642
  }) {
643
643
  var _a, _b;
644
644
  const value = row[column.field];
645
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
645
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
646
646
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
647
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
647
648
  const tdRef = (0, import_react2.useRef)(null);
648
649
  const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
649
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
650
- const checkOverflow = (el) => {
651
- if (el.scrollWidth > el.clientWidth) {
652
- return true;
653
- }
654
- const children = Array.from(el.children);
655
- for (const child of children) {
656
- if (child.scrollWidth > child.clientWidth) {
657
- return true;
658
- }
659
- }
660
- return false;
661
- };
662
- (0, import_react2.useEffect)(() => {
650
+ (0, import_react2.useLayoutEffect)(() => {
663
651
  if (tdRef.current && isTextContent) {
664
- setTimeout(() => {
665
- if (tdRef.current) {
666
- setShowTitle(checkOverflow(tdRef.current));
667
- }
668
- }, 0);
652
+ const el = tdRef.current;
653
+ setShowTitle(el.scrollWidth > el.clientWidth);
669
654
  }
670
655
  }, [content, isTextContent]);
671
656
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
672
657
  "td",
673
658
  {
674
659
  ref: tdRef,
675
- className: clsx(
676
- slots.td(),
677
- classNames == null ? void 0 : classNames.td,
678
- column.className,
679
- isTextContent && "truncate",
680
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
681
- ),
660
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
682
661
  style: {
683
662
  ...getCellStyle(column),
684
663
  maxWidth: column.width || "150px",
685
664
  textAlign: column.align || "center",
686
- ...!isTextContent && {
687
- overflow: "visible",
688
- whiteSpace: "normal"
689
- }
665
+ whiteSpace: isTextContent ? "nowrap" : "normal",
666
+ overflow: isTextContent ? "hidden" : "visible",
667
+ textOverflow: isTextContent ? "ellipsis" : void 0
690
668
  },
691
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
669
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
692
670
  children: content
693
671
  },
694
672
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -6744,37 +6722,13 @@ function TableHeaderCell({
6744
6722
  }) {
6745
6723
  const thRef = (0, import_react7.useRef)(null);
6746
6724
  const [showTitle, setShowTitle] = (0, import_react7.useState)(false);
6747
- const checkOverflow = (el) => {
6748
- if (el.scrollWidth > el.clientWidth) {
6749
- return true;
6750
- }
6751
- const children = Array.from(el.children);
6752
- for (const child of children) {
6753
- if (child.scrollWidth > child.clientWidth) {
6754
- return true;
6755
- }
6756
- }
6757
- return false;
6758
- };
6759
- const extractTextFromContent = (node) => {
6760
- if (typeof node === "string" || typeof node === "number") {
6761
- return String(node);
6762
- }
6763
- if ((0, import_react7.isValidElement)(node)) {
6764
- return String(node.props.children || "");
6765
- }
6766
- return "";
6767
- };
6768
- (0, import_react7.useEffect)(() => {
6769
- if (thRef.current && !isCheckbox) {
6770
- setTimeout(() => {
6771
- if (thRef.current) {
6772
- setShowTitle(checkOverflow(thRef.current));
6773
- }
6774
- }, 0);
6725
+ (0, import_react7.useLayoutEffect)(() => {
6726
+ if (!isCheckbox && thRef.current) {
6727
+ const el = thRef.current;
6728
+ setShowTitle(el.scrollWidth > el.clientWidth);
6775
6729
  }
6776
6730
  }, [content, isCheckbox]);
6777
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
6731
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
6778
6732
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6779
6733
  "th",
6780
6734
  {
@@ -6787,7 +6741,10 @@ function TableHeaderCell({
6787
6741
  flexShrink: 0,
6788
6742
  flexGrow: 0,
6789
6743
  boxSizing: "border-box"
6790
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
6744
+ } : column ? {
6745
+ ...getCellStyle(column),
6746
+ textAlign: "center"
6747
+ } : void 0,
6791
6748
  title: titleText,
6792
6749
  children: content
6793
6750
  }
@@ -6796,7 +6753,6 @@ function TableHeaderCell({
6796
6753
  var TableHead = ({
6797
6754
  slots,
6798
6755
  columns,
6799
- color,
6800
6756
  size,
6801
6757
  rowCheckbox = false,
6802
6758
  hasCheckedRows,
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  table_head_default
4
- } from "../../chunk-KYWCJIXI.mjs";
4
+ } from "../../chunk-W3V4SZV5.mjs";
5
5
  import "../../chunk-7B7LRG5J.mjs";
6
6
  import "../../chunk-VVCSY7DG.mjs";
7
7
  import "../../chunk-F3HENRVM.mjs";
8
+ import "../../chunk-QZ3LVYJW.mjs";
8
9
  import "../../chunk-2GCSFWHD.mjs";
9
10
  import "../../chunk-3RTVVQA3.mjs";
10
- import "../../chunk-QZ3LVYJW.mjs";
11
11
  import "../../chunk-DQRAFUDA.mjs";
12
12
  import "../../chunk-EWS3FESG.mjs";
13
13
  import "../../chunk-OEIEALIP.mjs";