@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.
@@ -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":"e8ea-163"},{"name":"svelte-table/src","children":[{"uid":"e8ea-165","name":"placeholder.svelte"},{"uid":"e8ea-167","name":"render-component.ts"},{"uid":"e8ea-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"e8ea-163":{"renderedLength":139811,"gzipLength":23896,"brotliLength":0,"mainUid":"e8ea-162"},"e8ea-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"e8ea-164"},"e8ea-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"e8ea-166"},"e8ea-169":{"renderedLength":2729,"gzipLength":868,"brotliLength":0,"mainUid":"e8ea-168"}},"nodeMetas":{"e8ea-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"e8ea-163"},"imported":[],"importedBy":[{"uid":"e8ea-168"}]},"e8ea-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"e8ea-165"},"imported":[{"uid":"e8ea-170"}],"importedBy":[{"uid":"e8ea-168"}]},"e8ea-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"e8ea-167"},"imported":[{"uid":"e8ea-170"}],"importedBy":[{"uid":"e8ea-168"}]},"e8ea-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"e8ea-169"},"imported":[{"uid":"e8ea-162"},{"uid":"e8ea-164"},{"uid":"e8ea-170"},{"uid":"e8ea-171"},{"uid":"e8ea-166"}],"importedBy":[],"isEntry":true},"e8ea-170":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"e8ea-168"},{"uid":"e8ea-164"},{"uid":"e8ea-166"}],"isExternal":true},"e8ea-171":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"e8ea-168"}],"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-163"},{"name":"svelte-table/src","children":[{"uid":"1e4f-165","name":"placeholder.svelte"},{"uid":"1e4f-167","name":"render-component.ts"},{"uid":"1e4f-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"1e4f-163":{"renderedLength":140240,"gzipLength":23956,"brotliLength":0,"mainUid":"1e4f-162"},"1e4f-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"1e4f-164"},"1e4f-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"1e4f-166"},"1e4f-169":{"renderedLength":2729,"gzipLength":868,"brotliLength":0,"mainUid":"1e4f-168"}},"nodeMetas":{"1e4f-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"1e4f-163"},"imported":[],"importedBy":[{"uid":"1e4f-168"}]},"1e4f-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"1e4f-165"},"imported":[{"uid":"1e4f-170"}],"importedBy":[{"uid":"1e4f-168"}]},"1e4f-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"1e4f-167"},"imported":[{"uid":"1e4f-170"}],"importedBy":[{"uid":"1e4f-168"}]},"1e4f-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"1e4f-169"},"imported":[{"uid":"1e4f-162"},{"uid":"1e4f-164"},{"uid":"1e4f-170"},{"uid":"1e4f-171"},{"uid":"1e4f-166"}],"importedBy":[],"isEntry":true},"1e4f-170":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"1e4f-168"},{"uid":"1e4f-164"},{"uid":"1e4f-166"}],"isExternal":true},"1e4f-171":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"1e4f-168"}],"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,21 +11,21 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "e8ea-173"
14
+ "uid": "1e4f-173"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "e8ea-175",
20
+ "uid": "1e4f-175",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "e8ea-177",
24
+ "uid": "1e4f-177",
25
25
  "name": "render-component.ts"
26
26
  },
27
27
  {
28
- "uid": "e8ea-179",
28
+ "uid": "1e4f-179",
29
29
  "name": "index.ts"
30
30
  }
31
31
  ]
@@ -38,125 +38,125 @@
38
38
  "isRoot": true
39
39
  },
40
40
  "nodeParts": {
41
- "e8ea-173": {
42
- "renderedLength": 139811,
43
- "gzipLength": 23896,
41
+ "1e4f-173": {
42
+ "renderedLength": 140240,
43
+ "gzipLength": 23956,
44
44
  "brotliLength": 0,
45
- "mainUid": "e8ea-172"
45
+ "mainUid": "1e4f-172"
46
46
  },
47
- "e8ea-175": {
47
+ "1e4f-175": {
48
48
  "renderedLength": 925,
49
49
  "gzipLength": 444,
50
50
  "brotliLength": 0,
51
- "mainUid": "e8ea-174"
51
+ "mainUid": "1e4f-174"
52
52
  },
53
- "e8ea-177": {
53
+ "1e4f-177": {
54
54
  "renderedLength": 1365,
55
55
  "gzipLength": 519,
56
56
  "brotliLength": 0,
57
- "mainUid": "e8ea-176"
57
+ "mainUid": "1e4f-176"
58
58
  },
59
- "e8ea-179": {
59
+ "1e4f-179": {
60
60
  "renderedLength": 2729,
61
61
  "gzipLength": 868,
62
62
  "brotliLength": 0,
63
- "mainUid": "e8ea-178"
63
+ "mainUid": "1e4f-178"
64
64
  }
65
65
  },
66
66
  "nodeMetas": {
67
- "e8ea-172": {
67
+ "1e4f-172": {
68
68
  "id": "/packages/table-core/build/esm/index.js",
69
69
  "moduleParts": {
70
- "index.production.js": "e8ea-173"
70
+ "index.production.js": "1e4f-173"
71
71
  },
72
72
  "imported": [],
73
73
  "importedBy": [
74
74
  {
75
- "uid": "e8ea-178"
75
+ "uid": "1e4f-178"
76
76
  }
77
77
  ]
78
78
  },
79
- "e8ea-174": {
79
+ "1e4f-174": {
80
80
  "id": "/packages/svelte-table/src/placeholder.svelte",
81
81
  "moduleParts": {
82
- "index.production.js": "e8ea-175"
82
+ "index.production.js": "1e4f-175"
83
83
  },
84
84
  "imported": [
85
85
  {
86
- "uid": "e8ea-180"
86
+ "uid": "1e4f-180"
87
87
  }
88
88
  ],
89
89
  "importedBy": [
90
90
  {
91
- "uid": "e8ea-178"
91
+ "uid": "1e4f-178"
92
92
  }
93
93
  ]
94
94
  },
95
- "e8ea-176": {
95
+ "1e4f-176": {
96
96
  "id": "/packages/svelte-table/src/render-component.ts",
97
97
  "moduleParts": {
98
- "index.production.js": "e8ea-177"
98
+ "index.production.js": "1e4f-177"
99
99
  },
100
100
  "imported": [
101
101
  {
102
- "uid": "e8ea-180"
102
+ "uid": "1e4f-180"
103
103
  }
104
104
  ],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "e8ea-178"
107
+ "uid": "1e4f-178"
108
108
  }
109
109
  ]
110
110
  },
111
- "e8ea-178": {
111
+ "1e4f-178": {
112
112
  "id": "/packages/svelte-table/src/index.ts",
113
113
  "moduleParts": {
114
- "index.production.js": "e8ea-179"
114
+ "index.production.js": "1e4f-179"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "e8ea-172"
118
+ "uid": "1e4f-172"
119
119
  },
120
120
  {
121
- "uid": "e8ea-174"
121
+ "uid": "1e4f-174"
122
122
  },
123
123
  {
124
- "uid": "e8ea-180"
124
+ "uid": "1e4f-180"
125
125
  },
126
126
  {
127
- "uid": "e8ea-181"
127
+ "uid": "1e4f-181"
128
128
  },
129
129
  {
130
- "uid": "e8ea-176"
130
+ "uid": "1e4f-176"
131
131
  }
132
132
  ],
133
133
  "importedBy": [],
134
134
  "isEntry": true
135
135
  },
136
- "e8ea-180": {
136
+ "1e4f-180": {
137
137
  "id": "svelte/internal",
138
138
  "moduleParts": {},
139
139
  "imported": [],
140
140
  "importedBy": [
141
141
  {
142
- "uid": "e8ea-178"
142
+ "uid": "1e4f-178"
143
143
  },
144
144
  {
145
- "uid": "e8ea-174"
145
+ "uid": "1e4f-174"
146
146
  },
147
147
  {
148
- "uid": "e8ea-176"
148
+ "uid": "1e4f-176"
149
149
  }
150
150
  ],
151
151
  "isExternal": true
152
152
  },
153
- "e8ea-181": {
153
+ "1e4f-181": {
154
154
  "id": "svelte/store",
155
155
  "moduleParts": {},
156
156
  "imported": [],
157
157
  "importedBy": [
158
158
  {
159
- "uid": "e8ea-178"
159
+ "uid": "1e4f-178"
160
160
  }
161
161
  ],
162
162
  "isExternal": true
@@ -300,7 +300,7 @@
300
300
  const column = instance.getColumn(columnId);
301
301
 
302
302
  if (!column.accessorFn) {
303
- throw new Error();
303
+ return undefined;
304
304
  }
305
305
 
306
306
  row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -537,7 +537,7 @@
537
537
  }
538
538
  }
539
539
 
540
- const startSize = column.getSize();
540
+ const startSize = header.getSize();
541
541
  const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
542
542
  const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
543
543
 
@@ -1091,7 +1091,8 @@
1091
1091
  },
1092
1092
  createRow: (row, instance) => {
1093
1093
  return {
1094
- columnFilterMap: {},
1094
+ columnFilters: {},
1095
+ columnFiltersMeta: {},
1095
1096
  subRowsByFacetId: {}
1096
1097
  };
1097
1098
  },
@@ -2333,7 +2334,7 @@
2333
2334
  createColumn: (column, instance) => {
2334
2335
  return {
2335
2336
  getAutoSortingFn: () => {
2336
- const firstRows = instance.getFilteredRowModel().flatRows.slice(100);
2337
+ const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2337
2338
  let isString = false;
2338
2339
 
2339
2340
  for (const row of firstRows) {
@@ -3181,6 +3182,7 @@
3181
3182
  setRowType: () => table,
3182
3183
  setTableMetaType: () => table,
3183
3184
  setColumnMetaType: () => table,
3185
+ setFilterMetaType: () => table,
3184
3186
  setOptions: newOptions => createTable$1(_, __, { ...options,
3185
3187
  ...newOptions
3186
3188
  }),
@@ -3308,7 +3310,7 @@
3308
3310
 
3309
3311
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3310
3312
  newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3311
- newRow.columnFilterMap = row.columnFilterMap;
3313
+ newRow.columnFilters = row.columnFilters;
3312
3314
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3313
3315
 
3314
3316
  if (!newRow.subRows.length) {
@@ -3381,6 +3383,11 @@
3381
3383
  function getFilteredRowModel() {
3382
3384
  return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3383
3385
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3386
+ for (let i = 0; i < rowModel.flatRows.length; i++) {
3387
+ rowModel.flatRows[i].columnFilters = {};
3388
+ rowModel.flatRows[i].columnFiltersMeta = {};
3389
+ }
3390
+
3384
3391
  return rowModel;
3385
3392
  }
3386
3393
 
@@ -3435,28 +3442,34 @@
3435
3442
 
3436
3443
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3437
3444
  const row = rowModel.flatRows[j];
3438
- row.columnFilterMap = {};
3445
+ row.columnFilters = {};
3439
3446
 
3440
3447
  if (resolvedColumnFilters.length) {
3441
3448
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3442
- currentColumnFilter = resolvedColumnFilters[i]; // Tag the row with the column filter state
3449
+ currentColumnFilter = resolvedColumnFilters[i];
3450
+ const id = currentColumnFilter.id; // Tag the row with the column filter state
3443
3451
 
3444
- row.columnFilterMap[currentColumnFilter.id] = currentColumnFilter.filterFn(row, currentColumnFilter.id, currentColumnFilter.resolvedValue);
3452
+ row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3453
+ row.columnFiltersMeta[id] = filterMeta;
3454
+ });
3445
3455
  }
3446
3456
  }
3447
3457
 
3448
3458
  if (resolvedGlobalFilters.length) {
3449
3459
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3450
- currentGlobalFilter = resolvedGlobalFilters[i]; // Tag the row with the first truthy global filter state
3460
+ currentGlobalFilter = resolvedGlobalFilters[i];
3461
+ const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3451
3462
 
3452
- if (currentGlobalFilter.filterFn(row, currentGlobalFilter.id, currentGlobalFilter.resolvedValue)) {
3453
- row.columnFilterMap.__global__ = true;
3463
+ if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3464
+ row.columnFiltersMeta[id] = filterMeta;
3465
+ })) {
3466
+ row.columnFilters.__global__ = true;
3454
3467
  break;
3455
3468
  }
3456
3469
  }
3457
3470
 
3458
- if (row.columnFilterMap.__global__ !== true) {
3459
- row.columnFilterMap.__global__ = false;
3471
+ if (row.columnFilters.__global__ !== true) {
3472
+ row.columnFilters.__global__ = false;
3460
3473
  }
3461
3474
  }
3462
3475
  }
@@ -3464,7 +3477,7 @@
3464
3477
  const filterRowsImpl = row => {
3465
3478
  // Horizontally filter rows through each column
3466
3479
  for (let i = 0; i < filterableIds.length; i++) {
3467
- if (row.columnFilterMap[filterableIds[i]] === false) {
3480
+ if (row.columnFilters[filterableIds[i]] === false) {
3468
3481
  return false;
3469
3482
  }
3470
3483
  }
@@ -3498,7 +3511,7 @@
3498
3511
  const filterRowsImpl = row => {
3499
3512
  // Horizontally filter rows through each column
3500
3513
  for (let i = 0; i < filterableIds.length; i++) {
3501
- if (row.columnFilterMap[filterableIds[i]] === false) {
3514
+ if (row.columnFilters[filterableIds[i]] === false) {
3502
3515
  return false;
3503
3516
  }
3504
3517
  }
@@ -4113,12 +4126,14 @@
4113
4126
  exports.RowSelection = RowSelection;
4114
4127
  exports.Sorting = Sorting;
4115
4128
  exports.Visibility = Visibility;
4129
+ exports.aggregationFns = aggregationFns;
4116
4130
  exports.buildHeaderGroups = buildHeaderGroups;
4117
4131
  exports.createTable = createTable;
4118
4132
  exports.createTableFactory = createTableFactory;
4119
4133
  exports.createTableInstance = createTableInstance;
4120
4134
  exports.defaultColumnSizing = defaultColumnSizing;
4121
4135
  exports.expandRows = expandRows;
4136
+ exports.filterFns = filterFns;
4122
4137
  exports.flattenBy = flattenBy;
4123
4138
  exports.functionalUpdate = functionalUpdate;
4124
4139
  exports.getCoreRowModel = getCoreRowModel;
@@ -4133,14 +4148,17 @@
4133
4148
  exports.isFunction = isFunction;
4134
4149
  exports.isRowSelected = isRowSelected;
4135
4150
  exports.makeStateUpdater = makeStateUpdater;
4151
+ exports.mean = mean;
4136
4152
  exports.memo = memo;
4137
4153
  exports.noop = noop;
4138
4154
  exports.orderColumns = orderColumns;
4139
4155
  exports.passiveEventSupported = passiveEventSupported;
4156
+ exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
4140
4157
  exports.render = render;
4141
4158
  exports.renderComponent = renderComponent;
4142
4159
  exports.selectRowsFn = selectRowsFn;
4143
4160
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
4161
+ exports.sortingFns = sortingFns;
4144
4162
 
4145
4163
  Object.defineProperty(exports, '__esModule', { value: true });
4146
4164