@tanstack/svelte-table 8.0.0-alpha.79 → 8.0.0-alpha.83
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/svelte-table/src/index.js +5 -0
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +94 -63
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +90 -64
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +38 -38
- package/build/types/index.d.ts +2 -2
- package/build/umd/index.development.js +94 -63
- 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/src/index.ts +4 -13
package/build/esm/index.js
CHANGED
|
@@ -102,7 +102,7 @@ function memo(getDeps, fn, opts) {
|
|
|
102
102
|
const Columns = {
|
|
103
103
|
createInstance: instance => {
|
|
104
104
|
return {
|
|
105
|
-
|
|
105
|
+
getDefaultColumnDef: memo(() => [instance.options.defaultColumnDef], defaultColumn => {
|
|
106
106
|
var _defaultColumn;
|
|
107
107
|
|
|
108
108
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
@@ -115,7 +115,7 @@ const Columns = {
|
|
|
115
115
|
return (_props$getValue$toStr = (_props$getValue$toStr2 = (_props$getValue = props.getValue()).toString) == null ? void 0 : _props$getValue$toStr2.call(_props$getValue)) != null ? _props$getValue$toStr : null;
|
|
116
116
|
},
|
|
117
117
|
...instance._features.reduce((obj, feature) => {
|
|
118
|
-
return Object.assign(obj, feature.
|
|
118
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
119
119
|
}, {}),
|
|
120
120
|
...defaultColumn
|
|
121
121
|
};
|
|
@@ -125,13 +125,16 @@ const Columns = {
|
|
|
125
125
|
|
|
126
126
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
|
|
127
127
|
},
|
|
128
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
128
|
+
key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
|
|
129
129
|
}),
|
|
130
130
|
getColumnDefs: () => instance.options.columns,
|
|
131
131
|
createColumn: (columnDef, depth, parent) => {
|
|
132
132
|
var _ref, _columnDef$id;
|
|
133
133
|
|
|
134
|
-
const
|
|
134
|
+
const defaultColumnDef = instance.getDefaultColumnDef();
|
|
135
|
+
columnDef = { ...defaultColumnDef,
|
|
136
|
+
...columnDef
|
|
137
|
+
};
|
|
135
138
|
let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
|
|
136
139
|
let accessorFn;
|
|
137
140
|
|
|
@@ -149,8 +152,7 @@ const Columns = {
|
|
|
149
152
|
throw new Error();
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
let column = { ...
|
|
153
|
-
...columnDef,
|
|
155
|
+
let column = { ...columnDef,
|
|
154
156
|
id: "" + id,
|
|
155
157
|
accessorFn,
|
|
156
158
|
parent: parent,
|
|
@@ -299,7 +301,7 @@ const Rows = {
|
|
|
299
301
|
const column = instance.getColumn(columnId);
|
|
300
302
|
|
|
301
303
|
if (!column.accessorFn) {
|
|
302
|
-
|
|
304
|
+
return undefined;
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
@@ -386,7 +388,7 @@ const Cells = {
|
|
|
386
388
|
row,
|
|
387
389
|
column,
|
|
388
390
|
getValue: () => row.getValue(columnId),
|
|
389
|
-
renderCell: () => column.cell ? instance._render(column.cell, {
|
|
391
|
+
renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
390
392
|
instance,
|
|
391
393
|
column,
|
|
392
394
|
row,
|
|
@@ -445,7 +447,7 @@ const getDefaultColumnSizingInfoState = () => ({
|
|
|
445
447
|
});
|
|
446
448
|
|
|
447
449
|
const ColumnSizing = {
|
|
448
|
-
|
|
450
|
+
getDefaultColumnDef: () => {
|
|
449
451
|
return defaultColumnSizing;
|
|
450
452
|
},
|
|
451
453
|
getInitialState: state => {
|
|
@@ -465,10 +467,10 @@ const ColumnSizing = {
|
|
|
465
467
|
createColumn: (column, instance) => {
|
|
466
468
|
return {
|
|
467
469
|
getSize: () => {
|
|
468
|
-
var _column$
|
|
470
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
469
471
|
|
|
470
472
|
const columnSize = instance.getState().columnSizing[column.id];
|
|
471
|
-
return Math.min(Math.max((_column$
|
|
473
|
+
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
472
474
|
},
|
|
473
475
|
getStart: position => {
|
|
474
476
|
const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
|
|
@@ -491,9 +493,9 @@ const ColumnSizing = {
|
|
|
491
493
|
});
|
|
492
494
|
},
|
|
493
495
|
getCanResize: () => {
|
|
494
|
-
var _column$
|
|
496
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
495
497
|
|
|
496
|
-
return ((_column$
|
|
498
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
|
|
497
499
|
},
|
|
498
500
|
getIsResizing: () => {
|
|
499
501
|
return instance.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
@@ -950,7 +952,7 @@ function testFalsey(val) {
|
|
|
950
952
|
|
|
951
953
|
//
|
|
952
954
|
const Filters = {
|
|
953
|
-
|
|
955
|
+
getDefaultColumnDef: () => {
|
|
954
956
|
return {
|
|
955
957
|
filterFn: 'auto'
|
|
956
958
|
};
|
|
@@ -993,6 +995,10 @@ const Filters = {
|
|
|
993
995
|
return filterFns.inNumberRange;
|
|
994
996
|
}
|
|
995
997
|
|
|
998
|
+
if (typeof value === 'boolean') {
|
|
999
|
+
return filterFns.equals;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
996
1002
|
if (value !== null && typeof value === 'object') {
|
|
997
1003
|
return filterFns.equals;
|
|
998
1004
|
}
|
|
@@ -1010,14 +1016,14 @@ const Filters = {
|
|
|
1010
1016
|
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
1011
1017
|
},
|
|
1012
1018
|
getCanFilter: () => {
|
|
1013
|
-
var _column$
|
|
1019
|
+
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
1014
1020
|
|
|
1015
|
-
return ((_column$
|
|
1021
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
|
|
1016
1022
|
},
|
|
1017
1023
|
getCanGlobalFilter: () => {
|
|
1018
|
-
var _column$
|
|
1024
|
+
var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
|
|
1019
1025
|
|
|
1020
|
-
return ((_column$
|
|
1026
|
+
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
|
|
1021
1027
|
},
|
|
1022
1028
|
getIsFiltered: () => column.getFilterIndex() > -1,
|
|
1023
1029
|
getFilterValue: () => {
|
|
@@ -1096,7 +1102,8 @@ const Filters = {
|
|
|
1096
1102
|
},
|
|
1097
1103
|
createRow: (row, instance) => {
|
|
1098
1104
|
return {
|
|
1099
|
-
|
|
1105
|
+
columnFilters: {},
|
|
1106
|
+
columnFiltersMeta: {},
|
|
1100
1107
|
subRowsByFacetId: {}
|
|
1101
1108
|
};
|
|
1102
1109
|
},
|
|
@@ -1294,7 +1301,7 @@ function count(getLeafValues) {
|
|
|
1294
1301
|
|
|
1295
1302
|
//
|
|
1296
1303
|
const Grouping = {
|
|
1297
|
-
|
|
1304
|
+
getDefaultColumnDef: () => {
|
|
1298
1305
|
return {
|
|
1299
1306
|
aggregationFn: 'auto'
|
|
1300
1307
|
};
|
|
@@ -1324,9 +1331,9 @@ const Grouping = {
|
|
|
1324
1331
|
});
|
|
1325
1332
|
},
|
|
1326
1333
|
getCanGroup: () => {
|
|
1327
|
-
var _ref, _ref2, _ref3, _column$
|
|
1334
|
+
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1328
1335
|
|
|
1329
|
-
return (_ref = (_ref2 = (_ref3 = (_column$
|
|
1336
|
+
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
|
|
1330
1337
|
},
|
|
1331
1338
|
getIsGrouped: () => {
|
|
1332
1339
|
var _instance$getState$gr;
|
|
@@ -1410,9 +1417,9 @@ const Grouping = {
|
|
|
1410
1417
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1411
1418
|
},
|
|
1412
1419
|
renderAggregatedCell: () => {
|
|
1413
|
-
var _column$
|
|
1420
|
+
var _column$columnDef$agg;
|
|
1414
1421
|
|
|
1415
|
-
const template = (_column$
|
|
1422
|
+
const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
|
|
1416
1423
|
return template ? instance._render(template, {
|
|
1417
1424
|
instance,
|
|
1418
1425
|
column,
|
|
@@ -1719,9 +1726,9 @@ const Pinning = {
|
|
|
1719
1726
|
getCanPin: () => {
|
|
1720
1727
|
const leafColumns = column.getLeafColumns();
|
|
1721
1728
|
return leafColumns.some(d => {
|
|
1722
|
-
var _d$
|
|
1729
|
+
var _d$columnDef$enablePi, _instance$options$ena;
|
|
1723
1730
|
|
|
1724
|
-
return ((_d$
|
|
1731
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
|
|
1725
1732
|
});
|
|
1726
1733
|
},
|
|
1727
1734
|
getIsPinned: () => {
|
|
@@ -1791,12 +1798,18 @@ const Pinning = {
|
|
|
1791
1798
|
|
|
1792
1799
|
return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
|
|
1793
1800
|
},
|
|
1794
|
-
getIsSomeColumnsPinned:
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1801
|
+
getIsSomeColumnsPinned: position => {
|
|
1802
|
+
var _pinningState$positio;
|
|
1803
|
+
|
|
1804
|
+
const pinningState = instance.getState().columnPinning;
|
|
1805
|
+
|
|
1806
|
+
if (!position) {
|
|
1807
|
+
var _pinningState$left, _pinningState$right;
|
|
1808
|
+
|
|
1809
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1800
1813
|
},
|
|
1801
1814
|
getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
|
|
1802
1815
|
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
@@ -2322,7 +2335,7 @@ const Sorting = {
|
|
|
2322
2335
|
...state
|
|
2323
2336
|
};
|
|
2324
2337
|
},
|
|
2325
|
-
|
|
2338
|
+
getDefaultColumnDef: () => {
|
|
2326
2339
|
return {
|
|
2327
2340
|
sortingFn: 'auto'
|
|
2328
2341
|
};
|
|
@@ -2338,7 +2351,7 @@ const Sorting = {
|
|
|
2338
2351
|
createColumn: (column, instance) => {
|
|
2339
2352
|
return {
|
|
2340
2353
|
getAutoSortingFn: () => {
|
|
2341
|
-
const firstRows = instance.getFilteredRowModel().flatRows.slice(
|
|
2354
|
+
const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
|
|
2342
2355
|
let isString = false;
|
|
2343
2356
|
|
|
2344
2357
|
for (const row of firstRows) {
|
|
@@ -2382,7 +2395,7 @@ const Sorting = {
|
|
|
2382
2395
|
throw new Error();
|
|
2383
2396
|
}
|
|
2384
2397
|
|
|
2385
|
-
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
|
|
2398
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.columnDef.sortingFn]) != null ? _ref : sortingFns[column.columnDef.sortingFn];
|
|
2386
2399
|
},
|
|
2387
2400
|
toggleSorting: (desc, multi) => {
|
|
2388
2401
|
// if (column.columns.length) {
|
|
@@ -2394,7 +2407,7 @@ const Sorting = {
|
|
|
2394
2407
|
// return
|
|
2395
2408
|
// }
|
|
2396
2409
|
instance.setSorting(old => {
|
|
2397
|
-
var _ref2, _column$
|
|
2410
|
+
var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
|
|
2398
2411
|
|
|
2399
2412
|
// Find any existing sorting for this column
|
|
2400
2413
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2421,7 +2434,7 @@ const Sorting = {
|
|
|
2421
2434
|
}
|
|
2422
2435
|
}
|
|
2423
2436
|
|
|
2424
|
-
const sortDescFirst = (_ref2 = (_column$
|
|
2437
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
|
|
2425
2438
|
|
|
2426
2439
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2427
2440
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
@@ -2465,14 +2478,14 @@ const Sorting = {
|
|
|
2465
2478
|
});
|
|
2466
2479
|
},
|
|
2467
2480
|
getCanSort: () => {
|
|
2468
|
-
var _column$
|
|
2481
|
+
var _column$columnDef$ena, _instance$options$ena3;
|
|
2469
2482
|
|
|
2470
|
-
return ((_column$
|
|
2483
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
|
|
2471
2484
|
},
|
|
2472
2485
|
getCanMultiSort: () => {
|
|
2473
|
-
var _ref3, _column$
|
|
2486
|
+
var _ref3, _column$columnDef$ena2;
|
|
2474
2487
|
|
|
2475
|
-
return (_ref3 = (_column$
|
|
2488
|
+
return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
|
|
2476
2489
|
},
|
|
2477
2490
|
getIsSorted: () => {
|
|
2478
2491
|
var _instance$getState$so;
|
|
@@ -2536,7 +2549,7 @@ const Visibility = {
|
|
|
2536
2549
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2537
2550
|
};
|
|
2538
2551
|
},
|
|
2539
|
-
|
|
2552
|
+
getDefaultColumnDef: () => {
|
|
2540
2553
|
return {
|
|
2541
2554
|
defaultIsVisible: true
|
|
2542
2555
|
};
|
|
@@ -2556,9 +2569,9 @@ const Visibility = {
|
|
|
2556
2569
|
return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
|
|
2557
2570
|
},
|
|
2558
2571
|
getCanHide: () => {
|
|
2559
|
-
var _column$
|
|
2572
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
2560
2573
|
|
|
2561
|
-
return ((_column$
|
|
2574
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
|
|
2562
2575
|
},
|
|
2563
2576
|
getToggleVisibilityHandler: () => {
|
|
2564
2577
|
return e => {
|
|
@@ -2669,12 +2682,12 @@ const Headers = {
|
|
|
2669
2682
|
recurseHeader(header);
|
|
2670
2683
|
return leafHeaders;
|
|
2671
2684
|
},
|
|
2672
|
-
renderHeader: () => column.header ? instance._render(column.header, {
|
|
2685
|
+
renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
|
|
2673
2686
|
instance,
|
|
2674
2687
|
header: header,
|
|
2675
2688
|
column
|
|
2676
2689
|
}) : null,
|
|
2677
|
-
renderFooter: () => column.footer ? instance._render(column.footer, {
|
|
2690
|
+
renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
|
|
2678
2691
|
instance,
|
|
2679
2692
|
header: header,
|
|
2680
2693
|
column
|
|
@@ -3182,10 +3195,11 @@ function createTable$1(_, __, options) {
|
|
|
3182
3195
|
throw new Error('');
|
|
3183
3196
|
})()
|
|
3184
3197
|
},
|
|
3185
|
-
setGenerics: () => table,
|
|
3198
|
+
// setGenerics: () => table as any,
|
|
3186
3199
|
setRowType: () => table,
|
|
3187
3200
|
setTableMetaType: () => table,
|
|
3188
3201
|
setColumnMetaType: () => table,
|
|
3202
|
+
setFilterMetaType: () => table,
|
|
3189
3203
|
setOptions: newOptions => createTable$1(_, __, { ...options,
|
|
3190
3204
|
...newOptions
|
|
3191
3205
|
}),
|
|
@@ -3217,7 +3231,8 @@ function createTable$1(_, __, options) {
|
|
|
3217
3231
|
}
|
|
3218
3232
|
|
|
3219
3233
|
throw new Error('Invalid accessor');
|
|
3220
|
-
}
|
|
3234
|
+
},
|
|
3235
|
+
createOptions: options => options
|
|
3221
3236
|
};
|
|
3222
3237
|
return table;
|
|
3223
3238
|
}
|
|
@@ -3313,7 +3328,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3313
3328
|
|
|
3314
3329
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3315
3330
|
newRow = instance.createRow(row.id, row.original, row.index, row.depth);
|
|
3316
|
-
newRow.
|
|
3331
|
+
newRow.columnFilters = row.columnFilters;
|
|
3317
3332
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3318
3333
|
|
|
3319
3334
|
if (!newRow.subRows.length) {
|
|
@@ -3386,6 +3401,11 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
|
3386
3401
|
function getFilteredRowModel() {
|
|
3387
3402
|
return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
3388
3403
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
3404
|
+
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
3405
|
+
rowModel.flatRows[i].columnFilters = {};
|
|
3406
|
+
rowModel.flatRows[i].columnFiltersMeta = {};
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3389
3409
|
return rowModel;
|
|
3390
3410
|
}
|
|
3391
3411
|
|
|
@@ -3440,28 +3460,34 @@ function getFilteredRowModel() {
|
|
|
3440
3460
|
|
|
3441
3461
|
for (let j = 0; j < rowModel.flatRows.length; j++) {
|
|
3442
3462
|
const row = rowModel.flatRows[j];
|
|
3443
|
-
row.
|
|
3463
|
+
row.columnFilters = {};
|
|
3444
3464
|
|
|
3445
3465
|
if (resolvedColumnFilters.length) {
|
|
3446
3466
|
for (let i = 0; i < resolvedColumnFilters.length; i++) {
|
|
3447
|
-
currentColumnFilter = resolvedColumnFilters[i];
|
|
3467
|
+
currentColumnFilter = resolvedColumnFilters[i];
|
|
3468
|
+
const id = currentColumnFilter.id; // Tag the row with the column filter state
|
|
3448
3469
|
|
|
3449
|
-
row.
|
|
3470
|
+
row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
|
|
3471
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3472
|
+
});
|
|
3450
3473
|
}
|
|
3451
3474
|
}
|
|
3452
3475
|
|
|
3453
3476
|
if (resolvedGlobalFilters.length) {
|
|
3454
3477
|
for (let i = 0; i < resolvedGlobalFilters.length; i++) {
|
|
3455
|
-
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3478
|
+
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3479
|
+
const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
|
|
3456
3480
|
|
|
3457
|
-
if (currentGlobalFilter.filterFn(row,
|
|
3458
|
-
row.
|
|
3481
|
+
if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
|
|
3482
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3483
|
+
})) {
|
|
3484
|
+
row.columnFilters.__global__ = true;
|
|
3459
3485
|
break;
|
|
3460
3486
|
}
|
|
3461
3487
|
}
|
|
3462
3488
|
|
|
3463
|
-
if (row.
|
|
3464
|
-
row.
|
|
3489
|
+
if (row.columnFilters.__global__ !== true) {
|
|
3490
|
+
row.columnFilters.__global__ = false;
|
|
3465
3491
|
}
|
|
3466
3492
|
}
|
|
3467
3493
|
}
|
|
@@ -3469,7 +3495,7 @@ function getFilteredRowModel() {
|
|
|
3469
3495
|
const filterRowsImpl = row => {
|
|
3470
3496
|
// Horizontally filter rows through each column
|
|
3471
3497
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3472
|
-
if (row.
|
|
3498
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3473
3499
|
return false;
|
|
3474
3500
|
}
|
|
3475
3501
|
}
|
|
@@ -3503,7 +3529,7 @@ function getFacetedRowModel() {
|
|
|
3503
3529
|
const filterRowsImpl = row => {
|
|
3504
3530
|
// Horizontally filter rows through each column
|
|
3505
3531
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3506
|
-
if (row.
|
|
3532
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3507
3533
|
return false;
|
|
3508
3534
|
}
|
|
3509
3535
|
}
|
|
@@ -3603,8 +3629,8 @@ function getSortedRowModel() {
|
|
|
3603
3629
|
availableSorting.forEach(sortEntry => {
|
|
3604
3630
|
const column = instance.getColumn(sortEntry.id);
|
|
3605
3631
|
columnInfoById[sortEntry.id] = {
|
|
3606
|
-
sortUndefined: column.sortUndefined,
|
|
3607
|
-
invertSorting: column.invertSorting,
|
|
3632
|
+
sortUndefined: column.columnDef.sortUndefined,
|
|
3633
|
+
invertSorting: column.columnDef.invertSorting,
|
|
3608
3634
|
sortingFn: column.getSortingFn()
|
|
3609
3635
|
};
|
|
3610
3636
|
});
|
|
@@ -3752,8 +3778,8 @@ function getGroupedRowModel() {
|
|
|
3752
3778
|
row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
|
|
3753
3779
|
let columnValue = row.getValue(columnId);
|
|
3754
3780
|
|
|
3755
|
-
if (!depth && column.aggregateValue) {
|
|
3756
|
-
columnValue = column.aggregateValue(columnValue);
|
|
3781
|
+
if (!depth && column.columnDef.aggregateValue) {
|
|
3782
|
+
columnValue = column.columnDef.aggregateValue(columnValue);
|
|
3757
3783
|
}
|
|
3758
3784
|
|
|
3759
3785
|
return columnValue;
|
|
@@ -4107,5 +4133,5 @@ function createTableInstance(table, options) {
|
|
|
4107
4133
|
return instanceReadable;
|
|
4108
4134
|
}
|
|
4109
4135
|
|
|
4110
|
-
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, renderComponent, selectRowsFn, shouldAutoRemoveFilter };
|
|
4136
|
+
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, renderComponent, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
4111
4137
|
//# sourceMappingURL=index.js.map
|