@tanstack/react-table 8.0.11 → 8.0.14

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.
@@ -49,9 +49,9 @@
49
49
  }
50
50
  function noop() {//
51
51
  }
52
- function makeStateUpdater(key, instance) {
52
+ function makeStateUpdater(key, table) {
53
53
  return updater => {
54
- instance.setState(old => {
54
+ table.setState(old => {
55
55
  return { ...old,
56
56
  [key]: functionalUpdate(updater, old[key])
57
57
  };
@@ -121,36 +121,35 @@
121
121
  };
122
122
  }
123
123
 
124
- function createColumn(instance, columnDef, depth, parent) {
125
- var _ref, _columnDef$id;
124
+ function createColumn(table, columnDef, depth, parent) {
125
+ var _ref, _resolvedColumnDef$id;
126
126
 
127
- const defaultColumn = instance._getDefaultColumnDef();
127
+ const defaultColumn = table._getDefaultColumnDef();
128
128
 
129
- columnDef = { ...defaultColumn,
129
+ const resolvedColumnDef = { ...defaultColumn,
130
130
  ...columnDef
131
131
  };
132
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
132
+ let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : resolvedColumnDef.accessorKey) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
133
133
  let accessorFn;
134
134
 
135
- if (columnDef.accessorFn) {
136
- accessorFn = columnDef.accessorFn;
137
- } else if (columnDef.accessorKey) {
138
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
135
+ if (resolvedColumnDef.accessorFn) {
136
+ accessorFn = resolvedColumnDef.accessorFn;
137
+ } else if (resolvedColumnDef.accessorKey) {
138
+ accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
139
139
  }
140
140
 
141
141
  if (!id) {
142
142
  {
143
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
143
+ throw new Error(resolvedColumnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
144
144
  }
145
145
  }
146
146
 
147
147
  let column = {
148
- id: "" + id,
148
+ id: "" + String(id),
149
149
  accessorFn,
150
150
  parent: parent,
151
151
  depth,
152
- columnDef,
153
- columnDefType: columnDef.columnDefType,
152
+ columnDef: resolvedColumnDef,
154
153
  columns: [],
155
154
  getFlatColumns: memo(() => [true], () => {
156
155
  var _column$columns;
@@ -159,12 +158,12 @@
159
158
  }, {
160
159
  key: "development" === 'production' ,
161
160
  debug: () => {
162
- var _instance$options$deb;
161
+ var _table$options$debugA;
163
162
 
164
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
163
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
165
164
  }
166
165
  }),
167
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
166
+ getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
168
167
  var _column$columns2;
169
168
 
170
169
  if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
@@ -176,21 +175,21 @@
176
175
  }, {
177
176
  key: "development" === 'production' ,
178
177
  debug: () => {
179
- var _instance$options$deb2;
178
+ var _table$options$debugA2;
180
179
 
181
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
180
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
182
181
  }
183
182
  })
184
183
  };
185
- column = instance._features.reduce((obj, feature) => {
186
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
187
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
184
+ column = table._features.reduce((obj, feature) => {
185
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
186
+ }, column); // Yes, we have to convert table to uknown, because we know more than the compiler here.
188
187
 
189
188
  return column;
190
189
  }
191
190
 
192
191
  //
193
- function createHeader(instance, column, options) {
192
+ function createHeader(table, column, options) {
194
193
  var _options$id;
195
194
 
196
195
  const id = (_options$id = options.id) != null ? _options$id : column.id;
@@ -219,174 +218,169 @@
219
218
  recurseHeader(header);
220
219
  return leafHeaders;
221
220
  },
222
- renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
223
- instance,
221
+ getContext: () => ({
222
+ table,
224
223
  header: header,
225
224
  column
226
- }) : null,
227
- renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
228
- instance,
229
- header: header,
230
- column
231
- }) : null
225
+ })
232
226
  };
233
227
 
234
- instance._features.forEach(feature => {
235
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
228
+ table._features.forEach(feature => {
229
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
236
230
  });
237
231
 
238
232
  return header;
239
233
  }
240
234
 
241
235
  const Headers = {
242
- createInstance: instance => {
236
+ createTable: table => {
243
237
  return {
244
238
  // Header Groups
245
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
239
+ getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
246
240
  var _left$map$filter, _right$map$filter;
247
241
 
248
242
  const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
249
243
  const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
250
244
  const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
251
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
245
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
252
246
  return headerGroups;
253
247
  }, {
254
248
  key: 'getHeaderGroups',
255
249
  debug: () => {
256
- var _instance$options$deb;
250
+ var _table$options$debugA;
257
251
 
258
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
252
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
259
253
  }
260
254
  }),
261
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
255
+ getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
262
256
  leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
263
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
257
+ return buildHeaderGroups(allColumns, leafColumns, table, 'center');
264
258
  }, {
265
259
  key: 'getCenterHeaderGroups',
266
260
  debug: () => {
267
- var _instance$options$deb2;
261
+ var _table$options$debugA2;
268
262
 
269
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
263
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
270
264
  }
271
265
  }),
272
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
266
+ getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
273
267
  var _left$map$filter2;
274
268
 
275
269
  const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
276
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
270
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
277
271
  }, {
278
272
  key: 'getLeftHeaderGroups',
279
273
  debug: () => {
280
- var _instance$options$deb3;
274
+ var _table$options$debugA3;
281
275
 
282
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
276
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
283
277
  }
284
278
  }),
285
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
279
+ getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
286
280
  var _right$map$filter2;
287
281
 
288
282
  const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
289
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
283
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
290
284
  }, {
291
285
  key: 'getRightHeaderGroups',
292
286
  debug: () => {
293
- var _instance$options$deb4;
287
+ var _table$options$debugA4;
294
288
 
295
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
289
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
296
290
  }
297
291
  }),
298
292
  // Footer Groups
299
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
293
+ getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
300
294
  return [...headerGroups].reverse();
301
295
  }, {
302
296
  key: 'getFooterGroups',
303
297
  debug: () => {
304
- var _instance$options$deb5;
298
+ var _table$options$debugA5;
305
299
 
306
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
300
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
307
301
  }
308
302
  }),
309
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
303
+ getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
310
304
  return [...headerGroups].reverse();
311
305
  }, {
312
306
  key: 'getLeftFooterGroups',
313
307
  debug: () => {
314
- var _instance$options$deb6;
308
+ var _table$options$debugA6;
315
309
 
316
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
310
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
317
311
  }
318
312
  }),
319
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
313
+ getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
320
314
  return [...headerGroups].reverse();
321
315
  }, {
322
316
  key: 'getCenterFooterGroups',
323
317
  debug: () => {
324
- var _instance$options$deb7;
318
+ var _table$options$debugA7;
325
319
 
326
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
320
+ return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
327
321
  }
328
322
  }),
329
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
323
+ getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
330
324
  return [...headerGroups].reverse();
331
325
  }, {
332
326
  key: 'getRightFooterGroups',
333
327
  debug: () => {
334
- var _instance$options$deb8;
328
+ var _table$options$debugA8;
335
329
 
336
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
330
+ return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
337
331
  }
338
332
  }),
339
333
  // Flat Headers
340
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
334
+ getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
341
335
  return headerGroups.map(headerGroup => {
342
336
  return headerGroup.headers;
343
337
  }).flat();
344
338
  }, {
345
339
  key: 'getFlatHeaders',
346
340
  debug: () => {
347
- var _instance$options$deb9;
341
+ var _table$options$debugA9;
348
342
 
349
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
343
+ return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
350
344
  }
351
345
  }),
352
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
346
+ getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
353
347
  return left.map(headerGroup => {
354
348
  return headerGroup.headers;
355
349
  }).flat();
356
350
  }, {
357
351
  key: 'getLeftFlatHeaders',
358
352
  debug: () => {
359
- var _instance$options$deb10;
353
+ var _table$options$debugA10;
360
354
 
361
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
355
+ return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
362
356
  }
363
357
  }),
364
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
358
+ getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
365
359
  return left.map(headerGroup => {
366
360
  return headerGroup.headers;
367
361
  }).flat();
368
362
  }, {
369
363
  key: 'getCenterFlatHeaders',
370
364
  debug: () => {
371
- var _instance$options$deb11;
365
+ var _table$options$debugA11;
372
366
 
373
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
367
+ return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
374
368
  }
375
369
  }),
376
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
370
+ getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
377
371
  return left.map(headerGroup => {
378
372
  return headerGroup.headers;
379
373
  }).flat();
380
374
  }, {
381
375
  key: 'getRightFlatHeaders',
382
376
  debug: () => {
383
- var _instance$options$deb12;
377
+ var _table$options$debugA12;
384
378
 
385
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
379
+ return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
386
380
  }
387
381
  }),
388
382
  // Leaf Headers
389
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
383
+ getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
390
384
  return flatHeaders.filter(header => {
391
385
  var _header$subHeaders;
392
386
 
@@ -395,12 +389,12 @@
395
389
  }, {
396
390
  key: 'getCenterLeafHeaders',
397
391
  debug: () => {
398
- var _instance$options$deb13;
392
+ var _table$options$debugA13;
399
393
 
400
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
394
+ return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
401
395
  }
402
396
  }),
403
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
397
+ getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
404
398
  return flatHeaders.filter(header => {
405
399
  var _header$subHeaders2;
406
400
 
@@ -409,12 +403,12 @@
409
403
  }, {
410
404
  key: 'getLeftLeafHeaders',
411
405
  debug: () => {
412
- var _instance$options$deb14;
406
+ var _table$options$debugA14;
413
407
 
414
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
408
+ return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
415
409
  }
416
410
  }),
417
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
411
+ getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
418
412
  return flatHeaders.filter(header => {
419
413
  var _header$subHeaders3;
420
414
 
@@ -423,12 +417,12 @@
423
417
  }, {
424
418
  key: 'getRightLeafHeaders',
425
419
  debug: () => {
426
- var _instance$options$deb15;
420
+ var _table$options$debugA15;
427
421
 
428
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
422
+ return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
429
423
  }
430
424
  }),
431
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
425
+ getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
432
426
  var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
433
427
 
434
428
  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 => {
@@ -437,15 +431,15 @@
437
431
  }, {
438
432
  key: 'getLeafHeaders',
439
433
  debug: () => {
440
- var _instance$options$deb16;
434
+ var _table$options$debugA16;
441
435
 
442
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
436
+ return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
443
437
  }
444
438
  })
445
439
  };
446
440
  }
447
441
  };
448
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
442
+ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
449
443
  var _headerGroups$0$heade, _headerGroups$;
450
444
 
451
445
  // Find the max depth of the columns:
@@ -499,12 +493,12 @@
499
493
  isPlaceholder = true;
500
494
  }
501
495
 
502
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
496
+ if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
503
497
  // This column is repeated. Add it as a sub header to the next batch
504
498
  latestPendingParentHeader.subHeaders.push(headerToGroup);
505
499
  } else {
506
500
  // This is a new header. Let's create it
507
- const header = createHeader(instance, column, {
501
+ const header = createHeader(table, column, {
508
502
  id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
509
503
  isPlaceholder,
510
504
  placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
@@ -528,7 +522,7 @@
528
522
  }
529
523
  };
530
524
 
531
- const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
525
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
532
526
  depth: maxDepth,
533
527
  index
534
528
  }));
@@ -600,23 +594,23 @@
600
594
  ...state
601
595
  };
602
596
  },
603
- getDefaultOptions: instance => {
597
+ getDefaultOptions: table => {
604
598
  return {
605
599
  columnResizeMode: 'onEnd',
606
- onColumnSizingChange: makeStateUpdater('columnSizing', instance),
607
- onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
600
+ onColumnSizingChange: makeStateUpdater('columnSizing', table),
601
+ onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
608
602
  };
609
603
  },
610
- createColumn: (column, instance) => {
604
+ createColumn: (column, table) => {
611
605
  return {
612
606
  getSize: () => {
613
607
  var _column$columnDef$min, _ref, _column$columnDef$max;
614
608
 
615
- const columnSize = instance.getState().columnSizing[column.id];
609
+ const columnSize = table.getState().columnSizing[column.id];
616
610
  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);
617
611
  },
618
612
  getStart: position => {
619
- const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
613
+ const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
620
614
  const index = columns.findIndex(d => d.id === column.id);
621
615
 
622
616
  if (index > 0) {
@@ -627,7 +621,7 @@
627
621
  return 0;
628
622
  },
629
623
  resetSize: () => {
630
- instance.setColumnSizing(_ref2 => {
624
+ table.setColumnSizing(_ref2 => {
631
625
  let {
632
626
  [column.id]: _,
633
627
  ...rest
@@ -636,16 +630,16 @@
636
630
  });
637
631
  },
638
632
  getCanResize: () => {
639
- var _column$columnDef$ena, _instance$options$ena;
633
+ var _column$columnDef$ena, _table$options$enable;
640
634
 
641
- return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
635
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
642
636
  },
643
637
  getIsResizing: () => {
644
- return instance.getState().columnSizingInfo.isResizingColumn === column.id;
638
+ return table.getState().columnSizingInfo.isResizingColumn === column.id;
645
639
  }
646
640
  };
647
641
  },
648
- createHeader: (header, instance) => {
642
+ createHeader: (header, table) => {
649
643
  return {
650
644
  getSize: () => {
651
645
  let sum = 0;
@@ -672,7 +666,7 @@
672
666
  return 0;
673
667
  },
674
668
  getResizeHandler: () => {
675
- const column = instance.getColumn(header.column.id);
669
+ const column = table.getColumn(header.column.id);
676
670
  const canResize = column.getCanResize();
677
671
  return e => {
678
672
  if (!canResize) {
@@ -697,7 +691,7 @@
697
691
  }
698
692
 
699
693
  let newColumnSizing = {};
700
- instance.setColumnSizingInfo(old => {
694
+ table.setColumnSizingInfo(old => {
701
695
  var _old$startOffset, _old$startSize;
702
696
 
703
697
  const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
@@ -712,8 +706,8 @@
712
706
  };
713
707
  });
714
708
 
715
- if (instance.options.columnResizeMode === 'onChange' || eventType === 'end') {
716
- instance.setColumnSizing(old => ({ ...old,
709
+ if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
710
+ table.setColumnSizing(old => ({ ...old,
717
711
  ...newColumnSizing
718
712
  }));
719
713
  }
@@ -723,7 +717,7 @@
723
717
 
724
718
  const onEnd = clientXPos => {
725
719
  updateOffset('end', clientXPos);
726
- instance.setColumnSizingInfo(old => ({ ...old,
720
+ table.setColumnSizingInfo(old => ({ ...old,
727
721
  isResizingColumn: false,
728
722
  startOffset: null,
729
723
  startSize: null,
@@ -750,7 +744,7 @@
750
744
  document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
751
745
  }
752
746
 
753
- instance.setColumnSizingInfo(old => ({ ...old,
747
+ table.setColumnSizingInfo(old => ({ ...old,
754
748
  startOffset: clientX,
755
749
  startSize,
756
750
  deltaOffset: 0,
@@ -762,47 +756,47 @@
762
756
  }
763
757
  };
764
758
  },
765
- createInstance: instance => {
759
+ createTable: table => {
766
760
  return {
767
- setColumnSizing: updater => instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater),
768
- setColumnSizingInfo: updater => instance.options.onColumnSizingInfoChange == null ? void 0 : instance.options.onColumnSizingInfoChange(updater),
761
+ setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
762
+ setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
769
763
  resetColumnSizing: defaultState => {
770
- var _instance$initialStat;
764
+ var _table$initialState$c;
771
765
 
772
- instance.setColumnSizing(defaultState ? {} : (_instance$initialStat = instance.initialState.columnSizing) != null ? _instance$initialStat : {});
766
+ table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
773
767
  },
774
768
  resetHeaderSizeInfo: defaultState => {
775
- var _instance$initialStat2;
769
+ var _table$initialState$c2;
776
770
 
777
- instance.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_instance$initialStat2 = instance.initialState.columnSizingInfo) != null ? _instance$initialStat2 : getDefaultColumnSizingInfoState());
771
+ table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
778
772
  },
779
773
  getTotalSize: () => {
780
- var _instance$getHeaderGr, _instance$getHeaderGr2;
774
+ var _table$getHeaderGroup, _table$getHeaderGroup2;
781
775
 
782
- return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
776
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
783
777
  return sum + header.getSize();
784
- }, 0)) != null ? _instance$getHeaderGr : 0;
778
+ }, 0)) != null ? _table$getHeaderGroup : 0;
785
779
  },
786
780
  getLeftTotalSize: () => {
787
- var _instance$getLeftHead, _instance$getLeftHead2;
781
+ var _table$getLeftHeaderG, _table$getLeftHeaderG2;
788
782
 
789
- return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
783
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
790
784
  return sum + header.getSize();
791
- }, 0)) != null ? _instance$getLeftHead : 0;
785
+ }, 0)) != null ? _table$getLeftHeaderG : 0;
792
786
  },
793
787
  getCenterTotalSize: () => {
794
- var _instance$getCenterHe, _instance$getCenterHe2;
788
+ var _table$getCenterHeade, _table$getCenterHeade2;
795
789
 
796
- return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
790
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
797
791
  return sum + header.getSize();
798
- }, 0)) != null ? _instance$getCenterHe : 0;
792
+ }, 0)) != null ? _table$getCenterHeade : 0;
799
793
  },
800
794
  getRightTotalSize: () => {
801
- var _instance$getRightHea, _instance$getRightHea2;
795
+ var _table$getRightHeader, _table$getRightHeader2;
802
796
 
803
- return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
797
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
804
798
  return sum + header.getSize();
805
- }, 0)) != null ? _instance$getRightHea : 0;
799
+ }, 0)) != null ? _table$getRightHeader : 0;
806
800
  }
807
801
  };
808
802
  }
@@ -845,65 +839,65 @@
845
839
  ...state
846
840
  };
847
841
  },
848
- getDefaultOptions: instance => {
842
+ getDefaultOptions: table => {
849
843
  return {
850
- onExpandedChange: makeStateUpdater('expanded', instance),
844
+ onExpandedChange: makeStateUpdater('expanded', table),
851
845
  paginateExpandedRows: true
852
846
  };
853
847
  },
854
- createInstance: instance => {
848
+ createTable: table => {
855
849
  let registered = false;
856
850
  let queued = false;
857
851
  return {
858
852
  _autoResetExpanded: () => {
859
- var _ref, _instance$options$aut;
853
+ var _ref, _table$options$autoRe;
860
854
 
861
855
  if (!registered) {
862
- instance._queue(() => {
856
+ table._queue(() => {
863
857
  registered = true;
864
858
  });
865
859
 
866
860
  return;
867
861
  }
868
862
 
869
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
863
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
870
864
  if (queued) return;
871
865
  queued = true;
872
866
 
873
- instance._queue(() => {
874
- instance.resetExpanded();
867
+ table._queue(() => {
868
+ table.resetExpanded();
875
869
  queued = false;
876
870
  });
877
871
  }
878
872
  },
879
- setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
873
+ setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
880
874
  toggleAllRowsExpanded: expanded => {
881
- if (expanded != null ? expanded : !instance.getIsAllRowsExpanded()) {
882
- instance.setExpanded(true);
875
+ if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
876
+ table.setExpanded(true);
883
877
  } else {
884
- instance.setExpanded({});
878
+ table.setExpanded({});
885
879
  }
886
880
  },
887
881
  resetExpanded: defaultState => {
888
- var _instance$initialStat, _instance$initialStat2;
882
+ var _table$initialState$e, _table$initialState;
889
883
 
890
- instance.setExpanded(defaultState ? {} : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.expanded) != null ? _instance$initialStat : {});
884
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
891
885
  },
892
886
  getCanSomeRowsExpand: () => {
893
- return instance.getRowModel().flatRows.some(row => row.getCanExpand());
887
+ return table.getRowModel().flatRows.some(row => row.getCanExpand());
894
888
  },
895
889
  getToggleAllRowsExpandedHandler: () => {
896
890
  return e => {
897
891
  e.persist == null ? void 0 : e.persist();
898
- instance.toggleAllRowsExpanded();
892
+ table.toggleAllRowsExpanded();
899
893
  };
900
894
  },
901
895
  getIsSomeRowsExpanded: () => {
902
- const expanded = instance.getState().expanded;
896
+ const expanded = table.getState().expanded;
903
897
  return expanded === true || Object.values(expanded).some(Boolean);
904
898
  },
905
899
  getIsAllRowsExpanded: () => {
906
- const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
900
+ const expanded = table.getState().expanded; // If expanded is true, save some cycles and return true
907
901
 
908
902
  if (typeof expanded === 'boolean') {
909
903
  return expanded === true;
@@ -914,7 +908,7 @@
914
908
  } // If any row is not expanded, return false
915
909
 
916
910
 
917
- if (instance.getRowModel().flatRows.some(row => row.getIsExpanded())) {
911
+ if (table.getRowModel().flatRows.some(row => row.getIsExpanded())) {
918
912
  return false;
919
913
  } // They must all be expanded :shrug:
920
914
 
@@ -923,38 +917,38 @@
923
917
  },
924
918
  getExpandedDepth: () => {
925
919
  let maxDepth = 0;
926
- const rowIds = instance.getState().expanded === true ? Object.keys(instance.getRowModel().rowsById) : Object.keys(instance.getState().expanded);
920
+ const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
927
921
  rowIds.forEach(id => {
928
922
  const splitId = id.split('.');
929
923
  maxDepth = Math.max(maxDepth, splitId.length);
930
924
  });
931
925
  return maxDepth;
932
926
  },
933
- getPreExpandedRowModel: () => instance.getSortedRowModel(),
927
+ getPreExpandedRowModel: () => table.getSortedRowModel(),
934
928
  getExpandedRowModel: () => {
935
- if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
936
- instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
929
+ if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
930
+ table._getExpandedRowModel = table.options.getExpandedRowModel(table);
937
931
  }
938
932
 
939
- if (instance.options.manualExpanding || !instance._getExpandedRowModel) {
940
- return instance.getPreExpandedRowModel();
933
+ if (table.options.manualExpanding || !table._getExpandedRowModel) {
934
+ return table.getPreExpandedRowModel();
941
935
  }
942
936
 
943
- return instance._getExpandedRowModel();
937
+ return table._getExpandedRowModel();
944
938
  }
945
939
  };
946
940
  },
947
- createRow: (row, instance) => {
941
+ createRow: (row, table) => {
948
942
  return {
949
943
  toggleExpanded: expanded => {
950
- instance.setExpanded(old => {
944
+ table.setExpanded(old => {
951
945
  var _expanded;
952
946
 
953
947
  const exists = old === true ? true : !!(old != null && old[row.id]);
954
948
  let oldExpanded = {};
955
949
 
956
950
  if (old === true) {
957
- Object.keys(instance.getRowModel().rowsById).forEach(rowId => {
951
+ Object.keys(table.getRowModel().rowsById).forEach(rowId => {
958
952
  oldExpanded[rowId] = true;
959
953
  });
960
954
  } else {
@@ -981,15 +975,15 @@
981
975
  });
982
976
  },
983
977
  getIsExpanded: () => {
984
- var _instance$options$get;
978
+ var _table$options$getIsR;
985
979
 
986
- const expanded = instance.getState().expanded;
987
- 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]));
980
+ const expanded = table.getState().expanded;
981
+ 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]));
988
982
  },
989
983
  getCanExpand: () => {
990
- var _instance$options$get2, _instance$options$ena, _row$subRows;
984
+ var _table$options$getRow, _table$options$enable, _row$subRows;
991
985
 
992
- 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);
986
+ 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);
993
987
  },
994
988
  getToggleExpandedHandler: () => {
995
989
  const canExpand = row.getCanExpand();
@@ -1125,24 +1119,24 @@
1125
1119
  ...state
1126
1120
  };
1127
1121
  },
1128
- getDefaultOptions: instance => {
1122
+ getDefaultOptions: table => {
1129
1123
  return {
1130
- onColumnFiltersChange: makeStateUpdater('columnFilters', instance),
1131
- onGlobalFilterChange: makeStateUpdater('globalFilter', instance),
1124
+ onColumnFiltersChange: makeStateUpdater('columnFilters', table),
1125
+ onGlobalFilterChange: makeStateUpdater('globalFilter', table),
1132
1126
  filterFromLeafRows: false,
1133
1127
  globalFilterFn: 'auto',
1134
1128
  getColumnCanGlobalFilter: column => {
1135
- var _instance$getCoreRowM, _instance$getCoreRowM2;
1129
+ var _table$getCoreRowMode, _table$getCoreRowMode2;
1136
1130
 
1137
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1131
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1138
1132
  return typeof value === 'string';
1139
1133
  }
1140
1134
  };
1141
1135
  },
1142
- createColumn: (column, instance) => {
1136
+ createColumn: (column, table) => {
1143
1137
  return {
1144
1138
  getAutoFilterFn: () => {
1145
- const firstRow = instance.getCoreRowModel().flatRows[0];
1139
+ const firstRow = table.getCoreRowModel().flatRows[0];
1146
1140
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1147
1141
 
1148
1142
  if (typeof value === 'string') {
@@ -1168,34 +1162,31 @@
1168
1162
  return filterFns.weakEquals;
1169
1163
  },
1170
1164
  getFilterFn: () => {
1171
- var _ref;
1172
-
1173
- const userFilterFns = instance.options.filterFns;
1174
- 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];
1165
+ return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : filterFns[column.columnDef.filterFn];
1175
1166
  },
1176
1167
  getCanFilter: () => {
1177
- var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
1168
+ var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
1178
1169
 
1179
- 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;
1170
+ 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;
1180
1171
  },
1181
1172
  getCanGlobalFilter: () => {
1182
- var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1173
+ var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1183
1174
 
1184
- 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;
1175
+ 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;
1185
1176
  },
1186
1177
  getIsFiltered: () => column.getFilterIndex() > -1,
1187
1178
  getFilterValue: () => {
1188
- var _instance$getState$co, _instance$getState$co2;
1179
+ var _table$getState$colum, _table$getState$colum2;
1189
1180
 
1190
- 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;
1181
+ 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;
1191
1182
  },
1192
1183
  getFilterIndex: () => {
1193
- var _instance$getState$co3, _instance$getState$co4;
1184
+ var _table$getState$colum3, _table$getState$colum4;
1194
1185
 
1195
- 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;
1186
+ 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;
1196
1187
  },
1197
1188
  setFilterValue: value => {
1198
- instance.setColumnFilters(old => {
1189
+ table.setColumnFilters(old => {
1199
1190
  const filterFn = column.getFilterFn();
1200
1191
  const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1201
1192
  const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined); //
@@ -1230,15 +1221,15 @@
1230
1221
  return [newFilterObj];
1231
1222
  });
1232
1223
  },
1233
- _getFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, column.id),
1224
+ _getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
1234
1225
  getFacetedRowModel: () => {
1235
1226
  if (!column._getFacetedRowModel) {
1236
- return instance.getPreFilteredRowModel();
1227
+ return table.getPreFilteredRowModel();
1237
1228
  }
1238
1229
 
1239
1230
  return column._getFacetedRowModel();
1240
1231
  },
1241
- _getFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, column.id),
1232
+ _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
1242
1233
  getFacetedUniqueValues: () => {
1243
1234
  if (!column._getFacetedUniqueValues) {
1244
1235
  return new Map();
@@ -1246,7 +1237,7 @@
1246
1237
 
1247
1238
  return column._getFacetedUniqueValues();
1248
1239
  },
1249
- _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1240
+ _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
1250
1241
  getFacetedMinMaxValues: () => {
1251
1242
  if (!column._getFacetedMinMaxValues) {
1252
1243
  return undefined;
@@ -1258,28 +1249,25 @@
1258
1249
 
1259
1250
  };
1260
1251
  },
1261
- createRow: (row, instance) => {
1252
+ createRow: (row, table) => {
1262
1253
  return {
1263
1254
  columnFilters: {},
1264
1255
  columnFiltersMeta: {}
1265
1256
  };
1266
1257
  },
1267
- createInstance: instance => {
1258
+ createTable: table => {
1268
1259
  return {
1269
1260
  getGlobalAutoFilterFn: () => {
1270
1261
  return filterFns.includesString;
1271
1262
  },
1272
1263
  getGlobalFilterFn: () => {
1273
- var _ref2;
1274
-
1275
1264
  const {
1276
- filterFns: userFilterFns,
1277
1265
  globalFilterFn: globalFilterFn
1278
- } = instance.options;
1279
- return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? instance.getGlobalAutoFilterFn() : (_ref2 = userFilterFns == null ? void 0 : userFilterFns[globalFilterFn]) != null ? _ref2 : filterFns[globalFilterFn];
1266
+ } = table.options;
1267
+ return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : filterFns[globalFilterFn];
1280
1268
  },
1281
1269
  setColumnFilters: updater => {
1282
- const leafColumns = instance.getAllLeafColumns();
1270
+ const leafColumns = table.getAllLeafColumns();
1283
1271
 
1284
1272
  const updateFn = old => {
1285
1273
  var _functionalUpdate;
@@ -1299,51 +1287,51 @@
1299
1287
  });
1300
1288
  };
1301
1289
 
1302
- instance.options.onColumnFiltersChange == null ? void 0 : instance.options.onColumnFiltersChange(updateFn);
1290
+ table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1303
1291
  },
1304
1292
  setGlobalFilter: updater => {
1305
- instance.options.onGlobalFilterChange == null ? void 0 : instance.options.onGlobalFilterChange(updater);
1293
+ table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1306
1294
  },
1307
1295
  resetGlobalFilter: defaultState => {
1308
- instance.setGlobalFilter(defaultState ? undefined : instance.initialState.globalFilter);
1296
+ table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1309
1297
  },
1310
1298
  resetColumnFilters: defaultState => {
1311
- var _instance$initialStat, _instance$initialStat2;
1299
+ var _table$initialState$c, _table$initialState;
1312
1300
 
1313
- instance.setColumnFilters(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnFilters) != null ? _instance$initialStat : []);
1301
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1314
1302
  },
1315
- getPreFilteredRowModel: () => instance.getCoreRowModel(),
1316
- _getFilteredRowModel: instance.options.getFilteredRowModel && instance.options.getFilteredRowModel(instance),
1303
+ getPreFilteredRowModel: () => table.getCoreRowModel(),
1304
+ _getFilteredRowModel: table.options.getFilteredRowModel && table.options.getFilteredRowModel(table),
1317
1305
  getFilteredRowModel: () => {
1318
- if (instance.options.manualFiltering || !instance._getFilteredRowModel) {
1319
- return instance.getPreFilteredRowModel();
1306
+ if (table.options.manualFiltering || !table._getFilteredRowModel) {
1307
+ return table.getPreFilteredRowModel();
1320
1308
  }
1321
1309
 
1322
- return instance._getFilteredRowModel();
1310
+ return table._getFilteredRowModel();
1323
1311
  },
1324
- _getGlobalFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, '__global__'),
1312
+ _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
1325
1313
  getGlobalFacetedRowModel: () => {
1326
- if (instance.options.manualFiltering || !instance._getGlobalFacetedRowModel) {
1327
- return instance.getPreFilteredRowModel();
1314
+ if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
1315
+ return table.getPreFilteredRowModel();
1328
1316
  }
1329
1317
 
1330
- return instance._getGlobalFacetedRowModel();
1318
+ return table._getGlobalFacetedRowModel();
1331
1319
  },
1332
- _getGlobalFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, '__global__'),
1320
+ _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
1333
1321
  getGlobalFacetedUniqueValues: () => {
1334
- if (!instance._getGlobalFacetedUniqueValues) {
1322
+ if (!table._getGlobalFacetedUniqueValues) {
1335
1323
  return new Map();
1336
1324
  }
1337
1325
 
1338
- return instance._getGlobalFacetedUniqueValues();
1326
+ return table._getGlobalFacetedUniqueValues();
1339
1327
  },
1340
- _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1328
+ _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
1341
1329
  getGlobalFacetedMinMaxValues: () => {
1342
- if (!instance._getGlobalFacetedMinMaxValues) {
1330
+ if (!table._getGlobalFacetedMinMaxValues) {
1343
1331
  return;
1344
1332
  }
1345
1333
 
1346
- return instance._getGlobalFacetedMinMaxValues();
1334
+ return table._getGlobalFacetedMinMaxValues();
1347
1335
  }
1348
1336
  };
1349
1337
  }
@@ -1464,9 +1452,9 @@
1464
1452
  getDefaultColumnDef: () => {
1465
1453
  return {
1466
1454
  aggregatedCell: props => {
1467
- var _props$getValue$toStr, _props$getValue;
1455
+ var _toString, _props$getValue;
1468
1456
 
1469
- 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;
1457
+ return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1470
1458
  },
1471
1459
  aggregationFn: 'auto'
1472
1460
  };
@@ -1477,16 +1465,16 @@
1477
1465
  ...state
1478
1466
  };
1479
1467
  },
1480
- getDefaultOptions: instance => {
1468
+ getDefaultOptions: table => {
1481
1469
  return {
1482
- onGroupingChange: makeStateUpdater('grouping', instance),
1470
+ onGroupingChange: makeStateUpdater('grouping', table),
1483
1471
  groupedColumnMode: 'reorder'
1484
1472
  };
1485
1473
  },
1486
- createColumn: (column, instance) => {
1474
+ createColumn: (column, table) => {
1487
1475
  return {
1488
1476
  toggleGrouping: () => {
1489
- instance.setGrouping(old => {
1477
+ table.setGrouping(old => {
1490
1478
  // Find any existing grouping for this column
1491
1479
  if (old != null && old.includes(column.id)) {
1492
1480
  return old.filter(d => d !== column.id);
@@ -1498,17 +1486,17 @@
1498
1486
  getCanGroup: () => {
1499
1487
  var _ref, _ref2, _ref3, _column$columnDef$ena;
1500
1488
 
1501
- 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;
1489
+ 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;
1502
1490
  },
1503
1491
  getIsGrouped: () => {
1504
- var _instance$getState$gr;
1492
+ var _table$getState$group;
1505
1493
 
1506
- return (_instance$getState$gr = instance.getState().grouping) == null ? void 0 : _instance$getState$gr.includes(column.id);
1494
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1507
1495
  },
1508
1496
  getGroupedIndex: () => {
1509
- var _instance$getState$gr2;
1497
+ var _table$getState$group2;
1510
1498
 
1511
- return (_instance$getState$gr2 = instance.getState().grouping) == null ? void 0 : _instance$getState$gr2.indexOf(column.id);
1499
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1512
1500
  },
1513
1501
  getToggleGroupingHandler: () => {
1514
1502
  const canGroup = column.getCanGroup();
@@ -1518,7 +1506,7 @@
1518
1506
  };
1519
1507
  },
1520
1508
  getAutoAggregationFn: () => {
1521
- const firstRow = instance.getCoreRowModel().flatRows[0];
1509
+ const firstRow = table.getCoreRowModel().flatRows[0];
1522
1510
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1523
1511
 
1524
1512
  if (typeof value === 'number') {
@@ -1530,37 +1518,33 @@
1530
1518
  }
1531
1519
  },
1532
1520
  getAggregationFn: () => {
1533
- var _ref4;
1534
-
1535
- const userAggregationFns = instance.options.aggregationFns;
1536
-
1537
1521
  if (!column) {
1538
1522
  throw new Error();
1539
1523
  }
1540
1524
 
1541
- 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];
1525
+ return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : aggregationFns[column.columnDef.aggregationFn];
1542
1526
  }
1543
1527
  };
1544
1528
  },
1545
- createInstance: instance => {
1529
+ createTable: table => {
1546
1530
  return {
1547
- setGrouping: updater => instance.options.onGroupingChange == null ? void 0 : instance.options.onGroupingChange(updater),
1531
+ setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1548
1532
  resetGrouping: defaultState => {
1549
- var _instance$initialStat, _instance$initialStat2;
1533
+ var _table$initialState$g, _table$initialState;
1550
1534
 
1551
- instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1535
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1552
1536
  },
1553
- getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1537
+ getPreGroupedRowModel: () => table.getFilteredRowModel(),
1554
1538
  getGroupedRowModel: () => {
1555
- if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1556
- instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
1539
+ if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
1540
+ table._getGroupedRowModel = table.options.getGroupedRowModel(table);
1557
1541
  }
1558
1542
 
1559
- if (instance.options.manualGrouping || !instance._getGroupedRowModel) {
1560
- return instance.getPreGroupedRowModel();
1543
+ if (table.options.manualGrouping || !table._getGroupedRowModel) {
1544
+ return table.getPreGroupedRowModel();
1561
1545
  }
1562
1546
 
1563
- return instance._getGroupedRowModel();
1547
+ return table._getGroupedRowModel();
1564
1548
  }
1565
1549
  };
1566
1550
  },
@@ -1570,12 +1554,7 @@
1570
1554
  _groupingValuesCache: {}
1571
1555
  };
1572
1556
  },
1573
- createCell: (cell, column, row, instance) => {
1574
- const getRenderValue = () => {
1575
- var _cell$getValue;
1576
-
1577
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
1578
- };
1557
+ createCell: (cell, column, row, table) => {
1579
1558
 
1580
1559
  return {
1581
1560
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
@@ -1584,22 +1563,6 @@
1584
1563
  var _row$subRows;
1585
1564
 
1586
1565
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1587
- },
1588
- renderAggregatedCell: () => {
1589
- {
1590
- if (!column.columnDef.aggregatedCell) {
1591
- console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
1592
- }
1593
- }
1594
-
1595
- const template = column.columnDef.aggregatedCell || column.columnDef.cell;
1596
- return template ? instance._render(template, {
1597
- instance,
1598
- column,
1599
- row,
1600
- cell,
1601
- getValue: getRenderValue
1602
- }) : null;
1603
1566
  }
1604
1567
  };
1605
1568
  }
@@ -1627,20 +1590,20 @@
1627
1590
  ...state
1628
1591
  };
1629
1592
  },
1630
- getDefaultOptions: instance => {
1593
+ getDefaultOptions: table => {
1631
1594
  return {
1632
- onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1595
+ onColumnOrderChange: makeStateUpdater('columnOrder', table)
1633
1596
  };
1634
1597
  },
1635
- createInstance: instance => {
1598
+ createTable: table => {
1636
1599
  return {
1637
- setColumnOrder: updater => instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater),
1600
+ setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1638
1601
  resetColumnOrder: defaultState => {
1639
- var _instance$initialStat;
1602
+ var _table$initialState$c;
1640
1603
 
1641
- instance.setColumnOrder(defaultState ? [] : (_instance$initialStat = instance.initialState.columnOrder) != null ? _instance$initialStat : []);
1604
+ table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
1642
1605
  },
1643
- _getOrderColumnsFn: memo(() => [instance.getState().columnOrder, instance.getState().grouping, instance.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1606
+ _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1644
1607
  // Sort grouped columns to the start of the column list
1645
1608
  // before the headers are built
1646
1609
  let orderedColumns = []; // If there is no order, return the normal columns
@@ -1668,7 +1631,7 @@
1668
1631
 
1669
1632
  return orderColumns(orderedColumns, grouping, groupedColumnMode);
1670
1633
  }, {
1671
- key: 'getOrderColumnsFn' // debug: () => instance.options.debugAll ?? instance.options.debugTable,
1634
+ key: 'getOrderColumnsFn' // debug: () => table.options.debugAll ?? table.options.debugTable,
1672
1635
 
1673
1636
  })
1674
1637
  };
@@ -1692,32 +1655,32 @@
1692
1655
  }
1693
1656
  };
1694
1657
  },
1695
- getDefaultOptions: instance => {
1658
+ getDefaultOptions: table => {
1696
1659
  return {
1697
- onPaginationChange: makeStateUpdater('pagination', instance)
1660
+ onPaginationChange: makeStateUpdater('pagination', table)
1698
1661
  };
1699
1662
  },
1700
- createInstance: instance => {
1663
+ createTable: table => {
1701
1664
  let registered = false;
1702
1665
  let queued = false;
1703
1666
  return {
1704
1667
  _autoResetPageIndex: () => {
1705
- var _ref, _instance$options$aut;
1668
+ var _ref, _table$options$autoRe;
1706
1669
 
1707
1670
  if (!registered) {
1708
- instance._queue(() => {
1671
+ table._queue(() => {
1709
1672
  registered = true;
1710
1673
  });
1711
1674
 
1712
1675
  return;
1713
1676
  }
1714
1677
 
1715
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetPageIndex) != null ? _ref : !instance.options.manualPagination) {
1678
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
1716
1679
  if (queued) return;
1717
1680
  queued = true;
1718
1681
 
1719
- instance._queue(() => {
1720
- instance.resetPageIndex();
1682
+ table._queue(() => {
1683
+ table.resetPageIndex();
1721
1684
  queued = false;
1722
1685
  });
1723
1686
  }
@@ -1728,17 +1691,17 @@
1728
1691
  return newState;
1729
1692
  };
1730
1693
 
1731
- return instance.options.onPaginationChange == null ? void 0 : instance.options.onPaginationChange(safeUpdater);
1694
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1732
1695
  },
1733
1696
  resetPagination: defaultState => {
1734
- var _instance$initialStat;
1697
+ var _table$initialState$p;
1735
1698
 
1736
- instance.setPagination(defaultState ? getDefaultPaginationState() : (_instance$initialStat = instance.initialState.pagination) != null ? _instance$initialStat : getDefaultPaginationState());
1699
+ table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
1737
1700
  },
1738
1701
  setPageIndex: updater => {
1739
- instance.setPagination(old => {
1702
+ table.setPagination(old => {
1740
1703
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1741
- const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1704
+ const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
1742
1705
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1743
1706
  return { ...old,
1744
1707
  pageIndex
@@ -1746,17 +1709,17 @@
1746
1709
  });
1747
1710
  },
1748
1711
  resetPageIndex: defaultState => {
1749
- var _instance$initialStat2, _instance$initialStat3, _instance$initialStat4;
1712
+ var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1750
1713
 
1751
- 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);
1714
+ 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);
1752
1715
  },
1753
1716
  resetPageSize: defaultState => {
1754
- var _instance$initialStat5, _instance$initialStat6, _instance$initialStat7;
1717
+ var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1755
1718
 
1756
- 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);
1719
+ 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);
1757
1720
  },
1758
1721
  setPageSize: updater => {
1759
- instance.setPagination(old => {
1722
+ table.setPagination(old => {
1760
1723
  const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
1761
1724
  const topRowIndex = old.pageSize * old.pageIndex;
1762
1725
  const pageIndex = Math.floor(topRowIndex / pageSize);
@@ -1766,10 +1729,10 @@
1766
1729
  };
1767
1730
  });
1768
1731
  },
1769
- setPageCount: updater => instance.setPagination(old => {
1770
- var _instance$options$pag;
1732
+ setPageCount: updater => table.setPagination(old => {
1733
+ var _table$options$pageCo;
1771
1734
 
1772
- let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1735
+ let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
1773
1736
 
1774
1737
  if (typeof newPageCount === 'number') {
1775
1738
  newPageCount = Math.max(-1, newPageCount);
@@ -1779,7 +1742,7 @@
1779
1742
  pageCount: newPageCount
1780
1743
  };
1781
1744
  }),
1782
- getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1745
+ getPageOptions: memo(() => [table.getPageCount()], pageCount => {
1783
1746
  let pageOptions = [];
1784
1747
 
1785
1748
  if (pageCount && pageCount > 0) {
@@ -1790,17 +1753,17 @@
1790
1753
  }, {
1791
1754
  key: 'getPageOptions',
1792
1755
  debug: () => {
1793
- var _instance$options$deb;
1756
+ var _table$options$debugA;
1794
1757
 
1795
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
1758
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
1796
1759
  }
1797
1760
  }),
1798
- getCanPreviousPage: () => instance.getState().pagination.pageIndex > 0,
1761
+ getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
1799
1762
  getCanNextPage: () => {
1800
1763
  const {
1801
1764
  pageIndex
1802
- } = instance.getState().pagination;
1803
- const pageCount = instance.getPageCount();
1765
+ } = table.getState().pagination;
1766
+ const pageCount = table.getPageCount();
1804
1767
 
1805
1768
  if (pageCount === -1) {
1806
1769
  return true;
@@ -1813,29 +1776,29 @@
1813
1776
  return pageIndex < pageCount - 1;
1814
1777
  },
1815
1778
  previousPage: () => {
1816
- return instance.setPageIndex(old => old - 1);
1779
+ return table.setPageIndex(old => old - 1);
1817
1780
  },
1818
1781
  nextPage: () => {
1819
- return instance.setPageIndex(old => {
1782
+ return table.setPageIndex(old => {
1820
1783
  return old + 1;
1821
1784
  });
1822
1785
  },
1823
- getPrePaginationRowModel: () => instance.getExpandedRowModel(),
1786
+ getPrePaginationRowModel: () => table.getExpandedRowModel(),
1824
1787
  getPaginationRowModel: () => {
1825
- if (!instance._getPaginationRowModel && instance.options.getPaginationRowModel) {
1826
- instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
1788
+ if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
1789
+ table._getPaginationRowModel = table.options.getPaginationRowModel(table);
1827
1790
  }
1828
1791
 
1829
- if (instance.options.manualPagination || !instance._getPaginationRowModel) {
1830
- return instance.getPrePaginationRowModel();
1792
+ if (table.options.manualPagination || !table._getPaginationRowModel) {
1793
+ return table.getPrePaginationRowModel();
1831
1794
  }
1832
1795
 
1833
- return instance._getPaginationRowModel();
1796
+ return table._getPaginationRowModel();
1834
1797
  },
1835
1798
  getPageCount: () => {
1836
- var _instance$options$pag2;
1799
+ var _table$options$pageCo2;
1837
1800
 
1838
- return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1801
+ return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1839
1802
  }
1840
1803
  };
1841
1804
  }
@@ -1854,16 +1817,16 @@
1854
1817
  ...state
1855
1818
  };
1856
1819
  },
1857
- getDefaultOptions: instance => {
1820
+ getDefaultOptions: table => {
1858
1821
  return {
1859
- onColumnPinningChange: makeStateUpdater('columnPinning', instance)
1822
+ onColumnPinningChange: makeStateUpdater('columnPinning', table)
1860
1823
  };
1861
1824
  },
1862
- createColumn: (column, instance) => {
1825
+ createColumn: (column, table) => {
1863
1826
  return {
1864
1827
  pin: position => {
1865
1828
  const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
1866
- instance.setColumnPinning(old => {
1829
+ table.setColumnPinning(old => {
1867
1830
  var _old$left3, _old$right3;
1868
1831
 
1869
1832
  if (position === 'right') {
@@ -1893,9 +1856,9 @@
1893
1856
  getCanPin: () => {
1894
1857
  const leafColumns = column.getLeafColumns();
1895
1858
  return leafColumns.some(d => {
1896
- var _d$columnDef$enablePi, _instance$options$ena;
1859
+ var _d$columnDef$enablePi, _table$options$enable;
1897
1860
 
1898
- return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1861
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
1899
1862
  });
1900
1863
  },
1901
1864
  getIsPinned: () => {
@@ -1903,33 +1866,33 @@
1903
1866
  const {
1904
1867
  left,
1905
1868
  right
1906
- } = instance.getState().columnPinning;
1869
+ } = table.getState().columnPinning;
1907
1870
  const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
1908
1871
  const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
1909
1872
  return isLeft ? 'left' : isRight ? 'right' : false;
1910
1873
  },
1911
1874
  getPinnedIndex: () => {
1912
- var _instance$getState$co, _instance$getState$co2, _instance$getState$co3;
1875
+ var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1913
1876
 
1914
1877
  const position = column.getIsPinned();
1915
- 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;
1878
+ 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;
1916
1879
  }
1917
1880
  };
1918
1881
  },
1919
- createRow: (row, instance) => {
1882
+ createRow: (row, table) => {
1920
1883
  return {
1921
- getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1884
+ getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
1922
1885
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1923
1886
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
1924
1887
  }, {
1925
1888
  key: "development" === 'production' ,
1926
1889
  debug: () => {
1927
- var _instance$options$deb;
1890
+ var _table$options$debugA;
1928
1891
 
1929
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
1892
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
1930
1893
  }
1931
1894
  }),
1932
- getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1895
+ getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
1933
1896
  const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1934
1897
  position: 'left'
1935
1898
  }));
@@ -1937,12 +1900,12 @@
1937
1900
  }, {
1938
1901
  key: "development" === 'production' ,
1939
1902
  debug: () => {
1940
- var _instance$options$deb2;
1903
+ var _table$options$debugA2;
1941
1904
 
1942
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
1905
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
1943
1906
  }
1944
1907
  }),
1945
- getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1908
+ getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
1946
1909
  const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1947
1910
  position: 'left'
1948
1911
  }));
@@ -1950,25 +1913,25 @@
1950
1913
  }, {
1951
1914
  key: "development" === 'production' ,
1952
1915
  debug: () => {
1953
- var _instance$options$deb3;
1916
+ var _table$options$debugA3;
1954
1917
 
1955
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
1918
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
1956
1919
  }
1957
1920
  })
1958
1921
  };
1959
1922
  },
1960
- createInstance: instance => {
1923
+ createTable: table => {
1961
1924
  return {
1962
- setColumnPinning: updater => instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater),
1925
+ setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1963
1926
  resetColumnPinning: defaultState => {
1964
- var _instance$initialStat, _instance$initialStat2;
1927
+ var _table$initialState$c, _table$initialState;
1965
1928
 
1966
- return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1929
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1967
1930
  },
1968
1931
  getIsSomeColumnsPinned: position => {
1969
1932
  var _pinningState$positio;
1970
1933
 
1971
- const pinningState = instance.getState().columnPinning;
1934
+ const pinningState = table.getState().columnPinning;
1972
1935
 
1973
1936
  if (!position) {
1974
1937
  var _pinningState$left, _pinningState$right;
@@ -1978,35 +1941,35 @@
1978
1941
 
1979
1942
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1980
1943
  },
1981
- getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1944
+ getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1982
1945
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1983
1946
  }, {
1984
1947
  key: 'getLeftLeafColumns',
1985
1948
  debug: () => {
1986
- var _instance$options$deb4;
1949
+ var _table$options$debugA4;
1987
1950
 
1988
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
1951
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
1989
1952
  }
1990
1953
  }),
1991
- getRightLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.right], (allColumns, right) => {
1954
+ getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
1992
1955
  return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1993
1956
  }, {
1994
1957
  key: 'getRightLeafColumns',
1995
1958
  debug: () => {
1996
- var _instance$options$deb5;
1959
+ var _table$options$debugA5;
1997
1960
 
1998
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
1961
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
1999
1962
  }
2000
1963
  }),
2001
- getCenterLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, left, right) => {
1964
+ getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
2002
1965
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
2003
1966
  return allColumns.filter(d => !leftAndRight.includes(d.id));
2004
1967
  }, {
2005
1968
  key: 'getCenterLeafColumns',
2006
1969
  debug: () => {
2007
- var _instance$options$deb6;
1970
+ var _table$options$debugA6;
2008
1971
 
2009
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
1972
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
2010
1973
  }
2011
1974
  })
2012
1975
  };
@@ -2021,9 +1984,9 @@
2021
1984
  ...state
2022
1985
  };
2023
1986
  },
2024
- getDefaultOptions: instance => {
1987
+ getDefaultOptions: table => {
2025
1988
  return {
2026
- onRowSelectionChange: makeStateUpdater('rowSelection', instance),
1989
+ onRowSelectionChange: makeStateUpdater('rowSelection', table),
2027
1990
  enableRowSelection: true,
2028
1991
  enableMultiRowSelection: true,
2029
1992
  enableSubRowSelection: true // enableGroupingRowSelection: false,
@@ -2032,20 +1995,20 @@
2032
1995
 
2033
1996
  };
2034
1997
  },
2035
- createInstance: instance => {
1998
+ createTable: table => {
2036
1999
  return {
2037
- setRowSelection: updater => instance.options.onRowSelectionChange == null ? void 0 : instance.options.onRowSelectionChange(updater),
2000
+ setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
2038
2001
  resetRowSelection: defaultState => {
2039
- var _instance$initialStat;
2002
+ var _table$initialState$r;
2040
2003
 
2041
- return instance.setRowSelection(defaultState ? {} : (_instance$initialStat = instance.initialState.rowSelection) != null ? _instance$initialStat : {});
2004
+ return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
2042
2005
  },
2043
2006
  toggleAllRowsSelected: value => {
2044
- instance.setRowSelection(old => {
2045
- value = typeof value !== 'undefined' ? value : !instance.getIsAllRowsSelected();
2007
+ table.setRowSelection(old => {
2008
+ value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
2046
2009
  const rowSelection = { ...old
2047
2010
  };
2048
- const preGroupedFlatRows = instance.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
2011
+ const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
2049
2012
  // All of the rows are flat already, so it wouldn't be worth it
2050
2013
 
2051
2014
  if (value) {
@@ -2061,12 +2024,12 @@
2061
2024
  return rowSelection;
2062
2025
  });
2063
2026
  },
2064
- toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2065
- const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2027
+ toggleAllPageRowsSelected: value => table.setRowSelection(old => {
2028
+ const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
2066
2029
  const rowSelection = { ...old
2067
2030
  };
2068
- instance.getRowModel().rows.forEach(row => {
2069
- mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2031
+ table.getRowModel().rows.forEach(row => {
2032
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
2070
2033
  });
2071
2034
  return rowSelection;
2072
2035
  }),
@@ -2075,7 +2038,7 @@
2075
2038
  // rows,
2076
2039
  // rowsById,
2077
2040
  // options: { selectGroupingRows, selectSubRows },
2078
- // } = instance
2041
+ // } = table
2079
2042
  // const findSelectedRow = (rows: Row[]) => {
2080
2043
  // let found
2081
2044
  // rows.find(d => {
@@ -2103,7 +2066,7 @@
2103
2066
  // selectSubRows: selectSubRows!,
2104
2067
  // })
2105
2068
  // }
2106
- // instance.rows.forEach(row => {
2069
+ // table.rows.forEach(row => {
2107
2070
  // const isFirstRow = row.id === firstRow.id
2108
2071
  // const isLastRow = row.id === lastRow.id
2109
2072
  // if (isFirstRow || isLastRow) {
@@ -2118,10 +2081,10 @@
2118
2081
  // addRow(row)
2119
2082
  // }
2120
2083
  // })
2121
- // instance.setRowSelection(selectedRowIds)
2084
+ // table.setRowSelection(selectedRowIds)
2122
2085
  // },
2123
- getPreSelectedRowModel: () => instance.getCoreRowModel(),
2124
- getSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getCoreRowModel()], (rowSelection, rowModel) => {
2086
+ getPreSelectedRowModel: () => table.getCoreRowModel(),
2087
+ getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
2125
2088
  if (!Object.keys(rowSelection).length) {
2126
2089
  return {
2127
2090
  rows: [],
@@ -2130,16 +2093,16 @@
2130
2093
  };
2131
2094
  }
2132
2095
 
2133
- return selectRowsFn(instance, rowModel);
2096
+ return selectRowsFn(table, rowModel);
2134
2097
  }, {
2135
2098
  key: 'getSelectedRowModel',
2136
2099
  debug: () => {
2137
- var _instance$options$deb;
2100
+ var _table$options$debugA;
2138
2101
 
2139
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
2102
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
2140
2103
  }
2141
2104
  }),
2142
- getFilteredSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getFilteredRowModel()], (rowSelection, rowModel) => {
2105
+ getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
2143
2106
  if (!Object.keys(rowSelection).length) {
2144
2107
  return {
2145
2108
  rows: [],
@@ -2148,16 +2111,16 @@
2148
2111
  };
2149
2112
  }
2150
2113
 
2151
- return selectRowsFn(instance, rowModel);
2114
+ return selectRowsFn(table, rowModel);
2152
2115
  }, {
2153
2116
  key: "development" === 'production' ,
2154
2117
  debug: () => {
2155
- var _instance$options$deb2;
2118
+ var _table$options$debugA2;
2156
2119
 
2157
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2120
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
2158
2121
  }
2159
2122
  }),
2160
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2123
+ getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
2161
2124
  if (!Object.keys(rowSelection).length) {
2162
2125
  return {
2163
2126
  rows: [],
@@ -2166,31 +2129,31 @@
2166
2129
  };
2167
2130
  }
2168
2131
 
2169
- return selectRowsFn(instance, rowModel);
2132
+ return selectRowsFn(table, rowModel);
2170
2133
  }, {
2171
2134
  key: "development" === 'production' ,
2172
2135
  debug: () => {
2173
- var _instance$options$deb3;
2136
+ var _table$options$debugA3;
2174
2137
 
2175
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugTable;
2138
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
2176
2139
  }
2177
2140
  }),
2178
2141
  ///
2179
2142
  // getGroupingRowCanSelect: rowId => {
2180
- // const row = instance.getRow(rowId)
2143
+ // const row = table.getRow(rowId)
2181
2144
  // if (!row) {
2182
2145
  // throw new Error()
2183
2146
  // }
2184
- // if (typeof instance.options.enableGroupingRowSelection === 'function') {
2185
- // return instance.options.enableGroupingRowSelection(row)
2147
+ // if (typeof table.options.enableGroupingRowSelection === 'function') {
2148
+ // return table.options.enableGroupingRowSelection(row)
2186
2149
  // }
2187
- // return instance.options.enableGroupingRowSelection ?? false
2150
+ // return table.options.enableGroupingRowSelection ?? false
2188
2151
  // },
2189
2152
  getIsAllRowsSelected: () => {
2190
- const preFilteredFlatRows = instance.getPreFilteredRowModel().flatRows;
2153
+ const preFilteredFlatRows = table.getPreFilteredRowModel().flatRows;
2191
2154
  const {
2192
2155
  rowSelection
2193
- } = instance.getState();
2156
+ } = table.getState();
2194
2157
  let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
2195
2158
 
2196
2159
  if (isAllRowsSelected) {
@@ -2202,10 +2165,10 @@
2202
2165
  return isAllRowsSelected;
2203
2166
  },
2204
2167
  getIsAllPageRowsSelected: () => {
2205
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2168
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2206
2169
  const {
2207
2170
  rowSelection
2208
- } = instance.getState();
2171
+ } = table.getState();
2209
2172
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2210
2173
 
2211
2174
  if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
@@ -2215,31 +2178,31 @@
2215
2178
  return isAllPageRowsSelected;
2216
2179
  },
2217
2180
  getIsSomeRowsSelected: () => {
2218
- var _instance$getState$ro;
2181
+ var _table$getState$rowSe;
2219
2182
 
2220
- return !instance.getIsAllRowsSelected() && !!Object.keys((_instance$getState$ro = instance.getState().rowSelection) != null ? _instance$getState$ro : {}).length;
2183
+ return !table.getIsAllRowsSelected() && !!Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
2221
2184
  },
2222
2185
  getIsSomePageRowsSelected: () => {
2223
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2224
- return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2186
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2187
+ return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2225
2188
  },
2226
2189
  getToggleAllRowsSelectedHandler: () => {
2227
2190
  return e => {
2228
- instance.toggleAllRowsSelected(e.target.checked);
2191
+ table.toggleAllRowsSelected(e.target.checked);
2229
2192
  };
2230
2193
  },
2231
2194
  getToggleAllPageRowsSelectedHandler: () => {
2232
2195
  return e => {
2233
- instance.toggleAllPageRowsSelected(e.target.checked);
2196
+ table.toggleAllPageRowsSelected(e.target.checked);
2234
2197
  };
2235
2198
  }
2236
2199
  };
2237
2200
  },
2238
- createRow: (row, instance) => {
2201
+ createRow: (row, table) => {
2239
2202
  return {
2240
2203
  toggleSelected: value => {
2241
2204
  const isSelected = row.getIsSelected();
2242
- instance.setRowSelection(old => {
2205
+ table.setRowSelection(old => {
2243
2206
  value = typeof value !== 'undefined' ? value : !isSelected;
2244
2207
 
2245
2208
  if (isSelected === value) {
@@ -2248,48 +2211,48 @@
2248
2211
 
2249
2212
  const selectedRowIds = { ...old
2250
2213
  };
2251
- mutateRowIsSelected(selectedRowIds, row.id, value, instance);
2214
+ mutateRowIsSelected(selectedRowIds, row.id, value, table);
2252
2215
  return selectedRowIds;
2253
2216
  });
2254
2217
  },
2255
2218
  getIsSelected: () => {
2256
2219
  const {
2257
2220
  rowSelection
2258
- } = instance.getState();
2221
+ } = table.getState();
2259
2222
  return isRowSelected(row, rowSelection) === true;
2260
2223
  },
2261
2224
  getIsSomeSelected: () => {
2262
2225
  const {
2263
2226
  rowSelection
2264
- } = instance.getState();
2227
+ } = table.getState();
2265
2228
  return isRowSelected(row, rowSelection) === 'some';
2266
2229
  },
2267
2230
  getCanSelect: () => {
2268
- var _instance$options$ena;
2231
+ var _table$options$enable;
2269
2232
 
2270
- if (typeof instance.options.enableRowSelection === 'function') {
2271
- return instance.options.enableRowSelection(row);
2233
+ if (typeof table.options.enableRowSelection === 'function') {
2234
+ return table.options.enableRowSelection(row);
2272
2235
  }
2273
2236
 
2274
- return (_instance$options$ena = instance.options.enableRowSelection) != null ? _instance$options$ena : true;
2237
+ return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
2275
2238
  },
2276
2239
  getCanSelectSubRows: () => {
2277
- var _instance$options$ena2;
2240
+ var _table$options$enable2;
2278
2241
 
2279
- if (typeof instance.options.enableSubRowSelection === 'function') {
2280
- return instance.options.enableSubRowSelection(row);
2242
+ if (typeof table.options.enableSubRowSelection === 'function') {
2243
+ return table.options.enableSubRowSelection(row);
2281
2244
  }
2282
2245
 
2283
- return (_instance$options$ena2 = instance.options.enableSubRowSelection) != null ? _instance$options$ena2 : true;
2246
+ return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
2284
2247
  },
2285
2248
  getCanMultiSelect: () => {
2286
- var _instance$options$ena3;
2249
+ var _table$options$enable3;
2287
2250
 
2288
- if (typeof instance.options.enableMultiRowSelection === 'function') {
2289
- return instance.options.enableMultiRowSelection(row);
2251
+ if (typeof table.options.enableMultiRowSelection === 'function') {
2252
+ return table.options.enableMultiRowSelection(row);
2290
2253
  }
2291
2254
 
2292
- return (_instance$options$ena3 = instance.options.enableMultiRowSelection) != null ? _instance$options$ena3 : true;
2255
+ return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
2293
2256
  },
2294
2257
  getToggleSelectedHandler: () => {
2295
2258
  const canSelect = row.getCanSelect();
@@ -2304,13 +2267,13 @@
2304
2267
  }
2305
2268
  };
2306
2269
 
2307
- const mutateRowIsSelected = (selectedRowIds, id, value, instance) => {
2270
+ const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2308
2271
  var _row$subRows;
2309
2272
 
2310
- const row = instance.getRow(id);
2273
+ const row = table.getRow(id);
2311
2274
  row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
2312
2275
  // !isGrouped ||
2313
- // (isGrouped && instance.options.enableGroupingRowSelection)
2276
+ // (isGrouped && table.options.enableGroupingRowSelection)
2314
2277
  // ) {
2315
2278
 
2316
2279
  if (value) {
@@ -2321,12 +2284,12 @@
2321
2284
 
2322
2285
 
2323
2286
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2324
- row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, instance));
2287
+ row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2325
2288
  }
2326
2289
  };
2327
2290
 
2328
- function selectRowsFn(instance, rowModel) {
2329
- const rowSelection = instance.getState().rowSelection;
2291
+ function selectRowsFn(table, rowModel) {
2292
+ const rowSelection = table.getState().rowSelection;
2330
2293
  const newSelectedFlatRows = [];
2331
2294
  const newSelectedRowsById = {}; // Filters top level and nested rows
2332
2295
 
@@ -2360,7 +2323,7 @@
2360
2323
  rowsById: newSelectedRowsById
2361
2324
  };
2362
2325
  }
2363
- function isRowSelected(row, selection, instance) {
2326
+ function isRowSelected(row, selection, table) {
2364
2327
  if (selection[row.id]) {
2365
2328
  return true;
2366
2329
  }
@@ -2506,18 +2469,18 @@
2506
2469
  sortingFn: 'auto'
2507
2470
  };
2508
2471
  },
2509
- getDefaultOptions: instance => {
2472
+ getDefaultOptions: table => {
2510
2473
  return {
2511
- onSortingChange: makeStateUpdater('sorting', instance),
2474
+ onSortingChange: makeStateUpdater('sorting', table),
2512
2475
  isMultiSortEvent: e => {
2513
2476
  return e.shiftKey;
2514
2477
  }
2515
2478
  };
2516
2479
  },
2517
- createColumn: (column, instance) => {
2480
+ createColumn: (column, table) => {
2518
2481
  return {
2519
2482
  getAutoSortingFn: () => {
2520
- const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2483
+ const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2521
2484
  let isString = false;
2522
2485
 
2523
2486
  for (const row of firstRows) {
@@ -2543,7 +2506,7 @@
2543
2506
  return sortingFns.basic;
2544
2507
  },
2545
2508
  getAutoSortDir: () => {
2546
- const firstRow = instance.getFilteredRowModel().flatRows[0];
2509
+ const firstRow = table.getFilteredRowModel().flatRows[0];
2547
2510
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2548
2511
 
2549
2512
  if (typeof value === 'string') {
@@ -2553,29 +2516,25 @@
2553
2516
  return 'desc';
2554
2517
  },
2555
2518
  getSortingFn: () => {
2556
- var _ref;
2557
-
2558
- const userSortingFn = instance.options.sortingFns;
2559
-
2560
2519
  if (!column) {
2561
2520
  throw new Error();
2562
2521
  }
2563
2522
 
2564
- 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];
2523
+ return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : sortingFns[column.columnDef.sortingFn];
2565
2524
  },
2566
2525
  toggleSorting: (desc, multi) => {
2567
2526
  // if (column.columns.length) {
2568
2527
  // column.columns.forEach((c, i) => {
2569
2528
  // if (c.id) {
2570
- // instance.toggleColumnSorting(c.id, undefined, multi || !!i)
2529
+ // table.toggleColumnSorting(c.id, undefined, multi || !!i)
2571
2530
  // }
2572
2531
  // })
2573
2532
  // return
2574
2533
  // }
2575
- // this needs to be outside of instance.setSorting to be in sync with rerender
2534
+ // this needs to be outside of table.setSorting to be in sync with rerender
2576
2535
  const nextSortingOrder = column.getNextSortingOrder();
2577
- instance.setSorting(old => {
2578
- var _instance$options$ena, _instance$options$ena2;
2536
+ table.setSorting(old => {
2537
+ var _table$options$enable, _table$options$enable2;
2579
2538
 
2580
2539
  // Find any existing sorting for this column
2581
2540
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2604,9 +2563,9 @@
2604
2563
 
2605
2564
 
2606
2565
  if (sortAction === 'toggle' && ( // Must be toggling
2607
- (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
2566
+ (_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && // If enableSortRemove, enable in general
2608
2567
  !hasDescDefined && ( // Must not be setting desc
2609
- multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
2568
+ multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) && // If multi, don't allow if enableMultiRemove
2610
2569
  !nextSortingOrder // Finally, detect if it should indeed be removed
2611
2570
  ) {
2612
2571
  sortAction = 'remove';
@@ -2618,14 +2577,14 @@
2618
2577
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2619
2578
  }];
2620
2579
  } else if (sortAction === 'add' && old != null && old.length) {
2621
- var _instance$options$max;
2580
+ var _table$options$maxMul;
2622
2581
 
2623
2582
  newSorting = [...old, {
2624
2583
  id: column.id,
2625
2584
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2626
2585
  }]; // Take latest n columns
2627
2586
 
2628
- newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
2587
+ newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
2629
2588
  } else if (sortAction === 'toggle' && old != null && old.length) {
2630
2589
  // This flips (or sets) the
2631
2590
  newSorting = old.map(d => {
@@ -2645,9 +2604,9 @@
2645
2604
  });
2646
2605
  },
2647
2606
  getNextSortingOrder: () => {
2648
- var _ref2, _column$columnDef$sor;
2607
+ var _ref, _column$columnDef$sor;
2649
2608
 
2650
- const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
2609
+ const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
2651
2610
  const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
2652
2611
  const isSorted = column.getIsSorted();
2653
2612
 
@@ -2662,59 +2621,59 @@
2662
2621
  }
2663
2622
  },
2664
2623
  getCanSort: () => {
2665
- var _column$columnDef$ena, _instance$options$ena3;
2624
+ var _column$columnDef$ena, _table$options$enable3;
2666
2625
 
2667
- 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;
2626
+ 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;
2668
2627
  },
2669
2628
  getCanMultiSort: () => {
2670
- var _ref3, _column$columnDef$ena2;
2629
+ var _ref2, _column$columnDef$ena2;
2671
2630
 
2672
- return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2631
+ return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2673
2632
  },
2674
2633
  getIsSorted: () => {
2675
- var _instance$getState$so;
2634
+ var _table$getState$sorti;
2676
2635
 
2677
- const columnSort = (_instance$getState$so = instance.getState().sorting) == null ? void 0 : _instance$getState$so.find(d => d.id === column.id);
2636
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2678
2637
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2679
2638
  },
2680
2639
  getSortIndex: () => {
2681
- var _instance$getState$so2, _instance$getState$so3;
2640
+ var _table$getState$sorti2, _table$getState$sorti3;
2682
2641
 
2683
- 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;
2642
+ 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;
2684
2643
  },
2685
2644
  clearSorting: () => {
2686
2645
  //clear sorting for just 1 column
2687
- instance.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2646
+ table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2688
2647
  },
2689
2648
  getToggleSortingHandler: () => {
2690
2649
  const canSort = column.getCanSort();
2691
2650
  return e => {
2692
2651
  if (!canSort) return;
2693
2652
  e.persist == null ? void 0 : e.persist();
2694
- column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? instance.options.isMultiSortEvent == null ? void 0 : instance.options.isMultiSortEvent(e) : false);
2653
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2695
2654
  };
2696
2655
  }
2697
2656
  };
2698
2657
  },
2699
- createInstance: instance => {
2658
+ createTable: table => {
2700
2659
  return {
2701
- setSorting: updater => instance.options.onSortingChange == null ? void 0 : instance.options.onSortingChange(updater),
2660
+ setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2702
2661
  resetSorting: defaultState => {
2703
- var _instance$initialStat, _instance$initialStat2;
2662
+ var _table$initialState$s, _table$initialState;
2704
2663
 
2705
- instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2664
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2706
2665
  },
2707
- getPreSortedRowModel: () => instance.getGroupedRowModel(),
2666
+ getPreSortedRowModel: () => table.getGroupedRowModel(),
2708
2667
  getSortedRowModel: () => {
2709
- if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2710
- instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
2668
+ if (!table._getSortedRowModel && table.options.getSortedRowModel) {
2669
+ table._getSortedRowModel = table.options.getSortedRowModel(table);
2711
2670
  }
2712
2671
 
2713
- if (instance.options.manualSorting || !instance._getSortedRowModel) {
2714
- return instance.getPreSortedRowModel();
2672
+ if (table.options.manualSorting || !table._getSortedRowModel) {
2673
+ return table.getPreSortedRowModel();
2715
2674
  }
2716
2675
 
2717
- return instance._getSortedRowModel();
2676
+ return table._getSortedRowModel();
2718
2677
  }
2719
2678
  };
2720
2679
  }
@@ -2728,29 +2687,29 @@
2728
2687
  ...state
2729
2688
  };
2730
2689
  },
2731
- getDefaultOptions: instance => {
2690
+ getDefaultOptions: table => {
2732
2691
  return {
2733
- onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2692
+ onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
2734
2693
  };
2735
2694
  },
2736
- createColumn: (column, instance) => {
2695
+ createColumn: (column, table) => {
2737
2696
  return {
2738
2697
  toggleVisibility: value => {
2739
2698
  if (column.getCanHide()) {
2740
- instance.setColumnVisibility(old => ({ ...old,
2699
+ table.setColumnVisibility(old => ({ ...old,
2741
2700
  [column.id]: value != null ? value : !column.getIsVisible()
2742
2701
  }));
2743
2702
  }
2744
2703
  },
2745
2704
  getIsVisible: () => {
2746
- var _instance$getState$co, _instance$getState$co2;
2705
+ var _table$getState$colum, _table$getState$colum2;
2747
2706
 
2748
- return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2707
+ return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2749
2708
  },
2750
2709
  getCanHide: () => {
2751
- var _column$columnDef$ena, _instance$options$ena;
2710
+ var _column$columnDef$ena, _table$options$enable;
2752
2711
 
2753
- return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2712
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
2754
2713
  },
2755
2714
  getToggleVisibilityHandler: () => {
2756
2715
  return e => {
@@ -2759,69 +2718,69 @@
2759
2718
  }
2760
2719
  };
2761
2720
  },
2762
- createRow: (row, instance) => {
2721
+ createRow: (row, table) => {
2763
2722
  return {
2764
- _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2723
+ _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
2765
2724
  return cells.filter(cell => cell.column.getIsVisible());
2766
2725
  }, {
2767
2726
  key: "development" === 'production' ,
2768
2727
  debug: () => {
2769
- var _instance$options$deb;
2728
+ var _table$options$debugA;
2770
2729
 
2771
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2730
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
2772
2731
  }
2773
2732
  }),
2774
2733
  getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2775
2734
  key: 'row.getVisibleCells',
2776
2735
  debug: () => {
2777
- var _instance$options$deb2;
2736
+ var _table$options$debugA2;
2778
2737
 
2779
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2738
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
2780
2739
  }
2781
2740
  })
2782
2741
  };
2783
2742
  },
2784
- createInstance: instance => {
2743
+ createTable: table => {
2785
2744
  const makeVisibleColumnsMethod = (key, getColumns) => {
2786
2745
  return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2787
2746
  return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2788
2747
  }, {
2789
2748
  key,
2790
2749
  debug: () => {
2791
- var _instance$options$deb3;
2750
+ var _table$options$debugA3;
2792
2751
 
2793
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2752
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2794
2753
  }
2795
2754
  });
2796
2755
  };
2797
2756
 
2798
2757
  return {
2799
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2800
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2801
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2802
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2803
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2804
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2758
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
2759
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
2760
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
2761
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
2762
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2763
+ setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2805
2764
  resetColumnVisibility: defaultState => {
2806
- var _instance$initialStat;
2765
+ var _table$initialState$c;
2807
2766
 
2808
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2767
+ table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
2809
2768
  },
2810
2769
  toggleAllColumnsVisible: value => {
2811
2770
  var _value;
2812
2771
 
2813
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2814
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2772
+ value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2773
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2815
2774
  [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2816
2775
  }), {}));
2817
2776
  },
2818
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2819
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2777
+ getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2778
+ getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2820
2779
  getToggleAllColumnsVisibilityHandler: () => {
2821
2780
  return e => {
2822
2781
  var _target;
2823
2782
 
2824
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2783
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2825
2784
  };
2826
2785
  }
2827
2786
  };
@@ -2830,24 +2789,24 @@
2830
2789
 
2831
2790
  const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
2832
2791
 
2833
- function createTableInstance(options) {
2792
+ function createTable(options) {
2834
2793
  var _options$initialState;
2835
2794
 
2836
2795
  if (options.debugAll || options.debugTable) {
2837
2796
  console.info('Creating Table Instance...');
2838
2797
  }
2839
2798
 
2840
- let instance = {
2799
+ let table = {
2841
2800
  _features: features
2842
2801
  };
2843
2802
 
2844
- const defaultOptions = instance._features.reduce((obj, feature) => {
2845
- return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
2803
+ const defaultOptions = table._features.reduce((obj, feature) => {
2804
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2846
2805
  }, {});
2847
2806
 
2848
2807
  const mergeOptions = options => {
2849
- if (instance.options.mergeOptions) {
2850
- return instance.options.mergeOptions(defaultOptions, options);
2808
+ if (table.options.mergeOptions) {
2809
+ return table.options.mergeOptions(defaultOptions, options);
2851
2810
  }
2852
2811
 
2853
2812
  return { ...defaultOptions,
@@ -2860,7 +2819,7 @@
2860
2819
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
2861
2820
  };
2862
2821
 
2863
- instance._features.forEach(feature => {
2822
+ table._features.forEach(feature => {
2864
2823
  var _feature$getInitialSt;
2865
2824
 
2866
2825
  initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
@@ -2893,48 +2852,37 @@
2893
2852
  }
2894
2853
  },
2895
2854
  reset: () => {
2896
- instance.setState(instance.initialState);
2855
+ table.setState(table.initialState);
2897
2856
  },
2898
2857
  setOptions: updater => {
2899
- const newOptions = functionalUpdate(updater, instance.options);
2900
- instance.options = mergeOptions(newOptions);
2901
- },
2902
- _render: (template, props) => {
2903
- if (typeof instance.options.render === 'function') {
2904
- return instance.options.render(template, props);
2905
- }
2906
-
2907
- if (typeof template === 'function') {
2908
- return template(props);
2909
- }
2910
-
2911
- return template;
2858
+ const newOptions = functionalUpdate(updater, table.options);
2859
+ table.options = mergeOptions(newOptions);
2912
2860
  },
2913
2861
  getState: () => {
2914
- return instance.options.state;
2862
+ return table.options.state;
2915
2863
  },
2916
2864
  setState: updater => {
2917
- instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
2865
+ table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2918
2866
  },
2919
2867
  _getRowId: (row, index, parent) => {
2920
- var _instance$options$get;
2868
+ var _table$options$getRow;
2921
2869
 
2922
- 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);
2870
+ 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);
2923
2871
  },
2924
2872
  getCoreRowModel: () => {
2925
- if (!instance._getCoreRowModel) {
2926
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2873
+ if (!table._getCoreRowModel) {
2874
+ table._getCoreRowModel = table.options.getCoreRowModel(table);
2927
2875
  }
2928
2876
 
2929
- return instance._getCoreRowModel();
2877
+ return table._getCoreRowModel();
2930
2878
  },
2931
2879
  // The final calls start at the bottom of the model,
2932
2880
  // expanded rows, which then work their way up
2933
2881
  getRowModel: () => {
2934
- return instance.getPaginationRowModel();
2882
+ return table.getPaginationRowModel();
2935
2883
  },
2936
2884
  getRow: id => {
2937
- const row = instance.getRowModel().rowsById[id];
2885
+ const row = table.getRowModel().rowsById[id];
2938
2886
 
2939
2887
  if (!row) {
2940
2888
  {
@@ -2944,7 +2892,7 @@
2944
2892
 
2945
2893
  return row;
2946
2894
  },
2947
- _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2895
+ _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
2948
2896
  var _defaultColumn;
2949
2897
 
2950
2898
  defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
@@ -2952,32 +2900,32 @@
2952
2900
  header: props => props.header.column.id,
2953
2901
  footer: props => props.header.column.id,
2954
2902
  cell: props => {
2955
- var _props$getValue$toStr, _props$getValue;
2903
+ var _toString, _props$renderValue;
2956
2904
 
2957
- 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;
2905
+ return (_toString = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _toString : null;
2958
2906
  },
2959
- ...instance._features.reduce((obj, feature) => {
2907
+ ...table._features.reduce((obj, feature) => {
2960
2908
  return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2961
2909
  }, {}),
2962
2910
  ...defaultColumn
2963
2911
  };
2964
2912
  }, {
2965
2913
  debug: () => {
2966
- var _instance$options$deb;
2914
+ var _table$options$debugA;
2967
2915
 
2968
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2916
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
2969
2917
  },
2970
2918
  key: 'getDefaultColumnDef'
2971
2919
  }),
2972
- _getColumnDefs: () => instance.options.columns,
2973
- getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2920
+ _getColumnDefs: () => table.options.columns,
2921
+ getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
2974
2922
  const recurseColumns = function (columnDefs, parent, depth) {
2975
2923
  if (depth === void 0) {
2976
2924
  depth = 0;
2977
2925
  }
2978
2926
 
2979
2927
  return columnDefs.map(columnDef => {
2980
- const column = createColumn(instance, columnDef, depth, parent);
2928
+ const column = createColumn(table, columnDef, depth, parent);
2981
2929
  column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2982
2930
  return column;
2983
2931
  });
@@ -2987,24 +2935,24 @@
2987
2935
  }, {
2988
2936
  key: 'getAllColumns',
2989
2937
  debug: () => {
2990
- var _instance$options$deb2;
2938
+ var _table$options$debugA2;
2991
2939
 
2992
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2940
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
2993
2941
  }
2994
2942
  }),
2995
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2943
+ getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
2996
2944
  return allColumns.flatMap(column => {
2997
2945
  return column.getFlatColumns();
2998
2946
  });
2999
2947
  }, {
3000
2948
  key: 'getAllFlatColumns',
3001
2949
  debug: () => {
3002
- var _instance$options$deb3;
2950
+ var _table$options$debugA3;
3003
2951
 
3004
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2952
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
3005
2953
  }
3006
2954
  }),
3007
- _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2955
+ _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
3008
2956
  return flatColumns.reduce((acc, column) => {
3009
2957
  acc[column.id] = column;
3010
2958
  return acc;
@@ -3012,24 +2960,24 @@
3012
2960
  }, {
3013
2961
  key: 'getAllFlatColumnsById',
3014
2962
  debug: () => {
3015
- var _instance$options$deb4;
2963
+ var _table$options$debugA4;
3016
2964
 
3017
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2965
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
3018
2966
  }
3019
2967
  }),
3020
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2968
+ getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
3021
2969
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
3022
2970
  return orderColumns(leafColumns);
3023
2971
  }, {
3024
2972
  key: 'getAllLeafColumns',
3025
2973
  debug: () => {
3026
- var _instance$options$deb5;
2974
+ var _table$options$debugA5;
3027
2975
 
3028
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2976
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
3029
2977
  }
3030
2978
  }),
3031
2979
  getColumn: columnId => {
3032
- const column = instance._getAllFlatColumnsById()[columnId];
2980
+ const column = table._getAllFlatColumnsById()[columnId];
3033
2981
 
3034
2982
  if (!column) {
3035
2983
  {
@@ -3042,76 +2990,20 @@
3042
2990
  return column;
3043
2991
  }
3044
2992
  };
3045
- Object.assign(instance, coreInstance);
2993
+ Object.assign(table, coreInstance);
3046
2994
 
3047
- instance._features.forEach(feature => {
3048
- return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
2995
+ table._features.forEach(feature => {
2996
+ return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
3049
2997
  });
3050
2998
 
3051
- return instance;
3052
- }
3053
-
3054
- //
3055
- function createTableFactory(opts) {
3056
- return () => createTable$1(undefined, undefined, opts);
3057
- } // A lot of returns in here are `as any` for a reason. Unless you
3058
- // can find a better way to do this, then don't worry about them
3059
-
3060
- function createTable$1(_, __, options) {
3061
- const table = {
3062
- generics: undefined,
3063
- options: options != null ? options : {
3064
- render: (() => {
3065
- throw new Error('');
3066
- })()
3067
- },
3068
- // setGenerics: () => table as any,
3069
- setRowType: () => table,
3070
- setTableMetaType: () => table,
3071
- setColumnMetaType: () => table,
3072
- setFilterMetaType: () => table,
3073
- setOptions: newOptions => createTable$1(_, __, { ...options,
3074
- ...newOptions
3075
- }),
3076
- createDisplayColumn: column => ({ ...column,
3077
- columnDefType: 'display'
3078
- }),
3079
- createGroup: column => ({ ...column,
3080
- columnDefType: 'group'
3081
- }),
3082
- createDataColumn: (accessor, column) => {
3083
- column = { ...column,
3084
- columnDefType: 'data',
3085
- id: column.id
3086
- };
3087
-
3088
- if (typeof accessor === 'string') {
3089
- var _column$id;
3090
-
3091
- return { ...column,
3092
- id: (_column$id = column.id) != null ? _column$id : accessor,
3093
- accessorKey: accessor
3094
- };
3095
- }
3096
-
3097
- if (typeof accessor === 'function') {
3098
- return { ...column,
3099
- accessorFn: accessor
3100
- };
3101
- }
3102
-
3103
- throw new Error('Invalid accessor');
3104
- },
3105
- createOptions: options => options
3106
- };
3107
2999
  return table;
3108
3000
  }
3109
3001
 
3110
- function createCell(instance, row, column, columnId) {
3002
+ function createCell(table, row, column, columnId) {
3111
3003
  const getRenderValue = () => {
3112
3004
  var _cell$getValue;
3113
3005
 
3114
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
3006
+ return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
3115
3007
  };
3116
3008
 
3117
3009
  const cell = {
@@ -3119,25 +3011,25 @@
3119
3011
  row,
3120
3012
  column,
3121
3013
  getValue: () => row.getValue(columnId),
3122
- renderCell: () => {
3123
- return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3124
- instance,
3125
- column,
3126
- row,
3127
- cell: cell,
3128
- getValue: getRenderValue
3129
- }) : null;
3130
- }
3014
+ renderValue: getRenderValue,
3015
+ getContext: () => ({
3016
+ table,
3017
+ column,
3018
+ row,
3019
+ cell: cell,
3020
+ getValue: cell.getValue,
3021
+ renderValue: cell.renderValue
3022
+ })
3131
3023
  };
3132
3024
 
3133
- instance._features.forEach(feature => {
3134
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
3025
+ table._features.forEach(feature => {
3026
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
3135
3027
  }, {});
3136
3028
 
3137
3029
  return cell;
3138
3030
  }
3139
3031
 
3140
- const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3032
+ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3141
3033
  let row = {
3142
3034
  id,
3143
3035
  index: rowIndex,
@@ -3149,7 +3041,7 @@
3149
3041
  return row._valuesCache[columnId];
3150
3042
  }
3151
3043
 
3152
- const column = instance.getColumn(columnId);
3044
+ const column = table.getColumn(columnId);
3153
3045
 
3154
3046
  if (!column.accessorFn) {
3155
3047
  return undefined;
@@ -3158,18 +3050,23 @@
3158
3050
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3159
3051
  return row._valuesCache[columnId];
3160
3052
  },
3053
+ renderValue: columnId => {
3054
+ var _row$getValue;
3055
+
3056
+ return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
3057
+ },
3161
3058
  subRows: subRows != null ? subRows : [],
3162
3059
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3163
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3060
+ getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
3164
3061
  return leafColumns.map(column => {
3165
- return createCell(instance, row, column, column.id);
3062
+ return createCell(table, row, column, column.id);
3166
3063
  });
3167
3064
  }, {
3168
3065
  key: 'row.getAllCells',
3169
3066
  debug: () => {
3170
- var _instance$options$deb;
3067
+ var _table$options$debugA;
3171
3068
 
3172
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3069
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
3173
3070
  }
3174
3071
  }),
3175
3072
  _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
@@ -3180,23 +3077,23 @@
3180
3077
  }, {
3181
3078
  key: "development" === 'production' ,
3182
3079
  debug: () => {
3183
- var _instance$options$deb2;
3080
+ var _table$options$debugA2;
3184
3081
 
3185
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3082
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
3186
3083
  }
3187
3084
  })
3188
3085
  };
3189
3086
 
3190
- for (let i = 0; i < instance._features.length; i++) {
3191
- const feature = instance._features[i];
3192
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3087
+ for (let i = 0; i < table._features.length; i++) {
3088
+ const feature = table._features[i];
3089
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
3193
3090
  }
3194
3091
 
3195
3092
  return row;
3196
3093
  };
3197
3094
 
3198
3095
  function getCoreRowModel() {
3199
- return instance => memo(() => [instance.options.data], data => {
3096
+ return table => memo(() => [table.options.data], data => {
3200
3097
  const rowModel = {
3201
3098
  rows: [],
3202
3099
  flatRows: [],
@@ -3218,18 +3115,18 @@
3218
3115
  // }
3219
3116
  // }
3220
3117
  // Make the row
3221
- const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3118
+ const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3222
3119
 
3223
3120
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3224
3121
 
3225
- rowModel.rowsById[row.id] = row; // Push instance row into parent
3122
+ rowModel.rowsById[row.id] = row; // Push table row into parent
3226
3123
 
3227
3124
  rows.push(row); // Get the original subrows
3228
3125
 
3229
- if (instance.options.getSubRows) {
3126
+ if (table.options.getSubRows) {
3230
3127
  var _row$originalSubRows;
3231
3128
 
3232
- row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3129
+ row.originalSubRows = table.options.getSubRows(originalRows[i], i); // Then recursively access them
3233
3130
 
3234
3131
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3235
3132
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
@@ -3245,24 +3142,24 @@
3245
3142
  }, {
3246
3143
  key: 'getRowModel',
3247
3144
  debug: () => {
3248
- var _instance$options$deb;
3145
+ var _table$options$debugA;
3249
3146
 
3250
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3147
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3251
3148
  },
3252
3149
  onChange: () => {
3253
- instance._autoResetPageIndex();
3150
+ table._autoResetPageIndex();
3254
3151
  }
3255
3152
  });
3256
3153
  }
3257
3154
 
3258
- function filterRows(rows, filterRowImpl, instance) {
3259
- if (instance.options.filterFromLeafRows) {
3260
- return filterRowModelFromLeafs(rows, filterRowImpl, instance);
3155
+ function filterRows(rows, filterRowImpl, table) {
3156
+ if (table.options.filterFromLeafRows) {
3157
+ return filterRowModelFromLeafs(rows, filterRowImpl, table);
3261
3158
  }
3262
3159
 
3263
- return filterRowModelFromRoot(rows, filterRowImpl, instance);
3160
+ return filterRowModelFromRoot(rows, filterRowImpl, table);
3264
3161
  }
3265
- function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3162
+ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3266
3163
  const newFilteredFlatRows = [];
3267
3164
  const newFilteredRowsById = {};
3268
3165
 
@@ -3276,7 +3173,7 @@
3276
3173
  let row = rowsToFilter[i];
3277
3174
 
3278
3175
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3279
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3176
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3280
3177
  newRow.columnFilters = row.columnFilters;
3281
3178
  newRow.subRows = recurseFilterRows(row.subRows);
3282
3179
 
@@ -3303,7 +3200,7 @@
3303
3200
  rowsById: newFilteredRowsById
3304
3201
  };
3305
3202
  }
3306
- function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3203
+ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3307
3204
  const newFilteredFlatRows = [];
3308
3205
  const newFilteredRowsById = {}; // Filters top level and nested rows
3309
3206
 
@@ -3320,7 +3217,7 @@
3320
3217
  var _row$subRows2;
3321
3218
 
3322
3219
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3323
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3220
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3324
3221
  newRow.subRows = recurseFilterRows(row.subRows);
3325
3222
  row = newRow;
3326
3223
  }
@@ -3342,7 +3239,7 @@
3342
3239
  }
3343
3240
 
3344
3241
  function getFilteredRowModel() {
3345
- return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3242
+ return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3346
3243
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3347
3244
  for (let i = 0; i < rowModel.flatRows.length; i++) {
3348
3245
  rowModel.flatRows[i].columnFilters = {};
@@ -3357,7 +3254,7 @@
3357
3254
  (columnFilters != null ? columnFilters : []).forEach(d => {
3358
3255
  var _filterFn$resolveFilt;
3359
3256
 
3360
- const column = instance.getColumn(d.id);
3257
+ const column = table.getColumn(d.id);
3361
3258
 
3362
3259
  if (!column) {
3363
3260
  {
@@ -3382,8 +3279,8 @@
3382
3279
  });
3383
3280
  });
3384
3281
  const filterableIds = columnFilters.map(d => d.id);
3385
- const globalFilterFn = instance.getGlobalFilterFn();
3386
- const globallyFilterableColumns = instance.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3282
+ const globalFilterFn = table.getGlobalFilterFn();
3283
+ const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3387
3284
 
3388
3285
  if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
3389
3286
  filterableIds.push('__global__');
@@ -3447,22 +3344,22 @@
3447
3344
  }; // Filter final rows using all of the active filters
3448
3345
 
3449
3346
 
3450
- return filterRows(rowModel.rows, filterRowsImpl, instance);
3347
+ return filterRows(rowModel.rows, filterRowsImpl, table);
3451
3348
  }, {
3452
3349
  key: 'getFilteredRowModel',
3453
3350
  debug: () => {
3454
- var _instance$options$deb;
3351
+ var _table$options$debugA;
3455
3352
 
3456
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3353
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3457
3354
  },
3458
3355
  onChange: () => {
3459
- instance._autoResetPageIndex();
3356
+ table._autoResetPageIndex();
3460
3357
  }
3461
3358
  });
3462
3359
  }
3463
3360
 
3464
3361
  function getFacetedRowModel() {
3465
- return (instance, columnId) => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter, instance.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3362
+ return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3466
3363
  if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3467
3364
  return preRowModel;
3468
3365
  }
@@ -3480,20 +3377,20 @@
3480
3377
  return true;
3481
3378
  };
3482
3379
 
3483
- return filterRows(preRowModel.rows, filterRowsImpl, instance);
3380
+ return filterRows(preRowModel.rows, filterRowsImpl, table);
3484
3381
  }, {
3485
3382
  key: 'getFacetedRowModel_' + columnId,
3486
3383
  debug: () => {
3487
- var _instance$options$deb;
3384
+ var _table$options$debugA;
3488
3385
 
3489
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3386
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3490
3387
  },
3491
3388
  onChange: () => {}
3492
3389
  });
3493
3390
  }
3494
3391
 
3495
3392
  function getFacetedUniqueValues() {
3496
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3393
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3497
3394
  let facetedUniqueValues = new Map();
3498
3395
 
3499
3396
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
@@ -3514,16 +3411,16 @@
3514
3411
  }, {
3515
3412
  key: 'getFacetedUniqueValues_' + columnId,
3516
3413
  debug: () => {
3517
- var _instance$options$deb;
3414
+ var _table$options$debugA;
3518
3415
 
3519
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3416
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3520
3417
  },
3521
3418
  onChange: () => {}
3522
3419
  });
3523
3420
  }
3524
3421
 
3525
3422
  function getFacetedMinMaxValues() {
3526
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3423
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3527
3424
  var _facetedRowModel$flat;
3528
3425
 
3529
3426
  const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
@@ -3550,27 +3447,27 @@
3550
3447
  }, {
3551
3448
  key: 'getFacetedMinMaxValues_' + columnId,
3552
3449
  debug: () => {
3553
- var _instance$options$deb;
3450
+ var _table$options$debugA;
3554
3451
 
3555
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3452
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3556
3453
  },
3557
3454
  onChange: () => {}
3558
3455
  });
3559
3456
  }
3560
3457
 
3561
3458
  function getSortedRowModel() {
3562
- return instance => memo(() => [instance.getState().sorting, instance.getPreSortedRowModel()], (sorting, rowModel) => {
3459
+ return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
3563
3460
  if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3564
3461
  return rowModel;
3565
3462
  }
3566
3463
 
3567
- const sortingState = instance.getState().sorting;
3464
+ const sortingState = table.getState().sorting;
3568
3465
  const sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
3569
3466
 
3570
- const availableSorting = sortingState.filter(sort => instance.getColumn(sort.id).getCanSort());
3467
+ const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3571
3468
  const columnInfoById = {};
3572
3469
  availableSorting.forEach(sortEntry => {
3573
- const column = instance.getColumn(sortEntry.id);
3470
+ const column = table.getColumn(sortEntry.id);
3574
3471
  columnInfoById[sortEntry.id] = {
3575
3472
  sortUndefined: column.columnDef.sortUndefined,
3576
3473
  invertSorting: column.columnDef.invertSorting,
@@ -3640,24 +3537,24 @@
3640
3537
  }, {
3641
3538
  key: 'getSortedRowModel',
3642
3539
  debug: () => {
3643
- var _instance$options$deb;
3540
+ var _table$options$debugA;
3644
3541
 
3645
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3542
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3646
3543
  },
3647
3544
  onChange: () => {
3648
- instance._autoResetPageIndex();
3545
+ table._autoResetPageIndex();
3649
3546
  }
3650
3547
  });
3651
3548
  }
3652
3549
 
3653
3550
  function getGroupedRowModel() {
3654
- return instance => memo(() => [instance.getState().grouping, instance.getPreGroupedRowModel()], (grouping, rowModel) => {
3551
+ return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
3655
3552
  if (!rowModel.rows.length || !grouping.length) {
3656
3553
  return rowModel;
3657
3554
  } // Filter the grouping list down to columns that exist
3658
3555
 
3659
3556
 
3660
- const existingGrouping = grouping.filter(columnId => instance.getColumn(columnId));
3557
+ const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
3661
3558
  const groupedFlatRows = [];
3662
3559
  const groupedRowsById = {}; // const onlyGroupedFlatRows: Row[] = [];
3663
3560
  // const onlyGroupedRowsById: Record<RowId, Row> = {};
@@ -3687,7 +3584,7 @@
3687
3584
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3688
3585
 
3689
3586
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3690
- const row = createRow(instance, id, undefined, index, depth);
3587
+ const row = createRow(table, id, undefined, index, depth);
3691
3588
  Object.assign(row, {
3692
3589
  groupingColumnId: columnId,
3693
3590
  groupingValue,
@@ -3714,7 +3611,7 @@
3714
3611
  } // Aggregate the values
3715
3612
 
3716
3613
 
3717
- const column = instance.getColumn(columnId);
3614
+ const column = table.getColumn(columnId);
3718
3615
  const aggregateFn = column.getAggregationFn();
3719
3616
 
3720
3617
  if (aggregateFn) {
@@ -3757,15 +3654,15 @@
3757
3654
  }, {
3758
3655
  key: 'getGroupedRowModel',
3759
3656
  debug: () => {
3760
- var _instance$options$deb;
3657
+ var _table$options$debugA;
3761
3658
 
3762
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3659
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3763
3660
  },
3764
3661
  onChange: () => {
3765
- instance._queue(() => {
3766
- instance._autoResetExpanded();
3662
+ table._queue(() => {
3663
+ table._autoResetExpanded();
3767
3664
 
3768
- instance._autoResetPageIndex();
3665
+ table._autoResetPageIndex();
3769
3666
  });
3770
3667
  }
3771
3668
  });
@@ -3788,7 +3685,7 @@
3788
3685
  }
3789
3686
 
3790
3687
  function getExpandedRowModel() {
3791
- return instance => memo(() => [instance.getState().expanded, instance.getPreExpandedRowModel(), instance.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3688
+ return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3792
3689
  if (!rowModel.rows.length || // Do not expand if rows are not included in pagination
3793
3690
  !paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3794
3691
  return rowModel;
@@ -3798,13 +3695,13 @@
3798
3695
  }, {
3799
3696
  key: 'getExpandedRowModel',
3800
3697
  debug: () => {
3801
- var _instance$options$deb;
3698
+ var _table$options$debugA;
3802
3699
 
3803
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3700
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3804
3701
  }
3805
3702
  });
3806
3703
  }
3807
- function expandRows(rowModel, instance) {
3704
+ function expandRows(rowModel, table) {
3808
3705
  const expandedRows = [];
3809
3706
 
3810
3707
  const handleRow = row => {
@@ -3826,7 +3723,7 @@
3826
3723
  }
3827
3724
 
3828
3725
  function getPaginationRowModel(opts) {
3829
- return instance => memo(() => [instance.getState().pagination, instance.getPrePaginationRowModel()], (pagination, rowModel) => {
3726
+ return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
3830
3727
  if (!rowModel.rows.length) {
3831
3728
  return rowModel;
3832
3729
  }
@@ -3845,7 +3742,7 @@
3845
3742
  rows = rows.slice(pageStart, pageEnd);
3846
3743
  let paginatedRowModel;
3847
3744
 
3848
- if (!instance.options.paginateExpandedRows) {
3745
+ if (!table.options.paginateExpandedRows) {
3849
3746
  paginatedRowModel = expandRows({
3850
3747
  rows,
3851
3748
  flatRows,
@@ -3874,15 +3771,17 @@
3874
3771
  }, {
3875
3772
  key: 'getPaginationRowModel',
3876
3773
  debug: () => {
3877
- var _instance$options$deb;
3774
+ var _table$options$debugA;
3878
3775
 
3879
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3776
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3880
3777
  }
3881
3778
  });
3882
3779
  }
3883
3780
 
3884
3781
  //
3885
- const render = (Comp, props) => !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
3782
+ function flexRender(Comp, props) {
3783
+ return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
3784
+ }
3886
3785
 
3887
3786
  function isReactComponent(component) {
3888
3787
  return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
@@ -3899,31 +3798,25 @@
3899
3798
  return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
3900
3799
  }
3901
3800
 
3902
- const createTable = createTableFactory({
3903
- render
3904
- }); // const useIsomorphicLayoutEffect =
3905
- // typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect
3906
-
3907
- function useTableInstance(table, options) {
3801
+ function useReactTable(options) {
3908
3802
  // Compose in the generic options to the user options
3909
- const resolvedOptions = { ...table.options,
3803
+ const resolvedOptions = {
3910
3804
  state: {},
3911
3805
  // Dummy state
3912
3806
  onStateChange: () => {},
3913
3807
  // noop
3914
- render,
3915
3808
  renderFallbackValue: null,
3916
3809
  ...options
3917
- }; // Create a new table instance and store it in state
3810
+ }; // Create a new table and store it in state
3918
3811
 
3919
- const [instanceRef] = React__namespace.useState(() => ({
3920
- current: createTableInstance(resolvedOptions)
3921
- })); // By default, manage table state here using the instance's initial state
3812
+ const [tableRef] = React__namespace.useState(() => ({
3813
+ current: createTable(resolvedOptions)
3814
+ })); // By default, manage table state here using the table's initial state
3922
3815
 
3923
- const [state, setState] = React__namespace.useState(() => instanceRef.current.initialState); // Compose the default state above with any user state. This will allow the user
3816
+ const [state, setState] = React__namespace.useState(() => tableRef.current.initialState); // Compose the default state above with any user state. This will allow the user
3924
3817
  // to only control a subset of the state if desired.
3925
3818
 
3926
- instanceRef.current.setOptions(prev => ({ ...prev,
3819
+ tableRef.current.setOptions(prev => ({ ...prev,
3927
3820
  ...options,
3928
3821
  state: { ...state,
3929
3822
  ...options.state
@@ -3935,7 +3828,7 @@
3935
3828
  options.onStateChange == null ? void 0 : options.onStateChange(updater);
3936
3829
  }
3937
3830
  }));
3938
- return instanceRef.current;
3831
+ return tableRef.current;
3939
3832
  }
3940
3833
 
3941
3834
  exports.ColumnSizing = ColumnSizing;
@@ -3954,12 +3847,11 @@
3954
3847
  exports.createColumn = createColumn;
3955
3848
  exports.createRow = createRow;
3956
3849
  exports.createTable = createTable;
3957
- exports.createTableFactory = createTableFactory;
3958
- exports.createTableInstance = createTableInstance;
3959
3850
  exports.defaultColumnSizing = defaultColumnSizing;
3960
3851
  exports.expandRows = expandRows;
3961
3852
  exports.filterFns = filterFns;
3962
3853
  exports.flattenBy = flattenBy;
3854
+ exports.flexRender = flexRender;
3963
3855
  exports.functionalUpdate = functionalUpdate;
3964
3856
  exports.getCoreRowModel = getCoreRowModel;
3965
3857
  exports.getExpandedRowModel = getExpandedRowModel;
@@ -3978,11 +3870,10 @@
3978
3870
  exports.orderColumns = orderColumns;
3979
3871
  exports.passiveEventSupported = passiveEventSupported;
3980
3872
  exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
3981
- exports.render = render;
3982
3873
  exports.selectRowsFn = selectRowsFn;
3983
3874
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
3984
3875
  exports.sortingFns = sortingFns;
3985
- exports.useTableInstance = useTableInstance;
3876
+ exports.useReactTable = useReactTable;
3986
3877
 
3987
3878
  Object.defineProperty(exports, '__esModule', { value: true });
3988
3879