@tanstack/react-table 8.0.13 → 8.1.1

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.
@@ -27,9 +27,9 @@ function functionalUpdate(updater, input) {
27
27
  }
28
28
  function noop() {//
29
29
  }
30
- function makeStateUpdater(key, instance) {
30
+ function makeStateUpdater(key, table) {
31
31
  return updater => {
32
- instance.setState(old => {
32
+ table.setState(old => {
33
33
  return { ...old,
34
34
  [key]: functionalUpdate(updater, old[key])
35
35
  };
@@ -99,38 +99,37 @@ function memo(getDeps, fn, opts) {
99
99
  };
100
100
  }
101
101
 
102
- function createColumn(instance, columnDef, depth, parent) {
103
- var _ref, _columnDef$id;
102
+ function createColumn(table, columnDef, depth, parent) {
103
+ var _ref, _resolvedColumnDef$id;
104
104
 
105
- const defaultColumn = instance._getDefaultColumnDef();
105
+ const defaultColumn = table._getDefaultColumnDef();
106
106
 
107
- columnDef = { ...defaultColumn,
107
+ const resolvedColumnDef = { ...defaultColumn,
108
108
  ...columnDef
109
109
  };
110
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
110
+ let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : resolvedColumnDef.accessorKey) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
111
111
  let accessorFn;
112
112
 
113
- if (columnDef.accessorFn) {
114
- accessorFn = columnDef.accessorFn;
115
- } else if (columnDef.accessorKey) {
116
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
113
+ if (resolvedColumnDef.accessorFn) {
114
+ accessorFn = resolvedColumnDef.accessorFn;
115
+ } else if (resolvedColumnDef.accessorKey) {
116
+ accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
117
117
  }
118
118
 
119
119
  if (!id) {
120
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");
121
+ throw new Error(resolvedColumnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
122
122
  }
123
123
 
124
124
  throw new Error();
125
125
  }
126
126
 
127
127
  let column = {
128
- id: "" + id,
128
+ id: "" + String(id),
129
129
  accessorFn,
130
130
  parent: parent,
131
131
  depth,
132
- columnDef,
133
- columnDefType: columnDef.columnDefType,
132
+ columnDef: resolvedColumnDef,
134
133
  columns: [],
135
134
  getFlatColumns: memo(() => [true], () => {
136
135
  var _column$columns;
@@ -139,12 +138,12 @@ function createColumn(instance, columnDef, depth, parent) {
139
138
  }, {
140
139
  key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',
141
140
  debug: () => {
142
- var _instance$options$deb;
141
+ var _table$options$debugA;
143
142
 
144
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
143
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
145
144
  }
146
145
  }),
147
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
146
+ getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
148
147
  var _column$columns2;
149
148
 
150
149
  if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
@@ -156,21 +155,21 @@ function createColumn(instance, columnDef, depth, parent) {
156
155
  }, {
157
156
  key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',
158
157
  debug: () => {
159
- var _instance$options$deb2;
158
+ var _table$options$debugA2;
160
159
 
161
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
160
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
162
161
  }
163
162
  })
164
163
  };
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.
164
+ column = table._features.reduce((obj, feature) => {
165
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
166
+ }, column); // Yes, we have to convert table to uknown, because we know more than the compiler here.
168
167
 
169
168
  return column;
170
169
  }
171
170
 
172
171
  //
173
- function createHeader(instance, column, options) {
172
+ function createHeader(table, column, options) {
174
173
  var _options$id;
175
174
 
176
175
  const id = (_options$id = options.id) != null ? _options$id : column.id;
@@ -199,174 +198,169 @@ function createHeader(instance, column, options) {
199
198
  recurseHeader(header);
200
199
  return leafHeaders;
201
200
  },
202
- renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
203
- instance,
201
+ getContext: () => ({
202
+ table,
204
203
  header: header,
205
204
  column
206
- }) : null,
207
- renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
208
- instance,
209
- header: header,
210
- column
211
- }) : null
205
+ })
212
206
  };
213
207
 
214
- instance._features.forEach(feature => {
215
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
208
+ table._features.forEach(feature => {
209
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
216
210
  });
217
211
 
218
212
  return header;
219
213
  }
220
214
 
221
215
  const Headers = {
222
- createInstance: instance => {
216
+ createTable: table => {
223
217
  return {
224
218
  // Header Groups
225
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
219
+ getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
226
220
  var _left$map$filter, _right$map$filter;
227
221
 
228
222
  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
223
  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
224
  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);
225
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
232
226
  return headerGroups;
233
227
  }, {
234
228
  key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
235
229
  debug: () => {
236
- var _instance$options$deb;
230
+ var _table$options$debugA;
237
231
 
238
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
232
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
239
233
  }
240
234
  }),
241
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
235
+ getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
242
236
  leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
243
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
237
+ return buildHeaderGroups(allColumns, leafColumns, table, 'center');
244
238
  }, {
245
239
  key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
246
240
  debug: () => {
247
- var _instance$options$deb2;
241
+ var _table$options$debugA2;
248
242
 
249
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
243
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
250
244
  }
251
245
  }),
252
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
246
+ getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
253
247
  var _left$map$filter2;
254
248
 
255
249
  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');
250
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
257
251
  }, {
258
252
  key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
259
253
  debug: () => {
260
- var _instance$options$deb3;
254
+ var _table$options$debugA3;
261
255
 
262
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
256
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
263
257
  }
264
258
  }),
265
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
259
+ getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
266
260
  var _right$map$filter2;
267
261
 
268
262
  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');
263
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
270
264
  }, {
271
265
  key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
272
266
  debug: () => {
273
- var _instance$options$deb4;
267
+ var _table$options$debugA4;
274
268
 
275
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
269
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
276
270
  }
277
271
  }),
278
272
  // Footer Groups
279
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
273
+ getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
280
274
  return [...headerGroups].reverse();
281
275
  }, {
282
276
  key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
283
277
  debug: () => {
284
- var _instance$options$deb5;
278
+ var _table$options$debugA5;
285
279
 
286
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
280
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
287
281
  }
288
282
  }),
289
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
283
+ getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
290
284
  return [...headerGroups].reverse();
291
285
  }, {
292
286
  key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
293
287
  debug: () => {
294
- var _instance$options$deb6;
288
+ var _table$options$debugA6;
295
289
 
296
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
290
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
297
291
  }
298
292
  }),
299
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
293
+ getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
300
294
  return [...headerGroups].reverse();
301
295
  }, {
302
296
  key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
303
297
  debug: () => {
304
- var _instance$options$deb7;
298
+ var _table$options$debugA7;
305
299
 
306
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
300
+ return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
307
301
  }
308
302
  }),
309
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
303
+ getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
310
304
  return [...headerGroups].reverse();
311
305
  }, {
312
306
  key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
313
307
  debug: () => {
314
- var _instance$options$deb8;
308
+ var _table$options$debugA8;
315
309
 
316
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
310
+ return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
317
311
  }
318
312
  }),
319
313
  // Flat Headers
320
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
314
+ getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
321
315
  return headerGroups.map(headerGroup => {
322
316
  return headerGroup.headers;
323
317
  }).flat();
324
318
  }, {
325
319
  key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
326
320
  debug: () => {
327
- var _instance$options$deb9;
321
+ var _table$options$debugA9;
328
322
 
329
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
323
+ return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
330
324
  }
331
325
  }),
332
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
326
+ getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
333
327
  return left.map(headerGroup => {
334
328
  return headerGroup.headers;
335
329
  }).flat();
336
330
  }, {
337
331
  key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
338
332
  debug: () => {
339
- var _instance$options$deb10;
333
+ var _table$options$debugA10;
340
334
 
341
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
335
+ return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
342
336
  }
343
337
  }),
344
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
338
+ getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
345
339
  return left.map(headerGroup => {
346
340
  return headerGroup.headers;
347
341
  }).flat();
348
342
  }, {
349
343
  key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
350
344
  debug: () => {
351
- var _instance$options$deb11;
345
+ var _table$options$debugA11;
352
346
 
353
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
347
+ return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
354
348
  }
355
349
  }),
356
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
350
+ getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
357
351
  return left.map(headerGroup => {
358
352
  return headerGroup.headers;
359
353
  }).flat();
360
354
  }, {
361
355
  key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
362
356
  debug: () => {
363
- var _instance$options$deb12;
357
+ var _table$options$debugA12;
364
358
 
365
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
359
+ return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
366
360
  }
367
361
  }),
368
362
  // Leaf Headers
369
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
363
+ getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
370
364
  return flatHeaders.filter(header => {
371
365
  var _header$subHeaders;
372
366
 
@@ -375,12 +369,12 @@ const Headers = {
375
369
  }, {
376
370
  key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
377
371
  debug: () => {
378
- var _instance$options$deb13;
372
+ var _table$options$debugA13;
379
373
 
380
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
374
+ return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
381
375
  }
382
376
  }),
383
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
377
+ getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
384
378
  return flatHeaders.filter(header => {
385
379
  var _header$subHeaders2;
386
380
 
@@ -389,12 +383,12 @@ const Headers = {
389
383
  }, {
390
384
  key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
391
385
  debug: () => {
392
- var _instance$options$deb14;
386
+ var _table$options$debugA14;
393
387
 
394
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
388
+ return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
395
389
  }
396
390
  }),
397
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
391
+ getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
398
392
  return flatHeaders.filter(header => {
399
393
  var _header$subHeaders3;
400
394
 
@@ -403,12 +397,12 @@ const Headers = {
403
397
  }, {
404
398
  key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
405
399
  debug: () => {
406
- var _instance$options$deb15;
400
+ var _table$options$debugA15;
407
401
 
408
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
402
+ return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
409
403
  }
410
404
  }),
411
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
405
+ getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
412
406
  var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
413
407
 
414
408
  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 => {
@@ -417,15 +411,15 @@ const Headers = {
417
411
  }, {
418
412
  key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
419
413
  debug: () => {
420
- var _instance$options$deb16;
414
+ var _table$options$debugA16;
421
415
 
422
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
416
+ return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
423
417
  }
424
418
  })
425
419
  };
426
420
  }
427
421
  };
428
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
422
+ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
429
423
  var _headerGroups$0$heade, _headerGroups$;
430
424
 
431
425
  // Find the max depth of the columns:
@@ -479,12 +473,12 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
479
473
  isPlaceholder = true;
480
474
  }
481
475
 
482
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
476
+ if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
483
477
  // This column is repeated. Add it as a sub header to the next batch
484
478
  latestPendingParentHeader.subHeaders.push(headerToGroup);
485
479
  } else {
486
480
  // This is a new header. Let's create it
487
- const header = createHeader(instance, column, {
481
+ const header = createHeader(table, column, {
488
482
  id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
489
483
  isPlaceholder,
490
484
  placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
@@ -508,7 +502,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
508
502
  }
509
503
  };
510
504
 
511
- const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
505
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
512
506
  depth: maxDepth,
513
507
  index
514
508
  }));
@@ -580,23 +574,23 @@ const ColumnSizing = {
580
574
  ...state
581
575
  };
582
576
  },
583
- getDefaultOptions: instance => {
577
+ getDefaultOptions: table => {
584
578
  return {
585
579
  columnResizeMode: 'onEnd',
586
- onColumnSizingChange: makeStateUpdater('columnSizing', instance),
587
- onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
580
+ onColumnSizingChange: makeStateUpdater('columnSizing', table),
581
+ onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
588
582
  };
589
583
  },
590
- createColumn: (column, instance) => {
584
+ createColumn: (column, table) => {
591
585
  return {
592
586
  getSize: () => {
593
587
  var _column$columnDef$min, _ref, _column$columnDef$max;
594
588
 
595
- const columnSize = instance.getState().columnSizing[column.id];
589
+ const columnSize = table.getState().columnSizing[column.id];
596
590
  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);
597
591
  },
598
592
  getStart: position => {
599
- const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
593
+ const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
600
594
  const index = columns.findIndex(d => d.id === column.id);
601
595
 
602
596
  if (index > 0) {
@@ -607,7 +601,7 @@ const ColumnSizing = {
607
601
  return 0;
608
602
  },
609
603
  resetSize: () => {
610
- instance.setColumnSizing(_ref2 => {
604
+ table.setColumnSizing(_ref2 => {
611
605
  let {
612
606
  [column.id]: _,
613
607
  ...rest
@@ -616,16 +610,16 @@ const ColumnSizing = {
616
610
  });
617
611
  },
618
612
  getCanResize: () => {
619
- var _column$columnDef$ena, _instance$options$ena;
613
+ var _column$columnDef$ena, _table$options$enable;
620
614
 
621
- return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
615
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
622
616
  },
623
617
  getIsResizing: () => {
624
- return instance.getState().columnSizingInfo.isResizingColumn === column.id;
618
+ return table.getState().columnSizingInfo.isResizingColumn === column.id;
625
619
  }
626
620
  };
627
621
  },
628
- createHeader: (header, instance) => {
622
+ createHeader: (header, table) => {
629
623
  return {
630
624
  getSize: () => {
631
625
  let sum = 0;
@@ -652,7 +646,7 @@ const ColumnSizing = {
652
646
  return 0;
653
647
  },
654
648
  getResizeHandler: () => {
655
- const column = instance.getColumn(header.column.id);
649
+ const column = table.getColumn(header.column.id);
656
650
  const canResize = column.getCanResize();
657
651
  return e => {
658
652
  if (!canResize) {
@@ -677,7 +671,7 @@ const ColumnSizing = {
677
671
  }
678
672
 
679
673
  let newColumnSizing = {};
680
- instance.setColumnSizingInfo(old => {
674
+ table.setColumnSizingInfo(old => {
681
675
  var _old$startOffset, _old$startSize;
682
676
 
683
677
  const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
@@ -692,8 +686,8 @@ const ColumnSizing = {
692
686
  };
693
687
  });
694
688
 
695
- if (instance.options.columnResizeMode === 'onChange' || eventType === 'end') {
696
- instance.setColumnSizing(old => ({ ...old,
689
+ if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
690
+ table.setColumnSizing(old => ({ ...old,
697
691
  ...newColumnSizing
698
692
  }));
699
693
  }
@@ -703,7 +697,7 @@ const ColumnSizing = {
703
697
 
704
698
  const onEnd = clientXPos => {
705
699
  updateOffset('end', clientXPos);
706
- instance.setColumnSizingInfo(old => ({ ...old,
700
+ table.setColumnSizingInfo(old => ({ ...old,
707
701
  isResizingColumn: false,
708
702
  startOffset: null,
709
703
  startSize: null,
@@ -730,7 +724,7 @@ const ColumnSizing = {
730
724
  document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
731
725
  }
732
726
 
733
- instance.setColumnSizingInfo(old => ({ ...old,
727
+ table.setColumnSizingInfo(old => ({ ...old,
734
728
  startOffset: clientX,
735
729
  startSize,
736
730
  deltaOffset: 0,
@@ -742,47 +736,47 @@ const ColumnSizing = {
742
736
  }
743
737
  };
744
738
  },
745
- createInstance: instance => {
739
+ createTable: table => {
746
740
  return {
747
- setColumnSizing: updater => instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater),
748
- setColumnSizingInfo: updater => instance.options.onColumnSizingInfoChange == null ? void 0 : instance.options.onColumnSizingInfoChange(updater),
741
+ setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
742
+ setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
749
743
  resetColumnSizing: defaultState => {
750
- var _instance$initialStat;
744
+ var _table$initialState$c;
751
745
 
752
- instance.setColumnSizing(defaultState ? {} : (_instance$initialStat = instance.initialState.columnSizing) != null ? _instance$initialStat : {});
746
+ table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
753
747
  },
754
748
  resetHeaderSizeInfo: defaultState => {
755
- var _instance$initialStat2;
749
+ var _table$initialState$c2;
756
750
 
757
- instance.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_instance$initialStat2 = instance.initialState.columnSizingInfo) != null ? _instance$initialStat2 : getDefaultColumnSizingInfoState());
751
+ table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
758
752
  },
759
753
  getTotalSize: () => {
760
- var _instance$getHeaderGr, _instance$getHeaderGr2;
754
+ var _table$getHeaderGroup, _table$getHeaderGroup2;
761
755
 
762
- return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
756
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
763
757
  return sum + header.getSize();
764
- }, 0)) != null ? _instance$getHeaderGr : 0;
758
+ }, 0)) != null ? _table$getHeaderGroup : 0;
765
759
  },
766
760
  getLeftTotalSize: () => {
767
- var _instance$getLeftHead, _instance$getLeftHead2;
761
+ var _table$getLeftHeaderG, _table$getLeftHeaderG2;
768
762
 
769
- return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
763
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
770
764
  return sum + header.getSize();
771
- }, 0)) != null ? _instance$getLeftHead : 0;
765
+ }, 0)) != null ? _table$getLeftHeaderG : 0;
772
766
  },
773
767
  getCenterTotalSize: () => {
774
- var _instance$getCenterHe, _instance$getCenterHe2;
768
+ var _table$getCenterHeade, _table$getCenterHeade2;
775
769
 
776
- return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
770
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
777
771
  return sum + header.getSize();
778
- }, 0)) != null ? _instance$getCenterHe : 0;
772
+ }, 0)) != null ? _table$getCenterHeade : 0;
779
773
  },
780
774
  getRightTotalSize: () => {
781
- var _instance$getRightHea, _instance$getRightHea2;
775
+ var _table$getRightHeader, _table$getRightHeader2;
782
776
 
783
- return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
777
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
784
778
  return sum + header.getSize();
785
- }, 0)) != null ? _instance$getRightHea : 0;
779
+ }, 0)) != null ? _table$getRightHeader : 0;
786
780
  }
787
781
  };
788
782
  }
@@ -825,65 +819,65 @@ const Expanding = {
825
819
  ...state
826
820
  };
827
821
  },
828
- getDefaultOptions: instance => {
822
+ getDefaultOptions: table => {
829
823
  return {
830
- onExpandedChange: makeStateUpdater('expanded', instance),
824
+ onExpandedChange: makeStateUpdater('expanded', table),
831
825
  paginateExpandedRows: true
832
826
  };
833
827
  },
834
- createInstance: instance => {
828
+ createTable: table => {
835
829
  let registered = false;
836
830
  let queued = false;
837
831
  return {
838
832
  _autoResetExpanded: () => {
839
- var _ref, _instance$options$aut;
833
+ var _ref, _table$options$autoRe;
840
834
 
841
835
  if (!registered) {
842
- instance._queue(() => {
836
+ table._queue(() => {
843
837
  registered = true;
844
838
  });
845
839
 
846
840
  return;
847
841
  }
848
842
 
849
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
843
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
850
844
  if (queued) return;
851
845
  queued = true;
852
846
 
853
- instance._queue(() => {
854
- instance.resetExpanded();
847
+ table._queue(() => {
848
+ table.resetExpanded();
855
849
  queued = false;
856
850
  });
857
851
  }
858
852
  },
859
- setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
853
+ setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
860
854
  toggleAllRowsExpanded: expanded => {
861
- if (expanded != null ? expanded : !instance.getIsAllRowsExpanded()) {
862
- instance.setExpanded(true);
855
+ if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
856
+ table.setExpanded(true);
863
857
  } else {
864
- instance.setExpanded({});
858
+ table.setExpanded({});
865
859
  }
866
860
  },
867
861
  resetExpanded: defaultState => {
868
- var _instance$initialStat, _instance$initialStat2;
862
+ var _table$initialState$e, _table$initialState;
869
863
 
870
- instance.setExpanded(defaultState ? {} : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.expanded) != null ? _instance$initialStat : {});
864
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
871
865
  },
872
866
  getCanSomeRowsExpand: () => {
873
- return instance.getRowModel().flatRows.some(row => row.getCanExpand());
867
+ return table.getRowModel().flatRows.some(row => row.getCanExpand());
874
868
  },
875
869
  getToggleAllRowsExpandedHandler: () => {
876
870
  return e => {
877
871
  e.persist == null ? void 0 : e.persist();
878
- instance.toggleAllRowsExpanded();
872
+ table.toggleAllRowsExpanded();
879
873
  };
880
874
  },
881
875
  getIsSomeRowsExpanded: () => {
882
- const expanded = instance.getState().expanded;
876
+ const expanded = table.getState().expanded;
883
877
  return expanded === true || Object.values(expanded).some(Boolean);
884
878
  },
885
879
  getIsAllRowsExpanded: () => {
886
- const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
880
+ const expanded = table.getState().expanded; // If expanded is true, save some cycles and return true
887
881
 
888
882
  if (typeof expanded === 'boolean') {
889
883
  return expanded === true;
@@ -894,7 +888,7 @@ const Expanding = {
894
888
  } // If any row is not expanded, return false
895
889
 
896
890
 
897
- if (instance.getRowModel().flatRows.some(row => row.getIsExpanded())) {
891
+ if (table.getRowModel().flatRows.some(row => row.getIsExpanded())) {
898
892
  return false;
899
893
  } // They must all be expanded :shrug:
900
894
 
@@ -903,38 +897,38 @@ const Expanding = {
903
897
  },
904
898
  getExpandedDepth: () => {
905
899
  let maxDepth = 0;
906
- const rowIds = instance.getState().expanded === true ? Object.keys(instance.getRowModel().rowsById) : Object.keys(instance.getState().expanded);
900
+ const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
907
901
  rowIds.forEach(id => {
908
902
  const splitId = id.split('.');
909
903
  maxDepth = Math.max(maxDepth, splitId.length);
910
904
  });
911
905
  return maxDepth;
912
906
  },
913
- getPreExpandedRowModel: () => instance.getSortedRowModel(),
907
+ getPreExpandedRowModel: () => table.getSortedRowModel(),
914
908
  getExpandedRowModel: () => {
915
- if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
916
- instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
909
+ if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
910
+ table._getExpandedRowModel = table.options.getExpandedRowModel(table);
917
911
  }
918
912
 
919
- if (instance.options.manualExpanding || !instance._getExpandedRowModel) {
920
- return instance.getPreExpandedRowModel();
913
+ if (table.options.manualExpanding || !table._getExpandedRowModel) {
914
+ return table.getPreExpandedRowModel();
921
915
  }
922
916
 
923
- return instance._getExpandedRowModel();
917
+ return table._getExpandedRowModel();
924
918
  }
925
919
  };
926
920
  },
927
- createRow: (row, instance) => {
921
+ createRow: (row, table) => {
928
922
  return {
929
923
  toggleExpanded: expanded => {
930
- instance.setExpanded(old => {
924
+ table.setExpanded(old => {
931
925
  var _expanded;
932
926
 
933
927
  const exists = old === true ? true : !!(old != null && old[row.id]);
934
928
  let oldExpanded = {};
935
929
 
936
930
  if (old === true) {
937
- Object.keys(instance.getRowModel().rowsById).forEach(rowId => {
931
+ Object.keys(table.getRowModel().rowsById).forEach(rowId => {
938
932
  oldExpanded[rowId] = true;
939
933
  });
940
934
  } else {
@@ -961,15 +955,15 @@ const Expanding = {
961
955
  });
962
956
  },
963
957
  getIsExpanded: () => {
964
- var _instance$options$get;
958
+ var _table$options$getIsR;
965
959
 
966
- const expanded = instance.getState().expanded;
967
- return !!((_instance$options$get = instance.options.getIsRowExpanded == null ? void 0 : instance.options.getIsRowExpanded(row)) != null ? _instance$options$get : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
960
+ const expanded = table.getState().expanded;
961
+ return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
968
962
  },
969
963
  getCanExpand: () => {
970
- var _instance$options$get2, _instance$options$ena, _row$subRows;
964
+ var _table$options$getRow, _table$options$enable, _row$subRows;
971
965
 
972
- return ((_instance$options$get2 = instance.options.getRowCanExpand == null ? void 0 : instance.options.getRowCanExpand(row)) != null ? _instance$options$get2 : true) && ((_instance$options$ena = instance.options.enableExpanding) != null ? _instance$options$ena : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
966
+ return ((_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : true) && ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
973
967
  },
974
968
  getToggleExpandedHandler: () => {
975
969
  const canExpand = row.getCanExpand();
@@ -1105,24 +1099,24 @@ const Filters = {
1105
1099
  ...state
1106
1100
  };
1107
1101
  },
1108
- getDefaultOptions: instance => {
1102
+ getDefaultOptions: table => {
1109
1103
  return {
1110
- onColumnFiltersChange: makeStateUpdater('columnFilters', instance),
1111
- onGlobalFilterChange: makeStateUpdater('globalFilter', instance),
1104
+ onColumnFiltersChange: makeStateUpdater('columnFilters', table),
1105
+ onGlobalFilterChange: makeStateUpdater('globalFilter', table),
1112
1106
  filterFromLeafRows: false,
1113
1107
  globalFilterFn: 'auto',
1114
1108
  getColumnCanGlobalFilter: column => {
1115
- var _instance$getCoreRowM, _instance$getCoreRowM2;
1109
+ var _table$getCoreRowMode, _table$getCoreRowMode2;
1116
1110
 
1117
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1111
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1118
1112
  return typeof value === 'string';
1119
1113
  }
1120
1114
  };
1121
1115
  },
1122
- createColumn: (column, instance) => {
1116
+ createColumn: (column, table) => {
1123
1117
  return {
1124
1118
  getAutoFilterFn: () => {
1125
- const firstRow = instance.getCoreRowModel().flatRows[0];
1119
+ const firstRow = table.getCoreRowModel().flatRows[0];
1126
1120
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1127
1121
 
1128
1122
  if (typeof value === 'string') {
@@ -1148,34 +1142,31 @@ const Filters = {
1148
1142
  return filterFns.weakEquals;
1149
1143
  },
1150
1144
  getFilterFn: () => {
1151
- var _ref;
1152
-
1153
- const userFilterFns = instance.options.filterFns;
1154
- return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.columnDef.filterFn]) != null ? _ref : filterFns[column.columnDef.filterFn];
1145
+ return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : filterFns[column.columnDef.filterFn];
1155
1146
  },
1156
1147
  getCanFilter: () => {
1157
- var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
1148
+ var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
1158
1149
 
1159
- 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;
1150
+ return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
1160
1151
  },
1161
1152
  getCanGlobalFilter: () => {
1162
- var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1153
+ var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1163
1154
 
1164
- 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;
1155
+ return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
1165
1156
  },
1166
1157
  getIsFiltered: () => column.getFilterIndex() > -1,
1167
1158
  getFilterValue: () => {
1168
- var _instance$getState$co, _instance$getState$co2;
1159
+ var _table$getState$colum, _table$getState$colum2;
1169
1160
 
1170
- return (_instance$getState$co = instance.getState().columnFilters) == null ? void 0 : (_instance$getState$co2 = _instance$getState$co.find(d => d.id === column.id)) == null ? void 0 : _instance$getState$co2.value;
1161
+ return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum2.value;
1171
1162
  },
1172
1163
  getFilterIndex: () => {
1173
- var _instance$getState$co3, _instance$getState$co4;
1164
+ var _table$getState$colum3, _table$getState$colum4;
1174
1165
 
1175
- return (_instance$getState$co3 = (_instance$getState$co4 = instance.getState().columnFilters) == null ? void 0 : _instance$getState$co4.findIndex(d => d.id === column.id)) != null ? _instance$getState$co3 : -1;
1166
+ return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex(d => d.id === column.id)) != null ? _table$getState$colum3 : -1;
1176
1167
  },
1177
1168
  setFilterValue: value => {
1178
- instance.setColumnFilters(old => {
1169
+ table.setColumnFilters(old => {
1179
1170
  const filterFn = column.getFilterFn();
1180
1171
  const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1181
1172
  const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined); //
@@ -1210,15 +1201,15 @@ const Filters = {
1210
1201
  return [newFilterObj];
1211
1202
  });
1212
1203
  },
1213
- _getFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, column.id),
1204
+ _getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
1214
1205
  getFacetedRowModel: () => {
1215
1206
  if (!column._getFacetedRowModel) {
1216
- return instance.getPreFilteredRowModel();
1207
+ return table.getPreFilteredRowModel();
1217
1208
  }
1218
1209
 
1219
1210
  return column._getFacetedRowModel();
1220
1211
  },
1221
- _getFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, column.id),
1212
+ _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
1222
1213
  getFacetedUniqueValues: () => {
1223
1214
  if (!column._getFacetedUniqueValues) {
1224
1215
  return new Map();
@@ -1226,7 +1217,7 @@ const Filters = {
1226
1217
 
1227
1218
  return column._getFacetedUniqueValues();
1228
1219
  },
1229
- _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1220
+ _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
1230
1221
  getFacetedMinMaxValues: () => {
1231
1222
  if (!column._getFacetedMinMaxValues) {
1232
1223
  return undefined;
@@ -1238,28 +1229,25 @@ const Filters = {
1238
1229
 
1239
1230
  };
1240
1231
  },
1241
- createRow: (row, instance) => {
1232
+ createRow: (row, table) => {
1242
1233
  return {
1243
1234
  columnFilters: {},
1244
1235
  columnFiltersMeta: {}
1245
1236
  };
1246
1237
  },
1247
- createInstance: instance => {
1238
+ createTable: table => {
1248
1239
  return {
1249
1240
  getGlobalAutoFilterFn: () => {
1250
1241
  return filterFns.includesString;
1251
1242
  },
1252
1243
  getGlobalFilterFn: () => {
1253
- var _ref2;
1254
-
1255
1244
  const {
1256
- filterFns: userFilterFns,
1257
1245
  globalFilterFn: globalFilterFn
1258
- } = instance.options;
1259
- return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? instance.getGlobalAutoFilterFn() : (_ref2 = userFilterFns == null ? void 0 : userFilterFns[globalFilterFn]) != null ? _ref2 : filterFns[globalFilterFn];
1246
+ } = table.options;
1247
+ return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : filterFns[globalFilterFn];
1260
1248
  },
1261
1249
  setColumnFilters: updater => {
1262
- const leafColumns = instance.getAllLeafColumns();
1250
+ const leafColumns = table.getAllLeafColumns();
1263
1251
 
1264
1252
  const updateFn = old => {
1265
1253
  var _functionalUpdate;
@@ -1279,51 +1267,51 @@ const Filters = {
1279
1267
  });
1280
1268
  };
1281
1269
 
1282
- instance.options.onColumnFiltersChange == null ? void 0 : instance.options.onColumnFiltersChange(updateFn);
1270
+ table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1283
1271
  },
1284
1272
  setGlobalFilter: updater => {
1285
- instance.options.onGlobalFilterChange == null ? void 0 : instance.options.onGlobalFilterChange(updater);
1273
+ table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1286
1274
  },
1287
1275
  resetGlobalFilter: defaultState => {
1288
- instance.setGlobalFilter(defaultState ? undefined : instance.initialState.globalFilter);
1276
+ table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1289
1277
  },
1290
1278
  resetColumnFilters: defaultState => {
1291
- var _instance$initialStat, _instance$initialStat2;
1279
+ var _table$initialState$c, _table$initialState;
1292
1280
 
1293
- instance.setColumnFilters(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnFilters) != null ? _instance$initialStat : []);
1281
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1294
1282
  },
1295
- getPreFilteredRowModel: () => instance.getCoreRowModel(),
1296
- _getFilteredRowModel: instance.options.getFilteredRowModel && instance.options.getFilteredRowModel(instance),
1283
+ getPreFilteredRowModel: () => table.getCoreRowModel(),
1284
+ _getFilteredRowModel: table.options.getFilteredRowModel && table.options.getFilteredRowModel(table),
1297
1285
  getFilteredRowModel: () => {
1298
- if (instance.options.manualFiltering || !instance._getFilteredRowModel) {
1299
- return instance.getPreFilteredRowModel();
1286
+ if (table.options.manualFiltering || !table._getFilteredRowModel) {
1287
+ return table.getPreFilteredRowModel();
1300
1288
  }
1301
1289
 
1302
- return instance._getFilteredRowModel();
1290
+ return table._getFilteredRowModel();
1303
1291
  },
1304
- _getGlobalFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, '__global__'),
1292
+ _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
1305
1293
  getGlobalFacetedRowModel: () => {
1306
- if (instance.options.manualFiltering || !instance._getGlobalFacetedRowModel) {
1307
- return instance.getPreFilteredRowModel();
1294
+ if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
1295
+ return table.getPreFilteredRowModel();
1308
1296
  }
1309
1297
 
1310
- return instance._getGlobalFacetedRowModel();
1298
+ return table._getGlobalFacetedRowModel();
1311
1299
  },
1312
- _getGlobalFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, '__global__'),
1300
+ _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
1313
1301
  getGlobalFacetedUniqueValues: () => {
1314
- if (!instance._getGlobalFacetedUniqueValues) {
1302
+ if (!table._getGlobalFacetedUniqueValues) {
1315
1303
  return new Map();
1316
1304
  }
1317
1305
 
1318
- return instance._getGlobalFacetedUniqueValues();
1306
+ return table._getGlobalFacetedUniqueValues();
1319
1307
  },
1320
- _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1308
+ _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
1321
1309
  getGlobalFacetedMinMaxValues: () => {
1322
- if (!instance._getGlobalFacetedMinMaxValues) {
1310
+ if (!table._getGlobalFacetedMinMaxValues) {
1323
1311
  return;
1324
1312
  }
1325
1313
 
1326
- return instance._getGlobalFacetedMinMaxValues();
1314
+ return table._getGlobalFacetedMinMaxValues();
1327
1315
  }
1328
1316
  };
1329
1317
  }
@@ -1444,9 +1432,9 @@ const Grouping = {
1444
1432
  getDefaultColumnDef: () => {
1445
1433
  return {
1446
1434
  aggregatedCell: props => {
1447
- var _props$getValue$toStr, _props$getValue;
1435
+ var _toString, _props$getValue;
1448
1436
 
1449
- return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
1437
+ return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1450
1438
  },
1451
1439
  aggregationFn: 'auto'
1452
1440
  };
@@ -1457,16 +1445,16 @@ const Grouping = {
1457
1445
  ...state
1458
1446
  };
1459
1447
  },
1460
- getDefaultOptions: instance => {
1448
+ getDefaultOptions: table => {
1461
1449
  return {
1462
- onGroupingChange: makeStateUpdater('grouping', instance),
1450
+ onGroupingChange: makeStateUpdater('grouping', table),
1463
1451
  groupedColumnMode: 'reorder'
1464
1452
  };
1465
1453
  },
1466
- createColumn: (column, instance) => {
1454
+ createColumn: (column, table) => {
1467
1455
  return {
1468
1456
  toggleGrouping: () => {
1469
- instance.setGrouping(old => {
1457
+ table.setGrouping(old => {
1470
1458
  // Find any existing grouping for this column
1471
1459
  if (old != null && old.includes(column.id)) {
1472
1460
  return old.filter(d => d !== column.id);
@@ -1478,17 +1466,17 @@ const Grouping = {
1478
1466
  getCanGroup: () => {
1479
1467
  var _ref, _ref2, _ref3, _column$columnDef$ena;
1480
1468
 
1481
- 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;
1469
+ return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
1482
1470
  },
1483
1471
  getIsGrouped: () => {
1484
- var _instance$getState$gr;
1472
+ var _table$getState$group;
1485
1473
 
1486
- return (_instance$getState$gr = instance.getState().grouping) == null ? void 0 : _instance$getState$gr.includes(column.id);
1474
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1487
1475
  },
1488
1476
  getGroupedIndex: () => {
1489
- var _instance$getState$gr2;
1477
+ var _table$getState$group2;
1490
1478
 
1491
- return (_instance$getState$gr2 = instance.getState().grouping) == null ? void 0 : _instance$getState$gr2.indexOf(column.id);
1479
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1492
1480
  },
1493
1481
  getToggleGroupingHandler: () => {
1494
1482
  const canGroup = column.getCanGroup();
@@ -1498,7 +1486,7 @@ const Grouping = {
1498
1486
  };
1499
1487
  },
1500
1488
  getAutoAggregationFn: () => {
1501
- const firstRow = instance.getCoreRowModel().flatRows[0];
1489
+ const firstRow = table.getCoreRowModel().flatRows[0];
1502
1490
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1503
1491
 
1504
1492
  if (typeof value === 'number') {
@@ -1510,37 +1498,33 @@ const Grouping = {
1510
1498
  }
1511
1499
  },
1512
1500
  getAggregationFn: () => {
1513
- var _ref4;
1514
-
1515
- const userAggregationFns = instance.options.aggregationFns;
1516
-
1517
1501
  if (!column) {
1518
1502
  throw new Error();
1519
1503
  }
1520
1504
 
1521
- return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.columnDef.aggregationFn]) != null ? _ref4 : aggregationFns[column.columnDef.aggregationFn];
1505
+ return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : aggregationFns[column.columnDef.aggregationFn];
1522
1506
  }
1523
1507
  };
1524
1508
  },
1525
- createInstance: instance => {
1509
+ createTable: table => {
1526
1510
  return {
1527
- setGrouping: updater => instance.options.onGroupingChange == null ? void 0 : instance.options.onGroupingChange(updater),
1511
+ setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1528
1512
  resetGrouping: defaultState => {
1529
- var _instance$initialStat, _instance$initialStat2;
1513
+ var _table$initialState$g, _table$initialState;
1530
1514
 
1531
- instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1515
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1532
1516
  },
1533
- getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1517
+ getPreGroupedRowModel: () => table.getFilteredRowModel(),
1534
1518
  getGroupedRowModel: () => {
1535
- if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1536
- instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
1519
+ if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
1520
+ table._getGroupedRowModel = table.options.getGroupedRowModel(table);
1537
1521
  }
1538
1522
 
1539
- if (instance.options.manualGrouping || !instance._getGroupedRowModel) {
1540
- return instance.getPreGroupedRowModel();
1523
+ if (table.options.manualGrouping || !table._getGroupedRowModel) {
1524
+ return table.getPreGroupedRowModel();
1541
1525
  }
1542
1526
 
1543
- return instance._getGroupedRowModel();
1527
+ return table._getGroupedRowModel();
1544
1528
  }
1545
1529
  };
1546
1530
  },
@@ -1550,12 +1534,7 @@ const Grouping = {
1550
1534
  _groupingValuesCache: {}
1551
1535
  };
1552
1536
  },
1553
- createCell: (cell, column, row, instance) => {
1554
- const getRenderValue = () => {
1555
- var _cell$getValue;
1556
-
1557
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
1558
- };
1537
+ createCell: (cell, column, row, table) => {
1559
1538
 
1560
1539
  return {
1561
1540
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
@@ -1564,22 +1543,6 @@ const Grouping = {
1564
1543
  var _row$subRows;
1565
1544
 
1566
1545
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1567
- },
1568
- renderAggregatedCell: () => {
1569
- if (process.env.NODE_ENV === 'development') {
1570
- if (!column.columnDef.aggregatedCell) {
1571
- console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
1572
- }
1573
- }
1574
-
1575
- const template = column.columnDef.aggregatedCell || column.columnDef.cell;
1576
- return template ? instance._render(template, {
1577
- instance,
1578
- column,
1579
- row,
1580
- cell,
1581
- getValue: getRenderValue
1582
- }) : null;
1583
1546
  }
1584
1547
  };
1585
1548
  }
@@ -1607,20 +1570,20 @@ const Ordering = {
1607
1570
  ...state
1608
1571
  };
1609
1572
  },
1610
- getDefaultOptions: instance => {
1573
+ getDefaultOptions: table => {
1611
1574
  return {
1612
- onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1575
+ onColumnOrderChange: makeStateUpdater('columnOrder', table)
1613
1576
  };
1614
1577
  },
1615
- createInstance: instance => {
1578
+ createTable: table => {
1616
1579
  return {
1617
- setColumnOrder: updater => instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater),
1580
+ setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1618
1581
  resetColumnOrder: defaultState => {
1619
- var _instance$initialStat;
1582
+ var _table$initialState$c;
1620
1583
 
1621
- instance.setColumnOrder(defaultState ? [] : (_instance$initialStat = instance.initialState.columnOrder) != null ? _instance$initialStat : []);
1584
+ table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
1622
1585
  },
1623
- _getOrderColumnsFn: memo(() => [instance.getState().columnOrder, instance.getState().grouping, instance.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1586
+ _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1624
1587
  // Sort grouped columns to the start of the column list
1625
1588
  // before the headers are built
1626
1589
  let orderedColumns = []; // If there is no order, return the normal columns
@@ -1648,7 +1611,7 @@ const Ordering = {
1648
1611
 
1649
1612
  return orderColumns(orderedColumns, grouping, groupedColumnMode);
1650
1613
  }, {
1651
- key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn' // debug: () => instance.options.debugAll ?? instance.options.debugTable,
1614
+ key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn' // debug: () => table.options.debugAll ?? table.options.debugTable,
1652
1615
 
1653
1616
  })
1654
1617
  };
@@ -1672,32 +1635,32 @@ const Pagination = {
1672
1635
  }
1673
1636
  };
1674
1637
  },
1675
- getDefaultOptions: instance => {
1638
+ getDefaultOptions: table => {
1676
1639
  return {
1677
- onPaginationChange: makeStateUpdater('pagination', instance)
1640
+ onPaginationChange: makeStateUpdater('pagination', table)
1678
1641
  };
1679
1642
  },
1680
- createInstance: instance => {
1643
+ createTable: table => {
1681
1644
  let registered = false;
1682
1645
  let queued = false;
1683
1646
  return {
1684
1647
  _autoResetPageIndex: () => {
1685
- var _ref, _instance$options$aut;
1648
+ var _ref, _table$options$autoRe;
1686
1649
 
1687
1650
  if (!registered) {
1688
- instance._queue(() => {
1651
+ table._queue(() => {
1689
1652
  registered = true;
1690
1653
  });
1691
1654
 
1692
1655
  return;
1693
1656
  }
1694
1657
 
1695
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetPageIndex) != null ? _ref : !instance.options.manualPagination) {
1658
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
1696
1659
  if (queued) return;
1697
1660
  queued = true;
1698
1661
 
1699
- instance._queue(() => {
1700
- instance.resetPageIndex();
1662
+ table._queue(() => {
1663
+ table.resetPageIndex();
1701
1664
  queued = false;
1702
1665
  });
1703
1666
  }
@@ -1708,17 +1671,17 @@ const Pagination = {
1708
1671
  return newState;
1709
1672
  };
1710
1673
 
1711
- return instance.options.onPaginationChange == null ? void 0 : instance.options.onPaginationChange(safeUpdater);
1674
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1712
1675
  },
1713
1676
  resetPagination: defaultState => {
1714
- var _instance$initialStat;
1677
+ var _table$initialState$p;
1715
1678
 
1716
- instance.setPagination(defaultState ? getDefaultPaginationState() : (_instance$initialStat = instance.initialState.pagination) != null ? _instance$initialStat : getDefaultPaginationState());
1679
+ table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
1717
1680
  },
1718
1681
  setPageIndex: updater => {
1719
- instance.setPagination(old => {
1682
+ table.setPagination(old => {
1720
1683
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1721
- const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1684
+ const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
1722
1685
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1723
1686
  return { ...old,
1724
1687
  pageIndex
@@ -1726,17 +1689,17 @@ const Pagination = {
1726
1689
  });
1727
1690
  },
1728
1691
  resetPageIndex: defaultState => {
1729
- var _instance$initialStat2, _instance$initialStat3, _instance$initialStat4;
1692
+ var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1730
1693
 
1731
- instance.setPageIndex(defaultState ? defaultPageIndex : (_instance$initialStat2 = (_instance$initialStat3 = instance.initialState) == null ? void 0 : (_instance$initialStat4 = _instance$initialStat3.pagination) == null ? void 0 : _instance$initialStat4.pageIndex) != null ? _instance$initialStat2 : defaultPageIndex);
1694
+ table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null ? void 0 : (_table$initialState$p3 = _table$initialState.pagination) == null ? void 0 : _table$initialState$p3.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
1732
1695
  },
1733
1696
  resetPageSize: defaultState => {
1734
- var _instance$initialStat5, _instance$initialStat6, _instance$initialStat7;
1697
+ var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1735
1698
 
1736
- instance.setPageSize(defaultState ? defaultPageSize : (_instance$initialStat5 = (_instance$initialStat6 = instance.initialState) == null ? void 0 : (_instance$initialStat7 = _instance$initialStat6.pagination) == null ? void 0 : _instance$initialStat7.pageSize) != null ? _instance$initialStat5 : defaultPageSize);
1699
+ table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p4 = (_table$initialState2 = table.initialState) == null ? void 0 : (_table$initialState2$ = _table$initialState2.pagination) == null ? void 0 : _table$initialState2$.pageSize) != null ? _table$initialState$p4 : defaultPageSize);
1737
1700
  },
1738
1701
  setPageSize: updater => {
1739
- instance.setPagination(old => {
1702
+ table.setPagination(old => {
1740
1703
  const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
1741
1704
  const topRowIndex = old.pageSize * old.pageIndex;
1742
1705
  const pageIndex = Math.floor(topRowIndex / pageSize);
@@ -1746,10 +1709,10 @@ const Pagination = {
1746
1709
  };
1747
1710
  });
1748
1711
  },
1749
- setPageCount: updater => instance.setPagination(old => {
1750
- var _instance$options$pag;
1712
+ setPageCount: updater => table.setPagination(old => {
1713
+ var _table$options$pageCo;
1751
1714
 
1752
- let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1715
+ let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
1753
1716
 
1754
1717
  if (typeof newPageCount === 'number') {
1755
1718
  newPageCount = Math.max(-1, newPageCount);
@@ -1759,7 +1722,7 @@ const Pagination = {
1759
1722
  pageCount: newPageCount
1760
1723
  };
1761
1724
  }),
1762
- getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1725
+ getPageOptions: memo(() => [table.getPageCount()], pageCount => {
1763
1726
  let pageOptions = [];
1764
1727
 
1765
1728
  if (pageCount && pageCount > 0) {
@@ -1770,17 +1733,17 @@ const Pagination = {
1770
1733
  }, {
1771
1734
  key: process.env.NODE_ENV === 'development' && 'getPageOptions',
1772
1735
  debug: () => {
1773
- var _instance$options$deb;
1736
+ var _table$options$debugA;
1774
1737
 
1775
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
1738
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
1776
1739
  }
1777
1740
  }),
1778
- getCanPreviousPage: () => instance.getState().pagination.pageIndex > 0,
1741
+ getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
1779
1742
  getCanNextPage: () => {
1780
1743
  const {
1781
1744
  pageIndex
1782
- } = instance.getState().pagination;
1783
- const pageCount = instance.getPageCount();
1745
+ } = table.getState().pagination;
1746
+ const pageCount = table.getPageCount();
1784
1747
 
1785
1748
  if (pageCount === -1) {
1786
1749
  return true;
@@ -1793,29 +1756,29 @@ const Pagination = {
1793
1756
  return pageIndex < pageCount - 1;
1794
1757
  },
1795
1758
  previousPage: () => {
1796
- return instance.setPageIndex(old => old - 1);
1759
+ return table.setPageIndex(old => old - 1);
1797
1760
  },
1798
1761
  nextPage: () => {
1799
- return instance.setPageIndex(old => {
1762
+ return table.setPageIndex(old => {
1800
1763
  return old + 1;
1801
1764
  });
1802
1765
  },
1803
- getPrePaginationRowModel: () => instance.getExpandedRowModel(),
1766
+ getPrePaginationRowModel: () => table.getExpandedRowModel(),
1804
1767
  getPaginationRowModel: () => {
1805
- if (!instance._getPaginationRowModel && instance.options.getPaginationRowModel) {
1806
- instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
1768
+ if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
1769
+ table._getPaginationRowModel = table.options.getPaginationRowModel(table);
1807
1770
  }
1808
1771
 
1809
- if (instance.options.manualPagination || !instance._getPaginationRowModel) {
1810
- return instance.getPrePaginationRowModel();
1772
+ if (table.options.manualPagination || !table._getPaginationRowModel) {
1773
+ return table.getPrePaginationRowModel();
1811
1774
  }
1812
1775
 
1813
- return instance._getPaginationRowModel();
1776
+ return table._getPaginationRowModel();
1814
1777
  },
1815
1778
  getPageCount: () => {
1816
- var _instance$options$pag2;
1779
+ var _table$options$pageCo2;
1817
1780
 
1818
- return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1781
+ return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1819
1782
  }
1820
1783
  };
1821
1784
  }
@@ -1834,16 +1797,16 @@ const Pinning = {
1834
1797
  ...state
1835
1798
  };
1836
1799
  },
1837
- getDefaultOptions: instance => {
1800
+ getDefaultOptions: table => {
1838
1801
  return {
1839
- onColumnPinningChange: makeStateUpdater('columnPinning', instance)
1802
+ onColumnPinningChange: makeStateUpdater('columnPinning', table)
1840
1803
  };
1841
1804
  },
1842
- createColumn: (column, instance) => {
1805
+ createColumn: (column, table) => {
1843
1806
  return {
1844
1807
  pin: position => {
1845
1808
  const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
1846
- instance.setColumnPinning(old => {
1809
+ table.setColumnPinning(old => {
1847
1810
  var _old$left3, _old$right3;
1848
1811
 
1849
1812
  if (position === 'right') {
@@ -1873,9 +1836,9 @@ const Pinning = {
1873
1836
  getCanPin: () => {
1874
1837
  const leafColumns = column.getLeafColumns();
1875
1838
  return leafColumns.some(d => {
1876
- var _d$columnDef$enablePi, _instance$options$ena;
1839
+ var _d$columnDef$enablePi, _table$options$enable;
1877
1840
 
1878
- return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1841
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
1879
1842
  });
1880
1843
  },
1881
1844
  getIsPinned: () => {
@@ -1883,33 +1846,33 @@ const Pinning = {
1883
1846
  const {
1884
1847
  left,
1885
1848
  right
1886
- } = instance.getState().columnPinning;
1849
+ } = table.getState().columnPinning;
1887
1850
  const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
1888
1851
  const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
1889
1852
  return isLeft ? 'left' : isRight ? 'right' : false;
1890
1853
  },
1891
1854
  getPinnedIndex: () => {
1892
- var _instance$getState$co, _instance$getState$co2, _instance$getState$co3;
1855
+ var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1893
1856
 
1894
1857
  const position = column.getIsPinned();
1895
- return position ? (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnPinning) == null ? void 0 : (_instance$getState$co3 = _instance$getState$co2[position]) == null ? void 0 : _instance$getState$co3.indexOf(column.id)) != null ? _instance$getState$co : -1 : 0;
1858
+ return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null ? void 0 : (_table$getState$colum3 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum3.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
1896
1859
  }
1897
1860
  };
1898
1861
  },
1899
- createRow: (row, instance) => {
1862
+ createRow: (row, table) => {
1900
1863
  return {
1901
- getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1864
+ getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
1902
1865
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1903
1866
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
1904
1867
  }, {
1905
1868
  key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
1906
1869
  debug: () => {
1907
- var _instance$options$deb;
1870
+ var _table$options$debugA;
1908
1871
 
1909
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
1872
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
1910
1873
  }
1911
1874
  }),
1912
- getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1875
+ getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
1913
1876
  const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1914
1877
  position: 'left'
1915
1878
  }));
@@ -1917,12 +1880,12 @@ const Pinning = {
1917
1880
  }, {
1918
1881
  key: process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
1919
1882
  debug: () => {
1920
- var _instance$options$deb2;
1883
+ var _table$options$debugA2;
1921
1884
 
1922
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
1885
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
1923
1886
  }
1924
1887
  }),
1925
- getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1888
+ getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
1926
1889
  const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1927
1890
  position: 'left'
1928
1891
  }));
@@ -1930,25 +1893,25 @@ const Pinning = {
1930
1893
  }, {
1931
1894
  key: process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
1932
1895
  debug: () => {
1933
- var _instance$options$deb3;
1896
+ var _table$options$debugA3;
1934
1897
 
1935
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
1898
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
1936
1899
  }
1937
1900
  })
1938
1901
  };
1939
1902
  },
1940
- createInstance: instance => {
1903
+ createTable: table => {
1941
1904
  return {
1942
- setColumnPinning: updater => instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater),
1905
+ setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1943
1906
  resetColumnPinning: defaultState => {
1944
- var _instance$initialStat, _instance$initialStat2;
1907
+ var _table$initialState$c, _table$initialState;
1945
1908
 
1946
- return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1909
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1947
1910
  },
1948
1911
  getIsSomeColumnsPinned: position => {
1949
1912
  var _pinningState$positio;
1950
1913
 
1951
- const pinningState = instance.getState().columnPinning;
1914
+ const pinningState = table.getState().columnPinning;
1952
1915
 
1953
1916
  if (!position) {
1954
1917
  var _pinningState$left, _pinningState$right;
@@ -1958,35 +1921,35 @@ const Pinning = {
1958
1921
 
1959
1922
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1960
1923
  },
1961
- getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1924
+ getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1962
1925
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1963
1926
  }, {
1964
1927
  key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
1965
1928
  debug: () => {
1966
- var _instance$options$deb4;
1929
+ var _table$options$debugA4;
1967
1930
 
1968
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
1931
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
1969
1932
  }
1970
1933
  }),
1971
- getRightLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.right], (allColumns, right) => {
1934
+ getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
1972
1935
  return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1973
1936
  }, {
1974
1937
  key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
1975
1938
  debug: () => {
1976
- var _instance$options$deb5;
1939
+ var _table$options$debugA5;
1977
1940
 
1978
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
1941
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
1979
1942
  }
1980
1943
  }),
1981
- getCenterLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, left, right) => {
1944
+ getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
1982
1945
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1983
1946
  return allColumns.filter(d => !leftAndRight.includes(d.id));
1984
1947
  }, {
1985
1948
  key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
1986
1949
  debug: () => {
1987
- var _instance$options$deb6;
1950
+ var _table$options$debugA6;
1988
1951
 
1989
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
1952
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
1990
1953
  }
1991
1954
  })
1992
1955
  };
@@ -2001,9 +1964,9 @@ const RowSelection = {
2001
1964
  ...state
2002
1965
  };
2003
1966
  },
2004
- getDefaultOptions: instance => {
1967
+ getDefaultOptions: table => {
2005
1968
  return {
2006
- onRowSelectionChange: makeStateUpdater('rowSelection', instance),
1969
+ onRowSelectionChange: makeStateUpdater('rowSelection', table),
2007
1970
  enableRowSelection: true,
2008
1971
  enableMultiRowSelection: true,
2009
1972
  enableSubRowSelection: true // enableGroupingRowSelection: false,
@@ -2012,20 +1975,20 @@ const RowSelection = {
2012
1975
 
2013
1976
  };
2014
1977
  },
2015
- createInstance: instance => {
1978
+ createTable: table => {
2016
1979
  return {
2017
- setRowSelection: updater => instance.options.onRowSelectionChange == null ? void 0 : instance.options.onRowSelectionChange(updater),
1980
+ setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
2018
1981
  resetRowSelection: defaultState => {
2019
- var _instance$initialStat;
1982
+ var _table$initialState$r;
2020
1983
 
2021
- return instance.setRowSelection(defaultState ? {} : (_instance$initialStat = instance.initialState.rowSelection) != null ? _instance$initialStat : {});
1984
+ return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
2022
1985
  },
2023
1986
  toggleAllRowsSelected: value => {
2024
- instance.setRowSelection(old => {
2025
- value = typeof value !== 'undefined' ? value : !instance.getIsAllRowsSelected();
1987
+ table.setRowSelection(old => {
1988
+ value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
2026
1989
  const rowSelection = { ...old
2027
1990
  };
2028
- const preGroupedFlatRows = instance.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
1991
+ const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
2029
1992
  // All of the rows are flat already, so it wouldn't be worth it
2030
1993
 
2031
1994
  if (value) {
@@ -2041,12 +2004,12 @@ const RowSelection = {
2041
2004
  return rowSelection;
2042
2005
  });
2043
2006
  },
2044
- toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2045
- const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2007
+ toggleAllPageRowsSelected: value => table.setRowSelection(old => {
2008
+ const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
2046
2009
  const rowSelection = { ...old
2047
2010
  };
2048
- instance.getRowModel().rows.forEach(row => {
2049
- mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2011
+ table.getRowModel().rows.forEach(row => {
2012
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
2050
2013
  });
2051
2014
  return rowSelection;
2052
2015
  }),
@@ -2055,7 +2018,7 @@ const RowSelection = {
2055
2018
  // rows,
2056
2019
  // rowsById,
2057
2020
  // options: { selectGroupingRows, selectSubRows },
2058
- // } = instance
2021
+ // } = table
2059
2022
  // const findSelectedRow = (rows: Row[]) => {
2060
2023
  // let found
2061
2024
  // rows.find(d => {
@@ -2083,7 +2046,7 @@ const RowSelection = {
2083
2046
  // selectSubRows: selectSubRows!,
2084
2047
  // })
2085
2048
  // }
2086
- // instance.rows.forEach(row => {
2049
+ // table.rows.forEach(row => {
2087
2050
  // const isFirstRow = row.id === firstRow.id
2088
2051
  // const isLastRow = row.id === lastRow.id
2089
2052
  // if (isFirstRow || isLastRow) {
@@ -2098,10 +2061,10 @@ const RowSelection = {
2098
2061
  // addRow(row)
2099
2062
  // }
2100
2063
  // })
2101
- // instance.setRowSelection(selectedRowIds)
2064
+ // table.setRowSelection(selectedRowIds)
2102
2065
  // },
2103
- getPreSelectedRowModel: () => instance.getCoreRowModel(),
2104
- getSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getCoreRowModel()], (rowSelection, rowModel) => {
2066
+ getPreSelectedRowModel: () => table.getCoreRowModel(),
2067
+ getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
2105
2068
  if (!Object.keys(rowSelection).length) {
2106
2069
  return {
2107
2070
  rows: [],
@@ -2110,16 +2073,16 @@ const RowSelection = {
2110
2073
  };
2111
2074
  }
2112
2075
 
2113
- return selectRowsFn(instance, rowModel);
2076
+ return selectRowsFn(table, rowModel);
2114
2077
  }, {
2115
2078
  key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
2116
2079
  debug: () => {
2117
- var _instance$options$deb;
2080
+ var _table$options$debugA;
2118
2081
 
2119
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
2082
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
2120
2083
  }
2121
2084
  }),
2122
- getFilteredSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getFilteredRowModel()], (rowSelection, rowModel) => {
2085
+ getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
2123
2086
  if (!Object.keys(rowSelection).length) {
2124
2087
  return {
2125
2088
  rows: [],
@@ -2128,16 +2091,16 @@ const RowSelection = {
2128
2091
  };
2129
2092
  }
2130
2093
 
2131
- return selectRowsFn(instance, rowModel);
2094
+ return selectRowsFn(table, rowModel);
2132
2095
  }, {
2133
2096
  key: process.env.NODE_ENV === 'production' && 'getFilteredSelectedRowModel',
2134
2097
  debug: () => {
2135
- var _instance$options$deb2;
2098
+ var _table$options$debugA2;
2136
2099
 
2137
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2100
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
2138
2101
  }
2139
2102
  }),
2140
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2103
+ getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
2141
2104
  if (!Object.keys(rowSelection).length) {
2142
2105
  return {
2143
2106
  rows: [],
@@ -2146,31 +2109,31 @@ const RowSelection = {
2146
2109
  };
2147
2110
  }
2148
2111
 
2149
- return selectRowsFn(instance, rowModel);
2112
+ return selectRowsFn(table, rowModel);
2150
2113
  }, {
2151
2114
  key: process.env.NODE_ENV === 'production' && 'getGroupedSelectedRowModel',
2152
2115
  debug: () => {
2153
- var _instance$options$deb3;
2116
+ var _table$options$debugA3;
2154
2117
 
2155
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugTable;
2118
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
2156
2119
  }
2157
2120
  }),
2158
2121
  ///
2159
2122
  // getGroupingRowCanSelect: rowId => {
2160
- // const row = instance.getRow(rowId)
2123
+ // const row = table.getRow(rowId)
2161
2124
  // if (!row) {
2162
2125
  // throw new Error()
2163
2126
  // }
2164
- // if (typeof instance.options.enableGroupingRowSelection === 'function') {
2165
- // return instance.options.enableGroupingRowSelection(row)
2127
+ // if (typeof table.options.enableGroupingRowSelection === 'function') {
2128
+ // return table.options.enableGroupingRowSelection(row)
2166
2129
  // }
2167
- // return instance.options.enableGroupingRowSelection ?? false
2130
+ // return table.options.enableGroupingRowSelection ?? false
2168
2131
  // },
2169
2132
  getIsAllRowsSelected: () => {
2170
- const preFilteredFlatRows = instance.getPreFilteredRowModel().flatRows;
2133
+ const preFilteredFlatRows = table.getPreFilteredRowModel().flatRows;
2171
2134
  const {
2172
2135
  rowSelection
2173
- } = instance.getState();
2136
+ } = table.getState();
2174
2137
  let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
2175
2138
 
2176
2139
  if (isAllRowsSelected) {
@@ -2182,10 +2145,10 @@ const RowSelection = {
2182
2145
  return isAllRowsSelected;
2183
2146
  },
2184
2147
  getIsAllPageRowsSelected: () => {
2185
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2148
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2186
2149
  const {
2187
2150
  rowSelection
2188
- } = instance.getState();
2151
+ } = table.getState();
2189
2152
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2190
2153
 
2191
2154
  if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
@@ -2195,31 +2158,31 @@ const RowSelection = {
2195
2158
  return isAllPageRowsSelected;
2196
2159
  },
2197
2160
  getIsSomeRowsSelected: () => {
2198
- var _instance$getState$ro;
2161
+ var _table$getState$rowSe;
2199
2162
 
2200
- return !instance.getIsAllRowsSelected() && !!Object.keys((_instance$getState$ro = instance.getState().rowSelection) != null ? _instance$getState$ro : {}).length;
2163
+ return !table.getIsAllRowsSelected() && !!Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
2201
2164
  },
2202
2165
  getIsSomePageRowsSelected: () => {
2203
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2204
- return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2166
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2167
+ return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2205
2168
  },
2206
2169
  getToggleAllRowsSelectedHandler: () => {
2207
2170
  return e => {
2208
- instance.toggleAllRowsSelected(e.target.checked);
2171
+ table.toggleAllRowsSelected(e.target.checked);
2209
2172
  };
2210
2173
  },
2211
2174
  getToggleAllPageRowsSelectedHandler: () => {
2212
2175
  return e => {
2213
- instance.toggleAllPageRowsSelected(e.target.checked);
2176
+ table.toggleAllPageRowsSelected(e.target.checked);
2214
2177
  };
2215
2178
  }
2216
2179
  };
2217
2180
  },
2218
- createRow: (row, instance) => {
2181
+ createRow: (row, table) => {
2219
2182
  return {
2220
2183
  toggleSelected: value => {
2221
2184
  const isSelected = row.getIsSelected();
2222
- instance.setRowSelection(old => {
2185
+ table.setRowSelection(old => {
2223
2186
  value = typeof value !== 'undefined' ? value : !isSelected;
2224
2187
 
2225
2188
  if (isSelected === value) {
@@ -2228,48 +2191,54 @@ const RowSelection = {
2228
2191
 
2229
2192
  const selectedRowIds = { ...old
2230
2193
  };
2231
- mutateRowIsSelected(selectedRowIds, row.id, value, instance);
2194
+ mutateRowIsSelected(selectedRowIds, row.id, value, table);
2232
2195
  return selectedRowIds;
2233
2196
  });
2234
2197
  },
2235
2198
  getIsSelected: () => {
2236
2199
  const {
2237
2200
  rowSelection
2238
- } = instance.getState();
2239
- return isRowSelected(row, rowSelection) === true;
2201
+ } = table.getState();
2202
+ return isRowSelected(row, rowSelection);
2240
2203
  },
2241
2204
  getIsSomeSelected: () => {
2242
2205
  const {
2243
2206
  rowSelection
2244
- } = instance.getState();
2245
- return isRowSelected(row, rowSelection) === 'some';
2207
+ } = table.getState();
2208
+ return isSubRowSelected(row, rowSelection) === 'some';
2209
+ },
2210
+ getIsAllSubRowsSelected: () => {
2211
+ const {
2212
+ rowSelection
2213
+ } = table.getState();
2214
+ return isSubRowSelected(row, rowSelection) === 'all';
2246
2215
  },
2247
2216
  getCanSelect: () => {
2248
- var _instance$options$ena;
2217
+ var _table$options$enable;
2249
2218
 
2250
- if (typeof instance.options.enableRowSelection === 'function') {
2251
- return instance.options.enableRowSelection(row);
2219
+ if (typeof table.options.enableRowSelection === 'function') {
2220
+ return table.options.enableRowSelection(row);
2252
2221
  }
2253
2222
 
2254
- return (_instance$options$ena = instance.options.enableRowSelection) != null ? _instance$options$ena : true;
2223
+ return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
2255
2224
  },
2256
2225
  getCanSelectSubRows: () => {
2257
- var _instance$options$ena2;
2226
+ var _table$options$enable2;
2258
2227
 
2259
- if (typeof instance.options.enableSubRowSelection === 'function') {
2260
- return instance.options.enableSubRowSelection(row);
2228
+ if (typeof table.options.enableSubRowSelection === 'function') {
2229
+ return table.options.enableSubRowSelection(row);
2261
2230
  }
2262
2231
 
2263
- return (_instance$options$ena2 = instance.options.enableSubRowSelection) != null ? _instance$options$ena2 : true;
2232
+ return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
2264
2233
  },
2265
2234
  getCanMultiSelect: () => {
2266
- var _instance$options$ena3;
2235
+ var _table$options$enable3;
2267
2236
 
2268
- if (typeof instance.options.enableMultiRowSelection === 'function') {
2269
- return instance.options.enableMultiRowSelection(row);
2237
+ if (typeof table.options.enableMultiRowSelection === 'function') {
2238
+ return table.options.enableMultiRowSelection(row);
2270
2239
  }
2271
2240
 
2272
- return (_instance$options$ena3 = instance.options.enableMultiRowSelection) != null ? _instance$options$ena3 : true;
2241
+ return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
2273
2242
  },
2274
2243
  getToggleSelectedHandler: () => {
2275
2244
  const canSelect = row.getCanSelect();
@@ -2284,16 +2253,20 @@ const RowSelection = {
2284
2253
  }
2285
2254
  };
2286
2255
 
2287
- const mutateRowIsSelected = (selectedRowIds, id, value, instance) => {
2256
+ const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2288
2257
  var _row$subRows;
2289
2258
 
2290
- const row = instance.getRow(id);
2259
+ const row = table.getRow(id);
2291
2260
  row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
2292
2261
  // !isGrouped ||
2293
- // (isGrouped && instance.options.enableGroupingRowSelection)
2262
+ // (isGrouped && table.options.enableGroupingRowSelection)
2294
2263
  // ) {
2295
2264
 
2296
2265
  if (value) {
2266
+ if (!row.getCanMultiSelect()) {
2267
+ Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
2268
+ }
2269
+
2297
2270
  selectedRowIds[id] = true;
2298
2271
  } else {
2299
2272
  delete selectedRowIds[id];
@@ -2301,12 +2274,12 @@ const mutateRowIsSelected = (selectedRowIds, id, value, instance) => {
2301
2274
 
2302
2275
 
2303
2276
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2304
- row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, instance));
2277
+ row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2305
2278
  }
2306
2279
  };
2307
2280
 
2308
- function selectRowsFn(instance, rowModel) {
2309
- const rowSelection = instance.getState().rowSelection;
2281
+ function selectRowsFn(table, rowModel) {
2282
+ const rowSelection = table.getState().rowSelection;
2310
2283
  const newSelectedFlatRows = [];
2311
2284
  const newSelectedRowsById = {}; // Filters top level and nested rows
2312
2285
 
@@ -2315,7 +2288,7 @@ function selectRowsFn(instance, rowModel) {
2315
2288
  return rows.map(row => {
2316
2289
  var _row$subRows2;
2317
2290
 
2318
- const isSelected = isRowSelected(row, rowSelection) === true;
2291
+ const isSelected = isRowSelected(row, rowSelection);
2319
2292
 
2320
2293
  if (isSelected) {
2321
2294
  newSelectedFlatRows.push(row);
@@ -2340,11 +2313,12 @@ function selectRowsFn(instance, rowModel) {
2340
2313
  rowsById: newSelectedRowsById
2341
2314
  };
2342
2315
  }
2343
- function isRowSelected(row, selection, instance) {
2344
- if (selection[row.id]) {
2345
- return true;
2346
- }
2316
+ function isRowSelected(row, selection) {
2317
+ var _selection$row$id;
2347
2318
 
2319
+ return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
2320
+ }
2321
+ function isSubRowSelected(row, selection, table) {
2348
2322
  if (row.subRows && row.subRows.length) {
2349
2323
  let allChildrenSelected = true;
2350
2324
  let someSelected = false;
@@ -2360,7 +2334,7 @@ function isRowSelected(row, selection, instance) {
2360
2334
  allChildrenSelected = false;
2361
2335
  }
2362
2336
  });
2363
- return allChildrenSelected ? true : someSelected ? 'some' : false;
2337
+ return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
2364
2338
  }
2365
2339
 
2366
2340
  return false;
@@ -2486,18 +2460,18 @@ const Sorting = {
2486
2460
  sortingFn: 'auto'
2487
2461
  };
2488
2462
  },
2489
- getDefaultOptions: instance => {
2463
+ getDefaultOptions: table => {
2490
2464
  return {
2491
- onSortingChange: makeStateUpdater('sorting', instance),
2465
+ onSortingChange: makeStateUpdater('sorting', table),
2492
2466
  isMultiSortEvent: e => {
2493
2467
  return e.shiftKey;
2494
2468
  }
2495
2469
  };
2496
2470
  },
2497
- createColumn: (column, instance) => {
2471
+ createColumn: (column, table) => {
2498
2472
  return {
2499
2473
  getAutoSortingFn: () => {
2500
- const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2474
+ const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2501
2475
  let isString = false;
2502
2476
 
2503
2477
  for (const row of firstRows) {
@@ -2523,7 +2497,7 @@ const Sorting = {
2523
2497
  return sortingFns.basic;
2524
2498
  },
2525
2499
  getAutoSortDir: () => {
2526
- const firstRow = instance.getFilteredRowModel().flatRows[0];
2500
+ const firstRow = table.getFilteredRowModel().flatRows[0];
2527
2501
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2528
2502
 
2529
2503
  if (typeof value === 'string') {
@@ -2533,29 +2507,25 @@ const Sorting = {
2533
2507
  return 'desc';
2534
2508
  },
2535
2509
  getSortingFn: () => {
2536
- var _ref;
2537
-
2538
- const userSortingFn = instance.options.sortingFns;
2539
-
2540
2510
  if (!column) {
2541
2511
  throw new Error();
2542
2512
  }
2543
2513
 
2544
- 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];
2514
+ return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : sortingFns[column.columnDef.sortingFn];
2545
2515
  },
2546
2516
  toggleSorting: (desc, multi) => {
2547
2517
  // if (column.columns.length) {
2548
2518
  // column.columns.forEach((c, i) => {
2549
2519
  // if (c.id) {
2550
- // instance.toggleColumnSorting(c.id, undefined, multi || !!i)
2520
+ // table.toggleColumnSorting(c.id, undefined, multi || !!i)
2551
2521
  // }
2552
2522
  // })
2553
2523
  // return
2554
2524
  // }
2555
- // this needs to be outside of instance.setSorting to be in sync with rerender
2525
+ // this needs to be outside of table.setSorting to be in sync with rerender
2556
2526
  const nextSortingOrder = column.getNextSortingOrder();
2557
- instance.setSorting(old => {
2558
- var _instance$options$ena, _instance$options$ena2;
2527
+ table.setSorting(old => {
2528
+ var _table$options$enable, _table$options$enable2;
2559
2529
 
2560
2530
  // Find any existing sorting for this column
2561
2531
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2584,9 +2554,9 @@ const Sorting = {
2584
2554
 
2585
2555
 
2586
2556
  if (sortAction === 'toggle' && ( // Must be toggling
2587
- (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
2557
+ (_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && // If enableSortRemove, enable in general
2588
2558
  !hasDescDefined && ( // Must not be setting desc
2589
- multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
2559
+ multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) && // If multi, don't allow if enableMultiRemove
2590
2560
  !nextSortingOrder // Finally, detect if it should indeed be removed
2591
2561
  ) {
2592
2562
  sortAction = 'remove';
@@ -2598,14 +2568,14 @@ const Sorting = {
2598
2568
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2599
2569
  }];
2600
2570
  } else if (sortAction === 'add' && old != null && old.length) {
2601
- var _instance$options$max;
2571
+ var _table$options$maxMul;
2602
2572
 
2603
2573
  newSorting = [...old, {
2604
2574
  id: column.id,
2605
2575
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2606
2576
  }]; // Take latest n columns
2607
2577
 
2608
- newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
2578
+ newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
2609
2579
  } else if (sortAction === 'toggle' && old != null && old.length) {
2610
2580
  // This flips (or sets) the
2611
2581
  newSorting = old.map(d => {
@@ -2625,9 +2595,9 @@ const Sorting = {
2625
2595
  });
2626
2596
  },
2627
2597
  getNextSortingOrder: () => {
2628
- var _ref2, _column$columnDef$sor;
2598
+ var _ref, _column$columnDef$sor;
2629
2599
 
2630
- const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
2600
+ const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
2631
2601
  const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
2632
2602
  const isSorted = column.getIsSorted();
2633
2603
 
@@ -2642,59 +2612,59 @@ const Sorting = {
2642
2612
  }
2643
2613
  },
2644
2614
  getCanSort: () => {
2645
- var _column$columnDef$ena, _instance$options$ena3;
2615
+ var _column$columnDef$ena, _table$options$enable3;
2646
2616
 
2647
- 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;
2617
+ return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;
2648
2618
  },
2649
2619
  getCanMultiSort: () => {
2650
- var _ref3, _column$columnDef$ena2;
2620
+ var _ref2, _column$columnDef$ena2;
2651
2621
 
2652
- return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2622
+ return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2653
2623
  },
2654
2624
  getIsSorted: () => {
2655
- var _instance$getState$so;
2625
+ var _table$getState$sorti;
2656
2626
 
2657
- const columnSort = (_instance$getState$so = instance.getState().sorting) == null ? void 0 : _instance$getState$so.find(d => d.id === column.id);
2627
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2658
2628
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2659
2629
  },
2660
2630
  getSortIndex: () => {
2661
- var _instance$getState$so2, _instance$getState$so3;
2631
+ var _table$getState$sorti2, _table$getState$sorti3;
2662
2632
 
2663
- return (_instance$getState$so2 = (_instance$getState$so3 = instance.getState().sorting) == null ? void 0 : _instance$getState$so3.findIndex(d => d.id === column.id)) != null ? _instance$getState$so2 : -1;
2633
+ return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;
2664
2634
  },
2665
2635
  clearSorting: () => {
2666
2636
  //clear sorting for just 1 column
2667
- instance.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2637
+ table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2668
2638
  },
2669
2639
  getToggleSortingHandler: () => {
2670
2640
  const canSort = column.getCanSort();
2671
2641
  return e => {
2672
2642
  if (!canSort) return;
2673
2643
  e.persist == null ? void 0 : e.persist();
2674
- column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? instance.options.isMultiSortEvent == null ? void 0 : instance.options.isMultiSortEvent(e) : false);
2644
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2675
2645
  };
2676
2646
  }
2677
2647
  };
2678
2648
  },
2679
- createInstance: instance => {
2649
+ createTable: table => {
2680
2650
  return {
2681
- setSorting: updater => instance.options.onSortingChange == null ? void 0 : instance.options.onSortingChange(updater),
2651
+ setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2682
2652
  resetSorting: defaultState => {
2683
- var _instance$initialStat, _instance$initialStat2;
2653
+ var _table$initialState$s, _table$initialState;
2684
2654
 
2685
- instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2655
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2686
2656
  },
2687
- getPreSortedRowModel: () => instance.getGroupedRowModel(),
2657
+ getPreSortedRowModel: () => table.getGroupedRowModel(),
2688
2658
  getSortedRowModel: () => {
2689
- if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2690
- instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
2659
+ if (!table._getSortedRowModel && table.options.getSortedRowModel) {
2660
+ table._getSortedRowModel = table.options.getSortedRowModel(table);
2691
2661
  }
2692
2662
 
2693
- if (instance.options.manualSorting || !instance._getSortedRowModel) {
2694
- return instance.getPreSortedRowModel();
2663
+ if (table.options.manualSorting || !table._getSortedRowModel) {
2664
+ return table.getPreSortedRowModel();
2695
2665
  }
2696
2666
 
2697
- return instance._getSortedRowModel();
2667
+ return table._getSortedRowModel();
2698
2668
  }
2699
2669
  };
2700
2670
  }
@@ -2708,29 +2678,29 @@ const Visibility = {
2708
2678
  ...state
2709
2679
  };
2710
2680
  },
2711
- getDefaultOptions: instance => {
2681
+ getDefaultOptions: table => {
2712
2682
  return {
2713
- onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2683
+ onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
2714
2684
  };
2715
2685
  },
2716
- createColumn: (column, instance) => {
2686
+ createColumn: (column, table) => {
2717
2687
  return {
2718
2688
  toggleVisibility: value => {
2719
2689
  if (column.getCanHide()) {
2720
- instance.setColumnVisibility(old => ({ ...old,
2690
+ table.setColumnVisibility(old => ({ ...old,
2721
2691
  [column.id]: value != null ? value : !column.getIsVisible()
2722
2692
  }));
2723
2693
  }
2724
2694
  },
2725
2695
  getIsVisible: () => {
2726
- var _instance$getState$co, _instance$getState$co2;
2696
+ var _table$getState$colum, _table$getState$colum2;
2727
2697
 
2728
- return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2698
+ return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2729
2699
  },
2730
2700
  getCanHide: () => {
2731
- var _column$columnDef$ena, _instance$options$ena;
2701
+ var _column$columnDef$ena, _table$options$enable;
2732
2702
 
2733
- return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2703
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
2734
2704
  },
2735
2705
  getToggleVisibilityHandler: () => {
2736
2706
  return e => {
@@ -2739,69 +2709,69 @@ const Visibility = {
2739
2709
  }
2740
2710
  };
2741
2711
  },
2742
- createRow: (row, instance) => {
2712
+ createRow: (row, table) => {
2743
2713
  return {
2744
- _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2714
+ _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
2745
2715
  return cells.filter(cell => cell.column.getIsVisible());
2746
2716
  }, {
2747
2717
  key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
2748
2718
  debug: () => {
2749
- var _instance$options$deb;
2719
+ var _table$options$debugA;
2750
2720
 
2751
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2721
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
2752
2722
  }
2753
2723
  }),
2754
2724
  getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2755
2725
  key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
2756
2726
  debug: () => {
2757
- var _instance$options$deb2;
2727
+ var _table$options$debugA2;
2758
2728
 
2759
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2729
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
2760
2730
  }
2761
2731
  })
2762
2732
  };
2763
2733
  },
2764
- createInstance: instance => {
2734
+ createTable: table => {
2765
2735
  const makeVisibleColumnsMethod = (key, getColumns) => {
2766
2736
  return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2767
2737
  return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2768
2738
  }, {
2769
2739
  key,
2770
2740
  debug: () => {
2771
- var _instance$options$deb3;
2741
+ var _table$options$debugA3;
2772
2742
 
2773
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2743
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2774
2744
  }
2775
2745
  });
2776
2746
  };
2777
2747
 
2778
2748
  return {
2779
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2780
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2781
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2782
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2783
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2784
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2749
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
2750
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
2751
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
2752
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
2753
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2754
+ setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2785
2755
  resetColumnVisibility: defaultState => {
2786
- var _instance$initialStat;
2756
+ var _table$initialState$c;
2787
2757
 
2788
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2758
+ table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
2789
2759
  },
2790
2760
  toggleAllColumnsVisible: value => {
2791
2761
  var _value;
2792
2762
 
2793
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2794
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2763
+ value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2764
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2795
2765
  [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2796
2766
  }), {}));
2797
2767
  },
2798
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2799
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2768
+ getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2769
+ getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2800
2770
  getToggleAllColumnsVisibilityHandler: () => {
2801
2771
  return e => {
2802
2772
  var _target;
2803
2773
 
2804
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2774
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2805
2775
  };
2806
2776
  }
2807
2777
  };
@@ -2810,24 +2780,24 @@ const Visibility = {
2810
2780
 
2811
2781
  const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
2812
2782
 
2813
- function createTableInstance(options) {
2783
+ function createTable(options) {
2814
2784
  var _options$initialState;
2815
2785
 
2816
2786
  if (options.debugAll || options.debugTable) {
2817
2787
  console.info('Creating Table Instance...');
2818
2788
  }
2819
2789
 
2820
- let instance = {
2790
+ let table = {
2821
2791
  _features: features
2822
2792
  };
2823
2793
 
2824
- const defaultOptions = instance._features.reduce((obj, feature) => {
2825
- return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
2794
+ const defaultOptions = table._features.reduce((obj, feature) => {
2795
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2826
2796
  }, {});
2827
2797
 
2828
2798
  const mergeOptions = options => {
2829
- if (instance.options.mergeOptions) {
2830
- return instance.options.mergeOptions(defaultOptions, options);
2799
+ if (table.options.mergeOptions) {
2800
+ return table.options.mergeOptions(defaultOptions, options);
2831
2801
  }
2832
2802
 
2833
2803
  return { ...defaultOptions,
@@ -2840,7 +2810,7 @@ function createTableInstance(options) {
2840
2810
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
2841
2811
  };
2842
2812
 
2843
- instance._features.forEach(feature => {
2813
+ table._features.forEach(feature => {
2844
2814
  var _feature$getInitialSt;
2845
2815
 
2846
2816
  initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
@@ -2873,48 +2843,37 @@ function createTableInstance(options) {
2873
2843
  }
2874
2844
  },
2875
2845
  reset: () => {
2876
- instance.setState(instance.initialState);
2846
+ table.setState(table.initialState);
2877
2847
  },
2878
2848
  setOptions: updater => {
2879
- const newOptions = functionalUpdate(updater, instance.options);
2880
- instance.options = mergeOptions(newOptions);
2881
- },
2882
- _render: (template, props) => {
2883
- if (typeof instance.options.render === 'function') {
2884
- return instance.options.render(template, props);
2885
- }
2886
-
2887
- if (typeof template === 'function') {
2888
- return template(props);
2889
- }
2890
-
2891
- return template;
2849
+ const newOptions = functionalUpdate(updater, table.options);
2850
+ table.options = mergeOptions(newOptions);
2892
2851
  },
2893
2852
  getState: () => {
2894
- return instance.options.state;
2853
+ return table.options.state;
2895
2854
  },
2896
2855
  setState: updater => {
2897
- instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
2856
+ table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2898
2857
  },
2899
2858
  _getRowId: (row, index, parent) => {
2900
- var _instance$options$get;
2859
+ var _table$options$getRow;
2901
2860
 
2902
- 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);
2861
+ return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : "" + (parent ? [parent.id, index].join('.') : index);
2903
2862
  },
2904
2863
  getCoreRowModel: () => {
2905
- if (!instance._getCoreRowModel) {
2906
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2864
+ if (!table._getCoreRowModel) {
2865
+ table._getCoreRowModel = table.options.getCoreRowModel(table);
2907
2866
  }
2908
2867
 
2909
- return instance._getCoreRowModel();
2868
+ return table._getCoreRowModel();
2910
2869
  },
2911
2870
  // The final calls start at the bottom of the model,
2912
2871
  // expanded rows, which then work their way up
2913
2872
  getRowModel: () => {
2914
- return instance.getPaginationRowModel();
2873
+ return table.getPaginationRowModel();
2915
2874
  },
2916
2875
  getRow: id => {
2917
- const row = instance.getRowModel().rowsById[id];
2876
+ const row = table.getRowModel().rowsById[id];
2918
2877
 
2919
2878
  if (!row) {
2920
2879
  if (process.env.NODE_ENV !== 'production') {
@@ -2926,7 +2885,7 @@ function createTableInstance(options) {
2926
2885
 
2927
2886
  return row;
2928
2887
  },
2929
- _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2888
+ _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
2930
2889
  var _defaultColumn;
2931
2890
 
2932
2891
  defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
@@ -2934,32 +2893,32 @@ function createTableInstance(options) {
2934
2893
  header: props => props.header.column.id,
2935
2894
  footer: props => props.header.column.id,
2936
2895
  cell: props => {
2937
- var _props$getValue$toStr, _props$getValue;
2896
+ var _toString, _props$renderValue;
2938
2897
 
2939
- return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
2898
+ return (_toString = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _toString : null;
2940
2899
  },
2941
- ...instance._features.reduce((obj, feature) => {
2900
+ ...table._features.reduce((obj, feature) => {
2942
2901
  return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2943
2902
  }, {}),
2944
2903
  ...defaultColumn
2945
2904
  };
2946
2905
  }, {
2947
2906
  debug: () => {
2948
- var _instance$options$deb;
2907
+ var _table$options$debugA;
2949
2908
 
2950
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2909
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
2951
2910
  },
2952
2911
  key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
2953
2912
  }),
2954
- _getColumnDefs: () => instance.options.columns,
2955
- getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2913
+ _getColumnDefs: () => table.options.columns,
2914
+ getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
2956
2915
  const recurseColumns = function (columnDefs, parent, depth) {
2957
2916
  if (depth === void 0) {
2958
2917
  depth = 0;
2959
2918
  }
2960
2919
 
2961
2920
  return columnDefs.map(columnDef => {
2962
- const column = createColumn(instance, columnDef, depth, parent);
2921
+ const column = createColumn(table, columnDef, depth, parent);
2963
2922
  column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2964
2923
  return column;
2965
2924
  });
@@ -2969,24 +2928,24 @@ function createTableInstance(options) {
2969
2928
  }, {
2970
2929
  key: process.env.NODE_ENV === 'development' && 'getAllColumns',
2971
2930
  debug: () => {
2972
- var _instance$options$deb2;
2931
+ var _table$options$debugA2;
2973
2932
 
2974
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2933
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
2975
2934
  }
2976
2935
  }),
2977
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2936
+ getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
2978
2937
  return allColumns.flatMap(column => {
2979
2938
  return column.getFlatColumns();
2980
2939
  });
2981
2940
  }, {
2982
2941
  key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
2983
2942
  debug: () => {
2984
- var _instance$options$deb3;
2943
+ var _table$options$debugA3;
2985
2944
 
2986
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2945
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2987
2946
  }
2988
2947
  }),
2989
- _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2948
+ _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
2990
2949
  return flatColumns.reduce((acc, column) => {
2991
2950
  acc[column.id] = column;
2992
2951
  return acc;
@@ -2994,24 +2953,24 @@ function createTableInstance(options) {
2994
2953
  }, {
2995
2954
  key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
2996
2955
  debug: () => {
2997
- var _instance$options$deb4;
2956
+ var _table$options$debugA4;
2998
2957
 
2999
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2958
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
3000
2959
  }
3001
2960
  }),
3002
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2961
+ getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
3003
2962
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
3004
2963
  return orderColumns(leafColumns);
3005
2964
  }, {
3006
2965
  key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
3007
2966
  debug: () => {
3008
- var _instance$options$deb5;
2967
+ var _table$options$debugA5;
3009
2968
 
3010
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2969
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
3011
2970
  }
3012
2971
  }),
3013
2972
  getColumn: columnId => {
3014
- const column = instance._getAllFlatColumnsById()[columnId];
2973
+ const column = table._getAllFlatColumnsById()[columnId];
3015
2974
 
3016
2975
  if (!column) {
3017
2976
  if (process.env.NODE_ENV !== 'production') {
@@ -3024,76 +2983,20 @@ function createTableInstance(options) {
3024
2983
  return column;
3025
2984
  }
3026
2985
  };
3027
- Object.assign(instance, coreInstance);
2986
+ Object.assign(table, coreInstance);
3028
2987
 
3029
- instance._features.forEach(feature => {
3030
- return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
2988
+ table._features.forEach(feature => {
2989
+ return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
3031
2990
  });
3032
2991
 
3033
- return instance;
3034
- }
3035
-
3036
- //
3037
- function createTableFactory(opts) {
3038
- return () => createTable(undefined, undefined, opts);
3039
- } // A lot of returns in here are `as any` for a reason. Unless you
3040
- // can find a better way to do this, then don't worry about them
3041
-
3042
- function createTable(_, __, options) {
3043
- const table = {
3044
- generics: undefined,
3045
- options: options != null ? options : {
3046
- render: (() => {
3047
- throw new Error('');
3048
- })()
3049
- },
3050
- // setGenerics: () => table as any,
3051
- setRowType: () => table,
3052
- setTableMetaType: () => table,
3053
- setColumnMetaType: () => table,
3054
- setFilterMetaType: () => table,
3055
- setOptions: newOptions => createTable(_, __, { ...options,
3056
- ...newOptions
3057
- }),
3058
- createDisplayColumn: column => ({ ...column,
3059
- columnDefType: 'display'
3060
- }),
3061
- createGroup: column => ({ ...column,
3062
- columnDefType: 'group'
3063
- }),
3064
- createDataColumn: (accessor, column) => {
3065
- column = { ...column,
3066
- columnDefType: 'data',
3067
- id: column.id
3068
- };
3069
-
3070
- if (typeof accessor === 'string') {
3071
- var _column$id;
3072
-
3073
- return { ...column,
3074
- id: (_column$id = column.id) != null ? _column$id : accessor,
3075
- accessorKey: accessor
3076
- };
3077
- }
3078
-
3079
- if (typeof accessor === 'function') {
3080
- return { ...column,
3081
- accessorFn: accessor
3082
- };
3083
- }
3084
-
3085
- throw new Error('Invalid accessor');
3086
- },
3087
- createOptions: options => options
3088
- };
3089
2992
  return table;
3090
2993
  }
3091
2994
 
3092
- function createCell(instance, row, column, columnId) {
2995
+ function createCell(table, row, column, columnId) {
3093
2996
  const getRenderValue = () => {
3094
2997
  var _cell$getValue;
3095
2998
 
3096
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
2999
+ return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
3097
3000
  };
3098
3001
 
3099
3002
  const cell = {
@@ -3101,25 +3004,25 @@ function createCell(instance, row, column, columnId) {
3101
3004
  row,
3102
3005
  column,
3103
3006
  getValue: () => row.getValue(columnId),
3104
- renderCell: () => {
3105
- return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3106
- instance,
3107
- column,
3108
- row,
3109
- cell: cell,
3110
- getValue: getRenderValue
3111
- }) : null;
3112
- }
3007
+ renderValue: getRenderValue,
3008
+ getContext: () => ({
3009
+ table,
3010
+ column,
3011
+ row,
3012
+ cell: cell,
3013
+ getValue: cell.getValue,
3014
+ renderValue: cell.renderValue
3015
+ })
3113
3016
  };
3114
3017
 
3115
- instance._features.forEach(feature => {
3116
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
3018
+ table._features.forEach(feature => {
3019
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
3117
3020
  }, {});
3118
3021
 
3119
3022
  return cell;
3120
3023
  }
3121
3024
 
3122
- const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3025
+ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3123
3026
  let row = {
3124
3027
  id,
3125
3028
  index: rowIndex,
@@ -3131,7 +3034,7 @@ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3131
3034
  return row._valuesCache[columnId];
3132
3035
  }
3133
3036
 
3134
- const column = instance.getColumn(columnId);
3037
+ const column = table.getColumn(columnId);
3135
3038
 
3136
3039
  if (!column.accessorFn) {
3137
3040
  return undefined;
@@ -3140,18 +3043,23 @@ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3140
3043
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3141
3044
  return row._valuesCache[columnId];
3142
3045
  },
3046
+ renderValue: columnId => {
3047
+ var _row$getValue;
3048
+
3049
+ return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
3050
+ },
3143
3051
  subRows: subRows != null ? subRows : [],
3144
3052
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3145
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3053
+ getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
3146
3054
  return leafColumns.map(column => {
3147
- return createCell(instance, row, column, column.id);
3055
+ return createCell(table, row, column, column.id);
3148
3056
  });
3149
3057
  }, {
3150
3058
  key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
3151
3059
  debug: () => {
3152
- var _instance$options$deb;
3060
+ var _table$options$debugA;
3153
3061
 
3154
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3062
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
3155
3063
  }
3156
3064
  }),
3157
3065
  _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
@@ -3162,23 +3070,23 @@ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3162
3070
  }, {
3163
3071
  key: process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
3164
3072
  debug: () => {
3165
- var _instance$options$deb2;
3073
+ var _table$options$debugA2;
3166
3074
 
3167
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3075
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
3168
3076
  }
3169
3077
  })
3170
3078
  };
3171
3079
 
3172
- for (let i = 0; i < instance._features.length; i++) {
3173
- const feature = instance._features[i];
3174
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3080
+ for (let i = 0; i < table._features.length; i++) {
3081
+ const feature = table._features[i];
3082
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
3175
3083
  }
3176
3084
 
3177
3085
  return row;
3178
3086
  };
3179
3087
 
3180
3088
  function getCoreRowModel() {
3181
- return instance => memo(() => [instance.options.data], data => {
3089
+ return table => memo(() => [table.options.data], data => {
3182
3090
  const rowModel = {
3183
3091
  rows: [],
3184
3092
  flatRows: [],
@@ -3200,18 +3108,18 @@ function getCoreRowModel() {
3200
3108
  // }
3201
3109
  // }
3202
3110
  // Make the row
3203
- const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3111
+ const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3204
3112
 
3205
3113
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3206
3114
 
3207
- rowModel.rowsById[row.id] = row; // Push instance row into parent
3115
+ rowModel.rowsById[row.id] = row; // Push table row into parent
3208
3116
 
3209
3117
  rows.push(row); // Get the original subrows
3210
3118
 
3211
- if (instance.options.getSubRows) {
3119
+ if (table.options.getSubRows) {
3212
3120
  var _row$originalSubRows;
3213
3121
 
3214
- row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3122
+ row.originalSubRows = table.options.getSubRows(originalRows[i], i); // Then recursively access them
3215
3123
 
3216
3124
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3217
3125
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
@@ -3227,24 +3135,24 @@ function getCoreRowModel() {
3227
3135
  }, {
3228
3136
  key: process.env.NODE_ENV === 'development' && 'getRowModel',
3229
3137
  debug: () => {
3230
- var _instance$options$deb;
3138
+ var _table$options$debugA;
3231
3139
 
3232
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3140
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3233
3141
  },
3234
3142
  onChange: () => {
3235
- instance._autoResetPageIndex();
3143
+ table._autoResetPageIndex();
3236
3144
  }
3237
3145
  });
3238
3146
  }
3239
3147
 
3240
- function filterRows(rows, filterRowImpl, instance) {
3241
- if (instance.options.filterFromLeafRows) {
3242
- return filterRowModelFromLeafs(rows, filterRowImpl, instance);
3148
+ function filterRows(rows, filterRowImpl, table) {
3149
+ if (table.options.filterFromLeafRows) {
3150
+ return filterRowModelFromLeafs(rows, filterRowImpl, table);
3243
3151
  }
3244
3152
 
3245
- return filterRowModelFromRoot(rows, filterRowImpl, instance);
3153
+ return filterRowModelFromRoot(rows, filterRowImpl, table);
3246
3154
  }
3247
- function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3155
+ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3248
3156
  const newFilteredFlatRows = [];
3249
3157
  const newFilteredRowsById = {};
3250
3158
 
@@ -3258,7 +3166,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3258
3166
  let row = rowsToFilter[i];
3259
3167
 
3260
3168
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3261
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3169
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3262
3170
  newRow.columnFilters = row.columnFilters;
3263
3171
  newRow.subRows = recurseFilterRows(row.subRows);
3264
3172
 
@@ -3285,7 +3193,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3285
3193
  rowsById: newFilteredRowsById
3286
3194
  };
3287
3195
  }
3288
- function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3196
+ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3289
3197
  const newFilteredFlatRows = [];
3290
3198
  const newFilteredRowsById = {}; // Filters top level and nested rows
3291
3199
 
@@ -3302,7 +3210,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3302
3210
  var _row$subRows2;
3303
3211
 
3304
3212
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3305
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3213
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3306
3214
  newRow.subRows = recurseFilterRows(row.subRows);
3307
3215
  row = newRow;
3308
3216
  }
@@ -3324,7 +3232,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3324
3232
  }
3325
3233
 
3326
3234
  function getFilteredRowModel() {
3327
- return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3235
+ return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3328
3236
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3329
3237
  for (let i = 0; i < rowModel.flatRows.length; i++) {
3330
3238
  rowModel.flatRows[i].columnFilters = {};
@@ -3339,7 +3247,7 @@ function getFilteredRowModel() {
3339
3247
  (columnFilters != null ? columnFilters : []).forEach(d => {
3340
3248
  var _filterFn$resolveFilt;
3341
3249
 
3342
- const column = instance.getColumn(d.id);
3250
+ const column = table.getColumn(d.id);
3343
3251
 
3344
3252
  if (!column) {
3345
3253
  if (process.env.NODE_ENV !== 'production') {
@@ -3364,8 +3272,8 @@ function getFilteredRowModel() {
3364
3272
  });
3365
3273
  });
3366
3274
  const filterableIds = columnFilters.map(d => d.id);
3367
- const globalFilterFn = instance.getGlobalFilterFn();
3368
- const globallyFilterableColumns = instance.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3275
+ const globalFilterFn = table.getGlobalFilterFn();
3276
+ const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3369
3277
 
3370
3278
  if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
3371
3279
  filterableIds.push('__global__');
@@ -3429,22 +3337,22 @@ function getFilteredRowModel() {
3429
3337
  }; // Filter final rows using all of the active filters
3430
3338
 
3431
3339
 
3432
- return filterRows(rowModel.rows, filterRowsImpl, instance);
3340
+ return filterRows(rowModel.rows, filterRowsImpl, table);
3433
3341
  }, {
3434
3342
  key: process.env.NODE_ENV === 'development' && 'getFilteredRowModel',
3435
3343
  debug: () => {
3436
- var _instance$options$deb;
3344
+ var _table$options$debugA;
3437
3345
 
3438
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3346
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3439
3347
  },
3440
3348
  onChange: () => {
3441
- instance._autoResetPageIndex();
3349
+ table._autoResetPageIndex();
3442
3350
  }
3443
3351
  });
3444
3352
  }
3445
3353
 
3446
3354
  function getFacetedRowModel() {
3447
- return (instance, columnId) => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter, instance.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3355
+ return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3448
3356
  if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3449
3357
  return preRowModel;
3450
3358
  }
@@ -3462,20 +3370,20 @@ function getFacetedRowModel() {
3462
3370
  return true;
3463
3371
  };
3464
3372
 
3465
- return filterRows(preRowModel.rows, filterRowsImpl, instance);
3373
+ return filterRows(preRowModel.rows, filterRowsImpl, table);
3466
3374
  }, {
3467
3375
  key: process.env.NODE_ENV === 'development' && 'getFacetedRowModel_' + columnId,
3468
3376
  debug: () => {
3469
- var _instance$options$deb;
3377
+ var _table$options$debugA;
3470
3378
 
3471
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3379
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3472
3380
  },
3473
3381
  onChange: () => {}
3474
3382
  });
3475
3383
  }
3476
3384
 
3477
3385
  function getFacetedUniqueValues() {
3478
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3386
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3479
3387
  let facetedUniqueValues = new Map();
3480
3388
 
3481
3389
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
@@ -3496,16 +3404,16 @@ function getFacetedUniqueValues() {
3496
3404
  }, {
3497
3405
  key: process.env.NODE_ENV === 'development' && 'getFacetedUniqueValues_' + columnId,
3498
3406
  debug: () => {
3499
- var _instance$options$deb;
3407
+ var _table$options$debugA;
3500
3408
 
3501
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3409
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3502
3410
  },
3503
3411
  onChange: () => {}
3504
3412
  });
3505
3413
  }
3506
3414
 
3507
3415
  function getFacetedMinMaxValues() {
3508
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3416
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3509
3417
  var _facetedRowModel$flat;
3510
3418
 
3511
3419
  const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
@@ -3532,27 +3440,27 @@ function getFacetedMinMaxValues() {
3532
3440
  }, {
3533
3441
  key: process.env.NODE_ENV === 'development' && 'getFacetedMinMaxValues_' + columnId,
3534
3442
  debug: () => {
3535
- var _instance$options$deb;
3443
+ var _table$options$debugA;
3536
3444
 
3537
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3445
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3538
3446
  },
3539
3447
  onChange: () => {}
3540
3448
  });
3541
3449
  }
3542
3450
 
3543
3451
  function getSortedRowModel() {
3544
- return instance => memo(() => [instance.getState().sorting, instance.getPreSortedRowModel()], (sorting, rowModel) => {
3452
+ return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
3545
3453
  if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3546
3454
  return rowModel;
3547
3455
  }
3548
3456
 
3549
- const sortingState = instance.getState().sorting;
3457
+ const sortingState = table.getState().sorting;
3550
3458
  const sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
3551
3459
 
3552
- const availableSorting = sortingState.filter(sort => instance.getColumn(sort.id).getCanSort());
3460
+ const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3553
3461
  const columnInfoById = {};
3554
3462
  availableSorting.forEach(sortEntry => {
3555
- const column = instance.getColumn(sortEntry.id);
3463
+ const column = table.getColumn(sortEntry.id);
3556
3464
  columnInfoById[sortEntry.id] = {
3557
3465
  sortUndefined: column.columnDef.sortUndefined,
3558
3466
  invertSorting: column.columnDef.invertSorting,
@@ -3622,24 +3530,24 @@ function getSortedRowModel() {
3622
3530
  }, {
3623
3531
  key: process.env.NODE_ENV === 'development' && 'getSortedRowModel',
3624
3532
  debug: () => {
3625
- var _instance$options$deb;
3533
+ var _table$options$debugA;
3626
3534
 
3627
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3535
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3628
3536
  },
3629
3537
  onChange: () => {
3630
- instance._autoResetPageIndex();
3538
+ table._autoResetPageIndex();
3631
3539
  }
3632
3540
  });
3633
3541
  }
3634
3542
 
3635
3543
  function getGroupedRowModel() {
3636
- return instance => memo(() => [instance.getState().grouping, instance.getPreGroupedRowModel()], (grouping, rowModel) => {
3544
+ return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
3637
3545
  if (!rowModel.rows.length || !grouping.length) {
3638
3546
  return rowModel;
3639
3547
  } // Filter the grouping list down to columns that exist
3640
3548
 
3641
3549
 
3642
- const existingGrouping = grouping.filter(columnId => instance.getColumn(columnId));
3550
+ const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
3643
3551
  const groupedFlatRows = [];
3644
3552
  const groupedRowsById = {}; // const onlyGroupedFlatRows: Row[] = [];
3645
3553
  // const onlyGroupedRowsById: Record<RowId, Row> = {};
@@ -3669,7 +3577,7 @@ function getGroupedRowModel() {
3669
3577
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3670
3578
 
3671
3579
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3672
- const row = createRow(instance, id, undefined, index, depth);
3580
+ const row = createRow(table, id, undefined, index, depth);
3673
3581
  Object.assign(row, {
3674
3582
  groupingColumnId: columnId,
3675
3583
  groupingValue,
@@ -3696,7 +3604,7 @@ function getGroupedRowModel() {
3696
3604
  } // Aggregate the values
3697
3605
 
3698
3606
 
3699
- const column = instance.getColumn(columnId);
3607
+ const column = table.getColumn(columnId);
3700
3608
  const aggregateFn = column.getAggregationFn();
3701
3609
 
3702
3610
  if (aggregateFn) {
@@ -3739,15 +3647,15 @@ function getGroupedRowModel() {
3739
3647
  }, {
3740
3648
  key: process.env.NODE_ENV === 'development' && 'getGroupedRowModel',
3741
3649
  debug: () => {
3742
- var _instance$options$deb;
3650
+ var _table$options$debugA;
3743
3651
 
3744
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3652
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3745
3653
  },
3746
3654
  onChange: () => {
3747
- instance._queue(() => {
3748
- instance._autoResetExpanded();
3655
+ table._queue(() => {
3656
+ table._autoResetExpanded();
3749
3657
 
3750
- instance._autoResetPageIndex();
3658
+ table._autoResetPageIndex();
3751
3659
  });
3752
3660
  }
3753
3661
  });
@@ -3770,7 +3678,7 @@ function groupBy(rows, columnId) {
3770
3678
  }
3771
3679
 
3772
3680
  function getExpandedRowModel() {
3773
- return instance => memo(() => [instance.getState().expanded, instance.getPreExpandedRowModel(), instance.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3681
+ return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3774
3682
  if (!rowModel.rows.length || // Do not expand if rows are not included in pagination
3775
3683
  !paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3776
3684
  return rowModel;
@@ -3780,13 +3688,13 @@ function getExpandedRowModel() {
3780
3688
  }, {
3781
3689
  key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',
3782
3690
  debug: () => {
3783
- var _instance$options$deb;
3691
+ var _table$options$debugA;
3784
3692
 
3785
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3693
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3786
3694
  }
3787
3695
  });
3788
3696
  }
3789
- function expandRows(rowModel, instance) {
3697
+ function expandRows(rowModel, table) {
3790
3698
  const expandedRows = [];
3791
3699
 
3792
3700
  const handleRow = row => {
@@ -3808,7 +3716,7 @@ function expandRows(rowModel, instance) {
3808
3716
  }
3809
3717
 
3810
3718
  function getPaginationRowModel(opts) {
3811
- return instance => memo(() => [instance.getState().pagination, instance.getPrePaginationRowModel()], (pagination, rowModel) => {
3719
+ return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
3812
3720
  if (!rowModel.rows.length) {
3813
3721
  return rowModel;
3814
3722
  }
@@ -3827,7 +3735,7 @@ function getPaginationRowModel(opts) {
3827
3735
  rows = rows.slice(pageStart, pageEnd);
3828
3736
  let paginatedRowModel;
3829
3737
 
3830
- if (!instance.options.paginateExpandedRows) {
3738
+ if (!table.options.paginateExpandedRows) {
3831
3739
  paginatedRowModel = expandRows({
3832
3740
  rows,
3833
3741
  flatRows,
@@ -3856,9 +3764,9 @@ function getPaginationRowModel(opts) {
3856
3764
  }, {
3857
3765
  key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',
3858
3766
  debug: () => {
3859
- var _instance$options$deb;
3767
+ var _table$options$debugA;
3860
3768
 
3861
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3769
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3862
3770
  }
3863
3771
  });
3864
3772
  }
@@ -3878,8 +3786,7 @@ exports.aggregationFns = aggregationFns;
3878
3786
  exports.buildHeaderGroups = buildHeaderGroups;
3879
3787
  exports.createColumn = createColumn;
3880
3788
  exports.createRow = createRow;
3881
- exports.createTableFactory = createTableFactory;
3882
- exports.createTableInstance = createTableInstance;
3789
+ exports.createTable = createTable;
3883
3790
  exports.defaultColumnSizing = defaultColumnSizing;
3884
3791
  exports.expandRows = expandRows;
3885
3792
  exports.filterFns = filterFns;
@@ -3896,6 +3803,7 @@ exports.getPaginationRowModel = getPaginationRowModel;
3896
3803
  exports.getSortedRowModel = getSortedRowModel;
3897
3804
  exports.isFunction = isFunction;
3898
3805
  exports.isRowSelected = isRowSelected;
3806
+ exports.isSubRowSelected = isSubRowSelected;
3899
3807
  exports.makeStateUpdater = makeStateUpdater;
3900
3808
  exports.memo = memo;
3901
3809
  exports.noop = noop;