@kne/table-page 0.1.10 → 0.1.11

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.
@@ -1007,7 +1007,8 @@ const observeViewportIntersection = (element, onChange) => {
1007
1007
  };
1008
1008
 
1009
1009
  const _excluded$2 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "renderMobile", "context", "sticky", "scrollTopInset", "stickyOffset", "getStickyContainer", "headerStyle", "pagination", "sortRender", "mobileSortToolbar", "name", "controllerOpen", "tableServerApis", "scroll", "summary", "size"],
1010
- _excluded2$2 = ["getContainer"];
1010
+ _excluded2$2 = ["y"],
1011
+ _excluded3 = ["getContainer"];
1011
1012
  const mapJustifyToAlign = justify => {
1012
1013
  if (justify === 'center') {
1013
1014
  return 'center';
@@ -1328,6 +1329,7 @@ const Table = p => {
1328
1329
  })
1329
1330
  });
1330
1331
  }, [context, dataSource, rowKey, rowSelection, hasFixedColumn]);
1332
+ const hasData = Array.isArray(dataSource) && dataSource.length > 0;
1331
1333
  const tableScroll = useMemo(() => {
1332
1334
  let x;
1333
1335
  if (hasFixedColumn) {
@@ -1335,11 +1337,16 @@ const Table = p => {
1335
1337
  } else if (controllerOpen) {
1336
1338
  x = Math.max(tableWidth, totalWidth);
1337
1339
  }
1338
- return Object.assign({}, x != null ? {
1340
+ const nextScroll = Object.assign({}, x != null ? {
1339
1341
  x
1340
1342
  } : {}, scroll);
1341
- }, [hasFixedColumn, controllerOpen, totalWidth, tableWidth, scroll]);
1342
- const hasScrollY = (scroll == null ? void 0 : scroll.y) != null && (scroll == null ? void 0 : scroll.y) !== false;
1343
+ if (!hasData && nextScroll.y != null) {
1344
+ const rest = _objectWithoutPropertiesLoose(nextScroll, _excluded2$2);
1345
+ return rest;
1346
+ }
1347
+ return nextScroll;
1348
+ }, [hasFixedColumn, controllerOpen, totalWidth, tableWidth, scroll, hasData]);
1349
+ const hasScrollY = hasData && (scroll == null ? void 0 : scroll.y) != null && (scroll == null ? void 0 : scroll.y) !== false;
1343
1350
  const isStickyViewport = !!sticky && !hasScrollY;
1344
1351
  const resolvedScrollTopInset = resolveScrollTopInset(scrollTopInset, stickyOffset);
1345
1352
  const stickyGetContainer = useMemo(() => {
@@ -1360,7 +1367,7 @@ const Table = p => {
1360
1367
  }
1361
1368
  const config = typeof sticky === 'object' ? Object.assign({}, sticky) : {};
1362
1369
  if (hasScrollY) {
1363
- const scrollSticky = _objectWithoutPropertiesLoose(config, _excluded2$2);
1370
+ const scrollSticky = _objectWithoutPropertiesLoose(config, _excluded3);
1364
1371
  return Object.assign({
1365
1372
  offsetHeader: 0
1366
1373
  }, scrollSticky);
@@ -2199,7 +2206,7 @@ const TablePageInnerContent = withLocale(_ref => {
2199
2206
  });
2200
2207
  const paginationConfig = useMemo(() => {
2201
2208
  var _mobilePagination$sho;
2202
- if (!pagination.open) {
2209
+ if (!pagination.open || !(formatData.total > 0)) {
2203
2210
  return null;
2204
2211
  }
2205
2212
  const defaultShowTotal = total => /*#__PURE__*/jsxs(Fragment, {