@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
@@ -2000,7 +2000,7 @@ const RowSelection = {
2000
2000
  rowSelection
2001
2001
  } = table.getState();
2002
2002
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2003
- if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
2003
+ if (isAllPageRowsSelected && paginationFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
2004
2004
  isAllPageRowsSelected = false;
2005
2005
  }
2006
2006
  return isAllPageRowsSelected;
@@ -2819,12 +2819,13 @@ function createCell(table, row, column, columnId) {
2819
2819
  return cell;
2820
2820
  }
2821
2821
 
2822
- const createRow = (table, id, original, rowIndex, depth, subRows) => {
2822
+ const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) => {
2823
2823
  let row = {
2824
2824
  id,
2825
2825
  index: rowIndex,
2826
2826
  original,
2827
2827
  depth,
2828
+ parentRow,
2828
2829
  _valuesCache: {},
2829
2830
  _uniqueValuesCache: {},
2830
2831
  getValue: columnId => {
@@ -2954,7 +2955,7 @@ function getCoreRowModel() {
2954
2955
  flatRows: [],
2955
2956
  rowsById: {}
2956
2957
  };
2957
- const accessRows = function (originalRows, depth, parent) {
2958
+ const accessRows = function (originalRows, depth, parentRow) {
2958
2959
  if (depth === void 0) {
2959
2960
  depth = 0;
2960
2961
  }
@@ -2968,7 +2969,7 @@ function getCoreRowModel() {
2968
2969
  // }
2969
2970
 
2970
2971
  // Make the row
2971
- const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth);
2972
+ const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow);
2972
2973
 
2973
2974
  // Keep track of every row in a flat array
2974
2975
  rowModel.flatRows.push(row);
@@ -3015,7 +3016,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3015
3016
  const newFilteredFlatRows = [];
3016
3017
  const newFilteredRowsById = {};
3017
3018
  const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;
3018
- const recurseFilterRows = function (rowsToFilter, depth) {
3019
+ const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3019
3020
  if (depth === void 0) {
3020
3021
  depth = 0;
3021
3022
  }
@@ -3025,10 +3026,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3025
3026
  for (let i = 0; i < rowsToFilter.length; i++) {
3026
3027
  var _row$subRows;
3027
3028
  let row = rowsToFilter[i];
3028
- const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3029
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3029
3030
  newRow.columnFilters = row.columnFilters;
3030
3031
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
3031
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3032
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3032
3033
  row = newRow;
3033
3034
  if (filterRow(row) && !newRow.subRows.length) {
3034
3035
  rows.push(row);
@@ -3066,7 +3067,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3066
3067
  const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;
3067
3068
 
3068
3069
  // Filters top level and nested rows
3069
- const recurseFilterRows = function (rowsToFilter, depth) {
3070
+ const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3070
3071
  if (depth === void 0) {
3071
3072
  depth = 0;
3072
3073
  }
@@ -3081,8 +3082,8 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3081
3082
  if (pass) {
3082
3083
  var _row$subRows2;
3083
3084
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
3084
- const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3085
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3085
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3086
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3086
3087
  row = newRow;
3087
3088
  }
3088
3089
  rows.push(row);
@@ -3393,7 +3394,7 @@ function getGroupedRowModel() {
3393
3394
  // const nonGroupedRowsById: Record<RowId, Row> = {};
3394
3395
 
3395
3396
  // Recursively group the data
3396
- const groupUpRecursively = function (rows, depth, parentId) {
3397
+ const groupUpRecursively = function (rows, depth, parentRow, parentId) {
3397
3398
  if (depth === void 0) {
3398
3399
  depth = 0;
3399
3400
  }
@@ -3405,7 +3406,7 @@ function getGroupedRowModel() {
3405
3406
  groupedFlatRows.push(row);
3406
3407
  groupedRowsById[row.id] = row;
3407
3408
  if (row.subRows) {
3408
- row.subRows = groupUpRecursively(row.subRows, depth + 1);
3409
+ row.subRows = groupUpRecursively(row.subRows, depth + 1, row);
3409
3410
  }
3410
3411
  return row;
3411
3412
  });
@@ -3422,11 +3423,11 @@ function getGroupedRowModel() {
3422
3423
  id = parentId ? `${parentId}>${id}` : id;
3423
3424
 
3424
3425
  // First, Recurse to group sub rows before aggregation
3425
- const subRows = groupUpRecursively(groupedRows, depth + 1, id);
3426
+ const subRows = groupUpRecursively(groupedRows, depth + 1, parentRow, id);
3426
3427
 
3427
3428
  // Flatten the leaf rows of the rows in this group
3428
3429
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3429
- const row = createRow(table, id, leafRows[0].original, index, depth);
3430
+ const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentRow);
3430
3431
  Object.assign(row, {
3431
3432
  groupingColumnId: columnId,
3432
3433
  groupingValue,
@@ -3473,7 +3474,7 @@ function getGroupedRowModel() {
3473
3474
  });
3474
3475
  return aggregatedGroupedRows;
3475
3476
  };
3476
- const groupedRows = groupUpRecursively(rowModel.rows, 0, '');
3477
+ const groupedRows = groupUpRecursively(rowModel.rows, 0, undefined, '');
3477
3478
  groupedRows.forEach(subRow => {
3478
3479
  groupedFlatRows.push(subRow);
3479
3480
  groupedRowsById[subRow.id] = subRow;