@tanstack/svelte-table 8.2.2 → 8.2.5

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.
@@ -962,7 +962,7 @@ const Expanding = {
962
962
  getCanExpand: () => {
963
963
  var _table$options$getRow, _table$options$enable, _row$subRows;
964
964
 
965
- return ((_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : true) && ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
965
+ return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
966
966
  },
967
967
  getToggleExpandedHandler: () => {
968
968
  const canExpand = row.getCanExpand();
@@ -1992,6 +1992,10 @@ const RowSelection = {
1992
1992
 
1993
1993
  if (value) {
1994
1994
  preGroupedFlatRows.forEach(row => {
1995
+ if (!row.getCanSelect()) {
1996
+ return;
1997
+ }
1998
+
1995
1999
  rowSelection[row.id] = true;
1996
2000
  });
1997
2001
  } else {
@@ -2255,8 +2259,8 @@ const RowSelection = {
2255
2259
  const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2256
2260
  var _row$subRows;
2257
2261
 
2258
- const row = table.getRow(id);
2259
- row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
2262
+ const row = table.getRow(id); // const isGrouped = row.getIsGrouped()
2263
+ // if ( // TODO: enforce grouping row selection rules
2260
2264
  // !isGrouped ||
2261
2265
  // (isGrouped && table.options.enableGroupingRowSelection)
2262
2266
  // ) {
@@ -2266,7 +2270,9 @@ const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2266
2270
  Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
2267
2271
  }
2268
2272
 
2269
- selectedRowIds[id] = true;
2273
+ if (row.getCanSelect()) {
2274
+ selectedRowIds[id] = true;
2275
+ }
2270
2276
  } else {
2271
2277
  delete selectedRowIds[id];
2272
2278
  } // }
@@ -3569,9 +3575,20 @@ function getGroupedRowModel() {
3569
3575
  depth = 0;
3570
3576
  }
3571
3577
 
3572
- // This is the last level, just return the rows
3573
- if (depth === existingGrouping.length) {
3574
- return rows;
3578
+ // Grouping depth has been been met
3579
+ // Stop grouping and simply rewrite thd depth and row relationships
3580
+ if (depth >= existingGrouping.length) {
3581
+ return rows.map(row => {
3582
+ row.depth = depth;
3583
+ groupedFlatRows.push(row);
3584
+ groupedRowsById[row.id] = row;
3585
+
3586
+ if (row.subRows) {
3587
+ row.subRows = groupUpRecursively(row.subRows, depth + 1);
3588
+ }
3589
+
3590
+ return row;
3591
+ });
3575
3592
  }
3576
3593
 
3577
3594
  const columnId = existingGrouping[depth]; // Group the rows together for this level