@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.
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
2669
2669
  </script>
2670
2670
  <script>
2671
2671
  /*<!--*/
2672
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"3880-127"},{"name":"react-table/src/index.tsx","uid":"3880-129"}]}]}],"isRoot":true},"nodeParts":{"3880-127":{"renderedLength":139809,"gzipLength":23893,"brotliLength":0,"mainUid":"3880-126"},"3880-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"3880-128"}},"nodeMetas":{"3880-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"3880-127"},"imported":[],"importedBy":[{"uid":"3880-128"}]},"3880-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"3880-129"},"imported":[{"uid":"3880-130"},{"uid":"3880-126"}],"importedBy":[],"isEntry":true},"3880-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"3880-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2672
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"1e4f-127"},{"name":"react-table/src/index.tsx","uid":"1e4f-129"}]}]}],"isRoot":true},"nodeParts":{"1e4f-127":{"renderedLength":140238,"gzipLength":23954,"brotliLength":0,"mainUid":"1e4f-126"},"1e4f-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"1e4f-128"}},"nodeMetas":{"1e4f-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"1e4f-127"},"imported":[],"importedBy":[{"uid":"1e4f-128"}]},"1e4f-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"1e4f-129"},"imported":[{"uid":"1e4f-130"},{"uid":"1e4f-126"}],"importedBy":[],"isEntry":true},"1e4f-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"1e4f-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
2673
2673
 
2674
2674
  const run = () => {
2675
2675
  const width = window.innerWidth;
@@ -11,11 +11,11 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "3880-132"
14
+ "uid": "1e4f-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "3880-134"
18
+ "uid": "1e4f-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "3880-132": {
29
- "renderedLength": 139809,
30
- "gzipLength": 23893,
28
+ "1e4f-132": {
29
+ "renderedLength": 140238,
30
+ "gzipLength": 23954,
31
31
  "brotliLength": 0,
32
- "mainUid": "3880-131"
32
+ "mainUid": "1e4f-131"
33
33
  },
34
- "3880-134": {
34
+ "1e4f-134": {
35
35
  "renderedLength": 2102,
36
36
  "gzipLength": 836,
37
37
  "brotliLength": 0,
38
- "mainUid": "3880-133"
38
+ "mainUid": "1e4f-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "3880-131": {
42
+ "1e4f-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "3880-132"
45
+ "index.production.js": "1e4f-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "3880-133"
50
+ "uid": "1e4f-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "3880-133": {
54
+ "1e4f-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "3880-134"
57
+ "index.production.js": "1e4f-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "3880-135"
61
+ "uid": "1e4f-135"
62
62
  },
63
63
  {
64
- "uid": "3880-131"
64
+ "uid": "1e4f-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "3880-135": {
70
+ "1e4f-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "3880-133"
76
+ "uid": "1e4f-133"
77
77
  }
78
78
  ],
79
79
  "isExternal": true
@@ -320,7 +320,7 @@
320
320
  const column = instance.getColumn(columnId);
321
321
 
322
322
  if (!column.accessorFn) {
323
- throw new Error();
323
+ return undefined;
324
324
  }
325
325
 
326
326
  row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -1111,7 +1111,8 @@
1111
1111
  },
1112
1112
  createRow: (row, instance) => {
1113
1113
  return {
1114
- columnFilterMap: {},
1114
+ columnFilters: {},
1115
+ columnFiltersMeta: {},
1115
1116
  subRowsByFacetId: {}
1116
1117
  };
1117
1118
  },
@@ -2353,7 +2354,7 @@
2353
2354
  createColumn: (column, instance) => {
2354
2355
  return {
2355
2356
  getAutoSortingFn: () => {
2356
- const firstRows = instance.getFilteredRowModel().flatRows.slice(100);
2357
+ const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2357
2358
  let isString = false;
2358
2359
 
2359
2360
  for (const row of firstRows) {
@@ -3201,6 +3202,7 @@
3201
3202
  setRowType: () => table,
3202
3203
  setTableMetaType: () => table,
3203
3204
  setColumnMetaType: () => table,
3205
+ setFilterMetaType: () => table,
3204
3206
  setOptions: newOptions => createTable$1(_, __, { ...options,
3205
3207
  ...newOptions
3206
3208
  }),
@@ -3328,7 +3330,7 @@
3328
3330
 
3329
3331
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3330
3332
  newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3331
- newRow.columnFilterMap = row.columnFilterMap;
3333
+ newRow.columnFilters = row.columnFilters;
3332
3334
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3333
3335
 
3334
3336
  if (!newRow.subRows.length) {
@@ -3401,6 +3403,11 @@
3401
3403
  function getFilteredRowModel() {
3402
3404
  return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3403
3405
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3406
+ for (let i = 0; i < rowModel.flatRows.length; i++) {
3407
+ rowModel.flatRows[i].columnFilters = {};
3408
+ rowModel.flatRows[i].columnFiltersMeta = {};
3409
+ }
3410
+
3404
3411
  return rowModel;
3405
3412
  }
3406
3413
 
@@ -3455,28 +3462,34 @@
3455
3462
 
3456
3463
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3457
3464
  const row = rowModel.flatRows[j];
3458
- row.columnFilterMap = {};
3465
+ row.columnFilters = {};
3459
3466
 
3460
3467
  if (resolvedColumnFilters.length) {
3461
3468
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3462
- currentColumnFilter = resolvedColumnFilters[i]; // Tag the row with the column filter state
3469
+ currentColumnFilter = resolvedColumnFilters[i];
3470
+ const id = currentColumnFilter.id; // Tag the row with the column filter state
3463
3471
 
3464
- row.columnFilterMap[currentColumnFilter.id] = currentColumnFilter.filterFn(row, currentColumnFilter.id, currentColumnFilter.resolvedValue);
3472
+ row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3473
+ row.columnFiltersMeta[id] = filterMeta;
3474
+ });
3465
3475
  }
3466
3476
  }
3467
3477
 
3468
3478
  if (resolvedGlobalFilters.length) {
3469
3479
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3470
- currentGlobalFilter = resolvedGlobalFilters[i]; // Tag the row with the first truthy global filter state
3480
+ currentGlobalFilter = resolvedGlobalFilters[i];
3481
+ const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3471
3482
 
3472
- if (currentGlobalFilter.filterFn(row, currentGlobalFilter.id, currentGlobalFilter.resolvedValue)) {
3473
- row.columnFilterMap.__global__ = true;
3483
+ if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3484
+ row.columnFiltersMeta[id] = filterMeta;
3485
+ })) {
3486
+ row.columnFilters.__global__ = true;
3474
3487
  break;
3475
3488
  }
3476
3489
  }
3477
3490
 
3478
- if (row.columnFilterMap.__global__ !== true) {
3479
- row.columnFilterMap.__global__ = false;
3491
+ if (row.columnFilters.__global__ !== true) {
3492
+ row.columnFilters.__global__ = false;
3480
3493
  }
3481
3494
  }
3482
3495
  }
@@ -3484,7 +3497,7 @@
3484
3497
  const filterRowsImpl = row => {
3485
3498
  // Horizontally filter rows through each column
3486
3499
  for (let i = 0; i < filterableIds.length; i++) {
3487
- if (row.columnFilterMap[filterableIds[i]] === false) {
3500
+ if (row.columnFilters[filterableIds[i]] === false) {
3488
3501
  return false;
3489
3502
  }
3490
3503
  }
@@ -3518,7 +3531,7 @@
3518
3531
  const filterRowsImpl = row => {
3519
3532
  // Horizontally filter rows through each column
3520
3533
  for (let i = 0; i < filterableIds.length; i++) {
3521
- if (row.columnFilterMap[filterableIds[i]] === false) {
3534
+ if (row.columnFilters[filterableIds[i]] === false) {
3522
3535
  return false;
3523
3536
  }
3524
3537
  }
@@ -3993,12 +4006,14 @@
3993
4006
  exports.RowSelection = RowSelection;
3994
4007
  exports.Sorting = Sorting;
3995
4008
  exports.Visibility = Visibility;
4009
+ exports.aggregationFns = aggregationFns;
3996
4010
  exports.buildHeaderGroups = buildHeaderGroups;
3997
4011
  exports.createTable = createTable;
3998
4012
  exports.createTableFactory = createTableFactory;
3999
4013
  exports.createTableInstance = createTableInstance;
4000
4014
  exports.defaultColumnSizing = defaultColumnSizing;
4001
4015
  exports.expandRows = expandRows;
4016
+ exports.filterFns = filterFns;
4002
4017
  exports.flattenBy = flattenBy;
4003
4018
  exports.functionalUpdate = functionalUpdate;
4004
4019
  exports.getCoreRowModel = getCoreRowModel;
@@ -4013,13 +4028,16 @@
4013
4028
  exports.isFunction = isFunction;
4014
4029
  exports.isRowSelected = isRowSelected;
4015
4030
  exports.makeStateUpdater = makeStateUpdater;
4031
+ exports.mean = mean;
4016
4032
  exports.memo = memo;
4017
4033
  exports.noop = noop;
4018
4034
  exports.orderColumns = orderColumns;
4019
4035
  exports.passiveEventSupported = passiveEventSupported;
4036
+ exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
4020
4037
  exports.render = render;
4021
4038
  exports.selectRowsFn = selectRowsFn;
4022
4039
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
4040
+ exports.sortingFns = sortingFns;
4023
4041
  exports.useTableInstance = useTableInstance;
4024
4042
 
4025
4043
  Object.defineProperty(exports, '__esModule', { value: true });