@tanstack/svelte-table 8.0.0-alpha.78 → 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/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 +33 -15
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +29 -16
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +38 -38
- package/build/umd/index.development.js +33 -15
- 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
|
@@ -299,7 +299,7 @@ const Rows = {
|
|
|
299
299
|
const column = instance.getColumn(columnId);
|
|
300
300
|
|
|
301
301
|
if (!column.accessorFn) {
|
|
302
|
-
|
|
302
|
+
return undefined;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
@@ -542,7 +542,7 @@ const ColumnSizing = {
|
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
const startSize =
|
|
545
|
+
const startSize = header.getSize();
|
|
546
546
|
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
|
|
547
547
|
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
548
548
|
|
|
@@ -1096,7 +1096,8 @@ const Filters = {
|
|
|
1096
1096
|
},
|
|
1097
1097
|
createRow: (row, instance) => {
|
|
1098
1098
|
return {
|
|
1099
|
-
|
|
1099
|
+
columnFilters: {},
|
|
1100
|
+
columnFiltersMeta: {},
|
|
1100
1101
|
subRowsByFacetId: {}
|
|
1101
1102
|
};
|
|
1102
1103
|
},
|
|
@@ -2338,7 +2339,7 @@ const Sorting = {
|
|
|
2338
2339
|
createColumn: (column, instance) => {
|
|
2339
2340
|
return {
|
|
2340
2341
|
getAutoSortingFn: () => {
|
|
2341
|
-
const firstRows = instance.getFilteredRowModel().flatRows.slice(
|
|
2342
|
+
const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
|
|
2342
2343
|
let isString = false;
|
|
2343
2344
|
|
|
2344
2345
|
for (const row of firstRows) {
|
|
@@ -3186,6 +3187,7 @@ function createTable$1(_, __, options) {
|
|
|
3186
3187
|
setRowType: () => table,
|
|
3187
3188
|
setTableMetaType: () => table,
|
|
3188
3189
|
setColumnMetaType: () => table,
|
|
3190
|
+
setFilterMetaType: () => table,
|
|
3189
3191
|
setOptions: newOptions => createTable$1(_, __, { ...options,
|
|
3190
3192
|
...newOptions
|
|
3191
3193
|
}),
|
|
@@ -3313,7 +3315,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3313
3315
|
|
|
3314
3316
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3315
3317
|
newRow = instance.createRow(row.id, row.original, row.index, row.depth);
|
|
3316
|
-
newRow.
|
|
3318
|
+
newRow.columnFilters = row.columnFilters;
|
|
3317
3319
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3318
3320
|
|
|
3319
3321
|
if (!newRow.subRows.length) {
|
|
@@ -3386,6 +3388,11 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
|
3386
3388
|
function getFilteredRowModel() {
|
|
3387
3389
|
return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
3388
3390
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
3391
|
+
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
3392
|
+
rowModel.flatRows[i].columnFilters = {};
|
|
3393
|
+
rowModel.flatRows[i].columnFiltersMeta = {};
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3389
3396
|
return rowModel;
|
|
3390
3397
|
}
|
|
3391
3398
|
|
|
@@ -3440,28 +3447,34 @@ function getFilteredRowModel() {
|
|
|
3440
3447
|
|
|
3441
3448
|
for (let j = 0; j < rowModel.flatRows.length; j++) {
|
|
3442
3449
|
const row = rowModel.flatRows[j];
|
|
3443
|
-
row.
|
|
3450
|
+
row.columnFilters = {};
|
|
3444
3451
|
|
|
3445
3452
|
if (resolvedColumnFilters.length) {
|
|
3446
3453
|
for (let i = 0; i < resolvedColumnFilters.length; i++) {
|
|
3447
|
-
currentColumnFilter = resolvedColumnFilters[i];
|
|
3454
|
+
currentColumnFilter = resolvedColumnFilters[i];
|
|
3455
|
+
const id = currentColumnFilter.id; // Tag the row with the column filter state
|
|
3448
3456
|
|
|
3449
|
-
row.
|
|
3457
|
+
row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
|
|
3458
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3459
|
+
});
|
|
3450
3460
|
}
|
|
3451
3461
|
}
|
|
3452
3462
|
|
|
3453
3463
|
if (resolvedGlobalFilters.length) {
|
|
3454
3464
|
for (let i = 0; i < resolvedGlobalFilters.length; i++) {
|
|
3455
|
-
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3465
|
+
currentGlobalFilter = resolvedGlobalFilters[i];
|
|
3466
|
+
const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
|
|
3456
3467
|
|
|
3457
|
-
if (currentGlobalFilter.filterFn(row,
|
|
3458
|
-
row.
|
|
3468
|
+
if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
|
|
3469
|
+
row.columnFiltersMeta[id] = filterMeta;
|
|
3470
|
+
})) {
|
|
3471
|
+
row.columnFilters.__global__ = true;
|
|
3459
3472
|
break;
|
|
3460
3473
|
}
|
|
3461
3474
|
}
|
|
3462
3475
|
|
|
3463
|
-
if (row.
|
|
3464
|
-
row.
|
|
3476
|
+
if (row.columnFilters.__global__ !== true) {
|
|
3477
|
+
row.columnFilters.__global__ = false;
|
|
3465
3478
|
}
|
|
3466
3479
|
}
|
|
3467
3480
|
}
|
|
@@ -3469,7 +3482,7 @@ function getFilteredRowModel() {
|
|
|
3469
3482
|
const filterRowsImpl = row => {
|
|
3470
3483
|
// Horizontally filter rows through each column
|
|
3471
3484
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3472
|
-
if (row.
|
|
3485
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3473
3486
|
return false;
|
|
3474
3487
|
}
|
|
3475
3488
|
}
|
|
@@ -3503,7 +3516,7 @@ function getFacetedRowModel() {
|
|
|
3503
3516
|
const filterRowsImpl = row => {
|
|
3504
3517
|
// Horizontally filter rows through each column
|
|
3505
3518
|
for (let i = 0; i < filterableIds.length; i++) {
|
|
3506
|
-
if (row.
|
|
3519
|
+
if (row.columnFilters[filterableIds[i]] === false) {
|
|
3507
3520
|
return false;
|
|
3508
3521
|
}
|
|
3509
3522
|
}
|
|
@@ -4107,5 +4120,5 @@ function createTableInstance(table, options) {
|
|
|
4107
4120
|
return instanceReadable;
|
|
4108
4121
|
}
|
|
4109
4122
|
|
|
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 };
|
|
4123
|
+
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
4124
|
//# sourceMappingURL=index.js.map
|