@tanstack/react-table 8.0.0-alpha.79 → 8.0.0-alpha.82
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/react-table/src/index.js +5 -0
- package/build/cjs/react-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +32 -14
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +28 -15
- 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 +32 -14
- 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 +2 -2
package/build/esm/index.js
CHANGED
|
@@ -298,7 +298,7 @@ const Rows = {
|
|
|
298
298
|
const column = instance.getColumn(columnId);
|
|
299
299
|
|
|
300
300
|
if (!column.accessorFn) {
|
|
301
|
-
|
|
301
|
+
return undefined;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
@@ -1095,7 +1095,8 @@ const Filters = {
|
|
|
1095
1095
|
},
|
|
1096
1096
|
createRow: (row, instance) => {
|
|
1097
1097
|
return {
|
|
1098
|
-
|
|
1098
|
+
columnFilters: {},
|
|
1099
|
+
columnFiltersMeta: {},
|
|
1099
1100
|
subRowsByFacetId: {}
|
|
1100
1101
|
};
|
|
1101
1102
|
},
|
|
@@ -2337,7 +2338,7 @@ const Sorting = {
|
|
|
2337
2338
|
createColumn: (column, instance) => {
|
|
2338
2339
|
return {
|
|
2339
2340
|
getAutoSortingFn: () => {
|
|
2340
|
-
const firstRows = instance.getFilteredRowModel().flatRows.slice(
|
|
2341
|
+
const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
|
|
2341
2342
|
let isString = false;
|
|
2342
2343
|
|
|
2343
2344
|
for (const row of firstRows) {
|
|
@@ -3185,6 +3186,7 @@ function createTable$1(_, __, options) {
|
|
|
3185
3186
|
setRowType: () => table,
|
|
3186
3187
|
setTableMetaType: () => table,
|
|
3187
3188
|
setColumnMetaType: () => table,
|
|
3189
|
+
setFilterMetaType: () => table,
|
|
3188
3190
|
setOptions: newOptions => createTable$1(_, __, { ...options,
|
|
3189
3191
|
...newOptions
|
|
3190
3192
|
}),
|
|
@@ -3312,7 +3314,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3312
3314
|
|
|
3313
3315
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3314
3316
|
newRow = instance.createRow(row.id, row.original, row.index, row.depth);
|
|
3315
|
-
newRow.
|
|
3317
|
+
newRow.columnFilters = row.columnFilters;
|
|
3316
3318
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3317
3319
|
|
|
3318
3320
|
if (!newRow.subRows.length) {
|
|
@@ -3385,6 +3387,11 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
|
3385
3387
|
function getFilteredRowModel() {
|
|
3386
3388
|
return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
3387
3389
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
3390
|
+
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
3391
|
+
rowModel.flatRows[i].columnFilters = {};
|
|
3392
|
+
rowModel.flatRows[i].columnFiltersMeta = {};
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3388
3395
|
return rowModel;
|
|
3389
3396
|
}
|
|
3390
3397
|
|
|
@@ -3439,28 +3446,34 @@ function getFilteredRowModel() {
|
|
|
3439
3446
|
|
|
3440
3447
|
for (let j = 0; j < rowModel.flatRows.length; j++) {
|
|
3441
3448
|
const row = rowModel.flatRows[j];
|
|
3442
|
-
row.
|
|
3449
|
+
row.columnFilters = {};
|
|
3443
3450
|
|
|
3444
3451
|
if (resolvedColumnFilters.length) {
|
|
3445
3452
|
for (let i = 0; i < resolvedColumnFilters.length; i++) {
|
|
3446
|
-
currentColumnFilter = resolvedColumnFilters[i];
|
|
3453
|
+
currentColumnFilter = resolvedColumnFilters[i];
|
|
3454
|
+
const id = currentColumnFilter.id; // Tag the row with the column filter state
|
|
3447
3455
|
|
|
3448
|
-
row.
|
|
3456
|
+
row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
|
|
3457
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3458
|
+
});
|
|
3449
3459
|
}
|
|
3450
3460
|
}
|
|
3451
3461
|
|
|
3452
3462
|
if (resolvedGlobalFilters.length) {
|
|
3453
3463
|
for (let i = 0; i < resolvedGlobalFilters.length; i++) {
|
|
3454
|
-
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3464
|
+
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3465
|
+
const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
|
|
3455
3466
|
|
|
3456
|
-
if (currentGlobalFilter.filterFn(row,
|
|
3457
|
-
row.
|
|
3467
|
+
if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
|
|
3468
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3469
|
+
})) {
|
|
3470
|
+
row.columnFilters.__global__ = true;
|
|
3458
3471
|
break;
|
|
3459
3472
|
}
|
|
3460
3473
|
}
|
|
3461
3474
|
|
|
3462
|
-
if (row.
|
|
3463
|
-
row.
|
|
3475
|
+
if (row.columnFilters.__global__ !== true) {
|
|
3476
|
+
row.columnFilters.__global__ = false;
|
|
3464
3477
|
}
|
|
3465
3478
|
}
|
|
3466
3479
|
}
|
|
@@ -3468,7 +3481,7 @@ function getFilteredRowModel() {
|
|
|
3468
3481
|
const filterRowsImpl = row => {
|
|
3469
3482
|
// Horizontally filter rows through each column
|
|
3470
3483
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3471
|
-
if (row.
|
|
3484
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3472
3485
|
return false;
|
|
3473
3486
|
}
|
|
3474
3487
|
}
|
|
@@ -3502,7 +3515,7 @@ function getFacetedRowModel() {
|
|
|
3502
3515
|
const filterRowsImpl = row => {
|
|
3503
3516
|
// Horizontally filter rows through each column
|
|
3504
3517
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3505
|
-
if (row.
|
|
3518
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3506
3519
|
return false;
|
|
3507
3520
|
}
|
|
3508
3521
|
}
|
|
@@ -3966,5 +3979,5 @@ function useTableInstance(table, options) {
|
|
|
3966
3979
|
return instanceRef.current;
|
|
3967
3980
|
}
|
|
3968
3981
|
|
|
3969
|
-
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, buildHeaderGroups, createTable, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, render, selectRowsFn, shouldAutoRemoveFilter, useTableInstance };
|
|
3982
|
+
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createTable, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, makeStateUpdater, mean, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, render, selectRowsFn, shouldAutoRemoveFilter, sortingFns, useTableInstance };
|
|
3970
3983
|
//# sourceMappingURL=index.js.map
|