@tanstack/react-table 8.0.12 → 8.1.0

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