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