@tanstack/react-table 8.7.6 → 8.7.9
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.
|
@@ -139,9 +139,10 @@
|
|
|
139
139
|
accessorFn = originalRow => {
|
|
140
140
|
let result = originalRow;
|
|
141
141
|
for (const key of accessorKey.split('.')) {
|
|
142
|
-
|
|
142
|
+
var _result;
|
|
143
|
+
result = (_result = result) == null ? void 0 : _result[key];
|
|
143
144
|
if (result === undefined) {
|
|
144
|
-
|
|
145
|
+
console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
return result;
|
|
@@ -633,9 +634,9 @@
|
|
|
633
634
|
},
|
|
634
635
|
getResizeHandler: () => {
|
|
635
636
|
const column = table.getColumn(header.column.id);
|
|
636
|
-
const canResize = column.getCanResize();
|
|
637
|
+
const canResize = column == null ? void 0 : column.getCanResize();
|
|
637
638
|
return e => {
|
|
638
|
-
if (!canResize) {
|
|
639
|
+
if (!column || !canResize) {
|
|
639
640
|
return;
|
|
640
641
|
}
|
|
641
642
|
e.persist == null ? void 0 : e.persist();
|
|
@@ -2034,7 +2035,7 @@
|
|
|
2034
2035
|
rowSelection
|
|
2035
2036
|
} = table.getState();
|
|
2036
2037
|
let isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
2037
|
-
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
|
|
2038
|
+
if (isAllPageRowsSelected && paginationFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
2038
2039
|
isAllPageRowsSelected = false;
|
|
2039
2040
|
}
|
|
2040
2041
|
return isAllPageRowsSelected;
|
|
@@ -2811,10 +2812,7 @@
|
|
|
2811
2812
|
getColumn: columnId => {
|
|
2812
2813
|
const column = table._getAllFlatColumnsById()[columnId];
|
|
2813
2814
|
if (!column) {
|
|
2814
|
-
{
|
|
2815
|
-
console.warn(`[Table] Column with id ${columnId} does not exist.`);
|
|
2816
|
-
}
|
|
2817
|
-
throw new Error();
|
|
2815
|
+
console.error(`[Table] Column with id '${columnId}' does not exist.`);
|
|
2818
2816
|
}
|
|
2819
2817
|
return column;
|
|
2820
2818
|
}
|
|
@@ -2868,7 +2866,7 @@
|
|
|
2868
2866
|
return row._valuesCache[columnId];
|
|
2869
2867
|
}
|
|
2870
2868
|
const column = table.getColumn(columnId);
|
|
2871
|
-
if (!column.accessorFn) {
|
|
2869
|
+
if (!(column != null && column.accessorFn)) {
|
|
2872
2870
|
return undefined;
|
|
2873
2871
|
}
|
|
2874
2872
|
row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
@@ -2879,7 +2877,7 @@
|
|
|
2879
2877
|
return row._uniqueValuesCache[columnId];
|
|
2880
2878
|
}
|
|
2881
2879
|
const column = table.getColumn(columnId);
|
|
2882
|
-
if (!column.accessorFn) {
|
|
2880
|
+
if (!(column != null && column.accessorFn)) {
|
|
2883
2881
|
return undefined;
|
|
2884
2882
|
}
|
|
2885
2883
|
if (!column.columnDef.getUniqueValues) {
|
|
@@ -3150,9 +3148,7 @@
|
|
|
3150
3148
|
var _filterFn$resolveFilt;
|
|
3151
3149
|
const column = table.getColumn(d.id);
|
|
3152
3150
|
if (!column) {
|
|
3153
|
-
|
|
3154
|
-
console.warn(`Table: Could not find a column to filter with columnId: ${d.id}`);
|
|
3155
|
-
}
|
|
3151
|
+
return;
|
|
3156
3152
|
}
|
|
3157
3153
|
const filterFn = column.getFilterFn();
|
|
3158
3154
|
if (!filterFn) {
|
|
@@ -3267,7 +3263,11 @@
|
|
|
3267
3263
|
}
|
|
3268
3264
|
|
|
3269
3265
|
function getFacetedUniqueValues() {
|
|
3270
|
-
return (table, columnId) => memo(() =>
|
|
3266
|
+
return (table, columnId) => memo(() => {
|
|
3267
|
+
var _table$getColumn;
|
|
3268
|
+
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
3269
|
+
}, facetedRowModel => {
|
|
3270
|
+
if (!facetedRowModel) return new Map();
|
|
3271
3271
|
let facetedUniqueValues = new Map();
|
|
3272
3272
|
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
3273
3273
|
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
@@ -3293,8 +3293,12 @@
|
|
|
3293
3293
|
}
|
|
3294
3294
|
|
|
3295
3295
|
function getFacetedMinMaxValues() {
|
|
3296
|
-
return (table, columnId) => memo(() =>
|
|
3296
|
+
return (table, columnId) => memo(() => {
|
|
3297
|
+
var _table$getColumn;
|
|
3298
|
+
return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
|
|
3299
|
+
}, facetedRowModel => {
|
|
3297
3300
|
var _facetedRowModel$flat;
|
|
3301
|
+
if (!facetedRowModel) return undefined;
|
|
3298
3302
|
const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
|
|
3299
3303
|
if (typeof firstValue === 'undefined') {
|
|
3300
3304
|
return undefined;
|
|
@@ -3331,10 +3335,14 @@
|
|
|
3331
3335
|
const sortedFlatRows = [];
|
|
3332
3336
|
|
|
3333
3337
|
// Filter out sortings that correspond to non existing columns
|
|
3334
|
-
const availableSorting = sortingState.filter(sort =>
|
|
3338
|
+
const availableSorting = sortingState.filter(sort => {
|
|
3339
|
+
var _table$getColumn;
|
|
3340
|
+
return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
|
|
3341
|
+
});
|
|
3335
3342
|
const columnInfoById = {};
|
|
3336
3343
|
availableSorting.forEach(sortEntry => {
|
|
3337
3344
|
const column = table.getColumn(sortEntry.id);
|
|
3345
|
+
if (!column) return;
|
|
3338
3346
|
columnInfoById[sortEntry.id] = {
|
|
3339
3347
|
sortUndefined: column.columnDef.sortUndefined,
|
|
3340
3348
|
invertSorting: column.columnDef.invertSorting,
|
|
@@ -3476,7 +3484,7 @@
|
|
|
3476
3484
|
|
|
3477
3485
|
// Aggregate the values
|
|
3478
3486
|
const column = table.getColumn(columnId);
|
|
3479
|
-
const aggregateFn = column.getAggregationFn();
|
|
3487
|
+
const aggregateFn = column == null ? void 0 : column.getAggregationFn();
|
|
3480
3488
|
if (aggregateFn) {
|
|
3481
3489
|
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3482
3490
|
return row._groupingValuesCache[columnId];
|