@pdg/react-table 1.0.15 → 1.0.17

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.
@@ -17,6 +17,7 @@ export interface SearchTableTableProps<T = TableItem> extends Omit<TableProps<T>
17
17
  export interface SearchTableProps extends CommonSxProps {
18
18
  color?: SearchProps['color'];
19
19
  hash?: boolean;
20
+ stickyHeader?: boolean;
20
21
  fullHeight?: boolean;
21
22
  search?: SearchTableSearchProps;
22
23
  table: SearchTableTableProps;
package/dist/index.esm.js CHANGED
@@ -8850,21 +8850,22 @@ var Table = React__default.forwardRef(function (_a, ref) {
8850
8850
  }
8851
8851
  }, [initStyle, fullHeight]);
8852
8852
  var simpleBarStyle = useMemo(function () {
8853
+ var finalPagingHeight = paging && paging.total > 0 ? pagingHeight : undefined;
8853
8854
  if (fullHeight) {
8854
8855
  return {
8855
- height: (containerHeight || 0) - (pagingHeight || 0) - 2,
8856
+ height: (containerHeight || 0) - (finalPagingHeight || 0) - 2,
8856
8857
  flex: 1,
8857
8858
  position: 'absolute',
8858
8859
  top: 1,
8859
8860
  left: 0,
8860
8861
  right: 0,
8861
- marginBottom: pagingHeight || 0,
8862
+ marginBottom: finalPagingHeight || 0,
8862
8863
  };
8863
8864
  }
8864
8865
  else {
8865
8866
  return { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
8866
8867
  }
8867
- }, [containerHeight, fullHeight, height, maxHeight, minHeight, pagingHeight]);
8868
+ }, [paging, containerHeight, fullHeight, height, maxHeight, minHeight, pagingHeight]);
8868
8869
  var pagingStyle = useMemo(function () {
8869
8870
  var style = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
8870
8871
  if (fullHeight) {
@@ -8886,12 +8887,13 @@ var Table = React__default.forwardRef(function (_a, ref) {
8886
8887
  React__default.createElement("div", null, "\uAC80\uC0C9\uB41C \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."))))))) : undefined),
8887
8888
  footer && (React__default.createElement(TableFooter, null,
8888
8889
  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 },
8890
+ paging && paging.total > 0 && (React__default.createElement(Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
8890
8891
  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
8892
  });
8892
8893
  Table.displayName = 'Table';
8893
8894
  Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var SearchTable = React__default.forwardRef(function (_a, ref) {
8894
- var color = _a.color, hash = _a.hash, fullHeight = _a.fullHeight, search = _a.search, table = _a.table, betweenSearchTableComponent = _a.betweenSearchTableComponent, onGetData = _a.onGetData, onRequestHashChange = _a.onRequestHashChange,
8895
+ var _b, _c;
8896
+ 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,
8895
8897
  // ---------------------------------------------------------------------------------------------------------------
8896
8898
  className = _a.className, initStyle = _a.style, sx = _a.sx;
8897
8899
  var searchRef = useRef();
@@ -8919,11 +8921,11 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
8919
8921
  // Ref -------------------------------------------------------------------------------------------------------------
8920
8922
  var lastGetDataDataRef = useRef({});
8921
8923
  // State -----------------------------------------------------------------------------------------------------------
8922
- var _b = useState(true), isFirstSearchSubmit = _b[0], setIsFirstSearchSubmit = _b[1];
8923
- var _c = useState(), tableData = _c[0], setTableData = _c[1];
8924
+ var _d = useState(true), isFirstSearchSubmit = _d[0], setIsFirstSearchSubmit = _d[1];
8925
+ var _e = useState(), tableData = _e[0], setTableData = _e[1];
8924
8926
  // searchInfo ------------------------------------------------------------------------------------------------------
8925
8927
  var searchInfoFirstUseEffect = useRef(true);
8926
- var _d = useState(function () { return getSearchInfo(search); }), searchInfo = _d[0], setSearchInfo = _d[1];
8928
+ var _f = useState(function () { return getSearchInfo(search); }), searchInfo = _f[0], setSearchInfo = _f[1];
8927
8929
  useEffect(function () {
8928
8930
  if (searchInfoFirstUseEffect.current) {
8929
8931
  searchInfoFirstUseEffect.current = false;
@@ -8935,7 +8937,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
8935
8937
  }, [search]);
8936
8938
  // tableInfo -------------------------------------------------------------------------------------------------------
8937
8939
  var tableInfoFirstUseEffect = useRef(true);
8938
- var _e = useState(function () { return getTableInfo(table); }), tableInfo = _e[0], setTableInfo = _e[1];
8940
+ var _g = useState(function () { return getTableInfo(table); }), tableInfo = _g[0], setTableInfo = _g[1];
8939
8941
  useEffect(function () {
8940
8942
  if (tableInfoFirstUseEffect.current) {
8941
8943
  tableInfoFirstUseEffect.current = false;
@@ -9207,7 +9209,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
9207
9209
  searchInfo.searchGroups)),
9208
9210
  betweenSearchTableComponent && React__default.createElement(Grid, { item: true }, betweenSearchTableComponent),
9209
9211
  React__default.createElement(Grid, { item: true, style: tableContainerStyle },
9210
- React__default.createElement(Table, __assign$1({}, tableInfo.props, { fullHeight: fullHeight, ref: function (commands) {
9212
+ React__default.createElement(Table, __assign$1({}, 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) {
9211
9213
  if (tableInfo.ref) {
9212
9214
  if (typeof tableInfo.ref === 'function') {
9213
9215
  tableInfo.ref(commands);