@tanstack/table-core 8.7.8 → 8.8.0

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.
Files changed (50) hide show
  1. package/build/lib/aggregationFns.js.map +1 -1
  2. package/build/lib/columnHelper.js.map +1 -1
  3. package/build/lib/core/cell.js.map +1 -1
  4. package/build/lib/core/column.js.map +1 -1
  5. package/build/lib/core/headers.js.map +1 -1
  6. package/build/lib/core/row.d.ts +2 -1
  7. package/build/lib/core/row.js +2 -1
  8. package/build/lib/core/row.js.map +1 -1
  9. package/build/lib/core/table.js.map +1 -1
  10. package/build/lib/features/ColumnSizing.js.map +1 -1
  11. package/build/lib/features/Expanding.js.map +1 -1
  12. package/build/lib/features/Filters.js.map +1 -1
  13. package/build/lib/features/Grouping.js.map +1 -1
  14. package/build/lib/features/Ordering.js.map +1 -1
  15. package/build/lib/features/Pagination.js.map +1 -1
  16. package/build/lib/features/Pinning.js.map +1 -1
  17. package/build/lib/features/RowSelection.js +1 -1
  18. package/build/lib/features/RowSelection.js.map +1 -1
  19. package/build/lib/features/Sorting.js.map +1 -1
  20. package/build/lib/features/Visibility.js.map +1 -1
  21. package/build/lib/filterFns.js.map +1 -1
  22. package/build/lib/index.esm.js +16 -15
  23. package/build/lib/index.esm.js.map +1 -1
  24. package/build/lib/index.mjs +16 -15
  25. package/build/lib/index.mjs.map +1 -1
  26. package/build/lib/sortingFns.js.map +1 -1
  27. package/build/lib/utils/filterRowsUtils.js +6 -6
  28. package/build/lib/utils/filterRowsUtils.js.map +1 -1
  29. package/build/lib/utils/getCoreRowModel.js +2 -2
  30. package/build/lib/utils/getCoreRowModel.js.map +1 -1
  31. package/build/lib/utils/getExpandedRowModel.js.map +1 -1
  32. package/build/lib/utils/getFacetedMinMaxValues.js.map +1 -1
  33. package/build/lib/utils/getFacetedRowModel.js.map +1 -1
  34. package/build/lib/utils/getFacetedUniqueValues.js.map +1 -1
  35. package/build/lib/utils/getFilteredRowModel.js.map +1 -1
  36. package/build/lib/utils/getGroupedRowModel.js +5 -5
  37. package/build/lib/utils/getGroupedRowModel.js.map +1 -1
  38. package/build/lib/utils/getPaginationRowModel.js.map +1 -1
  39. package/build/lib/utils/getSortedRowModel.js.map +1 -1
  40. package/build/lib/utils.js.map +1 -1
  41. package/build/umd/index.development.js +16 -15
  42. package/build/umd/index.development.js.map +1 -1
  43. package/build/umd/index.production.js +1 -1
  44. package/build/umd/index.production.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/core/row.ts +4 -1
  47. package/src/features/RowSelection.ts +3 -1
  48. package/src/utils/filterRowsUtils.ts +19 -7
  49. package/src/utils/getCoreRowModel.ts +5 -3
  50. package/src/utils/getGroupedRowModel.ts +12 -4
@@ -2005,7 +2005,7 @@
2005
2005
  rowSelection
2006
2006
  } = table.getState();
2007
2007
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2008
- if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
2008
+ if (isAllPageRowsSelected && paginationFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
2009
2009
  isAllPageRowsSelected = false;
2010
2010
  }
2011
2011
  return isAllPageRowsSelected;
@@ -2823,12 +2823,13 @@
2823
2823
  return cell;
2824
2824
  }
2825
2825
 
2826
- const createRow = (table, id, original, rowIndex, depth, subRows) => {
2826
+ const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) => {
2827
2827
  let row = {
2828
2828
  id,
2829
2829
  index: rowIndex,
2830
2830
  original,
2831
2831
  depth,
2832
+ parentRow,
2832
2833
  _valuesCache: {},
2833
2834
  _uniqueValuesCache: {},
2834
2835
  getValue: columnId => {
@@ -2958,7 +2959,7 @@
2958
2959
  flatRows: [],
2959
2960
  rowsById: {}
2960
2961
  };
2961
- const accessRows = function (originalRows, depth, parent) {
2962
+ const accessRows = function (originalRows, depth, parentRow) {
2962
2963
  if (depth === void 0) {
2963
2964
  depth = 0;
2964
2965
  }
@@ -2972,7 +2973,7 @@
2972
2973
  // }
2973
2974
 
2974
2975
  // Make the row
2975
- const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth);
2976
+ const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow);
2976
2977
 
2977
2978
  // Keep track of every row in a flat array
2978
2979
  rowModel.flatRows.push(row);
@@ -3019,7 +3020,7 @@
3019
3020
  const newFilteredFlatRows = [];
3020
3021
  const newFilteredRowsById = {};
3021
3022
  const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;
3022
- const recurseFilterRows = function (rowsToFilter, depth) {
3023
+ const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3023
3024
  if (depth === void 0) {
3024
3025
  depth = 0;
3025
3026
  }
@@ -3029,10 +3030,10 @@
3029
3030
  for (let i = 0; i < rowsToFilter.length; i++) {
3030
3031
  var _row$subRows;
3031
3032
  let row = rowsToFilter[i];
3032
- const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3033
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3033
3034
  newRow.columnFilters = row.columnFilters;
3034
3035
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
3035
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3036
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3036
3037
  row = newRow;
3037
3038
  if (filterRow(row) && !newRow.subRows.length) {
3038
3039
  rows.push(row);
@@ -3070,7 +3071,7 @@
3070
3071
  const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;
3071
3072
 
3072
3073
  // Filters top level and nested rows
3073
- const recurseFilterRows = function (rowsToFilter, depth) {
3074
+ const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3074
3075
  if (depth === void 0) {
3075
3076
  depth = 0;
3076
3077
  }
@@ -3085,8 +3086,8 @@
3085
3086
  if (pass) {
3086
3087
  var _row$subRows2;
3087
3088
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
3088
- const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3089
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3089
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3090
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3090
3091
  row = newRow;
3091
3092
  }
3092
3093
  rows.push(row);
@@ -3397,7 +3398,7 @@
3397
3398
  // const nonGroupedRowsById: Record<RowId, Row> = {};
3398
3399
 
3399
3400
  // Recursively group the data
3400
- const groupUpRecursively = function (rows, depth, parentId) {
3401
+ const groupUpRecursively = function (rows, depth, parentRow, parentId) {
3401
3402
  if (depth === void 0) {
3402
3403
  depth = 0;
3403
3404
  }
@@ -3409,7 +3410,7 @@
3409
3410
  groupedFlatRows.push(row);
3410
3411
  groupedRowsById[row.id] = row;
3411
3412
  if (row.subRows) {
3412
- row.subRows = groupUpRecursively(row.subRows, depth + 1);
3413
+ row.subRows = groupUpRecursively(row.subRows, depth + 1, row);
3413
3414
  }
3414
3415
  return row;
3415
3416
  });
@@ -3426,11 +3427,11 @@
3426
3427
  id = parentId ? `${parentId}>${id}` : id;
3427
3428
 
3428
3429
  // First, Recurse to group sub rows before aggregation
3429
- const subRows = groupUpRecursively(groupedRows, depth + 1, id);
3430
+ const subRows = groupUpRecursively(groupedRows, depth + 1, parentRow, id);
3430
3431
 
3431
3432
  // Flatten the leaf rows of the rows in this group
3432
3433
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3433
- const row = createRow(table, id, leafRows[0].original, index, depth);
3434
+ const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentRow);
3434
3435
  Object.assign(row, {
3435
3436
  groupingColumnId: columnId,
3436
3437
  groupingValue,
@@ -3477,7 +3478,7 @@
3477
3478
  });
3478
3479
  return aggregatedGroupedRows;
3479
3480
  };
3480
- const groupedRows = groupUpRecursively(rowModel.rows, 0, '');
3481
+ const groupedRows = groupUpRecursively(rowModel.rows, 0, undefined, '');
3481
3482
  groupedRows.forEach(subRow => {
3482
3483
  groupedFlatRows.push(subRow);
3483
3484
  groupedRowsById[subRow.id] = subRow;