@tanstack/table-core 8.0.0-beta.5 → 8.0.0-beta.8
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/build/cjs/features/Expanding.js +4 -7
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Grouping.js +2 -2
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Pagination.js +6 -12
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/RowSelection.js +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/esm/index.js +14 -23
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +316 -316
- package/build/types/features/Pagination.d.ts +1 -1
- package/build/umd/index.development.js +14 -23
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/Expanding.ts +4 -8
- package/src/features/Grouping.ts +2 -2
- package/src/features/Pagination.ts +15 -18
- package/src/features/RowSelection.ts +1 -1
- package/src/features/Sorting.ts +1 -3
|
@@ -3,7 +3,6 @@ import { OnChangeFn, TableGenerics, TableInstance, RowModel, Updater } from '../
|
|
|
3
3
|
export declare type PaginationState = {
|
|
4
4
|
pageIndex: number;
|
|
5
5
|
pageSize: number;
|
|
6
|
-
pageCount?: number;
|
|
7
6
|
};
|
|
8
7
|
export declare type PaginationTableState = {
|
|
9
8
|
pagination: PaginationState;
|
|
@@ -12,6 +11,7 @@ export declare type PaginationInitialTableState = {
|
|
|
12
11
|
pagination?: Partial<PaginationState>;
|
|
13
12
|
};
|
|
14
13
|
export declare type PaginationOptions<TGenerics extends TableGenerics> = {
|
|
14
|
+
pageCount?: number;
|
|
15
15
|
manualPagination?: boolean;
|
|
16
16
|
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
17
17
|
autoResetPageIndex?: boolean;
|
|
@@ -818,7 +818,6 @@
|
|
|
818
818
|
getDefaultOptions: instance => {
|
|
819
819
|
return {
|
|
820
820
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
821
|
-
autoResetExpanded: true,
|
|
822
821
|
paginateExpandedRows: true
|
|
823
822
|
};
|
|
824
823
|
},
|
|
@@ -827,6 +826,8 @@
|
|
|
827
826
|
let queued = false;
|
|
828
827
|
return {
|
|
829
828
|
_autoResetExpanded: () => {
|
|
829
|
+
var _ref, _instance$options$aut;
|
|
830
|
+
|
|
830
831
|
if (!registered) {
|
|
831
832
|
instance._queue(() => {
|
|
832
833
|
registered = true;
|
|
@@ -835,11 +836,7 @@
|
|
|
835
836
|
return;
|
|
836
837
|
}
|
|
837
838
|
|
|
838
|
-
if (instance.options.autoResetAll
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
|
|
839
|
+
if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
|
|
843
840
|
if (queued) return;
|
|
844
841
|
queued = true;
|
|
845
842
|
|
|
@@ -903,7 +900,7 @@
|
|
|
903
900
|
});
|
|
904
901
|
return maxDepth;
|
|
905
902
|
},
|
|
906
|
-
getPreExpandedRowModel: () => instance.
|
|
903
|
+
getPreExpandedRowModel: () => instance.getSortedRowModel(),
|
|
907
904
|
getExpandedRowModel: () => {
|
|
908
905
|
if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
|
|
909
906
|
instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
|
|
@@ -1504,7 +1501,7 @@
|
|
|
1504
1501
|
|
|
1505
1502
|
instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
|
|
1506
1503
|
},
|
|
1507
|
-
getPreGroupedRowModel: () => instance.
|
|
1504
|
+
getPreGroupedRowModel: () => instance.getFilteredRowModel(),
|
|
1508
1505
|
getGroupedRowModel: () => {
|
|
1509
1506
|
if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
|
|
1510
1507
|
instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
|
|
@@ -1537,7 +1534,7 @@
|
|
|
1537
1534
|
getIsAggregated: () => {
|
|
1538
1535
|
var _row$subRows;
|
|
1539
1536
|
|
|
1540
|
-
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows)
|
|
1537
|
+
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1541
1538
|
},
|
|
1542
1539
|
renderAggregatedCell: () => {
|
|
1543
1540
|
{
|
|
@@ -1692,7 +1689,7 @@
|
|
|
1692
1689
|
setPageIndex: updater => {
|
|
1693
1690
|
instance.setPagination(old => {
|
|
1694
1691
|
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1695
|
-
const maxPageIndex = typeof
|
|
1692
|
+
const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
|
|
1696
1693
|
pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
|
|
1697
1694
|
return { ...old,
|
|
1698
1695
|
pageIndex
|
|
@@ -1721,9 +1718,9 @@
|
|
|
1721
1718
|
});
|
|
1722
1719
|
},
|
|
1723
1720
|
setPageCount: updater => instance.setPagination(old => {
|
|
1724
|
-
var
|
|
1721
|
+
var _instance$options$pag;
|
|
1725
1722
|
|
|
1726
|
-
let newPageCount = functionalUpdate(updater, (
|
|
1723
|
+
let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
|
|
1727
1724
|
|
|
1728
1725
|
if (typeof newPageCount === 'number') {
|
|
1729
1726
|
newPageCount = Math.max(-1, newPageCount);
|
|
@@ -1733,7 +1730,7 @@
|
|
|
1733
1730
|
pageCount: newPageCount
|
|
1734
1731
|
};
|
|
1735
1732
|
}),
|
|
1736
|
-
getPageOptions: memo(() => [instance.
|
|
1733
|
+
getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
|
|
1737
1734
|
let pageOptions = [];
|
|
1738
1735
|
|
|
1739
1736
|
if (pageCount && pageCount > 0) {
|
|
@@ -1787,15 +1784,9 @@
|
|
|
1787
1784
|
return instance._getPaginationRowModel();
|
|
1788
1785
|
},
|
|
1789
1786
|
getPageCount: () => {
|
|
1790
|
-
|
|
1791
|
-
pageCount
|
|
1792
|
-
} = instance.getState().pagination;
|
|
1793
|
-
|
|
1794
|
-
if (typeof pageCount !== 'undefined') {
|
|
1795
|
-
return pageCount;
|
|
1796
|
-
}
|
|
1787
|
+
var _instance$options$pag2;
|
|
1797
1788
|
|
|
1798
|
-
return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
|
|
1789
|
+
return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
|
|
1799
1790
|
}
|
|
1800
1791
|
};
|
|
1801
1792
|
}
|
|
@@ -2117,7 +2108,7 @@
|
|
|
2117
2108
|
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
|
|
2118
2109
|
}
|
|
2119
2110
|
}),
|
|
2120
|
-
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.
|
|
2111
|
+
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
2121
2112
|
if (!Object.keys(rowSelection).length) {
|
|
2122
2113
|
return {
|
|
2123
2114
|
rows: [],
|
|
@@ -2667,7 +2658,7 @@
|
|
|
2667
2658
|
|
|
2668
2659
|
instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
|
|
2669
2660
|
},
|
|
2670
|
-
getPreSortedRowModel: () => instance.
|
|
2661
|
+
getPreSortedRowModel: () => instance.getGroupedRowModel(),
|
|
2671
2662
|
getSortedRowModel: () => {
|
|
2672
2663
|
if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
|
|
2673
2664
|
instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
|