@underverse-ui/underverse 2.0.16 → 2.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 257,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -31843,24 +31843,19 @@ function DataTablePagination({
31843
31843
  pageSizeOptions,
31844
31844
  setCurPageSize,
31845
31845
  size,
31846
- align
31846
+ align,
31847
+ paginationRange
31847
31848
  }) {
31848
31849
  const totalPages = Math.ceil(totalItems / curPageSize);
31849
31850
  const pages = import_react35.default.useMemo(() => {
31850
- const result = [];
31851
- if (totalPages <= 5) {
31852
- for (let i = 1; i <= totalPages; i++) result.push(i);
31853
- return result;
31854
- }
31855
- result.push(1);
31856
- if (curPage > 3) result.push("...");
31857
- const start = Math.max(2, curPage - 1);
31858
- const end = Math.min(totalPages - 1, curPage + 1);
31859
- for (let i = start; i <= end; i++) result.push(i);
31860
- if (curPage < totalPages - 2) result.push("...");
31861
- result.push(totalPages);
31862
- return result;
31863
- }, [curPage, totalPages]);
31851
+ const edgeCount = Math.max(1, Math.floor(paginationRange ?? (totalPages < 14 ? 3 : 5)));
31852
+ if (totalPages <= edgeCount * 2 + 3) return Array.from({ length: totalPages }, (_, index) => index + 1);
31853
+ const pageNumbers = /* @__PURE__ */ new Set();
31854
+ for (let page = 1; page <= edgeCount; page += 1) pageNumbers.add(page);
31855
+ for (let page = totalPages - edgeCount + 1; page <= totalPages; page += 1) pageNumbers.add(page);
31856
+ for (let page = Math.max(1, curPage - 1); page <= Math.min(totalPages, curPage + 1); page += 1) pageNumbers.add(page);
31857
+ return Array.from(pageNumbers).sort((a, b) => a - b).flatMap((page, index, sortedPages) => index > 0 && page - sortedPages[index - 1] > 1 ? ["...", page] : [page]);
31858
+ }, [curPage, paginationRange, totalPages]);
31864
31859
  if (totalItems === 0) return null;
31865
31860
  const controlButtonSize = size === "lg" ? "md" : "sm";
31866
31861
  const navBtnClass = size === "sm" ? "h-6 w-6 p-0 rounded-full" : size === "lg" ? "h-8 w-8 p-0 rounded-full" : "h-7 w-7 p-0 rounded-full";
@@ -32646,6 +32641,7 @@ function DataTable({
32646
32641
  estimatedRowHeight,
32647
32642
  overscan = 8,
32648
32643
  paginationAlign = "right",
32644
+ paginationRange,
32649
32645
  enableHeaderAutoFit = true,
32650
32646
  labels,
32651
32647
  columnColorGroups,
@@ -32898,7 +32894,8 @@ function DataTable({
32898
32894
  pageSizeOptions,
32899
32895
  setCurPageSize,
32900
32896
  size,
32901
- align: paginationAlign
32897
+ align: paginationAlign,
32898
+ paginationRange
32902
32899
  }
32903
32900
  )
32904
32901
  ] });