@tanstack/table-core 8.0.0-alpha.87 → 8.0.0-alpha.88

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.
@@ -5,7 +5,6 @@ export * from './core/column';
5
5
  export * from './core/headers';
6
6
  export * from './core/row';
7
7
  export * from './features/ColumnSizing';
8
- export * from './features/ColumnSizing';
9
8
  export * from './features/Expanding';
10
9
  export * from './features/Filters';
11
10
  export * from './features/Grouping';
@@ -15,7 +14,6 @@ export * from './features/Pinning';
15
14
  export * from './features/RowSelection';
16
15
  export * from './features/Sorting';
17
16
  export * from './features/Visibility';
18
- export * from './features/Expanding';
19
17
  export * from './filterFns';
20
18
  export * from './sortingFns';
21
19
  export * from './aggregationFns';
@@ -114,7 +114,7 @@
114
114
  }
115
115
  }
116
116
 
117
- let column = { ...columnDef,
117
+ let column = {
118
118
  id: "" + id,
119
119
  accessorFn,
120
120
  parent: parent,
@@ -878,8 +878,12 @@
878
878
  getIsAllRowsExpanded: () => {
879
879
  const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
880
880
 
881
- if (expanded === true) {
882
- return true;
881
+ if (typeof expanded === 'boolean') {
882
+ return expanded === true;
883
+ }
884
+
885
+ if (!Object.keys(expanded).length) {
886
+ return false;
883
887
  } // If any row is not expanded, return false
884
888
 
885
889
 
@@ -2690,8 +2694,8 @@
2690
2694
  },
2691
2695
  createRow: (row, instance) => {
2692
2696
  return {
2693
- _getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
2694
- return row.getAllCells().filter(cell => cell.column.getIsVisible());
2697
+ _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2698
+ return cells.filter(cell => cell.column.getIsVisible());
2695
2699
  }, {
2696
2700
  key: "development" === 'production' ,
2697
2701
  debug: () => {
@@ -3042,13 +3046,15 @@
3042
3046
  row,
3043
3047
  column,
3044
3048
  getValue: () => row.getValue(columnId),
3045
- renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3046
- instance,
3047
- column,
3048
- row,
3049
- cell: cell,
3050
- getValue: cell.getValue
3051
- }) : null
3049
+ renderCell: () => {
3050
+ return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3051
+ instance,
3052
+ column,
3053
+ row,
3054
+ cell: cell,
3055
+ getValue: cell.getValue
3056
+ }) : null;
3057
+ }
3052
3058
  };
3053
3059
 
3054
3060
  instance._features.forEach(feature => {
@@ -3123,27 +3129,23 @@
3123
3129
  flatRows: [],
3124
3130
  rowsById: {}
3125
3131
  };
3126
- let rows;
3127
- let row;
3128
- let originalRow;
3129
3132
 
3130
3133
  const accessRows = function (originalRows, depth, parent) {
3131
3134
  if (depth === void 0) {
3132
3135
  depth = 0;
3133
3136
  }
3134
3137
 
3135
- rows = [];
3138
+ const rows = [];
3136
3139
 
3137
3140
  for (let i = 0; i < originalRows.length; i++) {
3138
- originalRow = originalRows[i]; // This could be an expensive check at scale, so we should move it somewhere else, but where?
3141
+ // This could be an expensive check at scale, so we should move it somewhere else, but where?
3139
3142
  // if (!id) {
3140
3143
  // if ("development" !== 'production') {
3141
3144
  // throw new Error(`getRowId expected an ID, but got ${id}`)
3142
3145
  // }
3143
3146
  // }
3144
3147
  // Make the row
3145
-
3146
- row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3148
+ const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3147
3149
 
3148
3150
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3149
3151
 
@@ -3154,7 +3156,7 @@
3154
3156
  if (instance.options.getSubRows) {
3155
3157
  var _row$originalSubRows;
3156
3158
 
3157
- row.originalSubRows = instance.options.getSubRows(originalRow, i); // Then recursively access them
3159
+ row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3158
3160
 
3159
3161
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3160
3162
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);