@tanstack/svelte-table 8.0.0-alpha.84 → 8.0.0-alpha.85
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 +0 -1
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +61 -71
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +62 -71
- 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 +61 -71
- 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
|
@@ -1225,8 +1225,7 @@ const Filters = {
|
|
|
1225
1225
|
createRow: (row, instance) => {
|
|
1226
1226
|
return {
|
|
1227
1227
|
columnFilters: {},
|
|
1228
|
-
columnFiltersMeta: {}
|
|
1229
|
-
subRowsByFacetId: {}
|
|
1228
|
+
columnFiltersMeta: {}
|
|
1230
1229
|
};
|
|
1231
1230
|
},
|
|
1232
1231
|
createInstance: instance => {
|
|
@@ -1317,53 +1316,42 @@ function shouldAutoRemoveFilter(filterFn, value, column) {
|
|
|
1317
1316
|
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
|
|
1318
1317
|
}
|
|
1319
1318
|
|
|
1320
|
-
const
|
|
1321
|
-
sum,
|
|
1322
|
-
min,
|
|
1323
|
-
max,
|
|
1324
|
-
extent,
|
|
1325
|
-
mean,
|
|
1326
|
-
median,
|
|
1327
|
-
unique,
|
|
1328
|
-
uniqueCount,
|
|
1329
|
-
count
|
|
1330
|
-
};
|
|
1331
|
-
|
|
1332
|
-
function sum(_getLeafValues, getChildValues) {
|
|
1319
|
+
const sum = (columnId, _leafRows, childRows) => {
|
|
1333
1320
|
// It's faster to just add the aggregations together instead of
|
|
1334
1321
|
// process leaf nodes individually
|
|
1335
|
-
return
|
|
1336
|
-
}
|
|
1322
|
+
return childRows.reduce((sum, next) => sum + (typeof next === 'number' ? next : 0), 0);
|
|
1323
|
+
};
|
|
1337
1324
|
|
|
1338
|
-
|
|
1325
|
+
const min = (columnId, _leafRows, childRows) => {
|
|
1339
1326
|
let min;
|
|
1327
|
+
childRows.forEach(row => {
|
|
1328
|
+
const value = row.getValue(columnId);
|
|
1340
1329
|
|
|
1341
|
-
for (const value of getChildValues()) {
|
|
1342
1330
|
if (value != null && (min > value || min === undefined && value >= value)) {
|
|
1343
1331
|
min = value;
|
|
1344
1332
|
}
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1333
|
+
});
|
|
1347
1334
|
return min;
|
|
1348
|
-
}
|
|
1335
|
+
};
|
|
1349
1336
|
|
|
1350
|
-
|
|
1337
|
+
const max = (columnId, _leafRows, childRows) => {
|
|
1351
1338
|
let max;
|
|
1339
|
+
childRows.forEach(row => {
|
|
1340
|
+
const value = row.getValue(columnId);
|
|
1352
1341
|
|
|
1353
|
-
for (const value of getChildValues()) {
|
|
1354
1342
|
if (value != null && (max < value || max === undefined && value >= value)) {
|
|
1355
1343
|
max = value;
|
|
1356
1344
|
}
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1345
|
+
});
|
|
1359
1346
|
return max;
|
|
1360
|
-
}
|
|
1347
|
+
};
|
|
1361
1348
|
|
|
1362
|
-
|
|
1349
|
+
const extent = (columnId, _leafRows, childRows) => {
|
|
1363
1350
|
let min;
|
|
1364
1351
|
let max;
|
|
1352
|
+
childRows.forEach(row => {
|
|
1353
|
+
const value = row.getValue(columnId);
|
|
1365
1354
|
|
|
1366
|
-
for (const value of getChildValues()) {
|
|
1367
1355
|
if (value != null) {
|
|
1368
1356
|
if (min === undefined) {
|
|
1369
1357
|
if (value >= value) min = max = value;
|
|
@@ -1372,54 +1360,65 @@ function extent(_getLeafValues, getChildValues) {
|
|
|
1372
1360
|
if (max < value) max = value;
|
|
1373
1361
|
}
|
|
1374
1362
|
}
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1363
|
+
});
|
|
1377
1364
|
return [min, max];
|
|
1378
|
-
}
|
|
1365
|
+
};
|
|
1379
1366
|
|
|
1380
|
-
|
|
1367
|
+
const mean = (columnId, leafRows) => {
|
|
1381
1368
|
let count = 0;
|
|
1382
1369
|
let sum = 0;
|
|
1370
|
+
leafRows.forEach(row => {
|
|
1371
|
+
let value = row.getValue(columnId);
|
|
1383
1372
|
|
|
1384
|
-
for (let value of getLeafValues()) {
|
|
1385
1373
|
if (value != null && (value = +value) >= value) {
|
|
1386
1374
|
++count, sum += value;
|
|
1387
1375
|
}
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1376
|
+
});
|
|
1390
1377
|
if (count) return sum / count;
|
|
1391
1378
|
return;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
function median(getLeafValues) {
|
|
1395
|
-
const leafValues = getLeafValues();
|
|
1379
|
+
};
|
|
1396
1380
|
|
|
1397
|
-
|
|
1381
|
+
const median = (columnId, leafRows) => {
|
|
1382
|
+
if (!leafRows.length) {
|
|
1398
1383
|
return;
|
|
1399
1384
|
}
|
|
1400
1385
|
|
|
1401
1386
|
let min = 0;
|
|
1402
1387
|
let max = 0;
|
|
1403
|
-
|
|
1388
|
+
leafRows.forEach(row => {
|
|
1389
|
+
let value = row.getValue(columnId);
|
|
1390
|
+
|
|
1404
1391
|
if (typeof value === 'number') {
|
|
1405
1392
|
min = Math.min(min, value);
|
|
1406
1393
|
max = Math.max(max, value);
|
|
1407
1394
|
}
|
|
1408
1395
|
});
|
|
1409
1396
|
return (min + max) / 2;
|
|
1410
|
-
}
|
|
1397
|
+
};
|
|
1411
1398
|
|
|
1412
|
-
|
|
1413
|
-
return Array.from(new Set(
|
|
1414
|
-
}
|
|
1399
|
+
const unique = (columnId, leafRows) => {
|
|
1400
|
+
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
1401
|
+
};
|
|
1415
1402
|
|
|
1416
|
-
|
|
1417
|
-
return new Set(
|
|
1418
|
-
}
|
|
1403
|
+
const uniqueCount = (columnId, leafRows) => {
|
|
1404
|
+
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
1405
|
+
};
|
|
1419
1406
|
|
|
1420
|
-
|
|
1421
|
-
return
|
|
1422
|
-
}
|
|
1407
|
+
const count = (_columnId, leafRows) => {
|
|
1408
|
+
return leafRows.length;
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
const aggregationFns = {
|
|
1412
|
+
sum,
|
|
1413
|
+
min,
|
|
1414
|
+
max,
|
|
1415
|
+
extent,
|
|
1416
|
+
mean,
|
|
1417
|
+
median,
|
|
1418
|
+
unique,
|
|
1419
|
+
uniqueCount,
|
|
1420
|
+
count
|
|
1421
|
+
};
|
|
1423
1422
|
|
|
1424
1423
|
//
|
|
1425
1424
|
const Grouping = {
|
|
@@ -1474,7 +1473,7 @@ const Grouping = {
|
|
|
1474
1473
|
column.toggleGrouping();
|
|
1475
1474
|
};
|
|
1476
1475
|
},
|
|
1477
|
-
|
|
1476
|
+
getAutoAggregationFn: () => {
|
|
1478
1477
|
const firstRow = instance.getCoreRowModel().flatRows[0];
|
|
1479
1478
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1480
1479
|
|
|
@@ -1488,7 +1487,7 @@ const Grouping = {
|
|
|
1488
1487
|
|
|
1489
1488
|
return aggregationFns.count;
|
|
1490
1489
|
},
|
|
1491
|
-
|
|
1490
|
+
getAggregationFn: () => {
|
|
1492
1491
|
var _ref4;
|
|
1493
1492
|
|
|
1494
1493
|
const userAggregationFns = instance.options.aggregationFns;
|
|
@@ -1497,7 +1496,7 @@ const Grouping = {
|
|
|
1497
1496
|
throw new Error();
|
|
1498
1497
|
}
|
|
1499
1498
|
|
|
1500
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.
|
|
1499
|
+
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref4 : aggregationFns[column.aggregationFn];
|
|
1501
1500
|
}
|
|
1502
1501
|
};
|
|
1503
1502
|
},
|
|
@@ -1523,10 +1522,10 @@ const Grouping = {
|
|
|
1523
1522
|
}
|
|
1524
1523
|
};
|
|
1525
1524
|
},
|
|
1526
|
-
createRow:
|
|
1525
|
+
createRow: row => {
|
|
1527
1526
|
return {
|
|
1528
1527
|
getIsGrouped: () => !!row.groupingColumnId,
|
|
1529
|
-
|
|
1528
|
+
_groupingValuesCache: {}
|
|
1530
1529
|
};
|
|
1531
1530
|
},
|
|
1532
1531
|
createCell: (cell, column, row, instance) => {
|
|
@@ -3661,25 +3660,17 @@ function getGroupedRowModel() {
|
|
|
3661
3660
|
return row._valuesCache[columnId];
|
|
3662
3661
|
}
|
|
3663
3662
|
|
|
3664
|
-
if (row.
|
|
3665
|
-
return row.
|
|
3663
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
3664
|
+
return row._groupingValuesCache[columnId];
|
|
3666
3665
|
} // Aggregate the values
|
|
3667
3666
|
|
|
3668
3667
|
|
|
3669
3668
|
const column = instance.getColumn(columnId);
|
|
3670
|
-
const aggregateFn = column.
|
|
3669
|
+
const aggregateFn = column.getAggregationFn();
|
|
3671
3670
|
|
|
3672
3671
|
if (aggregateFn) {
|
|
3673
|
-
row.
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
if (!depth && column.columnDef.aggregateValue) {
|
|
3677
|
-
columnValue = column.columnDef.aggregateValue(columnValue);
|
|
3678
|
-
}
|
|
3679
|
-
|
|
3680
|
-
return columnValue;
|
|
3681
|
-
}), () => groupedRows.map(row => row.getValue(columnId)));
|
|
3682
|
-
return row.groupingValuesCache[columnId];
|
|
3672
|
+
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3673
|
+
return row._groupingValuesCache[columnId];
|
|
3683
3674
|
} else if (column.aggregationFn) {
|
|
3684
3675
|
console.info({
|
|
3685
3676
|
column
|
|
@@ -4028,5 +4019,5 @@ function createTableInstance(table, options) {
|
|
|
4028
4019
|
return instanceReadable;
|
|
4029
4020
|
}
|
|
4030
4021
|
|
|
4031
|
-
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createColumn, createRow, createTable, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, makeStateUpdater,
|
|
4022
|
+
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createColumn, createRow, createTable, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, render, renderComponent, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
4032
4023
|
//# sourceMappingURL=index.js.map
|