@tanstack/table-core 8.0.0-beta.4 → 8.0.0-beta.7
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/RowSelection.js +4 -4
- 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/cjs/utils/getPaginationRowModel.js +19 -5
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/esm/index.js +30 -19
- 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/RowSelection.d.ts +2 -2
- package/build/umd/index.development.js +30 -19
- 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/RowSelection.ts +8 -6
- package/src/features/Sorting.ts +1 -3
- package/src/utils/getPaginationRowModel.ts +21 -6
package/build/esm/index.js
CHANGED
|
@@ -814,7 +814,6 @@ const Expanding = {
|
|
|
814
814
|
getDefaultOptions: instance => {
|
|
815
815
|
return {
|
|
816
816
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
817
|
-
autoResetExpanded: true,
|
|
818
817
|
paginateExpandedRows: true
|
|
819
818
|
};
|
|
820
819
|
},
|
|
@@ -823,6 +822,8 @@ const Expanding = {
|
|
|
823
822
|
let queued = false;
|
|
824
823
|
return {
|
|
825
824
|
_autoResetExpanded: () => {
|
|
825
|
+
var _ref, _instance$options$aut;
|
|
826
|
+
|
|
826
827
|
if (!registered) {
|
|
827
828
|
instance._queue(() => {
|
|
828
829
|
registered = true;
|
|
@@ -831,11 +832,7 @@ const Expanding = {
|
|
|
831
832
|
return;
|
|
832
833
|
}
|
|
833
834
|
|
|
834
|
-
if (instance.options.autoResetAll
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
|
|
835
|
+
if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
|
|
839
836
|
if (queued) return;
|
|
840
837
|
queued = true;
|
|
841
838
|
|
|
@@ -899,7 +896,7 @@ const Expanding = {
|
|
|
899
896
|
});
|
|
900
897
|
return maxDepth;
|
|
901
898
|
},
|
|
902
|
-
getPreExpandedRowModel: () => instance.
|
|
899
|
+
getPreExpandedRowModel: () => instance.getSortedRowModel(),
|
|
903
900
|
getExpandedRowModel: () => {
|
|
904
901
|
if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
|
|
905
902
|
instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
|
|
@@ -1500,7 +1497,7 @@ const Grouping = {
|
|
|
1500
1497
|
|
|
1501
1498
|
instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
|
|
1502
1499
|
},
|
|
1503
|
-
getPreGroupedRowModel: () => instance.
|
|
1500
|
+
getPreGroupedRowModel: () => instance.getFilteredRowModel(),
|
|
1504
1501
|
getGroupedRowModel: () => {
|
|
1505
1502
|
if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
|
|
1506
1503
|
instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
|
|
@@ -1533,7 +1530,7 @@ const Grouping = {
|
|
|
1533
1530
|
getIsAggregated: () => {
|
|
1534
1531
|
var _row$subRows;
|
|
1535
1532
|
|
|
1536
|
-
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows)
|
|
1533
|
+
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1537
1534
|
},
|
|
1538
1535
|
renderAggregatedCell: () => {
|
|
1539
1536
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -2018,11 +2015,11 @@ const RowSelection = {
|
|
|
2018
2015
|
});
|
|
2019
2016
|
},
|
|
2020
2017
|
toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
|
|
2021
|
-
typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2018
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2022
2019
|
const rowSelection = { ...old
|
|
2023
2020
|
};
|
|
2024
2021
|
instance.getRowModel().rows.forEach(row => {
|
|
2025
|
-
mutateRowIsSelected(rowSelection, row.id,
|
|
2022
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
|
|
2026
2023
|
});
|
|
2027
2024
|
return rowSelection;
|
|
2028
2025
|
}),
|
|
@@ -2113,7 +2110,7 @@ const RowSelection = {
|
|
|
2113
2110
|
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
|
|
2114
2111
|
}
|
|
2115
2112
|
}),
|
|
2116
|
-
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.
|
|
2113
|
+
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
2117
2114
|
if (!Object.keys(rowSelection).length) {
|
|
2118
2115
|
return {
|
|
2119
2116
|
rows: [],
|
|
@@ -2177,7 +2174,7 @@ const RowSelection = {
|
|
|
2177
2174
|
},
|
|
2178
2175
|
getIsSomePageRowsSelected: () => {
|
|
2179
2176
|
const paginationFlatRows = instance.getPaginationRowModel().flatRows;
|
|
2180
|
-
return instance.getIsAllPageRowsSelected() ? false :
|
|
2177
|
+
return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
2181
2178
|
},
|
|
2182
2179
|
getToggleAllRowsSelectedHandler: () => {
|
|
2183
2180
|
return e => {
|
|
@@ -2663,7 +2660,7 @@ const Sorting = {
|
|
|
2663
2660
|
|
|
2664
2661
|
instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
|
|
2665
2662
|
},
|
|
2666
|
-
getPreSortedRowModel: () => instance.
|
|
2663
|
+
getPreSortedRowModel: () => instance.getGroupedRowModel(),
|
|
2667
2664
|
getSortedRowModel: () => {
|
|
2668
2665
|
if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
|
|
2669
2666
|
instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
|
|
@@ -3815,20 +3812,34 @@ function getPaginationRowModel(opts) {
|
|
|
3815
3812
|
const pageStart = pageSize * pageIndex;
|
|
3816
3813
|
const pageEnd = pageStart + pageSize;
|
|
3817
3814
|
rows = rows.slice(pageStart, pageEnd);
|
|
3815
|
+
let paginatedRowModel;
|
|
3818
3816
|
|
|
3819
3817
|
if (!instance.options.paginateExpandedRows) {
|
|
3820
|
-
|
|
3818
|
+
paginatedRowModel = expandRows({
|
|
3821
3819
|
rows,
|
|
3822
3820
|
flatRows,
|
|
3823
3821
|
rowsById
|
|
3824
3822
|
});
|
|
3823
|
+
} else {
|
|
3824
|
+
paginatedRowModel = {
|
|
3825
|
+
rows,
|
|
3826
|
+
flatRows,
|
|
3827
|
+
rowsById
|
|
3828
|
+
};
|
|
3825
3829
|
}
|
|
3826
3830
|
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
+
paginatedRowModel.flatRows = [];
|
|
3832
|
+
|
|
3833
|
+
const handleRow = row => {
|
|
3834
|
+
paginatedRowModel.flatRows.push(row);
|
|
3835
|
+
|
|
3836
|
+
if (row.subRows.length) {
|
|
3837
|
+
row.subRows.forEach(handleRow);
|
|
3838
|
+
}
|
|
3831
3839
|
};
|
|
3840
|
+
|
|
3841
|
+
paginatedRowModel.rows.forEach(handleRow);
|
|
3842
|
+
return paginatedRowModel;
|
|
3832
3843
|
}, {
|
|
3833
3844
|
key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',
|
|
3834
3845
|
debug: () => {
|