@pdg/react-table 1.0.16 → 1.0.18

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
@@ -8841,6 +8841,8 @@ var Table = React__default.forwardRef(function (_a, ref) {
8841
8841
  }
8842
8842
  }, [onSortChange]);
8843
8843
  // Memo --------------------------------------------------------------------------------------------------------------
8844
+ var isNoData = useMemo(function () { return !!sortableItems && sortableItems.length <= 0; }, [sortableItems]);
8845
+ var finalPagingHeight = useMemo(function () { return (paging && paging.total > 0 ? pagingHeight || 0 : 0); }, [paging, pagingHeight]);
8844
8846
  var style = useMemo(function () {
8845
8847
  if (fullHeight) {
8846
8848
  return __assign$1(__assign$1({ width: '100%' }, initStyle), { flex: 1, justifyContent: 'flex-end', height: '100%', display: 'flex', flexDirection: 'column', position: 'relative' });
@@ -8852,19 +8854,24 @@ var Table = React__default.forwardRef(function (_a, ref) {
8852
8854
  var simpleBarStyle = useMemo(function () {
8853
8855
  if (fullHeight) {
8854
8856
  return {
8855
- height: (containerHeight || 0) - (pagingHeight || 0) - 2,
8857
+ height: (containerHeight || 0) - (finalPagingHeight || 0) - 2,
8856
8858
  flex: 1,
8857
8859
  position: 'absolute',
8858
8860
  top: 1,
8859
8861
  left: 0,
8860
8862
  right: 0,
8861
- marginBottom: pagingHeight || 0,
8863
+ marginBottom: finalPagingHeight || 0,
8862
8864
  };
8863
8865
  }
8864
8866
  else {
8865
8867
  return { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
8866
8868
  }
8867
- }, [containerHeight, fullHeight, height, maxHeight, minHeight, pagingHeight]);
8869
+ }, [fullHeight, containerHeight, finalPagingHeight, height, minHeight, maxHeight]);
8870
+ var tableStyle = useMemo(function () {
8871
+ if (fullHeight && isNoData) {
8872
+ return { flex: 1, height: (containerHeight || 0) - finalPagingHeight - 2 };
8873
+ }
8874
+ }, [fullHeight, isNoData, containerHeight, finalPagingHeight]);
8868
8875
  var pagingStyle = useMemo(function () {
8869
8876
  var style = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
8870
8877
  if (fullHeight) {
@@ -8876,17 +8883,17 @@ var Table = React__default.forwardRef(function (_a, ref) {
8876
8883
  return finalColumns ? (React__default.createElement(Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className), variant: 'outlined', style: style, sx: sx },
8877
8884
  React__default.createElement(SimpleBar, { style: simpleBarStyle },
8878
8885
  React__default.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd },
8879
- React__default.createElement(Table$1, { stickyHeader: stickyHeader, sx: tableSx },
8886
+ React__default.createElement(Table$1, { stickyHeader: !isNoData && stickyHeader, sx: tableSx, style: tableStyle },
8880
8887
  React__default.createElement(TableHead, null,
8881
8888
  React__default.createElement(TableRow, null, finalColumns.map(function (column, idx) { return (React__default.createElement(TableHeadCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))),
8882
8889
  React__default.createElement(TableBody, null, sortableItems ? (sortableItems.length > 0 ? (React__default.createElement(SortableContext, { items: sortableItems, strategy: verticalListSortingStrategy }, sortableItems.map(function (item, idx) { return (React__default.createElement(TableBodyRow, { key: item.id, className: classNames(!!showOddColor && 'odd-color', !!showEvenColor && 'even-color'), hover: true, sx: onGetBodyRowSx ? onGetBodyRowSx(item, idx) : undefined, id: item.id, index: idx, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, sortable: sortable, columns: finalColumns, item: item, onClick: onClick })); }))) : (React__default.createElement(StyledBodyRow$1, null,
8883
- React__default.createElement(TableCell, { colSpan: finalColumns.length }, noData ? (noData) : (React__default.createElement(StyledNoDataDiv, null,
8890
+ React__default.createElement(TableCell, { colSpan: finalColumns.length, style: { flex: 1 } }, noData ? (noData) : (React__default.createElement(StyledNoDataDiv, null,
8884
8891
  React__default.createElement("div", null,
8885
8892
  React__default.createElement(Icon, null, "error")),
8886
8893
  React__default.createElement("div", null, "\uAC80\uC0C9\uB41C \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."))))))) : undefined),
8887
- footer && (React__default.createElement(TableFooter, null,
8894
+ !isNoData && footer && (React__default.createElement(TableFooter, null,
8888
8895
  React__default.createElement(TableRow, null, finalColumns.map(function (column, idx) { return (React__default.createElement(TableFooterCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))))))),
8889
- paging && (React__default.createElement(Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
8896
+ paging && paging.total > 0 && (React__default.createElement(Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
8890
8897
  React__default.createElement(TablePagination, { className: pagination === null || pagination === void 0 ? void 0 : pagination.className, style: pagination === null || pagination === void 0 ? void 0 : pagination.style, sx: pagination === null || pagination === void 0 ? void 0 : pagination.sx, paging: paging, align: pagingAlign, onChange: onPageChange }))))) : null;
8891
8898
  });
8892
8899
  Table.displayName = 'Table';