sevago-library 1.0.77 → 1.0.79

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/dist/index.cjs.js CHANGED
@@ -75363,9 +75363,6 @@ const SwitchContentElement = ({
75363
75363
  /* @__PURE__ */ jsxRuntime.jsx(SwitchElement, { name, value, onChange })
75364
75364
  ] });
75365
75365
  };
75366
- const TableContainerPart = ({ children }) => {
75367
- return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
75368
- };
75369
75366
  var TableActions = /* @__PURE__ */ ((TableActions2) => {
75370
75367
  TableActions2["DISABLED_GET_ROW_MENU"] = "DISABLED_GET_ROW_MENU";
75371
75368
  TableActions2["HISTORY_GET_ROW_MENU"] = "HISTORY_GET_ROW_MENU";
@@ -75424,40 +75421,104 @@ const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
75424
75421
  } : {}
75425
75422
  };
75426
75423
  };
75427
- const TableHeadPart = ({ columns }) => {
75424
+ function TableRowPart({
75425
+ columns,
75426
+ row,
75427
+ indexRow,
75428
+ indexLoadingRow,
75429
+ rowSx = {},
75430
+ getRowId,
75431
+ onClickRow,
75432
+ onDisabled,
75433
+ onClickSelectRow = false,
75434
+ onSelectRowById,
75435
+ enableTree = false,
75436
+ rowLevels = {}
75437
+ }) {
75428
75438
  const { palette } = material.useTheme();
75429
- return /* @__PURE__ */ jsxRuntime.jsx(material.TableHead, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: columns.map((column) => {
75430
- var _a;
75431
- return /* @__PURE__ */ jsxRuntime.jsx(
75432
- material.TableCell,
75433
- {
75434
- align: column.align,
75435
- sx: {
75436
- width: `${column.width}px !important`,
75437
- minWidth: `${column.width}px !important`,
75438
- maxWidth: `${column.width}px !important`,
75439
- fontWeight: 550,
75440
- padding: PADDING_GAP_ITEM,
75441
- borderRadius: "0 !important",
75442
- backgroundColor: "#F9FAFB",
75443
- verticalAlign: "top",
75444
- textAlign: column.alignHead ? column.alignHead : "center",
75445
- borderTop: BORDER_TABLE,
75446
- ...column.stickyCss ? {
75447
- ...column.stickyCss,
75448
- position: "sticky",
75449
- backgroundColor: palette.background.paper,
75450
- zIndex: 4,
75451
- borderRight: ((_a = column.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
75452
- } : {},
75453
- ...column.sx ? column.sx : {}
75454
- },
75455
- children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children: column.label })
75439
+ const rowId = getRowId(row);
75440
+ const disabled = onDisabled ? onDisabled(row, indexRow) : { ...DISABLED_DEFAULT };
75441
+ const renderCopyableCell = React.useCallback((displayNode, copyValue) => {
75442
+ const content = copyValue || "";
75443
+ return /* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignCenterJustBetween, { sx: { color: BRAND[950] }, children: [
75444
+ displayNode,
75445
+ /* @__PURE__ */ jsxRuntime.jsx(
75446
+ IconElement,
75447
+ {
75448
+ icon: "content_copy",
75449
+ sx: { color: BRAND[950], fontSize: FONT_SIZE_ICON.medium },
75450
+ onClick: (e) => {
75451
+ e.stopPropagation();
75452
+ if (!content) return;
75453
+ void navigator.clipboard.writeText(content);
75454
+ }
75455
+ }
75456
+ )
75457
+ ] });
75458
+ }, []);
75459
+ const canSelectRowOnClick = Boolean(onClickSelectRow && onSelectRowById);
75460
+ const isClickableRow = Boolean(onClickRow || canSelectRowOnClick);
75461
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Fade, { in: true, timeout: indexRow * 120, children: /* @__PURE__ */ jsxRuntime.jsx(
75462
+ material.TableRow,
75463
+ {
75464
+ hover: true,
75465
+ tabIndex: -1,
75466
+ onClick: () => {
75467
+ onClickRow == null ? void 0 : onClickRow(row, indexRow);
75468
+ if (canSelectRowOnClick) {
75469
+ onSelectRowById == null ? void 0 : onSelectRowById(rowId);
75470
+ }
75456
75471
  },
75457
- column.id
75458
- );
75459
- }) }) });
75460
- };
75472
+ sx: {
75473
+ ...getStyleRow(isClickableRow, palette, indexRow, rowSx, indexLoadingRow),
75474
+ ...rowId === TableRowKey.TOTAL ? {
75475
+ backgroundColor: COMMON.green2,
75476
+ "& .MuiTableCell-root": {
75477
+ backgroundColor: COMMON.green2
75478
+ },
75479
+ "& *": {
75480
+ fontWeight: "bold"
75481
+ }
75482
+ } : {},
75483
+ ...rowId === TableRowKey.TOTAL_INCOME ? {
75484
+ backgroundColor: COMMON.gray7,
75485
+ "& .MuiTableCell-root": {
75486
+ backgroundColor: COMMON.gray7
75487
+ },
75488
+ "& *": {
75489
+ fontWeight: "bold"
75490
+ }
75491
+ } : {}
75492
+ },
75493
+ children: columns.map((column, colIndex) => {
75494
+ const level = enableTree ? rowLevels[rowId] ?? 0 : 0;
75495
+ const firstDataColIndex = enableTree ? columns.findIndex((item) => item.id !== "treeToggle") : -1;
75496
+ const isFirstDataCol = enableTree && colIndex === firstDataColIndex && column.id !== "treeToggle";
75497
+ return /* @__PURE__ */ jsxRuntime.jsx(
75498
+ material.TableCell,
75499
+ {
75500
+ align: column.align,
75501
+ sx: {
75502
+ ...getStyleCell(column, palette, disabled.DISABLED_ROW),
75503
+ ...isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : {}
75504
+ },
75505
+ onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
75506
+ e.stopPropagation();
75507
+ } : void 0,
75508
+ children: (() => {
75509
+ const rawValue = row[column.id];
75510
+ const defaultNode = column.render ? column.render(row, indexRow) : rawValue;
75511
+ if (!column.copyable) return defaultNode;
75512
+ const copyValue = typeof column.copyable === "object" && column.copyable.getValue ? String(column.copyable.getValue(row, indexRow) || "") : String(rawValue || "");
75513
+ return renderCopyableCell(defaultNode ?? String(rawValue), copyValue);
75514
+ })()
75515
+ },
75516
+ column.id
75517
+ );
75518
+ })
75519
+ }
75520
+ ) });
75521
+ }
75461
75522
  const EMPTY_TREE_META = {
75462
75523
  visibleRows: [],
75463
75524
  rowLevels: {},
@@ -75562,7 +75623,83 @@ const TreeToggleCell = ({
75562
75623
  }
75563
75624
  );
75564
75625
  };
75565
- const TableComponent = ({
75626
+ const TableContainerPart = ({ children }) => {
75627
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
75628
+ };
75629
+ const TableHeadPart = ({ columns }) => {
75630
+ const { palette } = material.useTheme();
75631
+ return /* @__PURE__ */ jsxRuntime.jsx(material.TableHead, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: columns.map((column) => {
75632
+ var _a;
75633
+ return /* @__PURE__ */ jsxRuntime.jsx(
75634
+ material.TableCell,
75635
+ {
75636
+ align: column.align,
75637
+ sx: {
75638
+ width: `${column.width}px !important`,
75639
+ minWidth: `${column.width}px !important`,
75640
+ maxWidth: `${column.width}px !important`,
75641
+ fontWeight: 550,
75642
+ padding: PADDING_GAP_ITEM,
75643
+ borderRadius: "0 !important",
75644
+ backgroundColor: "#F9FAFB",
75645
+ verticalAlign: "top",
75646
+ textAlign: column.alignHead ? column.alignHead : "center",
75647
+ borderTop: BORDER_TABLE,
75648
+ ...column.stickyCss ? {
75649
+ ...column.stickyCss,
75650
+ position: "sticky",
75651
+ backgroundColor: palette.background.paper,
75652
+ zIndex: 4,
75653
+ borderRight: ((_a = column.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
75654
+ } : {},
75655
+ ...column.sx ? column.sx : {}
75656
+ },
75657
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children: column.label })
75658
+ },
75659
+ column.id
75660
+ );
75661
+ }) }) });
75662
+ };
75663
+ const TableBaseComponent = ({
75664
+ columns,
75665
+ rows = [],
75666
+ loading = false,
75667
+ indexLoadingRow,
75668
+ stickyHeader = true,
75669
+ tableSx,
75670
+ tableRef,
75671
+ renderRow,
75672
+ renderLoading,
75673
+ renderEmpty
75674
+ }) => {
75675
+ return /* @__PURE__ */ jsxRuntime.jsx(TableContainerPart, { children: /* @__PURE__ */ jsxRuntime.jsxs(
75676
+ material.Table,
75677
+ {
75678
+ ref: tableRef,
75679
+ stickyHeader,
75680
+ sx: [
75681
+ {
75682
+ height: loading || rows.length === 0 ? "100%" : "none",
75683
+ borderCollapse: "separate !important",
75684
+ "& .MuiTableCell-root": {
75685
+ borderRight: BORDER_TABLE,
75686
+ borderBottom: BORDER_TABLE,
75687
+ "&:first-of-type": {
75688
+ borderLeft: BORDER_TABLE
75689
+ }
75690
+ }
75691
+ },
75692
+ ...Array.isArray(tableSx) ? tableSx : [tableSx]
75693
+ ],
75694
+ children: [
75695
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
75696
+ /* @__PURE__ */ jsxRuntime.jsx(material.TableBody, { children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: renderLoading() }) }) : rows.length ? rows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderRow(row, index) }, index)) : /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: renderEmpty() }) }) })
75697
+ ]
75698
+ }
75699
+ ) });
75700
+ };
75701
+ const EMPTY_ROWS = [];
75702
+ function TableRendererComponent({
75566
75703
  loading = false,
75567
75704
  rows,
75568
75705
  columns: initialColumns,
@@ -75575,10 +75712,8 @@ const TableComponent = ({
75575
75712
  getChildren,
75576
75713
  onClickRow,
75577
75714
  onDisabled,
75578
- // start row
75579
75715
  selectedRows,
75580
75716
  onSelectRows,
75581
- // end row
75582
75717
  onSelectRow,
75583
75718
  onDeleteRow,
75584
75719
  onInfoRow,
@@ -75586,20 +75721,32 @@ const TableComponent = ({
75586
75721
  onHistoryRow,
75587
75722
  onUpdateRow,
75588
75723
  getActionIcon,
75589
- getRowMenu
75590
- }) => {
75591
- rows = rows || [];
75724
+ getRowMenu,
75725
+ extraActionCount = 0,
75726
+ stickyHeader = true,
75727
+ tableSx,
75728
+ tableRef,
75729
+ renderRow
75730
+ }) {
75731
+ const tableRows = React.useMemo(() => rows ?? EMPTY_ROWS, [rows]);
75592
75732
  const [tooltipOpen, setTooltipOpen] = React.useState({});
75593
75733
  const [expandedRowIds, setExpandedRowIds] = React.useState(/* @__PURE__ */ new Set());
75594
75734
  const { palette } = material.useTheme();
75595
- const lengthActions = [onSelectRow, onDeleteRow, onInfoRow, onCopyRow, onHistoryRow, onUpdateRow, getRowMenu].filter(
75596
- Boolean
75597
- ).length;
75598
- const widthActions = lengthActions * 19 + (lengthActions - 1) * 16;
75735
+ const baseActionCount = [
75736
+ onSelectRow,
75737
+ onDeleteRow,
75738
+ onInfoRow,
75739
+ onCopyRow,
75740
+ onHistoryRow,
75741
+ onUpdateRow,
75742
+ getRowMenu
75743
+ ].filter(Boolean).length;
75744
+ const lengthActions = baseActionCount + extraActionCount;
75745
+ const widthActions = lengthActions > 0 ? lengthActions * 19 + Math.max(lengthActions - 1, 0) * 16 : 0;
75599
75746
  const getRowId = React.useCallback(
75600
75747
  (row) => {
75601
75748
  if (rowKey) return rowKey(row);
75602
- return row.id;
75749
+ return String(row.id);
75603
75750
  },
75604
75751
  [rowKey]
75605
75752
  );
@@ -75627,16 +75774,16 @@ const TableComponent = ({
75627
75774
  }
75628
75775
  });
75629
75776
  };
75630
- walkIds(rows);
75777
+ walkIds(tableRows);
75631
75778
  setExpandedRowIds(next);
75632
- }, [enableTree, getRowId, childrenGetter]);
75779
+ }, [enableTree, getRowId, childrenGetter, tableRows]);
75633
75780
  const { visibleRows, rowLevels, hasChildrenById } = React.useMemo(
75634
- () => buildTreeMeta({ rows, enableTree, expandedRowIds, getRowId, getChildren: childrenGetter }),
75635
- [rows, enableTree, expandedRowIds, getRowId, childrenGetter]
75781
+ () => buildTreeMeta({ rows: tableRows, enableTree, expandedRowIds, getRowId, getChildren: childrenGetter }),
75782
+ [tableRows, enableTree, expandedRowIds, getRowId, childrenGetter]
75636
75783
  );
75637
75784
  const allRowIds = React.useMemo(() => visibleRows.map(getRowId), [visibleRows, getRowId]);
75638
- const isAllSelected = selectedRows && allRowIds.every((id) => selectedRows.includes(id));
75639
- const isIndeterminate = selectedRows && selectedRows.length > 0 && !isAllSelected;
75785
+ const isAllSelected = selectedRows ? allRowIds.every((id) => selectedRows.includes(id)) : false;
75786
+ const isIndeterminate = selectedRows ? selectedRows.length > 0 && !isAllSelected : false;
75640
75787
  const handleSelectAll = React.useCallback(() => {
75641
75788
  if (isAllSelected) onSelectRows == null ? void 0 : onSelectRows([]);
75642
75789
  else onSelectRows == null ? void 0 : onSelectRows(allRowIds);
@@ -75645,7 +75792,7 @@ const TableComponent = ({
75645
75792
  (id) => {
75646
75793
  if (!selectedRows) return;
75647
75794
  if (selectedRows.includes(id)) {
75648
- onSelectRows == null ? void 0 : onSelectRows(selectedRows.filter((i) => i !== id));
75795
+ onSelectRows == null ? void 0 : onSelectRows(selectedRows.filter((item) => item !== id));
75649
75796
  } else {
75650
75797
  onSelectRows == null ? void 0 : onSelectRows([...selectedRows, id]);
75651
75798
  }
@@ -75660,6 +75807,133 @@ const TableComponent = ({
75660
75807
  return next;
75661
75808
  });
75662
75809
  }, []);
75810
+ const renderActionsContent = React.useCallback(
75811
+ (row, index) => {
75812
+ const rowIdValue = getRowId(row);
75813
+ if (rowIdValue === TableRowKey.TOTAL || rowIdValue === TableRowKey.TOTAL_INCOME) return null;
75814
+ const disabled = onDisabled ? onDisabled(row, index) : { ...DISABLED_DEFAULT };
75815
+ const disabledByParent = disabled.DISABLED_ROW || disabled.DISABLED_ALL_ACTIONS;
75816
+ const tooltipRowId = String(rowKey ? rowKey(row) : row.id || index);
75817
+ const createMenuWithCloseHandler = () => {
75818
+ if (!getRowMenu) return [];
75819
+ return getRowMenu(row, index).map((menuItem) => ({
75820
+ ...menuItem,
75821
+ onClick: () => {
75822
+ menuItem.onClick();
75823
+ setTooltipOpen((prev) => ({ ...prev, [tooltipRowId]: false }));
75824
+ }
75825
+ }));
75826
+ };
75827
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
75828
+ onSelectRow && /* @__PURE__ */ jsxRuntime.jsx(
75829
+ IconElement,
75830
+ {
75831
+ icon: "remove_red_eye",
75832
+ onClick: (e) => {
75833
+ e.stopPropagation();
75834
+ onSelectRow(row, index);
75835
+ },
75836
+ disabled: disabledByParent || disabled.SELECT
75837
+ }
75838
+ ),
75839
+ onDeleteRow && /* @__PURE__ */ jsxRuntime.jsx(
75840
+ IconElement,
75841
+ {
75842
+ icon: "delete",
75843
+ onClick: (e) => {
75844
+ e.stopPropagation();
75845
+ onDeleteRow(row, index);
75846
+ },
75847
+ color: "error",
75848
+ disabled: disabledByParent || disabled.DELETE
75849
+ }
75850
+ ),
75851
+ onInfoRow && /* @__PURE__ */ jsxRuntime.jsx(
75852
+ IconElement,
75853
+ {
75854
+ icon: "view_cozy",
75855
+ onClick: (e) => {
75856
+ e.stopPropagation();
75857
+ onInfoRow(row, index);
75858
+ },
75859
+ disabled: disabledByParent || disabled.INFO
75860
+ }
75861
+ ),
75862
+ onCopyRow && /* @__PURE__ */ jsxRuntime.jsx(
75863
+ IconElement,
75864
+ {
75865
+ icon: getActionIcon && getActionIcon(row, index, "COPY") || "content_copy",
75866
+ onClick: (e) => {
75867
+ e.stopPropagation();
75868
+ onCopyRow(row, index);
75869
+ window.scrollTo({ top: 0, behavior: "smooth" });
75870
+ },
75871
+ disabled: disabledByParent || disabled.COPY
75872
+ }
75873
+ ),
75874
+ onHistoryRow && /* @__PURE__ */ jsxRuntime.jsx(
75875
+ IconElement,
75876
+ {
75877
+ icon: "history",
75878
+ onClick: (e) => {
75879
+ e.stopPropagation();
75880
+ onHistoryRow(row, index);
75881
+ },
75882
+ disabled: disabledByParent || disabled.HISTORY_GET_ROW_MENU
75883
+ }
75884
+ ),
75885
+ onUpdateRow && /* @__PURE__ */ jsxRuntime.jsx(
75886
+ IconElement,
75887
+ {
75888
+ icon: getActionIcon && getActionIcon(row, index, "UPDATE") || "settings",
75889
+ onClick: (e) => {
75890
+ e.stopPropagation();
75891
+ onUpdateRow(row, index);
75892
+ window.scrollTo({ top: 0, behavior: "smooth" });
75893
+ },
75894
+ disabled: disabledByParent || disabled.UPDATE
75895
+ }
75896
+ ),
75897
+ getRowMenu && (!disabled.DISABLED_GET_ROW_MENU ? /* @__PURE__ */ jsxRuntime.jsx(
75898
+ TooltipOnHoverElement,
75899
+ {
75900
+ style: {
75901
+ cursor: "pointer",
75902
+ display: "flex",
75903
+ alignItems: "center"
75904
+ },
75905
+ placement: "bottom-end",
75906
+ open: !!tooltipOpen[tooltipRowId],
75907
+ onOpen: () => setTooltipOpen((prev) => ({ ...prev, [tooltipRowId]: true })),
75908
+ onClose: () => setTooltipOpen((prev) => ({ ...prev, [tooltipRowId]: false })),
75909
+ content: /* @__PURE__ */ jsxRuntime.jsx(ListIconContentElement, { list: createMenuWithCloseHandler() }),
75910
+ children: /* @__PURE__ */ jsxRuntime.jsx(IconElement, { icon: "open_in_browser", onClick: (e) => e.stopPropagation() })
75911
+ }
75912
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
75913
+ IconElement,
75914
+ {
75915
+ icon: "open_in_browser",
75916
+ disabled: disabledByParent || disabled.DISABLED_GET_ROW_MENU,
75917
+ onClick: (e) => e.stopPropagation()
75918
+ }
75919
+ ))
75920
+ ] });
75921
+ },
75922
+ [
75923
+ getActionIcon,
75924
+ getRowId,
75925
+ getRowMenu,
75926
+ onCopyRow,
75927
+ onDeleteRow,
75928
+ onDisabled,
75929
+ onHistoryRow,
75930
+ onInfoRow,
75931
+ onSelectRow,
75932
+ onUpdateRow,
75933
+ rowKey,
75934
+ tooltipOpen
75935
+ ]
75936
+ );
75663
75937
  const columns = React.useMemo(() => {
75664
75938
  const updateColumns = [...initialColumns];
75665
75939
  if (enableTree) {
@@ -75717,375 +75991,158 @@ const TableComponent = ({
75717
75991
  }
75718
75992
  });
75719
75993
  }
75720
- if (onSelectRow || onDeleteRow || onInfoRow || onCopyRow || onHistoryRow || onUpdateRow || getRowMenu) {
75994
+ if (lengthActions > 0) {
75721
75995
  updateColumns.push({
75722
75996
  id: "actions",
75723
75997
  label: "Actions",
75724
75998
  width: widthActions > 70 ? widthActions : 70,
75999
+ align: "center",
75725
76000
  alignHead: "center",
75726
76001
  stickyCss: isStickyActions ? { right: 0, borderLeft: BORDER_TABLE, zIndex: 1.5 } : void 0,
75727
- render: (row, index) => {
75728
- const rowIdValue = getRowId(row);
75729
- if (rowIdValue === TableRowKey.TOTAL || rowIdValue === TableRowKey.TOTAL_INCOME) return null;
75730
- const disabled = onDisabled ? onDisabled(row, index) : { ...DISABLED_DEFAULT };
75731
- const disabledByParent = disabled.DISABLED_ROW || disabled.DISABLED_ALL_ACTIONS;
75732
- const rowId = rowKey ? rowKey(row) : row.id || index;
75733
- const createMenuWithCloseHandler = () => {
75734
- if (!getRowMenu) return [];
75735
- return getRowMenu(row, index).map((menuItem) => ({
75736
- ...menuItem,
75737
- onClick: () => {
75738
- menuItem.onClick();
75739
- setTooltipOpen((prev) => ({ ...prev, [rowId]: false }));
75740
- }
75741
- }));
75742
- };
75743
- return /* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
75744
- onSelectRow && /* @__PURE__ */ jsxRuntime.jsx(
75745
- IconElement,
75746
- {
75747
- icon: "remove_red_eye",
75748
- onClick: (e) => {
75749
- e.stopPropagation();
75750
- onSelectRow(row, index);
75751
- },
75752
- disabled: disabledByParent || disabled.SELECT
75753
- }
75754
- ),
75755
- onDeleteRow && /* @__PURE__ */ jsxRuntime.jsx(
75756
- IconElement,
75757
- {
75758
- icon: "delete",
75759
- onClick: (e) => {
75760
- e.stopPropagation();
75761
- onDeleteRow(row, index);
75762
- },
75763
- color: "error",
75764
- disabled: disabledByParent || disabled.DELETE
75765
- }
75766
- ),
75767
- onInfoRow && /* @__PURE__ */ jsxRuntime.jsx(
75768
- IconElement,
75769
- {
75770
- icon: "view_cozy",
75771
- onClick: (e) => {
75772
- e.stopPropagation();
75773
- onInfoRow(row, index);
75774
- },
75775
- disabled: disabledByParent || disabled.INFO
75776
- }
75777
- ),
75778
- onCopyRow && /* @__PURE__ */ jsxRuntime.jsx(
75779
- IconElement,
75780
- {
75781
- icon: getActionIcon && getActionIcon(row, index, "COPY") || "content_copy",
75782
- onClick: (e) => {
75783
- e.stopPropagation();
75784
- onCopyRow(row, index);
75785
- window.scrollTo({ top: 0, behavior: "smooth" });
75786
- },
75787
- disabled: disabledByParent || disabled.COPY
75788
- }
75789
- ),
75790
- onHistoryRow && /* @__PURE__ */ jsxRuntime.jsx(
75791
- IconElement,
75792
- {
75793
- icon: "history",
75794
- onClick: (e) => {
75795
- e.stopPropagation();
75796
- onHistoryRow(row, index);
75797
- },
75798
- disabled: disabledByParent || disabled.HISTORY_GET_ROW_MENU
75799
- }
75800
- ),
75801
- onUpdateRow && /* @__PURE__ */ jsxRuntime.jsx(
75802
- IconElement,
75803
- {
75804
- icon: getActionIcon && getActionIcon(row, index, "UPDATE") || "settings",
75805
- onClick: (e) => {
75806
- e.stopPropagation();
75807
- onUpdateRow(row, index);
75808
- window.scrollTo({ top: 0, behavior: "smooth" });
75809
- },
75810
- disabled: disabledByParent || disabled.UPDATE
75811
- }
75812
- ),
75813
- getRowMenu && (!disabled.DISABLED_GET_ROW_MENU ? /* @__PURE__ */ jsxRuntime.jsx(
75814
- TooltipOnHoverElement,
75815
- {
75816
- style: {
75817
- cursor: "pointer",
75818
- display: "flex",
75819
- alignItems: "center"
75820
- },
75821
- placement: "bottom-end",
75822
- open: !!tooltipOpen[rowId],
75823
- onOpen: () => setTooltipOpen((prev) => ({ ...prev, [rowId]: true })),
75824
- onClose: () => setTooltipOpen((prev) => ({ ...prev, [rowId]: false })),
75825
- content: /* @__PURE__ */ jsxRuntime.jsx(ListIconContentElement, { list: createMenuWithCloseHandler() }),
75826
- children: /* @__PURE__ */ jsxRuntime.jsx(IconElement, { icon: "open_in_browser", onClick: (e) => e.stopPropagation() })
75827
- }
75828
- ) : /* @__PURE__ */ jsxRuntime.jsx(
75829
- IconElement,
75830
- {
75831
- icon: "open_in_browser",
75832
- disabled: disabledByParent || disabled.DISABLED_GET_ROW_MENU,
75833
- onClick: (e) => e.stopPropagation()
75834
- }
75835
- ))
75836
- ] });
75837
- }
76002
+ render: (row, index) => /* @__PURE__ */ jsxRuntime.jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
75838
76003
  });
75839
76004
  }
75840
76005
  return updateColumns;
75841
76006
  }, [
75842
76007
  initialColumns,
76008
+ enableTree,
75843
76009
  onSelectRows,
75844
- selectedRows,
76010
+ lengthActions,
76011
+ getRowId,
76012
+ rowLevels,
76013
+ hasChildrenById,
76014
+ expandedRowIds,
76015
+ handleToggleTreeRow,
76016
+ palette,
76017
+ handleSelectAll,
75845
76018
  isAllSelected,
75846
76019
  isIndeterminate,
75847
- handleSelectAll,
76020
+ onDisabled,
76021
+ selectedRows,
75848
76022
  handleSelectRow,
75849
- getRowId,
75850
- onSelectRow,
75851
- onDeleteRow,
75852
- onInfoRow,
75853
- onCopyRow,
75854
- onHistoryRow,
75855
- onUpdateRow,
75856
- getRowMenu,
75857
76023
  widthActions,
75858
76024
  isStickyActions,
75859
- onDisabled,
75860
- rowKey,
75861
- tooltipOpen,
75862
- enableTree,
75863
- rowLevels,
75864
- expandedRowIds,
75865
- hasChildrenById,
75866
- handleToggleTreeRow
76025
+ renderActionsContent
75867
76026
  ]);
75868
- const renderCopyableCell = React.useCallback((displayNode, copyValue) => {
75869
- const content = copyValue || "";
75870
- return /* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignCenterJustBetween, { sx: { color: BRAND[950] }, children: [
75871
- displayNode,
75872
- /* @__PURE__ */ jsxRuntime.jsx(
75873
- IconElement,
75874
- {
75875
- icon: "content_copy",
75876
- sx: { color: BRAND[950], fontSize: FONT_SIZE_ICON.medium },
75877
- onClick: (e) => {
75878
- e.stopPropagation();
75879
- if (!content) return;
75880
- void navigator.clipboard.writeText(content);
75881
- }
75882
- }
75883
- )
75884
- ] });
75885
- }, []);
75886
- return /* @__PURE__ */ jsxRuntime.jsx(TableContainerPart, { children: /* @__PURE__ */ jsxRuntime.jsxs(
75887
- material.Table,
76027
+ const renderDefaultRow = React.useCallback(
76028
+ (row, index, columnsOverride) => /* @__PURE__ */ jsxRuntime.jsx(
76029
+ TableRowPart,
76030
+ {
76031
+ columns: columnsOverride ?? columns,
76032
+ row,
76033
+ indexRow: index,
76034
+ indexLoadingRow,
76035
+ rowSx,
76036
+ getRowId,
76037
+ onClickRow,
76038
+ onDisabled,
76039
+ onClickSelectRow,
76040
+ onSelectRowById: handleSelectRow,
76041
+ enableTree,
76042
+ rowLevels
76043
+ }
76044
+ ),
76045
+ [
76046
+ columns,
76047
+ enableTree,
76048
+ getRowId,
76049
+ handleSelectRow,
76050
+ indexLoadingRow,
76051
+ onClickRow,
76052
+ onClickSelectRow,
76053
+ onDisabled,
76054
+ rowLevels,
76055
+ rowSx
76056
+ ]
76057
+ );
76058
+ return /* @__PURE__ */ jsxRuntime.jsx(
76059
+ TableBaseComponent,
75888
76060
  {
75889
- stickyHeader: true,
75890
- sx: {
75891
- height: loading || rows.length === 0 ? "100%" : "none",
75892
- borderCollapse: "separate !important",
75893
- "& .MuiTableCell-root": {
75894
- borderRight: BORDER_TABLE,
75895
- borderBottom: BORDER_TABLE,
75896
- "&:first-of-type": {
75897
- borderLeft: BORDER_TABLE
75898
- }
75899
- }
75900
- },
75901
- children: [
75902
- /* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
75903
- /* @__PURE__ */ jsxRuntime.jsx(material.TableBody, { children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(
75904
- material.TableCell,
75905
- {
75906
- sx: { borderTopLeftRadius: "0 !important", borderTopRightRadius: "0 !important" },
75907
- colSpan: columns.length,
75908
- children: /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {})
75909
- }
75910
- ) }) : visibleRows.length ? visibleRows.map((row, index) => {
75911
- const disabled = onDisabled ? onDisabled(row, index) : { ...DISABLED_DEFAULT };
75912
- return /* @__PURE__ */ jsxRuntime.jsx(material.Fade, { in: true, timeout: index * 120, children: /* @__PURE__ */ jsxRuntime.jsx(
75913
- material.TableRow,
75914
- {
75915
- hover: true,
75916
- tabIndex: -1,
75917
- onClick: () => {
75918
- if (onClickRow) onClickRow(row, index);
75919
- if (onClickSelectRow && onSelectRows && getRowId) {
75920
- const id = getRowId(row);
75921
- handleSelectRow(id);
75922
- }
75923
- },
75924
- sx: {
75925
- ...getStyleRow(Boolean(onClickRow), palette, index, rowSx, indexLoadingRow),
75926
- ...getRowId(row) === TableRowKey.TOTAL ? {
75927
- backgroundColor: COMMON.green2,
75928
- "& .MuiTableCell-root": {
75929
- backgroundColor: COMMON.green2
75930
- },
75931
- "& *": {
75932
- fontWeight: "bold"
75933
- }
75934
- } : {},
75935
- ...getRowId(row) === TableRowKey.TOTAL_INCOME ? {
75936
- backgroundColor: COMMON.gray7,
75937
- "& .MuiTableCell-root": {
75938
- backgroundColor: COMMON.gray7
75939
- },
75940
- "& *": {
75941
- fontWeight: "bold"
75942
- }
75943
- } : {}
75944
- },
75945
- children: columns.map((column, colIndex) => {
75946
- const level = enableTree ? rowLevels[getRowId(row)] ?? 0 : 0;
75947
- const firstDataColIndex = enableTree ? columns.findIndex((c) => c.id !== "treeToggle") : -1;
75948
- const isFirstDataCol = enableTree && colIndex === firstDataColIndex && column.id !== "treeToggle";
75949
- return /* @__PURE__ */ jsxRuntime.jsx(
75950
- material.TableCell,
75951
- {
75952
- align: column.align,
75953
- sx: {
75954
- ...getStyleCell(column, palette, disabled.DISABLED_ROW),
75955
- ...isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : {}
75956
- },
75957
- onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
75958
- e.stopPropagation();
75959
- } : void 0,
75960
- children: (() => {
75961
- const rawValue = row[column.id];
75962
- const defaultNode = column.render ? column.render(row, index) : rawValue;
75963
- if (!column.copyable) return defaultNode;
75964
- const copyValue = typeof column.copyable === "object" && column.copyable.getValue ? String(column.copyable.getValue(row, index) || "") : String(rawValue || "");
75965
- return renderCopyableCell(defaultNode ?? String(rawValue), copyValue);
75966
- })()
75967
- },
75968
- column.id
75969
- );
75970
- })
75971
- },
75972
- index
75973
- ) }, index);
75974
- }) : /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(
75975
- material.TableCell,
75976
- {
75977
- sx: { height: 200, borderTopLeftRadius: "0 !important", borderTopRightRadius: "0 !important" },
75978
- colSpan: columns.length,
75979
- children: /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent, {})
75980
- }
75981
- ) }) })
75982
- ]
76061
+ columns,
76062
+ rows: visibleRows,
76063
+ loading,
76064
+ indexLoadingRow,
76065
+ stickyHeader,
76066
+ tableRef,
76067
+ tableSx,
76068
+ renderLoading: () => /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {}),
76069
+ renderEmpty: () => /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent, {}),
76070
+ renderRow: (row, index) => {
76071
+ if (!renderRow) return renderDefaultRow(row, index);
76072
+ return renderRow({
76073
+ row,
76074
+ index,
76075
+ columns,
76076
+ renderDefaultRow: (columnsOverride) => renderDefaultRow(row, index, columnsOverride),
76077
+ renderActionsContent
76078
+ });
76079
+ }
75983
76080
  }
75984
- ) });
75985
- };
75986
- const RowCollapsePart = ({
76081
+ );
76082
+ }
76083
+ function RowCollapsePart({
75987
76084
  columns,
75988
76085
  row,
75989
76086
  indexRow,
75990
- indexLoadingRow,
75991
76087
  collapse,
75992
- rowSx = {},
75993
76088
  collapseTableWidth,
75994
- onClickRow,
75995
- onDisabled,
75996
- // end row
75997
- onSelectRow,
75998
- onDeleteRow,
75999
- onInfoRow,
76000
- onCopyRow,
76001
- onUpdateRow
76002
- }) => {
76089
+ renderDefaultRow,
76090
+ renderActionsContent,
76091
+ onDisabled
76092
+ }) {
76003
76093
  const { palette } = material.useTheme();
76004
76094
  const [open2, setOpen] = React.useState(false);
76005
76095
  const [state, setState] = React.useState();
76006
76096
  const [loading, setLoading] = React.useState(false);
76007
- const toggleCollapse = async (row2, indexRow2) => {
76008
- setOpen(!open2);
76009
- if (!collapse.onOpenCollapse || state) return;
76010
- setLoading(true);
76011
- try {
76012
- const data = await collapse.onOpenCollapse(row2, indexRow2);
76013
- setState(collapse.property ? data[collapse.property] : data);
76014
- } catch (error) {
76015
- console.error(error);
76016
- } finally {
76017
- setLoading(false);
76018
- }
76019
- };
76020
- columns[columns.length - 1].render = (row2, index) => {
76021
- const disabled2 = onDisabled ? onDisabled(row2, index) : { ...DISABLED_DEFAULT };
76022
- const disabledByParent = disabled2.DISABLED_ROW || disabled2.DISABLED_ALL_ACTIONS;
76023
- return /* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignJustCenter, { gap: 1, children: [
76024
- onSelectRow && /* @__PURE__ */ jsxRuntime.jsx(
76025
- IconElement,
76026
- {
76027
- icon: "info",
76028
- onClick: () => onSelectRow(row2, index),
76029
- disabled: disabledByParent || disabled2.SELECT
76030
- }
76031
- ),
76032
- onInfoRow && /* @__PURE__ */ jsxRuntime.jsx(
76033
- IconElement,
76034
- {
76035
- icon: "view_cozy",
76036
- onClick: () => onInfoRow(row2, index),
76037
- disabled: disabledByParent || disabled2.INFO
76038
- }
76039
- ),
76040
- onDeleteRow && /* @__PURE__ */ jsxRuntime.jsx(
76041
- IconElement,
76042
- {
76043
- icon: "delete",
76044
- onClick: () => onDeleteRow(row2, index),
76045
- disabled: disabledByParent || disabled2.DELETE
76046
- }
76047
- ),
76048
- onCopyRow && /* @__PURE__ */ jsxRuntime.jsx(
76049
- IconElement,
76050
- {
76051
- icon: "content_copy",
76052
- onClick: () => onCopyRow(row2, index),
76053
- disabled: disabledByParent || disabled2.COPY
76054
- }
76055
- ),
76056
- onUpdateRow && /* @__PURE__ */ jsxRuntime.jsx(
76057
- IconElement,
76058
- {
76059
- icon: "settings",
76060
- onClick: () => {
76061
- window.scrollTo({ top: 0, behavior: "smooth" });
76062
- onUpdateRow(row2, index);
76063
- },
76064
- disabled: disabledByParent || disabled2.UPDATE
76065
- }
76066
- ),
76067
- /* @__PURE__ */ jsxRuntime.jsx(
76068
- IconElement,
76069
- {
76070
- onClick: () => toggleCollapse(row2, indexRow),
76071
- icon: open2 ? "keyboard_arrow_down" : "keyboard_arrow_up",
76072
- disabled: disabledByParent || disabled2.COLLAPSE
76097
+ const toggleCollapse = React.useCallback(
76098
+ async (targetRow, targetIndex) => {
76099
+ const nextOpen = !open2;
76100
+ setOpen(nextOpen);
76101
+ if (!nextOpen || !collapse.onOpenCollapse || state !== void 0) return;
76102
+ setLoading(true);
76103
+ try {
76104
+ const data = await collapse.onOpenCollapse(targetRow, targetIndex);
76105
+ const nextRows = collapse.property ? data == null ? void 0 : data[collapse.property] : data;
76106
+ setState(nextRows);
76107
+ } catch (error) {
76108
+ console.error(error);
76109
+ } finally {
76110
+ setLoading(false);
76111
+ }
76112
+ },
76113
+ [collapse, open2, state]
76114
+ );
76115
+ const columnsWithCollapseAction = React.useMemo(
76116
+ () => columns.map((column) => {
76117
+ if (column.id !== "actions") return column;
76118
+ return {
76119
+ ...column,
76120
+ render: (actionRow, actionIndex) => {
76121
+ const disabled = onDisabled ? onDisabled(actionRow, actionIndex) : { ...DISABLED_DEFAULT };
76122
+ const disabledByParent = disabled.DISABLED_ROW || disabled.DISABLED_ALL_ACTIONS;
76123
+ return /* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
76124
+ renderActionsContent(actionRow, actionIndex),
76125
+ /* @__PURE__ */ jsxRuntime.jsx(
76126
+ IconElement,
76127
+ {
76128
+ onClick: (e) => {
76129
+ e.stopPropagation();
76130
+ void toggleCollapse(actionRow, actionIndex);
76131
+ },
76132
+ icon: open2 ? "keyboard_arrow_down" : "keyboard_arrow_up",
76133
+ disabled: disabledByParent || disabled.COLLAPSE
76134
+ }
76135
+ )
76136
+ ] });
76073
76137
  }
76074
- )
76075
- ] });
76076
- };
76077
- const disabled = onDisabled ? onDisabled(row, indexRow) : { ...DISABLED_DEFAULT };
76138
+ };
76139
+ }),
76140
+ [columns, onDisabled, open2, renderActionsContent, toggleCollapse]
76141
+ );
76142
+ const { iconTitle, title, property, onOpenCollapse, ...collapseTableProps } = collapse;
76143
+ const collapseRows = onOpenCollapse ? state : property ? row[property] : void 0;
76078
76144
  return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
76079
- /* @__PURE__ */ jsxRuntime.jsx(material.Fade, { in: true, timeout: indexRow * 120, children: /* @__PURE__ */ jsxRuntime.jsx(
76080
- material.TableRow,
76081
- {
76082
- hover: true,
76083
- tabIndex: -1,
76084
- onClick: () => onClickRow && onClickRow(row, indexRow),
76085
- sx: getStyleRow(Boolean(onClickRow), palette, indexRow, rowSx, indexLoadingRow),
76086
- children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { align: column.align, sx: getStyleCell(column, palette, disabled.DISABLED_ROW), children: column.render ? column.render(row, indexRow) : row[column.id] }, column.id))
76087
- }
76088
- ) }),
76145
+ renderDefaultRow(columnsWithCollapseAction),
76089
76146
  /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { style: { paddingBottom: 0, paddingTop: 0 }, colSpan: columns.length + 2, children: /* @__PURE__ */ jsxRuntime.jsx(
76090
76147
  material.Stack,
76091
76148
  {
@@ -76104,88 +76161,55 @@ const RowCollapsePart = ({
76104
76161
  backgroundColor: palette.background.default
76105
76162
  },
76106
76163
  children: [
76107
- /* @__PURE__ */ jsxRuntime.jsx(IconContentElement, { icon: collapse.iconTitle || "filter_list", content: collapse.title, size: "medium" }),
76108
- /* @__PURE__ */ jsxRuntime.jsx(
76109
- TableComponent,
76110
- {
76111
- loading,
76112
- columns: collapse.columns,
76113
- isStickyActions: collapse.isStickyActions,
76114
- rows: collapse.onOpenCollapse ? state : row[collapse.property],
76115
- onClickRow: collapse.onClickRow,
76116
- onDisabled: collapse.onDisabled,
76117
- onSelectRow: collapse.onSelectRow,
76118
- onDeleteRow: collapse.onDeleteRow,
76119
- onInfoRow: collapse.onInfoRow,
76120
- onCopyRow: collapse.onCopyRow,
76121
- onUpdateRow: collapse.onUpdateRow
76122
- }
76123
- )
76164
+ /* @__PURE__ */ jsxRuntime.jsx(IconContentElement, { icon: iconTitle || "filter_list", content: title, size: "medium" }),
76165
+ /* @__PURE__ */ jsxRuntime.jsx(TableRendererComponent, { ...collapseTableProps, loading, rows: collapseRows })
76124
76166
  ]
76125
76167
  }
76126
76168
  ) })
76127
76169
  }
76128
76170
  ) }) })
76129
76171
  ] });
76130
- };
76131
- const TableCollapseComponent = ({
76132
- loading,
76172
+ }
76173
+ function TableCollapseComponent({
76174
+ loading = false,
76133
76175
  rows,
76134
- columns: initialColumns,
76135
- indexLoadingRow,
76176
+ columns,
76136
76177
  collapse,
76137
- isStickyActions = false,
76138
- onClickRow,
76139
- onDisabled,
76140
- // end row + 1 icon collapse
76141
- onSelectRow,
76142
- onDeleteRow,
76143
- onInfoRow,
76144
- onCopyRow,
76145
- onUpdateRow
76146
- }) => {
76147
- rows = rows || [];
76148
- const lengthActions = [onSelectRow, onDeleteRow, onInfoRow, onCopyRow, onUpdateRow].filter(Boolean).length + 1;
76149
- const widthActions = lengthActions * 19 + (lengthActions - 1) * 16;
76150
- const columns = React.useMemo(() => {
76151
- const updateColumns = [...initialColumns];
76152
- updateColumns.push({
76153
- id: "actions",
76154
- label: "Actions",
76155
- width: widthActions > 70 ? widthActions : 70,
76156
- align: "center",
76157
- stickyCss: isStickyActions ? { right: 0 } : void 0
76158
- });
76159
- return updateColumns;
76160
- }, [initialColumns, widthActions, isStickyActions]);
76178
+ ...tableProps
76179
+ }) {
76180
+ const tableRows = React.useMemo(() => rows || [], [rows]);
76161
76181
  const ref = React.useRef(null);
76162
76182
  const [widthTable, setWidthTable] = React.useState(0);
76163
76183
  React.useEffect(() => {
76164
76184
  if (ref.current) setWidthTable(ref.current.clientWidth);
76165
76185
  }, []);
76166
- return /* @__PURE__ */ jsxRuntime.jsx(TableContainerPart, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Table, { sx: { height: loading || rows.length === 0 ? "100%" : "none" }, children: [
76167
- /* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
76168
- /* @__PURE__ */ jsxRuntime.jsx(material.TableBody, { children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {}) }) }) : rows.length ? rows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(
76169
- RowCollapsePart,
76170
- {
76171
- columns,
76172
- row,
76173
- indexRow: index,
76174
- onDisabled,
76175
- indexLoadingRow,
76176
- collapse: { ...collapse, columns: [...collapse.columns] },
76177
- collapseTableWidth: widthTable,
76178
- onSelectRow,
76179
- onInfoRow,
76180
- onClickRow,
76181
- onUpdateRow,
76182
- onCopyRow,
76183
- onDeleteRow
76184
- },
76185
- index
76186
- )) : /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent, {}) }) }) })
76187
- ] }) });
76188
- };
76186
+ return /* @__PURE__ */ jsxRuntime.jsx(
76187
+ TableRendererComponent,
76188
+ {
76189
+ ...tableProps,
76190
+ columns,
76191
+ rows: tableRows,
76192
+ loading,
76193
+ extraActionCount: 1,
76194
+ stickyHeader: false,
76195
+ tableRef: ref,
76196
+ tableSx: { height: loading || tableRows.length === 0 ? "100%" : "none" },
76197
+ renderRow: ({ row, index, columns: renderColumns, renderDefaultRow, renderActionsContent }) => /* @__PURE__ */ jsxRuntime.jsx(
76198
+ RowCollapsePart,
76199
+ {
76200
+ ...tableProps,
76201
+ columns: renderColumns,
76202
+ row,
76203
+ indexRow: index,
76204
+ collapse,
76205
+ collapseTableWidth: widthTable,
76206
+ renderDefaultRow,
76207
+ renderActionsContent
76208
+ }
76209
+ )
76210
+ }
76211
+ );
76212
+ }
76189
76213
  const tableArgTypes = {
76190
76214
  loading: {
76191
76215
  control: "boolean",
@@ -76227,6 +76251,9 @@ const tableArgTypes = {
76227
76251
  getRowMenu: { control: false },
76228
76252
  onDisabled: { control: false }
76229
76253
  };
76254
+ function TableComponent(props) {
76255
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRendererComponent, { ...props });
76256
+ }
76230
76257
  const UserInfo = ({
76231
76258
  name = "Hệ thống",
76232
76259
  department = "Hệ thống",