@tanstack/react-table 8.0.0-alpha.80 → 8.0.0-alpha.84

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.
@@ -99,335 +99,459 @@ function memo(getDeps, fn, opts) {
99
99
  };
100
100
  }
101
101
 
102
+ function createColumn(instance, columnDef, depth, parent) {
103
+ var _ref, _columnDef$id;
104
+
105
+ const defaultColumn = instance._getDefaultColumnDef();
106
+
107
+ columnDef = { ...defaultColumn,
108
+ ...columnDef
109
+ };
110
+ let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
111
+ let accessorFn;
112
+
113
+ if (columnDef.accessorFn) {
114
+ accessorFn = columnDef.accessorFn;
115
+ } else if (columnDef.accessorKey) {
116
+ accessorFn = originalRow => originalRow[columnDef.accessorKey];
117
+ }
118
+
119
+ if (!id) {
120
+ if (process.env.NODE_ENV !== 'production') {
121
+ throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
122
+ }
123
+
124
+ throw new Error();
125
+ }
126
+
127
+ let column = { ...columnDef,
128
+ id: "" + id,
129
+ accessorFn,
130
+ parent: parent,
131
+ depth,
132
+ columnDef,
133
+ columnDefType: columnDef.columnDefType,
134
+ columns: [],
135
+ getFlatColumns: memo(() => [true], () => {
136
+ var _column$columns;
137
+
138
+ return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
139
+ }, {
140
+ key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',
141
+ debug: () => {
142
+ var _instance$options$deb;
143
+
144
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
145
+ }
146
+ }),
147
+ getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
148
+ var _column$columns2;
149
+
150
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
151
+ let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
152
+ return orderColumns(leafColumns);
153
+ }
154
+
155
+ return [column];
156
+ }, {
157
+ key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',
158
+ debug: () => {
159
+ var _instance$options$deb2;
160
+
161
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
162
+ }
163
+ })
164
+ };
165
+ column = instance._features.reduce((obj, feature) => {
166
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
167
+ }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
168
+
169
+ return column;
170
+ }
171
+
102
172
  //
103
- const Columns = {
173
+ function createHeader(instance, column, options) {
174
+ var _options$id;
175
+
176
+ const id = (_options$id = options.id) != null ? _options$id : column.id;
177
+ let header = {
178
+ id,
179
+ column,
180
+ index: options.index,
181
+ isPlaceholder: !!options.isPlaceholder,
182
+ placeholderId: options.placeholderId,
183
+ depth: options.depth,
184
+ subHeaders: [],
185
+ colSpan: 0,
186
+ rowSpan: 0,
187
+ headerGroup: null,
188
+ getLeafHeaders: () => {
189
+ const leafHeaders = [];
190
+
191
+ const recurseHeader = h => {
192
+ if (h.subHeaders && h.subHeaders.length) {
193
+ h.subHeaders.map(recurseHeader);
194
+ }
195
+
196
+ leafHeaders.push(h);
197
+ };
198
+
199
+ recurseHeader(header);
200
+ return leafHeaders;
201
+ },
202
+ renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
203
+ instance,
204
+ header: header,
205
+ column
206
+ }) : null,
207
+ renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
208
+ instance,
209
+ header: header,
210
+ column
211
+ }) : null
212
+ };
213
+
214
+ instance._features.forEach(feature => {
215
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
216
+ });
217
+
218
+ return header;
219
+ }
220
+
221
+ const Headers = {
104
222
  createInstance: instance => {
105
223
  return {
106
- getDefaultColumn: memo(() => [instance.options.defaultColumn], defaultColumn => {
107
- var _defaultColumn;
108
-
109
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
110
- return {
111
- header: props => props.header.column.id,
112
- footer: props => props.header.column.id,
113
- cell: props => {
114
- var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
115
-
116
- 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;
117
- },
118
- ...instance._features.reduce((obj, feature) => {
119
- return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
120
- }, {}),
121
- ...defaultColumn
122
- };
224
+ // Header Groups
225
+ getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
226
+ var _left$map$filter, _right$map$filter;
227
+
228
+ const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
229
+ const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
230
+ const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
231
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
232
+ return headerGroups;
123
233
  }, {
234
+ key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
124
235
  debug: () => {
125
236
  var _instance$options$deb;
126
237
 
127
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
128
- },
129
- key: process.env.NODE_ENV === 'development' && 'getDefaultColumn'
238
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
239
+ }
130
240
  }),
131
- getColumnDefs: () => instance.options.columns,
132
- createColumn: (columnDef, depth, parent) => {
133
- var _ref, _columnDef$id;
134
-
135
- const defaultColumn = instance.getDefaultColumn();
136
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
137
- let accessorFn;
241
+ getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
242
+ leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
243
+ return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
244
+ }, {
245
+ key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
246
+ debug: () => {
247
+ var _instance$options$deb2;
138
248
 
139
- if (columnDef.accessorFn) {
140
- accessorFn = columnDef.accessorFn;
141
- } else if (columnDef.accessorKey) {
142
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
249
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
143
250
  }
251
+ }),
252
+ getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
253
+ var _left$map$filter2;
144
254
 
145
- if (!id) {
146
- if (process.env.NODE_ENV !== 'production') {
147
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
148
- }
255
+ const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
256
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
257
+ }, {
258
+ key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
259
+ debug: () => {
260
+ var _instance$options$deb3;
149
261
 
150
- throw new Error();
262
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
151
263
  }
264
+ }),
265
+ getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
266
+ var _right$map$filter2;
152
267
 
153
- let column = { ...defaultColumn,
154
- ...columnDef,
155
- id: "" + id,
156
- accessorFn,
157
- parent: parent,
158
- depth,
159
- columnDef,
160
- columnDefType: columnDef.columnDefType,
161
- columns: [],
162
- getFlatColumns: memo(() => [true], () => {
163
- var _column$columns;
164
-
165
- return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
166
- }, {
167
- key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',
168
- debug: () => {
169
- var _instance$options$deb2;
170
-
171
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
172
- }
173
- }),
174
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
175
- var _column$columns2;
176
-
177
- if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
178
- let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
179
- return orderColumns(leafColumns);
180
- }
181
-
182
- return [column];
183
- }, {
184
- key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',
185
- debug: () => {
186
- var _instance$options$deb3;
187
-
188
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
189
- }
190
- })
191
- };
192
- column = instance._features.reduce((obj, feature) => {
193
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
194
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
195
-
196
- return column;
197
- },
198
- getAllColumns: memo(() => [instance.getColumnDefs()], columnDefs => {
199
- const recurseColumns = function (columnDefs, parent, depth) {
200
- if (depth === void 0) {
201
- depth = 0;
202
- }
203
-
204
- return columnDefs.map(columnDef => {
205
- const column = instance.createColumn(columnDef, depth, parent);
206
- column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
207
- return column;
208
- });
209
- };
210
-
211
- return recurseColumns(columnDefs);
268
+ const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
269
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
212
270
  }, {
213
- key: process.env.NODE_ENV === 'development' && 'getAllColumns',
271
+ key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
214
272
  debug: () => {
215
273
  var _instance$options$deb4;
216
274
 
217
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
275
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
218
276
  }
219
277
  }),
220
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
221
- return allColumns.flatMap(column => {
222
- return column.getFlatColumns();
223
- });
278
+ // Footer Groups
279
+ getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
280
+ return [...headerGroups].reverse();
224
281
  }, {
225
- key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
282
+ key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
226
283
  debug: () => {
227
284
  var _instance$options$deb5;
228
285
 
229
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
286
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
230
287
  }
231
288
  }),
232
- getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
233
- return flatColumns.reduce((acc, column) => {
234
- acc[column.id] = column;
235
- return acc;
236
- }, {});
289
+ getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
290
+ return [...headerGroups].reverse();
237
291
  }, {
238
- key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
292
+ key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
239
293
  debug: () => {
240
294
  var _instance$options$deb6;
241
295
 
242
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
296
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
243
297
  }
244
298
  }),
245
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
246
- let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
247
- return orderColumns(leafColumns);
299
+ getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
300
+ return [...headerGroups].reverse();
248
301
  }, {
249
- key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
302
+ key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
250
303
  debug: () => {
251
304
  var _instance$options$deb7;
252
305
 
253
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
306
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
254
307
  }
255
308
  }),
256
- getColumn: columnId => {
257
- const column = instance.getAllFlatColumnsById()[columnId];
258
-
259
- if (!column) {
260
- if (process.env.NODE_ENV !== 'production') {
261
- console.warn("[Table] Column with id " + columnId + " does not exist.");
262
- }
309
+ getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
310
+ return [...headerGroups].reverse();
311
+ }, {
312
+ key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
313
+ debug: () => {
314
+ var _instance$options$deb8;
263
315
 
264
- throw new Error();
316
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
265
317
  }
318
+ }),
319
+ // Flat Headers
320
+ getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
321
+ return headerGroups.map(headerGroup => {
322
+ return headerGroup.headers;
323
+ }).flat();
324
+ }, {
325
+ key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
326
+ debug: () => {
327
+ var _instance$options$deb9;
266
328
 
267
- return column;
268
- }
269
- };
270
- }
271
- };
272
-
273
- //
274
- const Rows = {
275
- // createRow: <TGenerics extends TableGenerics>(
276
- // row: Row<TGenerics>,
277
- // instance: TableInstance<TGenerics>
278
- // ): CellsRow<TGenerics> => {
279
- // return {}
280
- // },
281
- createInstance: instance => {
282
- return {
283
- getRowId: (row, index, parent) => {
284
- var _instance$options$get;
285
-
286
- return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
287
- },
288
- createRow: (id, original, rowIndex, depth, subRows) => {
289
- let row = {
290
- id,
291
- index: rowIndex,
292
- original,
293
- depth,
294
- valuesCache: {},
295
- getValue: columnId => {
296
- if (row.valuesCache.hasOwnProperty(columnId)) {
297
- return row.valuesCache[columnId];
298
- }
299
-
300
- const column = instance.getColumn(columnId);
301
-
302
- if (!column.accessorFn) {
303
- return undefined;
304
- }
305
-
306
- row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
307
- return row.valuesCache[columnId];
308
- },
309
- subRows: subRows != null ? subRows : [],
310
- getLeafRows: () => flattenBy(row.subRows, d => d.subRows)
311
- };
329
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
330
+ }
331
+ }),
332
+ getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
333
+ return left.map(headerGroup => {
334
+ return headerGroup.headers;
335
+ }).flat();
336
+ }, {
337
+ key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
338
+ debug: () => {
339
+ var _instance$options$deb10;
312
340
 
313
- for (let i = 0; i < instance._features.length; i++) {
314
- const feature = instance._features[i];
315
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
341
+ return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
316
342
  }
343
+ }),
344
+ getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
345
+ return left.map(headerGroup => {
346
+ return headerGroup.headers;
347
+ }).flat();
348
+ }, {
349
+ key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
350
+ debug: () => {
351
+ var _instance$options$deb11;
317
352
 
318
- return row;
319
- },
320
- getCoreRowModel: () => {
321
- if (!instance._getCoreRowModel) {
322
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
353
+ return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
323
354
  }
355
+ }),
356
+ getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
357
+ return left.map(headerGroup => {
358
+ return headerGroup.headers;
359
+ }).flat();
360
+ }, {
361
+ key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
362
+ debug: () => {
363
+ var _instance$options$deb12;
324
364
 
325
- return instance._getCoreRowModel();
326
- },
327
- // The final calls start at the bottom of the model,
328
- // expanded rows, which then work their way up
329
- getRowModel: () => {
330
- return instance.getPaginationRowModel();
331
- },
332
- getRow: id => {
333
- const row = instance.getRowModel().rowsById[id];
365
+ return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
366
+ }
367
+ }),
368
+ // Leaf Headers
369
+ getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
370
+ return flatHeaders.filter(header => {
371
+ var _header$subHeaders;
334
372
 
335
- if (!row) {
336
- if (process.env.NODE_ENV !== 'production') {
337
- throw new Error("getRow expected an ID, but got " + id);
338
- }
373
+ return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
374
+ });
375
+ }, {
376
+ key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
377
+ debug: () => {
378
+ var _instance$options$deb13;
339
379
 
340
- throw new Error();
380
+ return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
341
381
  }
382
+ }),
383
+ getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
384
+ return flatHeaders.filter(header => {
385
+ var _header$subHeaders2;
342
386
 
343
- return row;
344
- }
345
- };
346
- }
347
- };
387
+ return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
388
+ });
389
+ }, {
390
+ key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
391
+ debug: () => {
392
+ var _instance$options$deb14;
348
393
 
349
- //
350
- const Cells = {
351
- createRow: (row, instance) => {
352
- return {
353
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
354
- return leafColumns.map(column => {
355
- return instance.createCell(row, column, column.id);
394
+ return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
395
+ }
396
+ }),
397
+ getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
398
+ return flatHeaders.filter(header => {
399
+ var _header$subHeaders3;
400
+
401
+ return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
356
402
  });
357
403
  }, {
358
- key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
404
+ key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
359
405
  debug: () => {
360
- var _instance$options$deb;
406
+ var _instance$options$deb15;
361
407
 
362
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
408
+ return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
363
409
  }
364
410
  }),
365
- getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
366
- return allCells.reduce((acc, cell) => {
367
- acc[cell.columnId] = cell;
368
- return acc;
369
- }, {});
411
+ getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
412
+ var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
413
+
414
+ return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
415
+ return header.getLeafHeaders();
416
+ }).flat();
370
417
  }, {
371
- key: process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
418
+ key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
372
419
  debug: () => {
373
- var _instance$options$deb2;
420
+ var _instance$options$deb16;
374
421
 
375
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
422
+ return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
376
423
  }
377
424
  })
378
425
  };
379
- },
380
- createInstance: instance => {
381
- return {
382
- createCell: (row, column, columnId) => {
383
- const cell = {
384
- id: row.id + "_" + column.id,
385
- rowId: row.id,
386
- columnId,
387
- row,
388
- column,
389
- getValue: () => row.getValue(columnId),
390
- renderCell: () => column.cell ? instance._render(column.cell, {
391
- instance,
392
- column,
393
- row,
394
- cell: cell,
395
- getValue: cell.getValue
396
- }) : null
397
- };
398
-
399
- instance._features.forEach(feature => {
400
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
401
- }, {});
426
+ }
427
+ };
428
+ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
429
+ var _headerGroups$0$heade, _headerGroups$;
402
430
 
403
- return cell;
404
- },
405
- getCell: (rowId, columnId) => {
406
- const row = instance.getRow(rowId);
431
+ // Find the max depth of the columns:
432
+ // build the leaf column row
433
+ // build each buffer row going up
434
+ // placeholder for non-existent level
435
+ // real column for existing level
436
+ let maxDepth = 0;
407
437
 
408
- if (!row) {
409
- if (process.env.NODE_ENV !== 'production') {
410
- throw new Error("[Table] could not find row with id " + rowId);
411
- }
438
+ const findMaxDepth = function (columns, depth) {
439
+ if (depth === void 0) {
440
+ depth = 1;
441
+ }
412
442
 
413
- throw new Error();
414
- }
443
+ maxDepth = Math.max(maxDepth, depth);
444
+ columns.filter(column => column.getIsVisible()).forEach(column => {
445
+ var _column$columns;
415
446
 
416
- const cell = row.getAllCellsByColumnId()[columnId];
447
+ if ((_column$columns = column.columns) != null && _column$columns.length) {
448
+ findMaxDepth(column.columns, depth + 1);
449
+ }
450
+ }, 0);
451
+ };
417
452
 
418
- if (!cell) {
419
- if (process.env.NODE_ENV !== 'production') {
420
- throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
421
- }
453
+ findMaxDepth(allColumns);
454
+ let headerGroups = [];
422
455
 
423
- throw new Error();
424
- }
456
+ const createHeaderGroup = (headersToGroup, depth) => {
457
+ // The header group we are creating
458
+ const headerGroup = {
459
+ depth,
460
+ id: [headerFamily, "" + depth].filter(Boolean).join('_'),
461
+ headers: []
462
+ }; // The parent columns we're going to scan next
463
+
464
+ const pendingParentHeaders = []; // Scan each column for parents
425
465
 
426
- return cell;
466
+ headersToGroup.forEach(headerToGroup => {
467
+ // What is the latest (last) parent column?
468
+ const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
469
+ const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
470
+ let column;
471
+ let isPlaceholder = false;
472
+
473
+ if (isLeafHeader && headerToGroup.column.parent) {
474
+ // The parent header is new
475
+ column = headerToGroup.column.parent;
476
+ } else {
477
+ // The parent header is repeated
478
+ column = headerToGroup.column;
479
+ isPlaceholder = true;
480
+ }
481
+
482
+ if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
483
+ // This column is repeated. Add it as a sub header to the next batch
484
+ latestPendingParentHeader.subHeaders.push(headerToGroup);
485
+ } else {
486
+ // This is a new header. Let's create it
487
+ const header = createHeader(instance, column, {
488
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
489
+ isPlaceholder,
490
+ placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
491
+ depth,
492
+ index: pendingParentHeaders.length
493
+ }); // Add the headerToGroup as a subHeader of the new header
494
+
495
+ header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
496
+ // in the next batch
497
+
498
+ pendingParentHeaders.push(header);
499
+ }
500
+
501
+ headerGroup.headers.push(headerToGroup);
502
+ headerToGroup.headerGroup = headerGroup;
503
+ });
504
+ headerGroups.push(headerGroup);
505
+
506
+ if (depth > 0) {
507
+ createHeaderGroup(pendingParentHeaders, depth - 1);
508
+ }
509
+ };
510
+
511
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
512
+ depth: maxDepth,
513
+ index
514
+ }));
515
+ createHeaderGroup(bottomHeaders, maxDepth - 1);
516
+ headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
517
+ // return !headerGroup.headers.every(header => header.isPlaceholder)
518
+ // })
519
+
520
+ const recurseHeadersForSpans = headers => {
521
+ const filteredHeaders = headers.filter(header => header.column.getIsVisible());
522
+ return filteredHeaders.map(header => {
523
+ let colSpan = 0;
524
+ let rowSpan = 0;
525
+ let childRowSpans = [0];
526
+
527
+ if (header.subHeaders && header.subHeaders.length) {
528
+ childRowSpans = [];
529
+ recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
530
+ let {
531
+ colSpan: childColSpan,
532
+ rowSpan: childRowSpan
533
+ } = _ref;
534
+ colSpan += childColSpan;
535
+ childRowSpans.push(childRowSpan);
536
+ });
537
+ } else {
538
+ colSpan = 1;
427
539
  }
428
- };
429
- }
430
- };
540
+
541
+ const minChildRowSpan = Math.min(...childRowSpans);
542
+ rowSpan = rowSpan + minChildRowSpan;
543
+ header.colSpan = colSpan;
544
+ header.rowSpan = rowSpan;
545
+ return {
546
+ colSpan,
547
+ rowSpan
548
+ };
549
+ });
550
+ };
551
+
552
+ recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
553
+ return headerGroups;
554
+ }
431
555
 
432
556
  //
433
557
  const defaultColumnSizing = {
@@ -446,7 +570,7 @@ const getDefaultColumnSizingInfoState = () => ({
446
570
  });
447
571
 
448
572
  const ColumnSizing = {
449
- getDefaultColumn: () => {
573
+ getDefaultColumnDef: () => {
450
574
  return defaultColumnSizing;
451
575
  },
452
576
  getInitialState: state => {
@@ -466,10 +590,10 @@ const ColumnSizing = {
466
590
  createColumn: (column, instance) => {
467
591
  return {
468
592
  getSize: () => {
469
- var _column$minSize, _ref, _column$maxSize;
593
+ var _column$columnDef$min, _ref, _column$columnDef$max;
470
594
 
471
595
  const columnSize = instance.getState().columnSizing[column.id];
472
- return Math.min(Math.max((_column$minSize = column.minSize) != null ? _column$minSize : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.size) != null ? _ref : defaultColumnSizing.size), (_column$maxSize = column.maxSize) != null ? _column$maxSize : defaultColumnSizing.maxSize);
596
+ 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);
473
597
  },
474
598
  getStart: position => {
475
599
  const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
@@ -492,9 +616,9 @@ const ColumnSizing = {
492
616
  });
493
617
  },
494
618
  getCanResize: () => {
495
- var _column$enableResizin, _instance$options$ena;
619
+ var _column$columnDef$ena, _instance$options$ena;
496
620
 
497
- return ((_column$enableResizin = column.enableResizing) != null ? _column$enableResizin : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
621
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
498
622
  },
499
623
  getIsResizing: () => {
500
624
  return instance.getState().columnSizingInfo.isResizingColumn === column.id;
@@ -951,7 +1075,7 @@ function testFalsey(val) {
951
1075
 
952
1076
  //
953
1077
  const Filters = {
954
- getDefaultColumn: () => {
1078
+ getDefaultColumnDef: () => {
955
1079
  return {
956
1080
  filterFn: 'auto'
957
1081
  };
@@ -974,7 +1098,7 @@ const Filters = {
974
1098
  getColumnCanGlobalFilter: column => {
975
1099
  var _instance$getCoreRowM, _instance$getCoreRowM2;
976
1100
 
977
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM.getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1101
+ const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
978
1102
  return typeof value === 'string';
979
1103
  }
980
1104
  };
@@ -994,6 +1118,10 @@ const Filters = {
994
1118
  return filterFns.inNumberRange;
995
1119
  }
996
1120
 
1121
+ if (typeof value === 'boolean') {
1122
+ return filterFns.equals;
1123
+ }
1124
+
997
1125
  if (value !== null && typeof value === 'object') {
998
1126
  return filterFns.equals;
999
1127
  }
@@ -1011,14 +1139,14 @@ const Filters = {
1011
1139
  return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
1012
1140
  },
1013
1141
  getCanFilter: () => {
1014
- var _column$enableColumnF, _instance$options$ena, _instance$options$ena2;
1142
+ var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
1015
1143
 
1016
- return ((_column$enableColumnF = column.enableColumnFilter) != null ? _column$enableColumnF : 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;
1144
+ 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;
1017
1145
  },
1018
1146
  getCanGlobalFilter: () => {
1019
- var _column$enableGlobalF, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1147
+ var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1020
1148
 
1021
- return ((_column$enableGlobalF = column.enableGlobalFilter) != null ? _column$enableGlobalF : 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;
1149
+ 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;
1022
1150
  },
1023
1151
  getIsFiltered: () => column.getFilterIndex() > -1,
1024
1152
  getFilterValue: () => {
@@ -1097,7 +1225,8 @@ const Filters = {
1097
1225
  },
1098
1226
  createRow: (row, instance) => {
1099
1227
  return {
1100
- columnFilterMap: {},
1228
+ columnFilters: {},
1229
+ columnFiltersMeta: {},
1101
1230
  subRowsByFacetId: {}
1102
1231
  };
1103
1232
  },
@@ -1295,7 +1424,7 @@ function count(getLeafValues) {
1295
1424
 
1296
1425
  //
1297
1426
  const Grouping = {
1298
- getDefaultColumn: () => {
1427
+ getDefaultColumnDef: () => {
1299
1428
  return {
1300
1429
  aggregationFn: 'auto'
1301
1430
  };
@@ -1325,9 +1454,9 @@ const Grouping = {
1325
1454
  });
1326
1455
  },
1327
1456
  getCanGroup: () => {
1328
- var _ref, _ref2, _ref3, _column$enableGroupin;
1457
+ var _ref, _ref2, _ref3, _column$columnDef$ena;
1329
1458
 
1330
- return (_ref = (_ref2 = (_ref3 = (_column$enableGroupin = column.enableGrouping) != null ? _column$enableGroupin : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
1459
+ 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;
1331
1460
  },
1332
1461
  getIsGrouped: () => {
1333
1462
  var _instance$getState$gr;
@@ -1411,9 +1540,9 @@ const Grouping = {
1411
1540
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1412
1541
  },
1413
1542
  renderAggregatedCell: () => {
1414
- var _column$aggregatedCel;
1543
+ var _column$columnDef$agg;
1415
1544
 
1416
- const template = (_column$aggregatedCel = column.aggregatedCell) != null ? _column$aggregatedCel : column.cell;
1545
+ const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
1417
1546
  return template ? instance._render(template, {
1418
1547
  instance,
1419
1548
  column,
@@ -1720,9 +1849,9 @@ const Pinning = {
1720
1849
  getCanPin: () => {
1721
1850
  const leafColumns = column.getLeafColumns();
1722
1851
  return leafColumns.some(d => {
1723
- var _d$enablePinning, _instance$options$ena;
1852
+ var _d$columnDef$enablePi, _instance$options$ena;
1724
1853
 
1725
- return ((_d$enablePinning = d.enablePinning) != null ? _d$enablePinning : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1854
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1726
1855
  });
1727
1856
  },
1728
1857
  getIsPinned: () => {
@@ -1747,7 +1876,7 @@ const Pinning = {
1747
1876
  return {
1748
1877
  getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1749
1878
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1750
- return allCells.filter(d => !leftAndRight.includes(d.columnId));
1879
+ return allCells.filter(d => !leftAndRight.includes(d.column.id));
1751
1880
  }, {
1752
1881
  key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
1753
1882
  debug: () => {
@@ -1757,7 +1886,7 @@ const Pinning = {
1757
1886
  }
1758
1887
  }),
1759
1888
  getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1760
- const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1889
+ const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1761
1890
  position: 'left'
1762
1891
  }));
1763
1892
  return cells;
@@ -1770,7 +1899,7 @@ const Pinning = {
1770
1899
  }
1771
1900
  }),
1772
1901
  getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1773
- const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1902
+ const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1774
1903
  position: 'left'
1775
1904
  }));
1776
1905
  return cells;
@@ -1792,12 +1921,18 @@ const Pinning = {
1792
1921
 
1793
1922
  return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1794
1923
  },
1795
- getIsSomeColumnsPinned: () => {
1796
- const {
1797
- left,
1798
- right
1799
- } = instance.getState().columnPinning;
1800
- return Boolean((left == null ? void 0 : left.length) || (right == null ? void 0 : right.length));
1924
+ getIsSomeColumnsPinned: position => {
1925
+ var _pinningState$positio;
1926
+
1927
+ const pinningState = instance.getState().columnPinning;
1928
+
1929
+ if (!position) {
1930
+ var _pinningState$left, _pinningState$right;
1931
+
1932
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1933
+ }
1934
+
1935
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1801
1936
  },
1802
1937
  getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1803
1938
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
@@ -2323,7 +2458,7 @@ const Sorting = {
2323
2458
  ...state
2324
2459
  };
2325
2460
  },
2326
- getDefaultColumn: () => {
2461
+ getDefaultColumnDef: () => {
2327
2462
  return {
2328
2463
  sortingFn: 'auto'
2329
2464
  };
@@ -2339,7 +2474,7 @@ const Sorting = {
2339
2474
  createColumn: (column, instance) => {
2340
2475
  return {
2341
2476
  getAutoSortingFn: () => {
2342
- const firstRows = instance.getFilteredRowModel().flatRows.slice(100);
2477
+ const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2343
2478
  let isString = false;
2344
2479
 
2345
2480
  for (const row of firstRows) {
@@ -2383,7 +2518,7 @@ const Sorting = {
2383
2518
  throw new Error();
2384
2519
  }
2385
2520
 
2386
- return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
2521
+ 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];
2387
2522
  },
2388
2523
  toggleSorting: (desc, multi) => {
2389
2524
  // if (column.columns.length) {
@@ -2395,7 +2530,7 @@ const Sorting = {
2395
2530
  // return
2396
2531
  // }
2397
2532
  instance.setSorting(old => {
2398
- var _ref2, _column$sortDescFirst, _instance$options$ena, _instance$options$ena2;
2533
+ var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
2399
2534
 
2400
2535
  // Find any existing sorting for this column
2401
2536
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2422,7 +2557,7 @@ const Sorting = {
2422
2557
  }
2423
2558
  }
2424
2559
 
2425
- const sortDescFirst = (_ref2 = (_column$sortDescFirst = column.sortDescFirst) != null ? _column$sortDescFirst : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
2560
+ 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
2426
2561
 
2427
2562
  if (sortAction === 'toggle' && ( // Must be toggling
2428
2563
  (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
@@ -2466,14 +2601,14 @@ const Sorting = {
2466
2601
  });
2467
2602
  },
2468
2603
  getCanSort: () => {
2469
- var _column$enableSorting, _instance$options$ena3;
2604
+ var _column$columnDef$ena, _instance$options$ena3;
2470
2605
 
2471
- return ((_column$enableSorting = column.enableSorting) != null ? _column$enableSorting : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
2606
+ 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;
2472
2607
  },
2473
2608
  getCanMultiSort: () => {
2474
- var _ref3, _column$enableMultiSo;
2609
+ var _ref3, _column$columnDef$ena2;
2475
2610
 
2476
- return (_ref3 = (_column$enableMultiSo = column.enableMultiSort) != null ? _column$enableMultiSo : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2611
+ return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2477
2612
  },
2478
2613
  getIsSorted: () => {
2479
2614
  var _instance$getState$so;
@@ -2537,7 +2672,7 @@ const Visibility = {
2537
2672
  onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2538
2673
  };
2539
2674
  },
2540
- getDefaultColumn: () => {
2675
+ getDefaultColumnDef: () => {
2541
2676
  return {
2542
2677
  defaultIsVisible: true
2543
2678
  };
@@ -2557,9 +2692,9 @@ const Visibility = {
2557
2692
  return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2558
2693
  },
2559
2694
  getCanHide: () => {
2560
- var _column$enableHiding, _instance$options$ena;
2695
+ var _column$columnDef$ena, _instance$options$ena;
2561
2696
 
2562
- return ((_column$enableHiding = column.enableHiding) != null ? _column$enableHiding : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2697
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2563
2698
  },
2564
2699
  getToggleVisibilityHandler: () => {
2565
2700
  return e => {
@@ -2575,475 +2710,70 @@ const Visibility = {
2575
2710
  }, {
2576
2711
  key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
2577
2712
  debug: () => {
2578
- var _instance$options$deb;
2579
-
2580
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2581
- }
2582
- }),
2583
- getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2584
- key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
2585
- debug: () => {
2586
- var _instance$options$deb2;
2587
-
2588
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2589
- }
2590
- })
2591
- };
2592
- },
2593
- createInstance: instance => {
2594
- const makeVisibleColumnsMethod = (key, getColumns) => {
2595
- return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2596
- return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2597
- }, {
2598
- key,
2599
- debug: () => {
2600
- var _instance$options$deb3;
2601
-
2602
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2603
- }
2604
- });
2605
- };
2606
-
2607
- return {
2608
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2609
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2610
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2611
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2612
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2613
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2614
- resetColumnVisibility: defaultState => {
2615
- var _instance$initialStat;
2616
-
2617
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2618
- },
2619
- toggleAllColumnsVisible: value => {
2620
- var _value;
2621
-
2622
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2623
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2624
- [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2625
- }), {}));
2626
- },
2627
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2628
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2629
- getToggleAllColumnsVisibilityHandler: () => {
2630
- return e => {
2631
- var _target;
2632
-
2633
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2634
- };
2635
- }
2636
- };
2637
- }
2638
- };
2639
-
2640
- //
2641
- const Headers = {
2642
- createInstance: instance => {
2643
- return {
2644
- createHeader: (column, options) => {
2645
- var _options$id;
2646
-
2647
- const id = (_options$id = options.id) != null ? _options$id : column.id;
2648
- let header = {
2649
- id,
2650
- column,
2651
- index: options.index,
2652
- isPlaceholder: options.isPlaceholder,
2653
- placeholderId: options.placeholderId,
2654
- depth: options.depth,
2655
- subHeaders: [],
2656
- colSpan: 0,
2657
- rowSpan: 0,
2658
- headerGroup: null,
2659
- getLeafHeaders: () => {
2660
- const leafHeaders = [];
2661
-
2662
- const recurseHeader = h => {
2663
- if (h.subHeaders && h.subHeaders.length) {
2664
- h.subHeaders.map(recurseHeader);
2665
- }
2666
-
2667
- leafHeaders.push(h);
2668
- };
2669
-
2670
- recurseHeader(header);
2671
- return leafHeaders;
2672
- },
2673
- renderHeader: () => column.header ? instance._render(column.header, {
2674
- instance,
2675
- header: header,
2676
- column
2677
- }) : null,
2678
- renderFooter: () => column.footer ? instance._render(column.footer, {
2679
- instance,
2680
- header: header,
2681
- column
2682
- }) : null
2683
- };
2684
-
2685
- instance._features.forEach(feature => {
2686
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
2687
- });
2688
-
2689
- return header;
2690
- },
2691
- // Header Groups
2692
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2693
- var _left$map$filter, _right$map$filter;
2694
-
2695
- const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
2696
- const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
2697
- const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2698
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
2699
- return headerGroups;
2700
- }, {
2701
- key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
2702
- debug: () => {
2703
- var _instance$options$deb;
2704
-
2705
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
2706
- }
2707
- }),
2708
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2709
- leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2710
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
2711
- }, {
2712
- key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
2713
- debug: () => {
2714
- var _instance$options$deb2;
2715
-
2716
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
2717
- }
2718
- }),
2719
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
2720
- var _left$map$filter2;
2721
-
2722
- const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
2723
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
2724
- }, {
2725
- key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
2726
- debug: () => {
2727
- var _instance$options$deb3;
2728
-
2729
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
2730
- }
2731
- }),
2732
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
2733
- var _right$map$filter2;
2734
-
2735
- const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
2736
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
2737
- }, {
2738
- key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
2739
- debug: () => {
2740
- var _instance$options$deb4;
2741
-
2742
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
2743
- }
2744
- }),
2745
- // Footer Groups
2746
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
2747
- return [...headerGroups].reverse();
2748
- }, {
2749
- key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
2750
- debug: () => {
2751
- var _instance$options$deb5;
2752
-
2753
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
2754
- }
2755
- }),
2756
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
2757
- return [...headerGroups].reverse();
2758
- }, {
2759
- key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
2760
- debug: () => {
2761
- var _instance$options$deb6;
2762
-
2763
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
2764
- }
2765
- }),
2766
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
2767
- return [...headerGroups].reverse();
2768
- }, {
2769
- key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
2770
- debug: () => {
2771
- var _instance$options$deb7;
2772
-
2773
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
2774
- }
2775
- }),
2776
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
2777
- return [...headerGroups].reverse();
2778
- }, {
2779
- key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
2780
- debug: () => {
2781
- var _instance$options$deb8;
2782
-
2783
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
2784
- }
2785
- }),
2786
- // Flat Headers
2787
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
2788
- return headerGroups.map(headerGroup => {
2789
- return headerGroup.headers;
2790
- }).flat();
2791
- }, {
2792
- key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
2793
- debug: () => {
2794
- var _instance$options$deb9;
2795
-
2796
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
2797
- }
2798
- }),
2799
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
2800
- return left.map(headerGroup => {
2801
- return headerGroup.headers;
2802
- }).flat();
2803
- }, {
2804
- key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
2805
- debug: () => {
2806
- var _instance$options$deb10;
2807
-
2808
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
2809
- }
2810
- }),
2811
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
2812
- return left.map(headerGroup => {
2813
- return headerGroup.headers;
2814
- }).flat();
2815
- }, {
2816
- key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
2817
- debug: () => {
2818
- var _instance$options$deb11;
2819
-
2820
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
2821
- }
2822
- }),
2823
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
2824
- return left.map(headerGroup => {
2825
- return headerGroup.headers;
2826
- }).flat();
2827
- }, {
2828
- key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
2829
- debug: () => {
2830
- var _instance$options$deb12;
2831
-
2832
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
2833
- }
2834
- }),
2835
- // Leaf Headers
2836
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
2837
- return flatHeaders.filter(header => {
2838
- var _header$subHeaders;
2839
-
2840
- return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
2841
- });
2842
- }, {
2843
- key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
2844
- debug: () => {
2845
- var _instance$options$deb13;
2846
-
2847
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
2848
- }
2849
- }),
2850
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
2851
- return flatHeaders.filter(header => {
2852
- var _header$subHeaders2;
2853
-
2854
- return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
2855
- });
2856
- }, {
2857
- key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
2858
- debug: () => {
2859
- var _instance$options$deb14;
2860
-
2861
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
2862
- }
2863
- }),
2864
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
2865
- return flatHeaders.filter(header => {
2866
- var _header$subHeaders3;
2867
-
2868
- return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
2869
- });
2870
- }, {
2871
- key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
2872
- debug: () => {
2873
- var _instance$options$deb15;
2713
+ var _instance$options$deb;
2874
2714
 
2875
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
2715
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2876
2716
  }
2877
2717
  }),
2878
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
2879
- var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
2718
+ getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2719
+ key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
2720
+ debug: () => {
2721
+ var _instance$options$deb2;
2880
2722
 
2881
- return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
2882
- return header.getLeafHeaders();
2883
- }).flat();
2723
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2724
+ }
2725
+ })
2726
+ };
2727
+ },
2728
+ createInstance: instance => {
2729
+ const makeVisibleColumnsMethod = (key, getColumns) => {
2730
+ return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2731
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2884
2732
  }, {
2885
- key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
2733
+ key,
2886
2734
  debug: () => {
2887
- var _instance$options$deb16;
2735
+ var _instance$options$deb3;
2888
2736
 
2889
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
2737
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2890
2738
  }
2891
- }),
2892
- getHeader: id => {
2893
- const header = [...instance.getFlatHeaders(), ...instance.getCenterFlatHeaders(), ...instance.getLeftFlatHeaders(), ...instance.getRightFlatHeaders()].find(d => d.id === id);
2739
+ });
2740
+ };
2894
2741
 
2895
- if (!header) {
2896
- if (process.env.NODE_ENV !== 'production') {
2897
- console.warn("Could not find header with id: " + id);
2898
- }
2742
+ return {
2743
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2744
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2745
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2746
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2747
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2748
+ setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2749
+ resetColumnVisibility: defaultState => {
2750
+ var _instance$initialStat;
2899
2751
 
2900
- throw new Error();
2901
- }
2752
+ instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2753
+ },
2754
+ toggleAllColumnsVisible: value => {
2755
+ var _value;
2756
+
2757
+ value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2758
+ instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2759
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2760
+ }), {}));
2761
+ },
2762
+ getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2763
+ getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2764
+ getToggleAllColumnsVisibilityHandler: () => {
2765
+ return e => {
2766
+ var _target;
2902
2767
 
2903
- return header;
2768
+ instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2769
+ };
2904
2770
  }
2905
2771
  };
2906
2772
  }
2907
2773
  };
2908
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
2909
- var _headerGroups$0$heade, _headerGroups$;
2910
-
2911
- // Find the max depth of the columns:
2912
- // build the leaf column row
2913
- // build each buffer row going up
2914
- // placeholder for non-existent level
2915
- // real column for existing level
2916
- let maxDepth = 0;
2917
-
2918
- const findMaxDepth = function (columns, depth) {
2919
- if (depth === void 0) {
2920
- depth = 1;
2921
- }
2922
-
2923
- maxDepth = Math.max(maxDepth, depth);
2924
- columns.filter(column => column.getIsVisible()).forEach(column => {
2925
- var _column$columns;
2926
-
2927
- if ((_column$columns = column.columns) != null && _column$columns.length) {
2928
- findMaxDepth(column.columns, depth + 1);
2929
- }
2930
- }, 0);
2931
- };
2932
-
2933
- findMaxDepth(allColumns);
2934
- let headerGroups = [];
2935
-
2936
- const createHeaderGroup = (headersToGroup, depth) => {
2937
- // The header group we are creating
2938
- const headerGroup = {
2939
- depth,
2940
- id: [headerFamily, "" + depth].filter(Boolean).join('_'),
2941
- headers: []
2942
- }; // The parent columns we're going to scan next
2943
-
2944
- const pendingParentHeaders = []; // Scan each column for parents
2945
-
2946
- headersToGroup.forEach(headerToGroup => {
2947
- // What is the latest (last) parent column?
2948
- const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
2949
- const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
2950
- let column;
2951
- let isPlaceholder = false;
2952
-
2953
- if (isLeafHeader && headerToGroup.column.parent) {
2954
- // The parent header is new
2955
- column = headerToGroup.column.parent;
2956
- } else {
2957
- // The parent header is repeated
2958
- column = headerToGroup.column;
2959
- isPlaceholder = true;
2960
- }
2961
-
2962
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
2963
- // This column is repeated. Add it as a sub header to the next batch
2964
- latestPendingParentHeader.subHeaders.push(headerToGroup);
2965
- } else {
2966
- // This is a new header. Let's create it
2967
- const header = instance.createHeader(column, {
2968
- id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
2969
- isPlaceholder,
2970
- placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
2971
- depth,
2972
- index: pendingParentHeaders.length
2973
- }); // Add the headerToGroup as a subHeader of the new header
2974
-
2975
- header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
2976
- // in the next batch
2977
-
2978
- pendingParentHeaders.push(header);
2979
- }
2980
-
2981
- headerGroup.headers.push(headerToGroup);
2982
- headerToGroup.headerGroup = headerGroup;
2983
- });
2984
- headerGroups.push(headerGroup);
2985
-
2986
- if (depth > 0) {
2987
- createHeaderGroup(pendingParentHeaders, depth - 1);
2988
- }
2989
- };
2990
-
2991
- const bottomHeaders = columnsToGroup.map((column, index) => instance.createHeader(column, {
2992
- depth: maxDepth,
2993
- index
2994
- }));
2995
- createHeaderGroup(bottomHeaders, maxDepth - 1);
2996
- headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
2997
- // return !headerGroup.headers.every(header => header.isPlaceholder)
2998
- // })
2999
-
3000
- const recurseHeadersForSpans = headers => {
3001
- const filteredHeaders = headers.filter(header => header.column.getIsVisible());
3002
- return filteredHeaders.map(header => {
3003
- let colSpan = 0;
3004
- let rowSpan = 0;
3005
- let childRowSpans = [0];
3006
-
3007
- if (header.subHeaders && header.subHeaders.length) {
3008
- childRowSpans = [];
3009
- recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
3010
- let {
3011
- colSpan: childColSpan,
3012
- rowSpan: childRowSpan
3013
- } = _ref;
3014
- colSpan += childColSpan;
3015
- childRowSpans.push(childRowSpan);
3016
- });
3017
- } else {
3018
- colSpan = 1;
3019
- }
3020
-
3021
- const minChildRowSpan = Math.min(...childRowSpans);
3022
- rowSpan = rowSpan + minChildRowSpan;
3023
- header.colSpan = colSpan > 0 ? colSpan : undefined;
3024
- header.rowSpan = rowSpan > 0 ? rowSpan : undefined;
3025
- return {
3026
- colSpan,
3027
- rowSpan
3028
- };
3029
- });
3030
- };
3031
2774
 
3032
- recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
3033
- return headerGroups;
3034
- }
2775
+ const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
3035
2776
 
3036
- // export type Batch = {
3037
- // id: number
3038
- // priority: keyof CoreBatches
3039
- // tasks: (() => void)[]
3040
- // schedule: (cb: () => void) => void
3041
- // cancel: () => void
3042
- // }
3043
- // type CoreBatches = {
3044
- // data: Batch[]
3045
- // facets: Batch[]
3046
- // }
3047
2777
  function createTableInstance(options) {
3048
2778
  var _options$initialState;
3049
2779
 
@@ -3052,7 +2782,7 @@ function createTableInstance(options) {
3052
2782
  }
3053
2783
 
3054
2784
  let instance = {
3055
- _features: [Columns, Rows, Cells, Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]
2785
+ _features: features
3056
2786
  };
3057
2787
 
3058
2788
  const defaultOptions = instance._features.reduce((obj, feature) => {
@@ -3069,8 +2799,7 @@ function createTableInstance(options) {
3069
2799
  };
3070
2800
  };
3071
2801
 
3072
- const coreInitialState = {// coreProgress: 1,
3073
- };
2802
+ const coreInitialState = {};
3074
2803
  let initialState = { ...coreInitialState,
3075
2804
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
3076
2805
  };
@@ -3083,16 +2812,8 @@ function createTableInstance(options) {
3083
2812
 
3084
2813
  const queued = [];
3085
2814
  let queuedTimeout = false;
3086
- const midInstance = { ...instance,
3087
- // init: () => {
3088
- // startWork()
3089
- // },
3090
- // willUpdate: () => {
3091
- // startWork()
3092
- // },
3093
- // destroy: () => {
3094
- // stopWork()
3095
- // },
2815
+ const coreInstance = {
2816
+ _features: features,
3096
2817
  options: { ...defaultOptions,
3097
2818
  ...options
3098
2819
  },
@@ -3138,29 +2859,136 @@ function createTableInstance(options) {
3138
2859
  },
3139
2860
  setState: updater => {
3140
2861
  instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
3141
- } // getOverallProgress: () => {
3142
- // const { coreProgress, filtersProgress, facetProgress } =
3143
- // instance.getState()
3144
- // return mean(() =>
3145
- // [coreProgress, filtersProgress].filter(d => d < 1)
3146
- // ) as number
3147
- // },
3148
- // getProgressStage: () => {
3149
- // const { coreProgress, filtersProgress, facetProgress } =
3150
- // instance.getState()
3151
- // if (coreProgress < 1) {
3152
- // return 'coreRowModel'
3153
- // }
3154
- // if (filtersProgress < 1) {
3155
- // return 'filteredRowModel'
3156
- // }
3157
- // if (Object.values(facetProgress).some(d => d < 1)) {
3158
- // return 'facetedRowModel'
3159
- // }
3160
- // },
2862
+ },
2863
+ _getRowId: (row, index, parent) => {
2864
+ var _instance$options$get;
2865
+
2866
+ return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
2867
+ },
2868
+ getCoreRowModel: () => {
2869
+ if (!instance._getCoreRowModel) {
2870
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2871
+ }
2872
+
2873
+ return instance._getCoreRowModel();
2874
+ },
2875
+ // The final calls start at the bottom of the model,
2876
+ // expanded rows, which then work their way up
2877
+ getRowModel: () => {
2878
+ return instance.getPaginationRowModel();
2879
+ },
2880
+ getRow: id => {
2881
+ const row = instance.getRowModel().rowsById[id];
2882
+
2883
+ if (!row) {
2884
+ if (process.env.NODE_ENV !== 'production') {
2885
+ throw new Error("getRow expected an ID, but got " + id);
2886
+ }
3161
2887
 
2888
+ throw new Error();
2889
+ }
2890
+
2891
+ return row;
2892
+ },
2893
+ _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2894
+ var _defaultColumn;
2895
+
2896
+ defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
2897
+ return {
2898
+ header: props => props.header.column.id,
2899
+ footer: props => props.header.column.id,
2900
+ cell: props => {
2901
+ var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
2902
+
2903
+ 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;
2904
+ },
2905
+ ...instance._features.reduce((obj, feature) => {
2906
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2907
+ }, {}),
2908
+ ...defaultColumn
2909
+ };
2910
+ }, {
2911
+ debug: () => {
2912
+ var _instance$options$deb;
2913
+
2914
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2915
+ },
2916
+ key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
2917
+ }),
2918
+ _getColumnDefs: () => instance.options.columns,
2919
+ getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2920
+ const recurseColumns = function (columnDefs, parent, depth) {
2921
+ if (depth === void 0) {
2922
+ depth = 0;
2923
+ }
2924
+
2925
+ return columnDefs.map(columnDef => {
2926
+ const column = createColumn(instance, columnDef, depth, parent);
2927
+ column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2928
+ return column;
2929
+ });
2930
+ };
2931
+
2932
+ return recurseColumns(columnDefs);
2933
+ }, {
2934
+ key: process.env.NODE_ENV === 'development' && 'getAllColumns',
2935
+ debug: () => {
2936
+ var _instance$options$deb2;
2937
+
2938
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2939
+ }
2940
+ }),
2941
+ getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2942
+ return allColumns.flatMap(column => {
2943
+ return column.getFlatColumns();
2944
+ });
2945
+ }, {
2946
+ key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
2947
+ debug: () => {
2948
+ var _instance$options$deb3;
2949
+
2950
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2951
+ }
2952
+ }),
2953
+ _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2954
+ return flatColumns.reduce((acc, column) => {
2955
+ acc[column.id] = column;
2956
+ return acc;
2957
+ }, {});
2958
+ }, {
2959
+ key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
2960
+ debug: () => {
2961
+ var _instance$options$deb4;
2962
+
2963
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2964
+ }
2965
+ }),
2966
+ getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2967
+ let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
2968
+ return orderColumns(leafColumns);
2969
+ }, {
2970
+ key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
2971
+ debug: () => {
2972
+ var _instance$options$deb5;
2973
+
2974
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2975
+ }
2976
+ }),
2977
+ getColumn: columnId => {
2978
+ const column = instance._getAllFlatColumnsById()[columnId];
2979
+
2980
+ if (!column) {
2981
+ if (process.env.NODE_ENV !== 'production') {
2982
+ console.warn("[Table] Column with id " + columnId + " does not exist.");
2983
+ }
2984
+
2985
+ throw new Error();
2986
+ }
2987
+
2988
+ return column;
2989
+ }
3162
2990
  };
3163
- instance = Object.assign(instance, midInstance);
2991
+ Object.assign(instance, coreInstance);
3164
2992
 
3165
2993
  instance._features.forEach(feature => {
3166
2994
  return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
@@ -3183,10 +3011,11 @@ function createTable(_, __, options) {
3183
3011
  throw new Error('');
3184
3012
  })()
3185
3013
  },
3186
- setGenerics: () => table,
3014
+ // setGenerics: () => table as any,
3187
3015
  setRowType: () => table,
3188
3016
  setTableMetaType: () => table,
3189
3017
  setColumnMetaType: () => table,
3018
+ setFilterMetaType: () => table,
3190
3019
  setOptions: newOptions => createTable(_, __, { ...options,
3191
3020
  ...newOptions
3192
3021
  }),
@@ -3218,11 +3047,92 @@ function createTable(_, __, options) {
3218
3047
  }
3219
3048
 
3220
3049
  throw new Error('Invalid accessor');
3221
- }
3050
+ },
3051
+ createOptions: options => options
3222
3052
  };
3223
3053
  return table;
3224
3054
  }
3225
3055
 
3056
+ function createCell(instance, row, column, columnId) {
3057
+ const cell = {
3058
+ id: row.id + "_" + column.id,
3059
+ row,
3060
+ column,
3061
+ getValue: () => row.getValue(columnId),
3062
+ renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3063
+ instance,
3064
+ column,
3065
+ row,
3066
+ cell: cell,
3067
+ getValue: cell.getValue
3068
+ }) : null
3069
+ };
3070
+
3071
+ instance._features.forEach(feature => {
3072
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
3073
+ }, {});
3074
+
3075
+ return cell;
3076
+ }
3077
+
3078
+ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3079
+ let row = {
3080
+ id,
3081
+ index: rowIndex,
3082
+ original,
3083
+ depth,
3084
+ _valuesCache: {},
3085
+ getValue: columnId => {
3086
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3087
+ return row._valuesCache[columnId];
3088
+ }
3089
+
3090
+ const column = instance.getColumn(columnId);
3091
+
3092
+ if (!column.accessorFn) {
3093
+ return undefined;
3094
+ }
3095
+
3096
+ row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3097
+ return row._valuesCache[columnId];
3098
+ },
3099
+ subRows: subRows != null ? subRows : [],
3100
+ getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3101
+ getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3102
+ return leafColumns.map(column => {
3103
+ return createCell(instance, row, column, column.id);
3104
+ });
3105
+ }, {
3106
+ key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
3107
+ debug: () => {
3108
+ var _instance$options$deb;
3109
+
3110
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3111
+ }
3112
+ }),
3113
+ _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
3114
+ return allCells.reduce((acc, cell) => {
3115
+ acc[cell.column.id] = cell;
3116
+ return acc;
3117
+ }, {});
3118
+ }, {
3119
+ key: process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
3120
+ debug: () => {
3121
+ var _instance$options$deb2;
3122
+
3123
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3124
+ }
3125
+ })
3126
+ };
3127
+
3128
+ for (let i = 0; i < instance._features.length; i++) {
3129
+ const feature = instance._features[i];
3130
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3131
+ }
3132
+
3133
+ return row;
3134
+ };
3135
+
3226
3136
  function getCoreRowModel() {
3227
3137
  return instance => memo(() => [instance.options.data], data => {
3228
3138
  const rowModel = {
@@ -3250,7 +3160,7 @@ function getCoreRowModel() {
3250
3160
  // }
3251
3161
  // Make the row
3252
3162
 
3253
- row = instance.createRow(instance.getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3163
+ row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3254
3164
 
3255
3165
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3256
3166
 
@@ -3313,8 +3223,8 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3313
3223
  row = rowsToFilter[i];
3314
3224
 
3315
3225
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3316
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3317
- newRow.columnFilterMap = row.columnFilterMap;
3226
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3227
+ newRow.columnFilters = row.columnFilters;
3318
3228
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3319
3229
 
3320
3230
  if (!newRow.subRows.length) {
@@ -3363,7 +3273,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3363
3273
  var _row$subRows2;
3364
3274
 
3365
3275
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3366
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3276
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3367
3277
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3368
3278
  row = newRow;
3369
3279
  }
@@ -3387,6 +3297,11 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3387
3297
  function getFilteredRowModel() {
3388
3298
  return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3389
3299
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3300
+ for (let i = 0; i < rowModel.flatRows.length; i++) {
3301
+ rowModel.flatRows[i].columnFilters = {};
3302
+ rowModel.flatRows[i].columnFiltersMeta = {};
3303
+ }
3304
+
3390
3305
  return rowModel;
3391
3306
  }
3392
3307
 
@@ -3441,28 +3356,34 @@ function getFilteredRowModel() {
3441
3356
 
3442
3357
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3443
3358
  const row = rowModel.flatRows[j];
3444
- row.columnFilterMap = {};
3359
+ row.columnFilters = {};
3445
3360
 
3446
3361
  if (resolvedColumnFilters.length) {
3447
3362
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3448
- currentColumnFilter = resolvedColumnFilters[i]; // Tag the row with the column filter state
3363
+ currentColumnFilter = resolvedColumnFilters[i];
3364
+ const id = currentColumnFilter.id; // Tag the row with the column filter state
3449
3365
 
3450
- row.columnFilterMap[currentColumnFilter.id] = currentColumnFilter.filterFn(row, currentColumnFilter.id, currentColumnFilter.resolvedValue);
3366
+ row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3367
+ row.columnFiltersMeta[id] = filterMeta;
3368
+ });
3451
3369
  }
3452
3370
  }
3453
3371
 
3454
3372
  if (resolvedGlobalFilters.length) {
3455
3373
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3456
- currentGlobalFilter = resolvedGlobalFilters[i]; // Tag the row with the first truthy global filter state
3374
+ currentGlobalFilter = resolvedGlobalFilters[i];
3375
+ const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3457
3376
 
3458
- if (currentGlobalFilter.filterFn(row, currentGlobalFilter.id, currentGlobalFilter.resolvedValue)) {
3459
- row.columnFilterMap.__global__ = true;
3377
+ if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3378
+ row.columnFiltersMeta[id] = filterMeta;
3379
+ })) {
3380
+ row.columnFilters.__global__ = true;
3460
3381
  break;
3461
3382
  }
3462
3383
  }
3463
3384
 
3464
- if (row.columnFilterMap.__global__ !== true) {
3465
- row.columnFilterMap.__global__ = false;
3385
+ if (row.columnFilters.__global__ !== true) {
3386
+ row.columnFilters.__global__ = false;
3466
3387
  }
3467
3388
  }
3468
3389
  }
@@ -3470,7 +3391,7 @@ function getFilteredRowModel() {
3470
3391
  const filterRowsImpl = row => {
3471
3392
  // Horizontally filter rows through each column
3472
3393
  for (let i = 0; i < filterableIds.length; i++) {
3473
- if (row.columnFilterMap[filterableIds[i]] === false) {
3394
+ if (row.columnFilters[filterableIds[i]] === false) {
3474
3395
  return false;
3475
3396
  }
3476
3397
  }
@@ -3504,7 +3425,7 @@ function getFacetedRowModel() {
3504
3425
  const filterRowsImpl = row => {
3505
3426
  // Horizontally filter rows through each column
3506
3427
  for (let i = 0; i < filterableIds.length; i++) {
3507
- if (row.columnFilterMap[filterableIds[i]] === false) {
3428
+ if (row.columnFilters[filterableIds[i]] === false) {
3508
3429
  return false;
3509
3430
  }
3510
3431
  }
@@ -3604,8 +3525,8 @@ function getSortedRowModel() {
3604
3525
  availableSorting.forEach(sortEntry => {
3605
3526
  const column = instance.getColumn(sortEntry.id);
3606
3527
  columnInfoById[sortEntry.id] = {
3607
- sortUndefined: column.sortUndefined,
3608
- invertSorting: column.invertSorting,
3528
+ sortUndefined: column.columnDef.sortUndefined,
3529
+ invertSorting: column.columnDef.invertSorting,
3609
3530
  sortingFn: column.getSortingFn()
3610
3531
  };
3611
3532
  });
@@ -3719,7 +3640,7 @@ function getGroupedRowModel() {
3719
3640
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3720
3641
 
3721
3642
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3722
- const row = instance.createRow(id, undefined, index, depth);
3643
+ const row = createRow(instance, id, undefined, index, depth);
3723
3644
  Object.assign(row, {
3724
3645
  groupingColumnId: columnId,
3725
3646
  groupingValue,
@@ -3728,17 +3649,17 @@ function getGroupedRowModel() {
3728
3649
  getValue: columnId => {
3729
3650
  // Don't aggregate columns that are in the grouping
3730
3651
  if (existingGrouping.includes(columnId)) {
3731
- if (row.valuesCache.hasOwnProperty(columnId)) {
3732
- return row.valuesCache[columnId];
3652
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3653
+ return row._valuesCache[columnId];
3733
3654
  }
3734
3655
 
3735
3656
  if (groupedRows[0]) {
3736
3657
  var _groupedRows$0$getVal;
3737
3658
 
3738
- row.valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3659
+ row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3739
3660
  }
3740
3661
 
3741
- return row.valuesCache[columnId];
3662
+ return row._valuesCache[columnId];
3742
3663
  }
3743
3664
 
3744
3665
  if (row.groupingValuesCache.hasOwnProperty(columnId)) {
@@ -3753,8 +3674,8 @@ function getGroupedRowModel() {
3753
3674
  row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
3754
3675
  let columnValue = row.getValue(columnId);
3755
3676
 
3756
- if (!depth && column.aggregateValue) {
3757
- columnValue = column.aggregateValue(columnValue);
3677
+ if (!depth && column.columnDef.aggregateValue) {
3678
+ columnValue = column.columnDef.aggregateValue(columnValue);
3758
3679
  }
3759
3680
 
3760
3681
  return columnValue;
@@ -3923,11 +3844,15 @@ exports.Pinning = Pinning;
3923
3844
  exports.RowSelection = RowSelection;
3924
3845
  exports.Sorting = Sorting;
3925
3846
  exports.Visibility = Visibility;
3847
+ exports.aggregationFns = aggregationFns;
3926
3848
  exports.buildHeaderGroups = buildHeaderGroups;
3849
+ exports.createColumn = createColumn;
3850
+ exports.createRow = createRow;
3927
3851
  exports.createTableFactory = createTableFactory;
3928
3852
  exports.createTableInstance = createTableInstance;
3929
3853
  exports.defaultColumnSizing = defaultColumnSizing;
3930
3854
  exports.expandRows = expandRows;
3855
+ exports.filterFns = filterFns;
3931
3856
  exports.flattenBy = flattenBy;
3932
3857
  exports.functionalUpdate = functionalUpdate;
3933
3858
  exports.getCoreRowModel = getCoreRowModel;
@@ -3942,10 +3867,13 @@ exports.getSortedRowModel = getSortedRowModel;
3942
3867
  exports.isFunction = isFunction;
3943
3868
  exports.isRowSelected = isRowSelected;
3944
3869
  exports.makeStateUpdater = makeStateUpdater;
3870
+ exports.mean = mean;
3945
3871
  exports.memo = memo;
3946
3872
  exports.noop = noop;
3947
3873
  exports.orderColumns = orderColumns;
3948
3874
  exports.passiveEventSupported = passiveEventSupported;
3875
+ exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
3949
3876
  exports.selectRowsFn = selectRowsFn;
3950
3877
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
3878
+ exports.sortingFns = sortingFns;
3951
3879
  //# sourceMappingURL=index.js.map