@tanstack/react-table 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.
@@ -124,7 +124,7 @@ function createColumn(instance, columnDef, depth, parent) {
124
124
  throw new Error();
125
125
  }
126
126
 
127
- let column = { ...columnDef,
127
+ let column = {
128
128
  id: "" + id,
129
129
  accessorFn,
130
130
  parent: parent,
@@ -888,8 +888,12 @@ const Expanding = {
888
888
  getIsAllRowsExpanded: () => {
889
889
  const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
890
890
 
891
- if (expanded === true) {
892
- return true;
891
+ if (typeof expanded === 'boolean') {
892
+ return expanded === true;
893
+ }
894
+
895
+ if (!Object.keys(expanded).length) {
896
+ return false;
893
897
  } // If any row is not expanded, return false
894
898
 
895
899
 
@@ -2700,8 +2704,8 @@ const Visibility = {
2700
2704
  },
2701
2705
  createRow: (row, instance) => {
2702
2706
  return {
2703
- _getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
2704
- return row.getAllCells().filter(cell => cell.column.getIsVisible());
2707
+ _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2708
+ return cells.filter(cell => cell.column.getIsVisible());
2705
2709
  }, {
2706
2710
  key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
2707
2711
  debug: () => {
@@ -3054,13 +3058,15 @@ function createCell(instance, row, column, columnId) {
3054
3058
  row,
3055
3059
  column,
3056
3060
  getValue: () => row.getValue(columnId),
3057
- renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3058
- instance,
3059
- column,
3060
- row,
3061
- cell: cell,
3062
- getValue: cell.getValue
3063
- }) : null
3061
+ renderCell: () => {
3062
+ return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3063
+ instance,
3064
+ column,
3065
+ row,
3066
+ cell: cell,
3067
+ getValue: cell.getValue
3068
+ }) : null;
3069
+ }
3064
3070
  };
3065
3071
 
3066
3072
  instance._features.forEach(feature => {
@@ -3135,27 +3141,23 @@ function getCoreRowModel() {
3135
3141
  flatRows: [],
3136
3142
  rowsById: {}
3137
3143
  };
3138
- let rows;
3139
- let row;
3140
- let originalRow;
3141
3144
 
3142
3145
  const accessRows = function (originalRows, depth, parent) {
3143
3146
  if (depth === void 0) {
3144
3147
  depth = 0;
3145
3148
  }
3146
3149
 
3147
- rows = [];
3150
+ const rows = [];
3148
3151
 
3149
3152
  for (let i = 0; i < originalRows.length; i++) {
3150
- originalRow = originalRows[i]; // This could be an expensive check at scale, so we should move it somewhere else, but where?
3153
+ // This could be an expensive check at scale, so we should move it somewhere else, but where?
3151
3154
  // if (!id) {
3152
3155
  // if (process.env.NODE_ENV !== 'production') {
3153
3156
  // throw new Error(`getRowId expected an ID, but got ${id}`)
3154
3157
  // }
3155
3158
  // }
3156
3159
  // Make the row
3157
-
3158
- row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3160
+ const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3159
3161
 
3160
3162
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3161
3163
 
@@ -3166,7 +3168,7 @@ function getCoreRowModel() {
3166
3168
  if (instance.options.getSubRows) {
3167
3169
  var _row$originalSubRows;
3168
3170
 
3169
- row.originalSubRows = instance.options.getSubRows(originalRow, i); // Then recursively access them
3171
+ row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3170
3172
 
3171
3173
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3172
3174
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);