@tanstack/table-core 8.12.0 → 8.13.1

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.
@@ -1480,6 +1480,7 @@ const Pagination = {
1480
1480
  };
1481
1481
  });
1482
1482
  };
1483
+ //deprecated
1483
1484
  table.setPageCount = updater => table.setPagination(old => {
1484
1485
  var _table$options$pageCo;
1485
1486
  let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
@@ -1520,6 +1521,12 @@ const Pagination = {
1520
1521
  return old + 1;
1521
1522
  });
1522
1523
  };
1524
+ table.firstPage = () => {
1525
+ return table.setPageIndex(0);
1526
+ };
1527
+ table.lastPage = () => {
1528
+ return table.setPageIndex(table.getPageCount() - 1);
1529
+ };
1523
1530
  table.getPrePaginationRowModel = () => table.getExpandedRowModel();
1524
1531
  table.getPaginationRowModel = () => {
1525
1532
  if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
@@ -1532,7 +1539,11 @@ const Pagination = {
1532
1539
  };
1533
1540
  table.getPageCount = () => {
1534
1541
  var _table$options$pageCo2;
1535
- return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1542
+ return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);
1543
+ };
1544
+ table.getRowCount = () => {
1545
+ var _table$options$rowCou;
1546
+ return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;
1536
1547
  };
1537
1548
  }
1538
1549
  };
@@ -1683,7 +1694,7 @@ const Pinning = {
1683
1694
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1684
1695
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
1685
1696
  }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells'));
1686
- row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
1697
+ row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
1687
1698
  const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
1688
1699
  ...d,
1689
1700
  position: 'left'
@@ -2472,8 +2483,9 @@ const Visibility = {
2472
2483
  }
2473
2484
  };
2474
2485
  column.getIsVisible = () => {
2475
- var _table$getState$colum, _table$getState$colum2;
2476
- return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2486
+ var _ref, _table$getState$colum;
2487
+ const childColumns = column.columns;
2488
+ return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;
2477
2489
  };
2478
2490
  column.getCanHide = () => {
2479
2491
  var _column$columnDef$ena, _table$options$enable;