@pdg/react-table 1.0.89 → 1.0.91

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React,{createContext,useContext,useMemo,useCallback,useState,useEffect,useRef,useLayoutEffect,useId}from'react';import classNames from'classnames';import {styled,TableRow,lighten,TableCell,Box,Tooltip,Checkbox,Stack,Pagination,useTheme,TableHead,TableBody,Icon,TableFooter,Paper,Table as Table$1,Grid,Popper,Grow,ClickAwayListener,IconButton}from'@mui/material';import SimpleBar from'simplebar-react';import {useResizeDetector}from'react-resize-detector';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {personalNoAutoDash,companyNoAutoDash,telNoAutoDash,numberFormat,notEmpty,equal,empty}from'@pdg/util';import {useAutoUpdateLayoutState}from'@pdg/react-hook';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import'simplebar-react/dist/simplebar.min.css';import {v4}from'uuid';import {Search,SearchGroup,FormHidden}from'@pdg/react-form';import {PdgButton,PdgIcon}from'@pdg/react-component';import {CopyToClipboard}from'react-copy-to-clipboard';/******************************************************************************
1
+ import React,{createContext,useContext,useMemo,useCallback,useState,useEffect,useRef,useLayoutEffect,useId}from'react';import classNames from'classnames';import {styled,TableRow,lighten,TableCell,Box,Tooltip,Checkbox,Stack,Pagination,useTheme,TableHead,TableBody,Icon,TableFooter,Paper,Table as Table$1,Grid,Popper,Grow,ClickAwayListener,IconButton}from'@mui/material';import {useResizeDetector}from'react-resize-detector';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {personalNoAutoDash,companyNoAutoDash,telNoAutoDash,numberFormat,notEmpty,equal,empty}from'@pdg/util';import {useAutoUpdateLayoutState}from'@pdg/react-hook';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import {v4}from'uuid';import SimpleBar from'simplebar-react';import'simplebar-react/dist/simplebar.min.css';import {Search,SearchGroup,FormHidden}from'@pdg/react-form';import {PdgButton,PdgIcon}from'@pdg/react-component';import {CopyToClipboard}from'react-copy-to-clipboard';/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -148,14 +148,12 @@ function typographyColorToSxColor(color) {
148
148
  }var TableContextDefaultValue = {
149
149
  menuOpen: false,
150
150
  openMenuId: undefined,
151
- /* eslint-disable */
152
151
  setMenuOpen: function () { },
153
152
  setItemColumnChecked: function () { },
154
153
  setItemColumnCheckDisabled: function () { },
155
154
  setItemColumnCommands: function () { },
156
155
  setHeadColumnChecked: function () { },
157
156
  setHeadColumnCommands: function () { },
158
- /* eslint-enable */
159
157
  };var TableContext = createContext(TableContextDefaultValue);function useTableState() {
160
158
  var value = useContext(TableContext);
161
159
  if (value === undefined) {
@@ -164,10 +162,14 @@ function typographyColorToSxColor(color) {
164
162
  return value;
165
163
  }var StyledTableCell = styled(TableCell)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"], ["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])));
166
164
  var TableCommonCell = function (_a) {
167
- // Use ---------------------------------------------------------------------------------------------------------------
165
+ /********************************************************************************************************************
166
+ * Use
167
+ * ******************************************************************************************************************/
168
168
  var children = _a.children, initClassName = _a.className, initStyle = _a.style, initSx = _a.sx, type = _a.type, column = _a.column, defaultAlign = _a.defaultAlign, initDefaultEllipsis = _a.defaultEllipsis, index = _a.index, item = _a.item, onClick = _a.onClick;
169
169
  var menuOpen = useTableState().menuOpen;
170
- // Memo --------------------------------------------------------------------------------------------------------------
170
+ /********************************************************************************************************************
171
+ * Memo
172
+ * ******************************************************************************************************************/
171
173
  var align = useMemo(function () { return getTableColumnAlign(column, defaultAlign); }, [column, defaultAlign]);
172
174
  var ellipsis = useMemo(function () {
173
175
  return type !== 'head' &&
@@ -286,7 +288,9 @@ var TableCommonCell = function (_a) {
286
288
  }
287
289
  }
288
290
  }, [column, index, initSx, item, type]);
289
- // Event Handler ---------------------------------------------------------------------------------------------------
291
+ /********************************************************************************************************************
292
+ * Event Handler
293
+ * ******************************************************************************************************************/
290
294
  var handleClick = useCallback(function (e) {
291
295
  if (!menuOpen &&
292
296
  column.type !== 'check' &&
@@ -307,18 +311,26 @@ var TableCommonCell = function (_a) {
307
311
  }
308
312
  }
309
313
  }, [menuOpen, type, item, index, column, onClick]);
310
- // Render ----------------------------------------------------------------------------------------------------------
314
+ /********************************************************************************************************************
315
+ * Render
316
+ * ******************************************************************************************************************/
311
317
  return (React.createElement(StyledTableCell, { align: align, className: classNames(className, 'TableCommonCell', ellipsis && 'ellipsis', column.type ? "column-type-".concat(column.type) : false), style: style, sx: sx, onClick: type === 'body' ? handleClick : undefined }, children));
312
318
  };
313
319
  var templateObject_1$3;var StyledButtonsBox = styled(Box)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n"], ["\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n"])));
314
320
  var TableBodyCell = function (_a) {
315
- // Use ---------------------------------------------------------------------------------------------------------------
321
+ /********************************************************************************************************************
322
+ * Use
323
+ * ******************************************************************************************************************/
316
324
  var className = _a.className, style = _a.style, sx = _a.sx, item = _a.item, index = _a.index, column = _a.column, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, onClick = _a.onClick, onCheckChange = _a.onCheckChange;
317
325
  var _b = useTableState(), menuOpen = _b.menuOpen, setItemColumnChecked = _b.setItemColumnChecked, setItemColumnCheckDisabled = _b.setItemColumnCheckDisabled, setItemColumnCommands = _b.setItemColumnCommands;
318
- // State -------------------------------------------------------------------------------------------------------------
326
+ /********************************************************************************************************************
327
+ * State
328
+ * ******************************************************************************************************************/
319
329
  var _c = useState(false), checked = _c[0], setChecked = _c[1];
320
330
  var _d = useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
321
- // Effect ------------------------------------------------------------------------------------------------------------
331
+ /********************************************************************************************************************
332
+ * Effect
333
+ * ******************************************************************************************************************/
322
334
  useEffect(function () {
323
335
  if (column.type === 'check') {
324
336
  setChecked(column.onInitChecked ? column.onInitChecked(item) : false);
@@ -350,7 +362,9 @@ var TableBodyCell = function (_a) {
350
362
  }
351
363
  // eslint-disable-next-line react-hooks/exhaustive-deps
352
364
  }, [checkDisabled]);
353
- // Memo --------------------------------------------------------------------------------------------------------------
365
+ /********************************************************************************************************************
366
+ * Memo
367
+ * ******************************************************************************************************************/
354
368
  var isHidden = useMemo(function () { return (column.onHide ? column.onHide(item, index) : false); }, [column, index, item]);
355
369
  var buttonsBoxJustifyContent = useMemo(function () {
356
370
  switch (getTableColumnAlign(column, defaultAlign)) {
@@ -477,7 +491,9 @@ var TableBodyCell = function (_a) {
477
491
  }
478
492
  return data;
479
493
  }, [column, item, index, menuOpen, checked, checkDisabled, buttonsBoxJustifyContent, onCheckChange]);
480
- // Event Handler ---------------------------------------------------------------------------------------------------
494
+ /********************************************************************************************************************
495
+ * Event Handler
496
+ * ******************************************************************************************************************/
481
497
  var handleClick = useCallback(function (item, index) {
482
498
  if (column.onClick) {
483
499
  column.onClick(item, index);
@@ -487,7 +503,9 @@ var TableBodyCell = function (_a) {
487
503
  onClick(item, index);
488
504
  }
489
505
  }, [column, onClick]);
490
- // Render ----------------------------------------------------------------------------------------------------------
506
+ /********************************************************************************************************************
507
+ * Render
508
+ * ******************************************************************************************************************/
491
509
  return (React.createElement(TableCommonCell, { type: 'body', className: classNames('TableBodyCell', className), style: style, sx: sx, column: column, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, item: item, index: index, onClick: column.onClick || onClick ? handleClick : undefined }, !isHidden && data));
492
510
  };
493
511
  var templateObject_1$2;var StyledBodyRow = styled(TableRow)(function (_a) {
@@ -502,12 +520,14 @@ var templateObject_1$2;var StyledBodyRow = styled(TableRow)(function (_a) {
502
520
  });
503
521
  });
504
522
  var TableBodyRow = function (_a) {
505
- var className = _a.className, style = _a.style,
506
- //--------------------------------------------------------------------------------------------------------------------
507
- id = _a.id, index = _a.index, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, sortable = _a.sortable, columns = _a.columns, item = _a.item, onClick = _a.onClick, onCheckChange = _a.onCheckChange, onGetColumnClassName = _a.onGetColumnClassName, onGetColumnStyle = _a.onGetColumnStyle, onGetColumnSx = _a.onGetColumnSx,
508
- // -------------------------------------------------------------------------------------------------------------------
509
- props = __rest(_a, ["className", "style", "id", "index", "defaultAlign", "defaultEllipsis", "sortable", "columns", "item", "onClick", "onCheckChange", "onGetColumnClassName", "onGetColumnStyle", "onGetColumnSx"]);
523
+ /********************************************************************************************************************
524
+ * Use
525
+ * ******************************************************************************************************************/
526
+ var className = _a.className, style = _a.style, id = _a.id, index = _a.index, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, sortable = _a.sortable, columns = _a.columns, item = _a.item, onClick = _a.onClick, onCheckChange = _a.onCheckChange, onGetColumnClassName = _a.onGetColumnClassName, onGetColumnStyle = _a.onGetColumnStyle, onGetColumnSx = _a.onGetColumnSx, props = __rest(_a, ["className", "style", "id", "index", "defaultAlign", "defaultEllipsis", "sortable", "columns", "item", "onClick", "onCheckChange", "onGetColumnClassName", "onGetColumnStyle", "onGetColumnSx"]);
510
527
  var _b = useSortable({ id: id }), attributes = _b.attributes, listeners = _b.listeners, setNodeRef = _b.setNodeRef, transform = _b.transform, transition = _b.transition;
528
+ /********************************************************************************************************************
529
+ * Memo
530
+ * ******************************************************************************************************************/
511
531
  var finalStyle = useMemo(function () {
512
532
  return sortable
513
533
  ? __assign(__assign({}, style), { transform: CSS.Transform.toString(transform), transition: transition }) : style;
@@ -516,10 +536,16 @@ var TableBodyRow = function (_a) {
516
536
  return sortable
517
537
  ? __assign(__assign({ ref: setNodeRef }, attributes), listeners) : {};
518
538
  }, [attributes, listeners, setNodeRef, sortable]);
539
+ /********************************************************************************************************************
540
+ * Render
541
+ * ******************************************************************************************************************/
519
542
  return (React.createElement(StyledBodyRow, __assign({ className: classNames('TableBodyRow', className), style: finalStyle }, props, sortableProps), columns.map(function (column, columnIdx) { return (React.createElement(TableBodyCell, { className: onGetColumnClassName ? onGetColumnClassName(column, item, index) : undefined, sx: onGetColumnSx ? onGetColumnSx(column, item, index) : undefined, style: onGetColumnStyle ? onGetColumnStyle(column, item, index) : undefined, key: columnIdx, index: index, item: item, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, column: column, onClick: onClick, onCheckChange: onCheckChange })); })));
520
543
  };
521
544
  TableBodyRow.displayName = 'TableBodyRow';
522
545
  TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableFooterCell = function (_a) {
546
+ /********************************************************************************************************************
547
+ * Memo
548
+ * ******************************************************************************************************************/
523
549
  var column = _a.column, defaultAlign = _a.defaultAlign;
524
550
  var data = useMemo(function () {
525
551
  var _a, _b, _c;
@@ -530,6 +556,9 @@ TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableFooterCell = funct
530
556
  return (_c = column.footer) === null || _c === void 0 ? void 0 : _c.value;
531
557
  }
532
558
  }, [column]);
559
+ /********************************************************************************************************************
560
+ * Render
561
+ * ******************************************************************************************************************/
533
562
  return (React.createElement(TableCommonCell, { type: 'head', className: 'TableFooterCell', column: column, defaultAlign: defaultAlign }, data));
534
563
  };var TablePagination = function (_a) {
535
564
  var className = _a.className, style = _a.style, sx = _a.sx, paging = _a.paging, align = _a.align, onChange = _a.onChange;
@@ -551,13 +580,19 @@ TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableFooterCell = funct
551
580
  },
552
581
  });
553
582
  });var TableHeadCell = function (_a) {
554
- // Use ---------------------------------------------------------------------------------------------------------------
583
+ /********************************************************************************************************************
584
+ * Use
585
+ * ******************************************************************************************************************/
555
586
  var column = _a.column, defaultAlign = _a.defaultAlign, top = _a.top, onCheckChange = _a.onCheckChange;
556
587
  var _b = useTableState(), setHeadColumnChecked = _b.setHeadColumnChecked, setHeadColumnCommands = _b.setHeadColumnCommands;
557
- // State -------------------------------------------------------------------------------------------------------------
588
+ /********************************************************************************************************************
589
+ * State
590
+ * ******************************************************************************************************************/
558
591
  var _c = useState(false), checked = _c[0], setChecked = _c[1];
559
592
  var _d = useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
560
- // Effect ------------------------------------------------------------------------------------------------------------
593
+ /********************************************************************************************************************
594
+ * Effect
595
+ * ******************************************************************************************************************/
561
596
  useEffect(function () {
562
597
  if (column.type === 'check') {
563
598
  setHeadColumnChecked(column, checked);
@@ -577,7 +612,9 @@ TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableFooterCell = funct
577
612
  },
578
613
  });
579
614
  }, [setHeadColumnCommands, column]);
580
- // Memo --------------------------------------------------------------------------------------------------------------
615
+ /********************************************************************************************************************
616
+ * Memo
617
+ * ******************************************************************************************************************/
581
618
  var style = useMemo(function () { return (top !== undefined ? { top: top } : undefined); }, [top]);
582
619
  var data = useMemo(function () {
583
620
  var _a, _b;
@@ -601,19 +638,27 @@ TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableFooterCell = funct
601
638
  }
602
639
  }
603
640
  }, [checkDisabled, checked, column, onCheckChange]);
604
- // Render ------------------------------------------------------------------------------------------------------------
641
+ /********************************************************************************************************************
642
+ * Render
643
+ * ******************************************************************************************************************/
605
644
  return (React.createElement(TableCommonCell, { type: 'head', className: 'TableHeadCell', style: style, column: column, defaultAlign: defaultAlign }, data));
606
645
  };var BottomLine = styled('div')(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n height: 1px;\n position: absolute;\n left: 3px;\n right: 3px;\n bottom: 0;\n"], ["\n height: 1px;\n position: absolute;\n left: 3px;\n right: 3px;\n bottom: 0;\n"])));
607
646
  var TableTopHead = function (_a) {
608
- // Use ---------------------------------------------------------------------------------------------------------------
647
+ /********************************************************************************************************************
648
+ * Use
649
+ * ******************************************************************************************************************/
609
650
  var columns = _a.columns, rows = _a.rows, caption = _a.caption, defaultAlign = _a.defaultAlign, onCheckChange = _a.onCheckChange;
610
651
  var theme = useTheme();
611
- // Ref ---------------------------------------------------------------------------------------------------------------
652
+ /********************************************************************************************************************
653
+ * Ref
654
+ * ******************************************************************************************************************/
612
655
  var captionRef = useRef(null);
613
656
  var row1Ref = useRef(null);
614
657
  var row2Ref = useRef(null);
615
658
  var row3Ref = useRef(null);
616
- // ResizeDetector ----------------------------------------------------------------------------------------------------
659
+ /********************************************************************************************************************
660
+ * ResizeDetector
661
+ * ******************************************************************************************************************/
617
662
  var captionHeight = useResizeDetector({
618
663
  targetRef: captionRef,
619
664
  handleWidth: false,
@@ -622,7 +667,9 @@ var TableTopHead = function (_a) {
622
667
  var row1Height = useResizeDetector({ targetRef: row1Ref, handleWidth: false, handleHeight: true }).height;
623
668
  var row2Height = useResizeDetector({ targetRef: row2Ref, handleWidth: false, handleHeight: true }).height;
624
669
  var row3Height = useResizeDetector({ targetRef: row3Ref, handleWidth: false, handleHeight: true }).height;
625
- // Function ----------------------------------------------------------------------------------------------------------
670
+ /********************************************************************************************************************
671
+ * Function
672
+ * ******************************************************************************************************************/
626
673
  var captionRow = useMemo(function () {
627
674
  return !!caption && (React.createElement(TableTopHeadCaptionRow, { ref: captionRef, className: 'TableTopHeadCaptionRow' },
628
675
  React.createElement(TableCell, { colSpan: columns.length }, caption)));
@@ -651,7 +698,9 @@ var TableTopHead = function (_a) {
651
698
  var top = (captionHeight || 0) + (row1Height || 0) + (row2Height || 0) + (row3Height || 0);
652
699
  return (React.createElement(TableRow, null, columns.map(function (column, idx) { return (React.createElement(TableHeadCell, { key: idx, column: column, defaultAlign: defaultAlign, top: top, onCheckChange: onCheckChange })); })));
653
700
  }, [captionHeight, columns, defaultAlign, onCheckChange, row1Height, row2Height, row3Height]);
654
- // Render ------------------------------------------------------------------------------------------------------------
701
+ /********************************************************************************************************************
702
+ * Render
703
+ * ******************************************************************************************************************/
655
704
  if (rows) {
656
705
  if (Array.isArray(rows[0])) {
657
706
  return (React.createElement(TableHead, { className: 'TableHead' },
@@ -698,17 +747,19 @@ var templateObject_1$1;function columnFilter(v) {
698
747
  }
699
748
  var _columnId = 0;
700
749
  var Table = React.forwardRef(function (_a, ref) {
701
- // Ref ---------------------------------------------------------------------------------------------------------------
702
- var caption = _a.caption, topHeadRows = _a.topHeadRows, initColumns = _a.columns, initItems = _a.items, initPaging = _a.paging, pagingAlign = _a.pagingAlign, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, initStickyHeader = _a.stickyHeader, height = _a.height, minHeight = _a.minHeight, maxHeight = _a.maxHeight, fullHeight = _a.fullHeight, showOddColor = _a.showOddColor, showEvenColor = _a.showEvenColor, cellPadding = _a.cellPadding, footer = _a.footer, noData = _a.noData, pagination = _a.pagination, sortable = _a.sortable, onClick = _a.onClick, onGetBodyRowClassName = _a.onGetBodyRowClassName, onGetBodyRowStyle = _a.onGetBodyRowStyle, onGetBodyRowSx = _a.onGetBodyRowSx, onGetBodyColumnClassName = _a.onGetBodyColumnClassName, onGetBodyColumnStyle = _a.onGetBodyColumnStyle, onGetBodyColumnSx = _a.onGetBodyColumnSx, onPageChange = _a.onPageChange, onSortChange = _a.onSortChange, onCheckChange = _a.onCheckChange,
703
- // ---------------------------------------------------------------------------------------------------------------
704
- className = _a.className, initStyle = _a.style, sx = _a.sx;
750
+ /********************************************************************************************************************
751
+ * Ref
752
+ * ******************************************************************************************************************/
753
+ var className = _a.className, initStyle = _a.style, sx = _a.sx, caption = _a.caption, topHeadRows = _a.topHeadRows, initColumns = _a.columns, initItems = _a.items, initPaging = _a.paging, pagingAlign = _a.pagingAlign, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, initStickyHeader = _a.stickyHeader, height = _a.height, minHeight = _a.minHeight, maxHeight = _a.maxHeight, fullHeight = _a.fullHeight, showOddColor = _a.showOddColor, showEvenColor = _a.showEvenColor, cellPadding = _a.cellPadding, footer = _a.footer, noData = _a.noData, pagination = _a.pagination, sortable = _a.sortable, onClick = _a.onClick, onGetBodyRowClassName = _a.onGetBodyRowClassName, onGetBodyRowStyle = _a.onGetBodyRowStyle, onGetBodyRowSx = _a.onGetBodyRowSx, onGetBodyColumnClassName = _a.onGetBodyColumnClassName, onGetBodyColumnStyle = _a.onGetBodyColumnStyle, onGetBodyColumnSx = _a.onGetBodyColumnSx, onPageChange = _a.onPageChange, onSortChange = _a.onSortChange, onCheckChange = _a.onCheckChange;
705
754
  var localHeaderDataRef = useRef({});
706
755
  var localBodyDataRef = useRef({});
707
756
  var updateHeadCheckTimer = useRef();
708
757
  var fireOnCheckChangeTimer = useRef({});
709
758
  var simpleBarRef = useRef(null);
710
759
  var finalColumnsIdRef = useRef([]);
711
- // sortable --------------------------------------------------------------------------------------------------------
760
+ /********************************************************************************************************************
761
+ * sortable
762
+ * ******************************************************************************************************************/
712
763
  var sensors = useSensors(useSensor(MouseSensor, {
713
764
  // Require the mouse to move by 10 pixels before activating
714
765
  activationConstraint: {
@@ -723,11 +774,20 @@ var Table = React.forwardRef(function (_a, ref) {
723
774
  }), useSensor(KeyboardSensor, {
724
775
  coordinateGetter: sortableKeyboardCoordinates,
725
776
  }));
726
- // State -------------------------------------------------------------------------------------------------------------
777
+ /********************************************************************************************************************
778
+ * State
779
+ * ******************************************************************************************************************/
727
780
  var _b = useState(false), menuOpen = _b[0], setMenuOpen = _b[1];
728
781
  var _c = useState(undefined), openMenuId = _c[0], setOpenMenuId = _c[1];
729
- // State - containerHeight -------------------------------------------------------------------------------------------
730
- var _d = useState(), containerHeight = _d[0], setContainerHeight = _d[1];
782
+ var _d = useAutoUpdateLayoutState(initColumns), columns = _d[0], setColumns = _d[1];
783
+ var _e = useState(), finalColumns = _e[0], setFinalColumns = _e[1];
784
+ var _f = useAutoUpdateLayoutState(initItems), items = _f[0], setItems = _f[1];
785
+ var _g = useState(), sortableItems = _g[0], setSortableItems = _g[1];
786
+ var _h = useAutoUpdateLayoutState(initPaging), paging = _h[0], setPaging = _h[1];
787
+ /********************************************************************************************************************
788
+ * containerHeight
789
+ * ******************************************************************************************************************/
790
+ var _j = useState(), containerHeight = _j[0], setContainerHeight = _j[1];
731
791
  var containerHeightDetector = useResizeDetector({
732
792
  handleHeight: true,
733
793
  handleWidth: false,
@@ -740,8 +800,10 @@ var Table = React.forwardRef(function (_a, ref) {
740
800
  }
741
801
  },
742
802
  }).ref;
743
- // State - footerHeight --------------------------------------------------------------------------------------------
744
- var _e = useState(), pagingHeight = _e[0], setPagingHeight = _e[1];
803
+ /********************************************************************************************************************
804
+ * footerHeight
805
+ * ******************************************************************************************************************/
806
+ var _k = useState(), pagingHeight = _k[0], setPagingHeight = _k[1];
745
807
  var pagingHeightResizeDetector = useResizeDetector({
746
808
  handleHeight: true,
747
809
  handleWidth: false,
@@ -754,13 +816,9 @@ var Table = React.forwardRef(function (_a, ref) {
754
816
  }
755
817
  },
756
818
  }).ref;
757
- // State -----------------------------------------------------------------------------------------------------------
758
- var _f = useAutoUpdateLayoutState(initColumns), columns = _f[0], setColumns = _f[1];
759
- var _g = useState(), finalColumns = _g[0], setFinalColumns = _g[1];
760
- var _h = useAutoUpdateLayoutState(initItems), items = _h[0], setItems = _h[1];
761
- var _j = useState(), sortableItems = _j[0], setSortableItems = _j[1];
762
- var _k = useAutoUpdateLayoutState(initPaging), paging = _k[0], setPaging = _k[1];
763
- // Memo --------------------------------------------------------------------------------------------------------------
819
+ /********************************************************************************************************************
820
+ * Memo
821
+ * ******************************************************************************************************************/
764
822
  var tableSx = useMemo(function () {
765
823
  var sx = {
766
824
  padding: typeof cellPadding === 'number' ? "".concat(cellPadding, "px") : cellPadding,
@@ -771,7 +829,9 @@ var Table = React.forwardRef(function (_a, ref) {
771
829
  '> .MuiTableFooter-root > .MuiTableRow-root > .MuiTableCell-root ': sx,
772
830
  };
773
831
  }, [cellPadding]);
774
- // Function --------------------------------------------------------------------------------------------------------
832
+ /********************************************************************************************************************
833
+ * Function
834
+ * ******************************************************************************************************************/
775
835
  var makeSortableItems = useCallback(function (items) {
776
836
  return items === null || items === void 0 ? void 0 : items.map(function (_a, index) {
777
837
  var id = _a.id, item = __rest(_a, ["id"]);
@@ -863,7 +923,9 @@ var Table = React.forwardRef(function (_a, ref) {
863
923
  var _a, _b;
864
924
  (_b = (_a = simpleBarRef.current) === null || _a === void 0 ? void 0 : _a.getScrollElement()) === null || _b === void 0 ? void 0 : _b.scrollTo({ top: 0 });
865
925
  }, []);
866
- // Effect ----------------------------------------------------------------------------------------------------------
926
+ /********************************************************************************************************************
927
+ * Effect
928
+ * ******************************************************************************************************************/
867
929
  useEffect(function () {
868
930
  return function () {
869
931
  stopHeadCheckTimer();
@@ -947,7 +1009,9 @@ var Table = React.forwardRef(function (_a, ref) {
947
1009
  localHeaderDataRef.current = {};
948
1010
  }
949
1011
  }, [finalColumns, getFinalColumnId]);
950
- // Commands --------------------------------------------------------------------------------------------------------
1012
+ /********************************************************************************************************************
1013
+ * Commands
1014
+ * ******************************************************************************************************************/
951
1015
  useLayoutEffect(function () {
952
1016
  if (ref) {
953
1017
  var lastColumns_1 = columns;
@@ -996,7 +1060,9 @@ var Table = React.forwardRef(function (_a, ref) {
996
1060
  getCheckedItems,
997
1061
  simpleBarScrollToTop,
998
1062
  ]);
999
- // Event Handler ---------------------------------------------------------------------------------------------------
1063
+ /********************************************************************************************************************
1064
+ * Event Handler
1065
+ * ******************************************************************************************************************/
1000
1066
  var handleDragEnd = useCallback(function (event) {
1001
1067
  var active = event.active, over = event.over;
1002
1068
  if (active && over) {
@@ -1046,7 +1112,9 @@ var Table = React.forwardRef(function (_a, ref) {
1046
1112
  simpleBarScrollToTop();
1047
1113
  onPageChange && onPageChange(page);
1048
1114
  }, [onPageChange, simpleBarScrollToTop]);
1049
- // TableContext Function ---------------------------------------------------------------------------------------------
1115
+ /********************************************************************************************************************
1116
+ * TableContext Function
1117
+ * ******************************************************************************************************************/
1050
1118
  var TableContextSetMenuOpen = useCallback(function (newMenuOpen, newOpenMenuId) {
1051
1119
  if (newMenuOpen) {
1052
1120
  setMenuOpen(newMenuOpen);
@@ -1095,7 +1163,9 @@ var Table = React.forwardRef(function (_a, ref) {
1095
1163
  data.commands = commands;
1096
1164
  }
1097
1165
  }, [getFinalColumnId]);
1098
- // Memo --------------------------------------------------------------------------------------------------------------
1166
+ /********************************************************************************************************************
1167
+ * Memo
1168
+ * ******************************************************************************************************************/
1099
1169
  var tableContextValue = useMemo(function () { return ({
1100
1170
  menuOpen: menuOpen,
1101
1171
  openMenuId: openMenuId,
@@ -1115,7 +1185,6 @@ var Table = React.forwardRef(function (_a, ref) {
1115
1185
  menuOpen,
1116
1186
  openMenuId,
1117
1187
  ]);
1118
- // Memo --------------------------------------------------------------------------------------------------------------
1119
1188
  var isNoData = useMemo(function () { return !!sortableItems && sortableItems.length <= 0; }, [sortableItems]);
1120
1189
  var finalPagingHeight = useMemo(function () { return (paging && paging.total > 0 ? pagingHeight || 0 : 0); }, [paging, pagingHeight]);
1121
1190
  var stickyHeader = useMemo(function () { return !isNoData && initStickyHeader; }, [initStickyHeader, isNoData]);
@@ -1205,7 +1274,9 @@ var Table = React.forwardRef(function (_a, ref) {
1205
1274
  pagingHeightResizeDetector,
1206
1275
  pagingStyle,
1207
1276
  ]);
1208
- // Render ----------------------------------------------------------------------------------------------------------
1277
+ /********************************************************************************************************************
1278
+ * Render
1279
+ * ******************************************************************************************************************/
1209
1280
  return finalColumns ? (React.createElement(TableContextProvider, { value: tableContextValue },
1210
1281
  React.createElement(Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className, !!stickyHeader && 'sticky-header', !!fullHeight && 'full-height', !!showOddColor && 'odd-color', !!showEvenColor && 'even-color', !!sortable && 'sortable'), variant: 'outlined', style: style, sx: sx },
1211
1282
  React.createElement(SimpleBar, { ref: simpleBarRef, style: simpleBarStyle },
@@ -1218,13 +1289,17 @@ var Table = React.forwardRef(function (_a, ref) {
1218
1289
  });
1219
1290
  Table.displayName = 'Table';
1220
1291
  Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var SearchTable = React.forwardRef(function (_a, ref) {
1292
+ /********************************************************************************************************************
1293
+ * Ref
1294
+ * ******************************************************************************************************************/
1221
1295
  var _b, _c;
1222
- var color = _a.color, hash = _a.hash, stickyHeader = _a.stickyHeader, fullHeight = _a.fullHeight, search = _a.search, table = _a.table, betweenSearchTableComponent = _a.betweenSearchTableComponent, onGetData = _a.onGetData, onRequestHashChange = _a.onRequestHashChange,
1223
- // ---------------------------------------------------------------------------------------------------------------
1224
- className = _a.className, initStyle = _a.style, sx = _a.sx;
1296
+ var className = _a.className, initStyle = _a.style, sx = _a.sx, color = _a.color, hash = _a.hash, stickyHeader = _a.stickyHeader, fullHeight = _a.fullHeight, search = _a.search, table = _a.table, betweenSearchTableComponent = _a.betweenSearchTableComponent, onGetData = _a.onGetData, onRequestHashChange = _a.onRequestHashChange;
1225
1297
  var searchRef = useRef();
1226
1298
  var tableRef = useRef();
1227
- //------------------------------------------------------------------------------------------------------------------
1299
+ var lastGetDataDataRef = useRef({});
1300
+ /********************************************************************************************************************
1301
+ * Function
1302
+ * ******************************************************************************************************************/
1228
1303
  var getSearchInfo = useCallback(function (search) {
1229
1304
  var searchInfo = {};
1230
1305
  if (search) {
@@ -1244,12 +1319,14 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1244
1319
  }
1245
1320
  return tableInfo;
1246
1321
  }, []);
1247
- // Ref -------------------------------------------------------------------------------------------------------------
1248
- var lastGetDataDataRef = useRef({});
1249
- // State -----------------------------------------------------------------------------------------------------------
1322
+ /********************************************************************************************************************
1323
+ * State
1324
+ * ******************************************************************************************************************/
1250
1325
  var _d = useState(true), isFirstSearchSubmit = _d[0], setIsFirstSearchSubmit = _d[1];
1251
1326
  var _e = useState(), tableData = _e[0], setTableData = _e[1];
1252
- // searchInfo ------------------------------------------------------------------------------------------------------
1327
+ /********************************************************************************************************************
1328
+ * searchInfo
1329
+ * ******************************************************************************************************************/
1253
1330
  var searchInfoFirstUseEffect = useRef(true);
1254
1331
  var _f = useState(function () { return getSearchInfo(search); }), searchInfo = _f[0], setSearchInfo = _f[1];
1255
1332
  useEffect(function () {
@@ -1261,7 +1338,9 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1261
1338
  }
1262
1339
  // eslint-disable-next-line react-hooks/exhaustive-deps
1263
1340
  }, [search]);
1264
- // tableInfo -------------------------------------------------------------------------------------------------------
1341
+ /********************************************************************************************************************
1342
+ * tableInfo
1343
+ * ******************************************************************************************************************/
1265
1344
  var tableInfoFirstUseEffect = useRef(true);
1266
1345
  var _g = useState(function () { return getTableInfo(table); }), tableInfo = _g[0], setTableInfo = _g[1];
1267
1346
  useEffect(function () {
@@ -1273,14 +1352,15 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1273
1352
  }
1274
1353
  // eslint-disable-next-line react-hooks/exhaustive-deps
1275
1354
  }, [table]);
1276
- // Function - getData ----------------------------------------------------------------------------------------------
1355
+ /********************************************************************************************************************
1356
+ * Function
1357
+ * ******************************************************************************************************************/
1277
1358
  var getData = useCallback(function (data) {
1278
1359
  lastGetDataDataRef.current = data;
1279
1360
  if (onGetData) {
1280
1361
  onGetData(data).then(setTableData);
1281
1362
  }
1282
1363
  }, [onGetData]);
1283
- // Function ----------------------------------------------------------------------------------------------------------
1284
1364
  var deHash = useCallback(function () {
1285
1365
  var values = {};
1286
1366
  var hash = window.location.hash.substring(1);
@@ -1414,7 +1494,9 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1414
1494
  return commands.getAllFormValue();
1415
1495
  }
1416
1496
  }, [searchRef, deHash]);
1417
- // Commands --------------------------------------------------------------------------------------------------------
1497
+ /********************************************************************************************************************
1498
+ * Commands
1499
+ * ******************************************************************************************************************/
1418
1500
  useLayoutEffect(function () {
1419
1501
  if (ref) {
1420
1502
  var commands = {
@@ -1454,7 +1536,9 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1454
1536
  }
1455
1537
  }
1456
1538
  }, [ref, hash, lastGetDataDataRef, searchRef, tableRef, getData, hashToSearchValue]);
1457
- //--------------------------------------------------------------------------------------------------------------------
1539
+ /********************************************************************************************************************
1540
+ * hash
1541
+ * ******************************************************************************************************************/
1458
1542
  useEffect(function () {
1459
1543
  if (hash) {
1460
1544
  var data = hashToSearchValue();
@@ -1463,7 +1547,6 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1463
1547
  }
1464
1548
  // eslint-disable-next-line react-hooks/exhaustive-deps
1465
1549
  }, [window.location.hash]);
1466
- //--------------------------------------------------------------------------------------------------------------------
1467
1550
  var hashChange = useCallback(function (params) {
1468
1551
  if (onRequestHashChange) {
1469
1552
  var hashes_1 = [];
@@ -1559,7 +1642,9 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1559
1642
  }
1560
1643
  }
1561
1644
  }, [onRequestHashChange, getData]);
1562
- //------------------------------------------------------------------------------------------------------------------
1645
+ /********************************************************************************************************************
1646
+ * Event Handler
1647
+ * ******************************************************************************************************************/
1563
1648
  var handlePageChange = useCallback(function (page) {
1564
1649
  var _a, _b;
1565
1650
  (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.setValue('page', page);
@@ -1598,22 +1683,21 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1598
1683
  }
1599
1684
  }
1600
1685
  }, [searchRef, hash, hashChange, getData, isFirstSearchSubmit]);
1601
- // Memo --------------------------------------------------------------------------------------------------------------
1602
- var style = useMemo(function () {
1603
- if (fullHeight) {
1604
- return __assign(__assign({}, initStyle), { flex: 1, display: 'flex' });
1605
- }
1606
- else {
1607
- return initStyle;
1608
- }
1686
+ /********************************************************************************************************************
1687
+ * Memo
1688
+ * ******************************************************************************************************************/
1689
+ var styles = useMemo(function () {
1690
+ return fullHeight
1691
+ ? {
1692
+ containerStyle: __assign(__assign({}, initStyle), { flex: 1, display: 'flex' }),
1693
+ tableContainerStyle: { flex: 1, display: 'flex', flexDirection: 'column' },
1694
+ }
1695
+ : { containerStyle: initStyle };
1609
1696
  }, [initStyle, fullHeight]);
1610
- var tableContainerStyle = useMemo(function () {
1611
- if (fullHeight) {
1612
- return { flex: 1, display: 'flex', flexDirection: 'column' };
1613
- }
1614
- }, [fullHeight]);
1615
- //------------------------------------------------------------------------------------------------------------------
1616
- return (React.createElement(Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: style, sx: sx },
1697
+ /********************************************************************************************************************
1698
+ * Render
1699
+ * ******************************************************************************************************************/
1700
+ return (React.createElement(Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: styles.containerStyle, sx: sx },
1617
1701
  React.createElement(Grid, { item: true, sx: { display: searchInfo.searchGroups ? undefined : 'none' } },
1618
1702
  React.createElement(Search, __assign({ color: color }, searchInfo.props, { ref: function (commands) {
1619
1703
  if (searchInfo.ref) {
@@ -1630,7 +1714,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1630
1714
  React.createElement(FormHidden, { name: 'page', value: 1 })),
1631
1715
  searchInfo.searchGroups)),
1632
1716
  betweenSearchTableComponent && React.createElement(Grid, { item: true }, betweenSearchTableComponent),
1633
- React.createElement(Grid, { item: true, style: tableContainerStyle },
1717
+ React.createElement(Grid, { item: true, style: styles.tableContainerStyle },
1634
1718
  React.createElement(Table, __assign({}, tableInfo.props, { stickyHeader: stickyHeader || ((_b = tableInfo.props) === null || _b === void 0 ? void 0 : _b.stickyHeader), fullHeight: fullHeight || ((_c = tableInfo.props) === null || _c === void 0 ? void 0 : _c.fullHeight), ref: function (commands) {
1635
1719
  if (tableInfo.ref) {
1636
1720
  if (typeof tableInfo.ref === 'function') {
@@ -1648,9 +1732,14 @@ SearchTable.defaultProps = SearchTableDefaultProps;var TableButtonDefaultProps =
1648
1732
  variant: 'outlined',
1649
1733
  color: 'primary',
1650
1734
  };var TableButton = React.forwardRef(function (_a, ref) {
1735
+ /********************************************************************************************************************
1736
+ * Memo
1737
+ * ******************************************************************************************************************/
1651
1738
  var children = _a.children, className = _a.className, initSx = _a.sx, color = _a.color, icon = _a.icon, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "color", "icon", "startIcon", "endIcon", "onClick"]);
1652
1739
  var sx = useMemo(function () { return (__assign({ minWidth: 0, px: 0.7 }, initSx)); }, [initSx]);
1653
- // Render ----------------------------------------------------------------------------------------------------------
1740
+ /********************************************************************************************************************
1741
+ * Render
1742
+ * ******************************************************************************************************************/
1654
1743
  return (React.createElement(PdgButton, __assign({ ref: ref, className: classNames(className, 'TableButton'), type: 'button', size: 'small', sx: sx, color: color, icon: icon, startIcon: startIcon, endIcon: endIcon, onClick: onClick }, props), children));
1655
1744
  });
1656
1745
  TableButton.displayName = 'TableButton';
@@ -1818,45 +1907,13 @@ var ValueClipboard = styled('div')(templateObject_5 || (templateObject_5 = __mak
1818
1907
  var ClipboardIconButton = styled(IconButton)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: -10px;\n margin-bottom: -10px;\n"], ["\n margin-top: -10px;\n margin-bottom: -10px;\n"])));
1819
1908
  var Line = styled('div')(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"], ["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"])));
1820
1909
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;var InfoTable = function (_a) {
1910
+ /********************************************************************************************************************
1911
+ * Memo
1912
+ * ******************************************************************************************************************/
1821
1913
  var cols = _a.cols, spacing = _a.spacing, columnSpacing = _a.columnSpacing, rowSpacing = _a.rowSpacing, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, labelColor = _a.labelColor, labelStyle = _a.labelStyle, labelSx = _a.labelSx, dividerColor = _a.dividerColor, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, ellipsis = _a.ellipsis, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items, onCopyToClipboard = _a.onCopyToClipboard;
1822
- var sizeProps = useMemo(function () {
1823
- var value = {};
1824
- if (typeof cols === 'number') {
1825
- value.xs = 12 / cols;
1826
- }
1827
- else {
1828
- if (cols.xs)
1829
- value.xs = 12 / cols.xs;
1830
- if (cols.sm)
1831
- value.sm = 12 / cols.sm;
1832
- if (cols.md)
1833
- value.md = 12 / cols.md;
1834
- if (cols.lg)
1835
- value.lg = 12 / cols.lg;
1836
- if (cols.xl)
1837
- value.xl = 12 / cols.xl;
1838
- }
1839
- return value;
1840
- }, [cols]);
1841
- return (React.createElement(Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, items.map(function (item, idx) {
1842
- if (item) {
1843
- var finalLabelColor = typographyColorToSxColor(item.type === 'divider' ? item.dividerColor || dividerColor : item.labelColor || labelColor);
1844
- var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
1845
- var finalValueSx = combineSx(valueSx, item.valueSx);
1846
- var valueUnderlineStyle = valueUnderline
1847
- ? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
1848
- : undefined;
1849
- var finalSizeProps = __assign({}, sizeProps);
1850
- if (item.xs)
1851
- finalSizeProps.xs = item.xs;
1852
- if (item.sm)
1853
- finalSizeProps.sm = item.sm;
1854
- if (item.md)
1855
- finalSizeProps.md = item.md;
1856
- if (item.lg)
1857
- finalSizeProps.lg = item.lg;
1858
- if (item.xl)
1859
- finalSizeProps.xl = item.xl;
1914
+ var renderItems = useMemo(function () {
1915
+ return items.filter(function (item) { return !!item && (!item.onHide || !item.onHide(info)); }).map(function (item) {
1916
+ /** data */
1860
1917
  var data = undefined;
1861
1918
  if (item.name !== undefined) {
1862
1919
  if (info[item.name] !== undefined) {
@@ -1954,24 +2011,91 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
1954
2011
  }
1955
2012
  if (empty(data))
1956
2013
  data = item.onRenderEmpty ? item.onRenderEmpty(info) : React.createElement(React.Fragment, null, "\u00A0");
1957
- var copyToClipboardText_1 = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
2014
+ /** copyToClipboardText */
2015
+ var copyToClipboardText = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
2016
+ /** sizeProps */
2017
+ var sizeProps = {};
2018
+ if (typeof cols === 'number') {
2019
+ sizeProps.xs = 12 / cols;
2020
+ }
2021
+ else {
2022
+ if (cols.xs)
2023
+ sizeProps.xs = 12 / cols.xs;
2024
+ if (cols.sm)
2025
+ sizeProps.sm = 12 / cols.sm;
2026
+ if (cols.md)
2027
+ sizeProps.md = 12 / cols.md;
2028
+ if (cols.lg)
2029
+ sizeProps.lg = 12 / cols.lg;
2030
+ if (cols.xl)
2031
+ sizeProps.xl = 12 / cols.xl;
2032
+ }
2033
+ if (item.xs)
2034
+ sizeProps.xs = item.xs;
2035
+ if (item.sm)
2036
+ sizeProps.sm = item.sm;
2037
+ if (item.md)
2038
+ sizeProps.md = item.md;
2039
+ if (item.lg)
2040
+ sizeProps.lg = item.lg;
2041
+ if (item.xl)
2042
+ sizeProps.xl = item.xl;
2043
+ if (item.onXs)
2044
+ sizeProps.xs = item.onXs(info);
2045
+ if (item.onSm)
2046
+ sizeProps.sm = item.onSm(info);
2047
+ if (item.onMd)
2048
+ sizeProps.md = item.onMd(info);
2049
+ if (item.onLg)
2050
+ sizeProps.lg = item.onLg(info);
2051
+ if (item.onXl)
2052
+ sizeProps.xl = item.onXl(info);
2053
+ return { item: item, data: data, copyToClipboardText: copyToClipboardText, sizeProps: sizeProps };
2054
+ });
2055
+ }, [info, items, cols]);
2056
+ var content = useMemo(function () {
2057
+ return renderItems.map(function (_a, idx) {
2058
+ var item = _a.item, data = _a.data, copyToClipboardText = _a.copyToClipboardText, sizeProps = _a.sizeProps;
2059
+ var finalLabelColor = typographyColorToSxColor(item.type === 'divider' ? item.dividerColor || dividerColor : item.labelColor || labelColor);
2060
+ var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
2061
+ var finalValueSx = combineSx(valueSx, item.valueSx);
2062
+ var valueUnderlineStyle = valueUnderline
2063
+ ? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
2064
+ : undefined;
1958
2065
  return item.type === 'divider' ? (React.createElement(Grid, { key: idx, item: true, xs: 12 },
1959
2066
  React.createElement(Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
1960
2067
  item.icon && (React.createElement(PdgIcon, { sx: { color: item.dividerColor || dividerColor }, fontSize: 'small' }, item.icon)),
1961
2068
  item.label && (React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
1962
2069
  item.dividerLine && (React.createElement(React.Fragment, null, item.icon || item.label ? (React.createElement("div", { style: { flex: 1, paddingLeft: 5 } },
1963
- React.createElement(Line, null))) : (React.createElement(Line, null))))))) : (React.createElement(Grid, __assign({ key: idx, item: true }, finalSizeProps, { className: item.className, style: item.style, sx: item.sx }),
2070
+ React.createElement(Line, null))) : (React.createElement(Line, null))))))) : (React.createElement(Grid, __assign({ key: idx, item: true }, sizeProps, { className: item.className, style: item.style, sx: item.sx }),
1964
2071
  React.createElement(Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
1965
2072
  item.icon && (React.createElement(PdgIcon, { sx: { color: finalLabelColor }, fontSize: 'small' }, "CalendarMonth")),
1966
2073
  React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
1967
2074
  React.createElement(ValueWrap, { className: classNames(valueClassName, item.valueClassName), style: __assign(__assign(__assign({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx },
1968
2075
  item.ellipsis || ellipsis ? React.createElement(ValueEllipsis, null, data) : React.createElement(Value, null, data),
1969
- item.clipboard && notEmpty(copyToClipboardText_1) && (React.createElement(ValueClipboard, null,
1970
- React.createElement(CopyToClipboard, { text: copyToClipboardText_1, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText_1); } : undefined },
2076
+ item.clipboard && notEmpty(copyToClipboardText) && (React.createElement(ValueClipboard, null,
2077
+ React.createElement(CopyToClipboard, { text: copyToClipboardText, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText); } : undefined },
1971
2078
  React.createElement(ClipboardIconButton, __assign({ size: 'small', color: 'primary' }, item.clipboardProps),
1972
2079
  React.createElement(PdgIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
1973
- }
1974
- })));
2080
+ });
2081
+ }, [
2082
+ dividerColor,
2083
+ ellipsis,
2084
+ labelClassName,
2085
+ labelColor,
2086
+ labelStyle,
2087
+ labelSx,
2088
+ onCopyToClipboard,
2089
+ renderItems,
2090
+ valueClassName,
2091
+ valueStyle,
2092
+ valueSx,
2093
+ valueUnderline,
2094
+ ]);
2095
+ /********************************************************************************************************************
2096
+ * Render
2097
+ * ******************************************************************************************************************/
2098
+ return (React.createElement(Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, content));
1975
2099
  };
1976
2100
  InfoTable.displayName = 'InfoTable';
1977
2101
  InfoTable.defaultProps = InfoTableDefaultProps;export{InfoTable,InfoTableDefaultProps,SearchTable,SearchTableDefaultProps,Table,TableButton,TableButtonDefaultProps,TableDefaultProps,TableMenuButton,TableMenuButtonDefaultProps};