@tanstack/table-core 8.0.11 → 8.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/build/cjs/core/cell.js +13 -13
  2. package/build/cjs/core/cell.js.map +1 -1
  3. package/build/cjs/core/column.js +20 -21
  4. package/build/cjs/core/column.js.map +1 -1
  5. package/build/cjs/core/headers.js +63 -68
  6. package/build/cjs/core/headers.js.map +1 -1
  7. package/build/cjs/core/row.js +16 -11
  8. package/build/cjs/core/row.js.map +1 -1
  9. package/build/cjs/core/{instance.js → table.js} +46 -57
  10. package/build/cjs/core/table.js.map +1 -0
  11. package/build/cjs/features/ColumnSizing.js +36 -36
  12. package/build/cjs/features/ColumnSizing.js.map +1 -1
  13. package/build/cjs/features/Expanding.js +34 -34
  14. package/build/cjs/features/Expanding.js.map +1 -1
  15. package/build/cjs/features/Filters.js +46 -52
  16. package/build/cjs/features/Filters.js.map +1 -1
  17. package/build/cjs/features/Grouping.js +24 -49
  18. package/build/cjs/features/Grouping.js.map +1 -1
  19. package/build/cjs/features/Ordering.js +8 -8
  20. package/build/cjs/features/Ordering.js.map +1 -1
  21. package/build/cjs/features/Pagination.js +37 -37
  22. package/build/cjs/features/Pagination.js.map +1 -1
  23. package/build/cjs/features/Pinning.js +33 -33
  24. package/build/cjs/features/Pinning.js.map +1 -1
  25. package/build/cjs/features/RowSelection.js +67 -67
  26. package/build/cjs/features/RowSelection.js.map +1 -1
  27. package/build/cjs/features/Sorting.js +36 -40
  28. package/build/cjs/features/Sorting.js.map +1 -1
  29. package/build/cjs/features/Visibility.js +30 -30
  30. package/build/cjs/features/Visibility.js.map +1 -1
  31. package/build/cjs/index.js +2 -4
  32. package/build/cjs/index.js.map +1 -1
  33. package/build/cjs/utils/filterRowsUtils.js +8 -8
  34. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  35. package/build/cjs/utils/getCoreRowModel.js +8 -8
  36. package/build/cjs/utils/getCoreRowModel.js.map +1 -1
  37. package/build/cjs/utils/getExpandedRowModel.js +4 -4
  38. package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
  39. package/build/cjs/utils/getFacetedMinMaxValues.js +3 -3
  40. package/build/cjs/utils/getFacetedMinMaxValues.js.map +1 -1
  41. package/build/cjs/utils/getFacetedRowModel.js +4 -4
  42. package/build/cjs/utils/getFacetedRowModel.js.map +1 -1
  43. package/build/cjs/utils/getFacetedUniqueValues.js +3 -3
  44. package/build/cjs/utils/getFacetedUniqueValues.js.map +1 -1
  45. package/build/cjs/utils/getFilteredRowModel.js +8 -8
  46. package/build/cjs/utils/getFilteredRowModel.js.map +1 -1
  47. package/build/cjs/utils/getGroupedRowModel.js +9 -9
  48. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  49. package/build/cjs/utils/getPaginationRowModel.js +4 -4
  50. package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
  51. package/build/cjs/utils/getSortedRowModel.js +7 -7
  52. package/build/cjs/utils/getSortedRowModel.js.map +1 -1
  53. package/build/cjs/utils.js +2 -2
  54. package/build/cjs/utils.js.map +1 -1
  55. package/build/esm/index.js +567 -670
  56. package/build/esm/index.js.map +1 -1
  57. package/build/stats-html.html +1 -1
  58. package/build/stats-react.json +1092 -0
  59. package/build/types/index.d.ts +759 -0
  60. package/build/umd/index.development.js +567 -671
  61. package/build/umd/index.development.js.map +1 -1
  62. package/build/umd/index.production.js +1 -1
  63. package/build/umd/index.production.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/core/cell.ts +34 -28
  66. package/src/core/column.ts +83 -72
  67. package/src/core/headers.ts +118 -149
  68. package/src/core/row.ts +31 -25
  69. package/src/core/{instance.ts → table.ts} +85 -116
  70. package/src/features/ColumnSizing.ts +45 -47
  71. package/src/features/Expanding.ts +53 -59
  72. package/src/features/Filters.ts +112 -132
  73. package/src/features/Grouping.ts +63 -112
  74. package/src/features/Ordering.ts +19 -21
  75. package/src/features/Pagination.ts +54 -55
  76. package/src/features/Pinning.ts +49 -61
  77. package/src/features/RowSelection.ts +97 -108
  78. package/src/features/Sorting.ts +57 -72
  79. package/src/features/Visibility.ts +48 -48
  80. package/src/index.ts +1 -2
  81. package/src/types.ts +64 -69
  82. package/src/utils/filterRowsUtils.ts +33 -28
  83. package/src/utils/getCoreRowModel.ts +22 -22
  84. package/src/utils/getExpandedRowModel.ts +15 -15
  85. package/src/utils/getFacetedMinMaxValues.ts +6 -6
  86. package/src/utils/getFacetedRowModel.ts +12 -12
  87. package/src/utils/getFacetedUniqueValues.ts +6 -6
  88. package/src/utils/getFilteredRowModel.ts +17 -17
  89. package/src/utils/getGroupedRowModel.ts +18 -21
  90. package/src/utils/getPaginationRowModel.ts +10 -13
  91. package/src/utils/getSortedRowModel.ts +14 -14
  92. package/src/utils.ts +8 -2
  93. package/build/cjs/core/instance.js.map +0 -1
  94. package/build/cjs/createTable.js +0 -72
  95. package/build/cjs/createTable.js.map +0 -1
  96. package/src/createTable.ts +0 -188
@@ -19,9 +19,9 @@
19
19
  }
20
20
  function noop() {//
21
21
  }
22
- function makeStateUpdater(key, instance) {
22
+ function makeStateUpdater(key, table) {
23
23
  return updater => {
24
- instance.setState(old => {
24
+ table.setState(old => {
25
25
  return { ...old,
26
26
  [key]: functionalUpdate(updater, old[key])
27
27
  };
@@ -91,36 +91,35 @@
91
91
  };
92
92
  }
93
93
 
94
- function createColumn(instance, columnDef, depth, parent) {
95
- var _ref, _columnDef$id;
94
+ function createColumn(table, columnDef, depth, parent) {
95
+ var _ref, _resolvedColumnDef$id;
96
96
 
97
- const defaultColumn = instance._getDefaultColumnDef();
97
+ const defaultColumn = table._getDefaultColumnDef();
98
98
 
99
- columnDef = { ...defaultColumn,
99
+ const resolvedColumnDef = { ...defaultColumn,
100
100
  ...columnDef
101
101
  };
102
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
102
+ let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : resolvedColumnDef.accessorKey) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
103
103
  let accessorFn;
104
104
 
105
- if (columnDef.accessorFn) {
106
- accessorFn = columnDef.accessorFn;
107
- } else if (columnDef.accessorKey) {
108
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
105
+ if (resolvedColumnDef.accessorFn) {
106
+ accessorFn = resolvedColumnDef.accessorFn;
107
+ } else if (resolvedColumnDef.accessorKey) {
108
+ accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
109
109
  }
110
110
 
111
111
  if (!id) {
112
112
  {
113
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
113
+ throw new Error(resolvedColumnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
114
114
  }
115
115
  }
116
116
 
117
117
  let column = {
118
- id: "" + id,
118
+ id: "" + String(id),
119
119
  accessorFn,
120
120
  parent: parent,
121
121
  depth,
122
- columnDef,
123
- columnDefType: columnDef.columnDefType,
122
+ columnDef: resolvedColumnDef,
124
123
  columns: [],
125
124
  getFlatColumns: memo(() => [true], () => {
126
125
  var _column$columns;
@@ -129,12 +128,12 @@
129
128
  }, {
130
129
  key: "development" === 'production' ,
131
130
  debug: () => {
132
- var _instance$options$deb;
131
+ var _table$options$debugA;
133
132
 
134
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
133
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
135
134
  }
136
135
  }),
137
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
136
+ getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
138
137
  var _column$columns2;
139
138
 
140
139
  if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
@@ -146,21 +145,21 @@
146
145
  }, {
147
146
  key: "development" === 'production' ,
148
147
  debug: () => {
149
- var _instance$options$deb2;
148
+ var _table$options$debugA2;
150
149
 
151
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
150
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
152
151
  }
153
152
  })
154
153
  };
155
- column = instance._features.reduce((obj, feature) => {
156
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
157
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
154
+ column = table._features.reduce((obj, feature) => {
155
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
156
+ }, column); // Yes, we have to convert table to uknown, because we know more than the compiler here.
158
157
 
159
158
  return column;
160
159
  }
161
160
 
162
161
  //
163
- function createHeader(instance, column, options) {
162
+ function createHeader(table, column, options) {
164
163
  var _options$id;
165
164
 
166
165
  const id = (_options$id = options.id) != null ? _options$id : column.id;
@@ -189,174 +188,169 @@
189
188
  recurseHeader(header);
190
189
  return leafHeaders;
191
190
  },
192
- renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
193
- instance,
191
+ getContext: () => ({
192
+ table,
194
193
  header: header,
195
194
  column
196
- }) : null,
197
- renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
198
- instance,
199
- header: header,
200
- column
201
- }) : null
195
+ })
202
196
  };
203
197
 
204
- instance._features.forEach(feature => {
205
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
198
+ table._features.forEach(feature => {
199
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
206
200
  });
207
201
 
208
202
  return header;
209
203
  }
210
204
 
211
205
  const Headers = {
212
- createInstance: instance => {
206
+ createTable: table => {
213
207
  return {
214
208
  // Header Groups
215
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
209
+ getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
216
210
  var _left$map$filter, _right$map$filter;
217
211
 
218
212
  const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
219
213
  const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
220
214
  const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
221
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
215
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
222
216
  return headerGroups;
223
217
  }, {
224
218
  key: 'getHeaderGroups',
225
219
  debug: () => {
226
- var _instance$options$deb;
220
+ var _table$options$debugA;
227
221
 
228
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
222
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
229
223
  }
230
224
  }),
231
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
225
+ getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
232
226
  leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
233
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
227
+ return buildHeaderGroups(allColumns, leafColumns, table, 'center');
234
228
  }, {
235
229
  key: 'getCenterHeaderGroups',
236
230
  debug: () => {
237
- var _instance$options$deb2;
231
+ var _table$options$debugA2;
238
232
 
239
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
233
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
240
234
  }
241
235
  }),
242
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
236
+ getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
243
237
  var _left$map$filter2;
244
238
 
245
239
  const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
246
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
240
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
247
241
  }, {
248
242
  key: 'getLeftHeaderGroups',
249
243
  debug: () => {
250
- var _instance$options$deb3;
244
+ var _table$options$debugA3;
251
245
 
252
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
246
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
253
247
  }
254
248
  }),
255
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
249
+ getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
256
250
  var _right$map$filter2;
257
251
 
258
252
  const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
259
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
253
+ return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
260
254
  }, {
261
255
  key: 'getRightHeaderGroups',
262
256
  debug: () => {
263
- var _instance$options$deb4;
257
+ var _table$options$debugA4;
264
258
 
265
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
259
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
266
260
  }
267
261
  }),
268
262
  // Footer Groups
269
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
263
+ getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
270
264
  return [...headerGroups].reverse();
271
265
  }, {
272
266
  key: 'getFooterGroups',
273
267
  debug: () => {
274
- var _instance$options$deb5;
268
+ var _table$options$debugA5;
275
269
 
276
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
270
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
277
271
  }
278
272
  }),
279
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
273
+ getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
280
274
  return [...headerGroups].reverse();
281
275
  }, {
282
276
  key: 'getLeftFooterGroups',
283
277
  debug: () => {
284
- var _instance$options$deb6;
278
+ var _table$options$debugA6;
285
279
 
286
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
280
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
287
281
  }
288
282
  }),
289
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
283
+ getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
290
284
  return [...headerGroups].reverse();
291
285
  }, {
292
286
  key: 'getCenterFooterGroups',
293
287
  debug: () => {
294
- var _instance$options$deb7;
288
+ var _table$options$debugA7;
295
289
 
296
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
290
+ return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
297
291
  }
298
292
  }),
299
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
293
+ getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
300
294
  return [...headerGroups].reverse();
301
295
  }, {
302
296
  key: 'getRightFooterGroups',
303
297
  debug: () => {
304
- var _instance$options$deb8;
298
+ var _table$options$debugA8;
305
299
 
306
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
300
+ return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
307
301
  }
308
302
  }),
309
303
  // Flat Headers
310
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
304
+ getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
311
305
  return headerGroups.map(headerGroup => {
312
306
  return headerGroup.headers;
313
307
  }).flat();
314
308
  }, {
315
309
  key: 'getFlatHeaders',
316
310
  debug: () => {
317
- var _instance$options$deb9;
311
+ var _table$options$debugA9;
318
312
 
319
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
313
+ return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
320
314
  }
321
315
  }),
322
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
316
+ getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
323
317
  return left.map(headerGroup => {
324
318
  return headerGroup.headers;
325
319
  }).flat();
326
320
  }, {
327
321
  key: 'getLeftFlatHeaders',
328
322
  debug: () => {
329
- var _instance$options$deb10;
323
+ var _table$options$debugA10;
330
324
 
331
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
325
+ return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
332
326
  }
333
327
  }),
334
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
328
+ getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
335
329
  return left.map(headerGroup => {
336
330
  return headerGroup.headers;
337
331
  }).flat();
338
332
  }, {
339
333
  key: 'getCenterFlatHeaders',
340
334
  debug: () => {
341
- var _instance$options$deb11;
335
+ var _table$options$debugA11;
342
336
 
343
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
337
+ return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
344
338
  }
345
339
  }),
346
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
340
+ getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
347
341
  return left.map(headerGroup => {
348
342
  return headerGroup.headers;
349
343
  }).flat();
350
344
  }, {
351
345
  key: 'getRightFlatHeaders',
352
346
  debug: () => {
353
- var _instance$options$deb12;
347
+ var _table$options$debugA12;
354
348
 
355
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
349
+ return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
356
350
  }
357
351
  }),
358
352
  // Leaf Headers
359
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
353
+ getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
360
354
  return flatHeaders.filter(header => {
361
355
  var _header$subHeaders;
362
356
 
@@ -365,12 +359,12 @@
365
359
  }, {
366
360
  key: 'getCenterLeafHeaders',
367
361
  debug: () => {
368
- var _instance$options$deb13;
362
+ var _table$options$debugA13;
369
363
 
370
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
364
+ return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
371
365
  }
372
366
  }),
373
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
367
+ getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
374
368
  return flatHeaders.filter(header => {
375
369
  var _header$subHeaders2;
376
370
 
@@ -379,12 +373,12 @@
379
373
  }, {
380
374
  key: 'getLeftLeafHeaders',
381
375
  debug: () => {
382
- var _instance$options$deb14;
376
+ var _table$options$debugA14;
383
377
 
384
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
378
+ return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
385
379
  }
386
380
  }),
387
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
381
+ getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
388
382
  return flatHeaders.filter(header => {
389
383
  var _header$subHeaders3;
390
384
 
@@ -393,12 +387,12 @@
393
387
  }, {
394
388
  key: 'getRightLeafHeaders',
395
389
  debug: () => {
396
- var _instance$options$deb15;
390
+ var _table$options$debugA15;
397
391
 
398
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
392
+ return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
399
393
  }
400
394
  }),
401
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
395
+ getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
402
396
  var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
403
397
 
404
398
  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 => {
@@ -407,15 +401,15 @@
407
401
  }, {
408
402
  key: 'getLeafHeaders',
409
403
  debug: () => {
410
- var _instance$options$deb16;
404
+ var _table$options$debugA16;
411
405
 
412
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
406
+ return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
413
407
  }
414
408
  })
415
409
  };
416
410
  }
417
411
  };
418
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
412
+ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
419
413
  var _headerGroups$0$heade, _headerGroups$;
420
414
 
421
415
  // Find the max depth of the columns:
@@ -469,12 +463,12 @@
469
463
  isPlaceholder = true;
470
464
  }
471
465
 
472
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
466
+ if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
473
467
  // This column is repeated. Add it as a sub header to the next batch
474
468
  latestPendingParentHeader.subHeaders.push(headerToGroup);
475
469
  } else {
476
470
  // This is a new header. Let's create it
477
- const header = createHeader(instance, column, {
471
+ const header = createHeader(table, column, {
478
472
  id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
479
473
  isPlaceholder,
480
474
  placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
@@ -498,7 +492,7 @@
498
492
  }
499
493
  };
500
494
 
501
- const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
495
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
502
496
  depth: maxDepth,
503
497
  index
504
498
  }));
@@ -570,23 +564,23 @@
570
564
  ...state
571
565
  };
572
566
  },
573
- getDefaultOptions: instance => {
567
+ getDefaultOptions: table => {
574
568
  return {
575
569
  columnResizeMode: 'onEnd',
576
- onColumnSizingChange: makeStateUpdater('columnSizing', instance),
577
- onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
570
+ onColumnSizingChange: makeStateUpdater('columnSizing', table),
571
+ onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
578
572
  };
579
573
  },
580
- createColumn: (column, instance) => {
574
+ createColumn: (column, table) => {
581
575
  return {
582
576
  getSize: () => {
583
577
  var _column$columnDef$min, _ref, _column$columnDef$max;
584
578
 
585
- const columnSize = instance.getState().columnSizing[column.id];
579
+ const columnSize = table.getState().columnSizing[column.id];
586
580
  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);
587
581
  },
588
582
  getStart: position => {
589
- const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
583
+ const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
590
584
  const index = columns.findIndex(d => d.id === column.id);
591
585
 
592
586
  if (index > 0) {
@@ -597,7 +591,7 @@
597
591
  return 0;
598
592
  },
599
593
  resetSize: () => {
600
- instance.setColumnSizing(_ref2 => {
594
+ table.setColumnSizing(_ref2 => {
601
595
  let {
602
596
  [column.id]: _,
603
597
  ...rest
@@ -606,16 +600,16 @@
606
600
  });
607
601
  },
608
602
  getCanResize: () => {
609
- var _column$columnDef$ena, _instance$options$ena;
603
+ var _column$columnDef$ena, _table$options$enable;
610
604
 
611
- return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
605
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
612
606
  },
613
607
  getIsResizing: () => {
614
- return instance.getState().columnSizingInfo.isResizingColumn === column.id;
608
+ return table.getState().columnSizingInfo.isResizingColumn === column.id;
615
609
  }
616
610
  };
617
611
  },
618
- createHeader: (header, instance) => {
612
+ createHeader: (header, table) => {
619
613
  return {
620
614
  getSize: () => {
621
615
  let sum = 0;
@@ -642,7 +636,7 @@
642
636
  return 0;
643
637
  },
644
638
  getResizeHandler: () => {
645
- const column = instance.getColumn(header.column.id);
639
+ const column = table.getColumn(header.column.id);
646
640
  const canResize = column.getCanResize();
647
641
  return e => {
648
642
  if (!canResize) {
@@ -667,7 +661,7 @@
667
661
  }
668
662
 
669
663
  let newColumnSizing = {};
670
- instance.setColumnSizingInfo(old => {
664
+ table.setColumnSizingInfo(old => {
671
665
  var _old$startOffset, _old$startSize;
672
666
 
673
667
  const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
@@ -682,8 +676,8 @@
682
676
  };
683
677
  });
684
678
 
685
- if (instance.options.columnResizeMode === 'onChange' || eventType === 'end') {
686
- instance.setColumnSizing(old => ({ ...old,
679
+ if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
680
+ table.setColumnSizing(old => ({ ...old,
687
681
  ...newColumnSizing
688
682
  }));
689
683
  }
@@ -693,7 +687,7 @@
693
687
 
694
688
  const onEnd = clientXPos => {
695
689
  updateOffset('end', clientXPos);
696
- instance.setColumnSizingInfo(old => ({ ...old,
690
+ table.setColumnSizingInfo(old => ({ ...old,
697
691
  isResizingColumn: false,
698
692
  startOffset: null,
699
693
  startSize: null,
@@ -720,7 +714,7 @@
720
714
  document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
721
715
  }
722
716
 
723
- instance.setColumnSizingInfo(old => ({ ...old,
717
+ table.setColumnSizingInfo(old => ({ ...old,
724
718
  startOffset: clientX,
725
719
  startSize,
726
720
  deltaOffset: 0,
@@ -732,47 +726,47 @@
732
726
  }
733
727
  };
734
728
  },
735
- createInstance: instance => {
729
+ createTable: table => {
736
730
  return {
737
- setColumnSizing: updater => instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater),
738
- setColumnSizingInfo: updater => instance.options.onColumnSizingInfoChange == null ? void 0 : instance.options.onColumnSizingInfoChange(updater),
731
+ setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
732
+ setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
739
733
  resetColumnSizing: defaultState => {
740
- var _instance$initialStat;
734
+ var _table$initialState$c;
741
735
 
742
- instance.setColumnSizing(defaultState ? {} : (_instance$initialStat = instance.initialState.columnSizing) != null ? _instance$initialStat : {});
736
+ table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
743
737
  },
744
738
  resetHeaderSizeInfo: defaultState => {
745
- var _instance$initialStat2;
739
+ var _table$initialState$c2;
746
740
 
747
- instance.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_instance$initialStat2 = instance.initialState.columnSizingInfo) != null ? _instance$initialStat2 : getDefaultColumnSizingInfoState());
741
+ table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
748
742
  },
749
743
  getTotalSize: () => {
750
- var _instance$getHeaderGr, _instance$getHeaderGr2;
744
+ var _table$getHeaderGroup, _table$getHeaderGroup2;
751
745
 
752
- return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
746
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
753
747
  return sum + header.getSize();
754
- }, 0)) != null ? _instance$getHeaderGr : 0;
748
+ }, 0)) != null ? _table$getHeaderGroup : 0;
755
749
  },
756
750
  getLeftTotalSize: () => {
757
- var _instance$getLeftHead, _instance$getLeftHead2;
751
+ var _table$getLeftHeaderG, _table$getLeftHeaderG2;
758
752
 
759
- return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
753
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
760
754
  return sum + header.getSize();
761
- }, 0)) != null ? _instance$getLeftHead : 0;
755
+ }, 0)) != null ? _table$getLeftHeaderG : 0;
762
756
  },
763
757
  getCenterTotalSize: () => {
764
- var _instance$getCenterHe, _instance$getCenterHe2;
758
+ var _table$getCenterHeade, _table$getCenterHeade2;
765
759
 
766
- return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
760
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
767
761
  return sum + header.getSize();
768
- }, 0)) != null ? _instance$getCenterHe : 0;
762
+ }, 0)) != null ? _table$getCenterHeade : 0;
769
763
  },
770
764
  getRightTotalSize: () => {
771
- var _instance$getRightHea, _instance$getRightHea2;
765
+ var _table$getRightHeader, _table$getRightHeader2;
772
766
 
773
- return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
767
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
774
768
  return sum + header.getSize();
775
- }, 0)) != null ? _instance$getRightHea : 0;
769
+ }, 0)) != null ? _table$getRightHeader : 0;
776
770
  }
777
771
  };
778
772
  }
@@ -815,65 +809,65 @@
815
809
  ...state
816
810
  };
817
811
  },
818
- getDefaultOptions: instance => {
812
+ getDefaultOptions: table => {
819
813
  return {
820
- onExpandedChange: makeStateUpdater('expanded', instance),
814
+ onExpandedChange: makeStateUpdater('expanded', table),
821
815
  paginateExpandedRows: true
822
816
  };
823
817
  },
824
- createInstance: instance => {
818
+ createTable: table => {
825
819
  let registered = false;
826
820
  let queued = false;
827
821
  return {
828
822
  _autoResetExpanded: () => {
829
- var _ref, _instance$options$aut;
823
+ var _ref, _table$options$autoRe;
830
824
 
831
825
  if (!registered) {
832
- instance._queue(() => {
826
+ table._queue(() => {
833
827
  registered = true;
834
828
  });
835
829
 
836
830
  return;
837
831
  }
838
832
 
839
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
833
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
840
834
  if (queued) return;
841
835
  queued = true;
842
836
 
843
- instance._queue(() => {
844
- instance.resetExpanded();
837
+ table._queue(() => {
838
+ table.resetExpanded();
845
839
  queued = false;
846
840
  });
847
841
  }
848
842
  },
849
- setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
843
+ setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
850
844
  toggleAllRowsExpanded: expanded => {
851
- if (expanded != null ? expanded : !instance.getIsAllRowsExpanded()) {
852
- instance.setExpanded(true);
845
+ if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
846
+ table.setExpanded(true);
853
847
  } else {
854
- instance.setExpanded({});
848
+ table.setExpanded({});
855
849
  }
856
850
  },
857
851
  resetExpanded: defaultState => {
858
- var _instance$initialStat, _instance$initialStat2;
852
+ var _table$initialState$e, _table$initialState;
859
853
 
860
- instance.setExpanded(defaultState ? {} : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.expanded) != null ? _instance$initialStat : {});
854
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
861
855
  },
862
856
  getCanSomeRowsExpand: () => {
863
- return instance.getRowModel().flatRows.some(row => row.getCanExpand());
857
+ return table.getRowModel().flatRows.some(row => row.getCanExpand());
864
858
  },
865
859
  getToggleAllRowsExpandedHandler: () => {
866
860
  return e => {
867
861
  e.persist == null ? void 0 : e.persist();
868
- instance.toggleAllRowsExpanded();
862
+ table.toggleAllRowsExpanded();
869
863
  };
870
864
  },
871
865
  getIsSomeRowsExpanded: () => {
872
- const expanded = instance.getState().expanded;
866
+ const expanded = table.getState().expanded;
873
867
  return expanded === true || Object.values(expanded).some(Boolean);
874
868
  },
875
869
  getIsAllRowsExpanded: () => {
876
- const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
870
+ const expanded = table.getState().expanded; // If expanded is true, save some cycles and return true
877
871
 
878
872
  if (typeof expanded === 'boolean') {
879
873
  return expanded === true;
@@ -884,7 +878,7 @@
884
878
  } // If any row is not expanded, return false
885
879
 
886
880
 
887
- if (instance.getRowModel().flatRows.some(row => row.getIsExpanded())) {
881
+ if (table.getRowModel().flatRows.some(row => row.getIsExpanded())) {
888
882
  return false;
889
883
  } // They must all be expanded :shrug:
890
884
 
@@ -893,38 +887,38 @@
893
887
  },
894
888
  getExpandedDepth: () => {
895
889
  let maxDepth = 0;
896
- const rowIds = instance.getState().expanded === true ? Object.keys(instance.getRowModel().rowsById) : Object.keys(instance.getState().expanded);
890
+ const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
897
891
  rowIds.forEach(id => {
898
892
  const splitId = id.split('.');
899
893
  maxDepth = Math.max(maxDepth, splitId.length);
900
894
  });
901
895
  return maxDepth;
902
896
  },
903
- getPreExpandedRowModel: () => instance.getSortedRowModel(),
897
+ getPreExpandedRowModel: () => table.getSortedRowModel(),
904
898
  getExpandedRowModel: () => {
905
- if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
906
- instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
899
+ if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
900
+ table._getExpandedRowModel = table.options.getExpandedRowModel(table);
907
901
  }
908
902
 
909
- if (instance.options.manualExpanding || !instance._getExpandedRowModel) {
910
- return instance.getPreExpandedRowModel();
903
+ if (table.options.manualExpanding || !table._getExpandedRowModel) {
904
+ return table.getPreExpandedRowModel();
911
905
  }
912
906
 
913
- return instance._getExpandedRowModel();
907
+ return table._getExpandedRowModel();
914
908
  }
915
909
  };
916
910
  },
917
- createRow: (row, instance) => {
911
+ createRow: (row, table) => {
918
912
  return {
919
913
  toggleExpanded: expanded => {
920
- instance.setExpanded(old => {
914
+ table.setExpanded(old => {
921
915
  var _expanded;
922
916
 
923
917
  const exists = old === true ? true : !!(old != null && old[row.id]);
924
918
  let oldExpanded = {};
925
919
 
926
920
  if (old === true) {
927
- Object.keys(instance.getRowModel().rowsById).forEach(rowId => {
921
+ Object.keys(table.getRowModel().rowsById).forEach(rowId => {
928
922
  oldExpanded[rowId] = true;
929
923
  });
930
924
  } else {
@@ -951,15 +945,15 @@
951
945
  });
952
946
  },
953
947
  getIsExpanded: () => {
954
- var _instance$options$get;
948
+ var _table$options$getIsR;
955
949
 
956
- const expanded = instance.getState().expanded;
957
- 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]));
950
+ const expanded = table.getState().expanded;
951
+ 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]));
958
952
  },
959
953
  getCanExpand: () => {
960
- var _instance$options$get2, _instance$options$ena, _row$subRows;
954
+ var _table$options$getRow, _table$options$enable, _row$subRows;
961
955
 
962
- 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);
956
+ 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);
963
957
  },
964
958
  getToggleExpandedHandler: () => {
965
959
  const canExpand = row.getCanExpand();
@@ -1095,24 +1089,24 @@
1095
1089
  ...state
1096
1090
  };
1097
1091
  },
1098
- getDefaultOptions: instance => {
1092
+ getDefaultOptions: table => {
1099
1093
  return {
1100
- onColumnFiltersChange: makeStateUpdater('columnFilters', instance),
1101
- onGlobalFilterChange: makeStateUpdater('globalFilter', instance),
1094
+ onColumnFiltersChange: makeStateUpdater('columnFilters', table),
1095
+ onGlobalFilterChange: makeStateUpdater('globalFilter', table),
1102
1096
  filterFromLeafRows: false,
1103
1097
  globalFilterFn: 'auto',
1104
1098
  getColumnCanGlobalFilter: column => {
1105
- var _instance$getCoreRowM, _instance$getCoreRowM2;
1099
+ var _table$getCoreRowMode, _table$getCoreRowMode2;
1106
1100
 
1107
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1101
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1108
1102
  return typeof value === 'string';
1109
1103
  }
1110
1104
  };
1111
1105
  },
1112
- createColumn: (column, instance) => {
1106
+ createColumn: (column, table) => {
1113
1107
  return {
1114
1108
  getAutoFilterFn: () => {
1115
- const firstRow = instance.getCoreRowModel().flatRows[0];
1109
+ const firstRow = table.getCoreRowModel().flatRows[0];
1116
1110
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1117
1111
 
1118
1112
  if (typeof value === 'string') {
@@ -1138,34 +1132,31 @@
1138
1132
  return filterFns.weakEquals;
1139
1133
  },
1140
1134
  getFilterFn: () => {
1141
- var _ref;
1142
-
1143
- const userFilterFns = instance.options.filterFns;
1144
- 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];
1135
+ return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : filterFns[column.columnDef.filterFn];
1145
1136
  },
1146
1137
  getCanFilter: () => {
1147
- var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
1138
+ var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
1148
1139
 
1149
- 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;
1140
+ 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;
1150
1141
  },
1151
1142
  getCanGlobalFilter: () => {
1152
- var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1143
+ var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1153
1144
 
1154
- 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;
1145
+ 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;
1155
1146
  },
1156
1147
  getIsFiltered: () => column.getFilterIndex() > -1,
1157
1148
  getFilterValue: () => {
1158
- var _instance$getState$co, _instance$getState$co2;
1149
+ var _table$getState$colum, _table$getState$colum2;
1159
1150
 
1160
- 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;
1151
+ 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;
1161
1152
  },
1162
1153
  getFilterIndex: () => {
1163
- var _instance$getState$co3, _instance$getState$co4;
1154
+ var _table$getState$colum3, _table$getState$colum4;
1164
1155
 
1165
- 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;
1156
+ 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;
1166
1157
  },
1167
1158
  setFilterValue: value => {
1168
- instance.setColumnFilters(old => {
1159
+ table.setColumnFilters(old => {
1169
1160
  const filterFn = column.getFilterFn();
1170
1161
  const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1171
1162
  const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined); //
@@ -1200,15 +1191,15 @@
1200
1191
  return [newFilterObj];
1201
1192
  });
1202
1193
  },
1203
- _getFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, column.id),
1194
+ _getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
1204
1195
  getFacetedRowModel: () => {
1205
1196
  if (!column._getFacetedRowModel) {
1206
- return instance.getPreFilteredRowModel();
1197
+ return table.getPreFilteredRowModel();
1207
1198
  }
1208
1199
 
1209
1200
  return column._getFacetedRowModel();
1210
1201
  },
1211
- _getFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, column.id),
1202
+ _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
1212
1203
  getFacetedUniqueValues: () => {
1213
1204
  if (!column._getFacetedUniqueValues) {
1214
1205
  return new Map();
@@ -1216,7 +1207,7 @@
1216
1207
 
1217
1208
  return column._getFacetedUniqueValues();
1218
1209
  },
1219
- _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1210
+ _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
1220
1211
  getFacetedMinMaxValues: () => {
1221
1212
  if (!column._getFacetedMinMaxValues) {
1222
1213
  return undefined;
@@ -1228,28 +1219,25 @@
1228
1219
 
1229
1220
  };
1230
1221
  },
1231
- createRow: (row, instance) => {
1222
+ createRow: (row, table) => {
1232
1223
  return {
1233
1224
  columnFilters: {},
1234
1225
  columnFiltersMeta: {}
1235
1226
  };
1236
1227
  },
1237
- createInstance: instance => {
1228
+ createTable: table => {
1238
1229
  return {
1239
1230
  getGlobalAutoFilterFn: () => {
1240
1231
  return filterFns.includesString;
1241
1232
  },
1242
1233
  getGlobalFilterFn: () => {
1243
- var _ref2;
1244
-
1245
1234
  const {
1246
- filterFns: userFilterFns,
1247
1235
  globalFilterFn: globalFilterFn
1248
- } = instance.options;
1249
- return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? instance.getGlobalAutoFilterFn() : (_ref2 = userFilterFns == null ? void 0 : userFilterFns[globalFilterFn]) != null ? _ref2 : filterFns[globalFilterFn];
1236
+ } = table.options;
1237
+ return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : filterFns[globalFilterFn];
1250
1238
  },
1251
1239
  setColumnFilters: updater => {
1252
- const leafColumns = instance.getAllLeafColumns();
1240
+ const leafColumns = table.getAllLeafColumns();
1253
1241
 
1254
1242
  const updateFn = old => {
1255
1243
  var _functionalUpdate;
@@ -1269,51 +1257,51 @@
1269
1257
  });
1270
1258
  };
1271
1259
 
1272
- instance.options.onColumnFiltersChange == null ? void 0 : instance.options.onColumnFiltersChange(updateFn);
1260
+ table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1273
1261
  },
1274
1262
  setGlobalFilter: updater => {
1275
- instance.options.onGlobalFilterChange == null ? void 0 : instance.options.onGlobalFilterChange(updater);
1263
+ table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1276
1264
  },
1277
1265
  resetGlobalFilter: defaultState => {
1278
- instance.setGlobalFilter(defaultState ? undefined : instance.initialState.globalFilter);
1266
+ table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1279
1267
  },
1280
1268
  resetColumnFilters: defaultState => {
1281
- var _instance$initialStat, _instance$initialStat2;
1269
+ var _table$initialState$c, _table$initialState;
1282
1270
 
1283
- instance.setColumnFilters(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnFilters) != null ? _instance$initialStat : []);
1271
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1284
1272
  },
1285
- getPreFilteredRowModel: () => instance.getCoreRowModel(),
1286
- _getFilteredRowModel: instance.options.getFilteredRowModel && instance.options.getFilteredRowModel(instance),
1273
+ getPreFilteredRowModel: () => table.getCoreRowModel(),
1274
+ _getFilteredRowModel: table.options.getFilteredRowModel && table.options.getFilteredRowModel(table),
1287
1275
  getFilteredRowModel: () => {
1288
- if (instance.options.manualFiltering || !instance._getFilteredRowModel) {
1289
- return instance.getPreFilteredRowModel();
1276
+ if (table.options.manualFiltering || !table._getFilteredRowModel) {
1277
+ return table.getPreFilteredRowModel();
1290
1278
  }
1291
1279
 
1292
- return instance._getFilteredRowModel();
1280
+ return table._getFilteredRowModel();
1293
1281
  },
1294
- _getGlobalFacetedRowModel: instance.options.getFacetedRowModel && instance.options.getFacetedRowModel(instance, '__global__'),
1282
+ _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
1295
1283
  getGlobalFacetedRowModel: () => {
1296
- if (instance.options.manualFiltering || !instance._getGlobalFacetedRowModel) {
1297
- return instance.getPreFilteredRowModel();
1284
+ if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
1285
+ return table.getPreFilteredRowModel();
1298
1286
  }
1299
1287
 
1300
- return instance._getGlobalFacetedRowModel();
1288
+ return table._getGlobalFacetedRowModel();
1301
1289
  },
1302
- _getGlobalFacetedUniqueValues: instance.options.getFacetedUniqueValues && instance.options.getFacetedUniqueValues(instance, '__global__'),
1290
+ _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
1303
1291
  getGlobalFacetedUniqueValues: () => {
1304
- if (!instance._getGlobalFacetedUniqueValues) {
1292
+ if (!table._getGlobalFacetedUniqueValues) {
1305
1293
  return new Map();
1306
1294
  }
1307
1295
 
1308
- return instance._getGlobalFacetedUniqueValues();
1296
+ return table._getGlobalFacetedUniqueValues();
1309
1297
  },
1310
- _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1298
+ _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
1311
1299
  getGlobalFacetedMinMaxValues: () => {
1312
- if (!instance._getGlobalFacetedMinMaxValues) {
1300
+ if (!table._getGlobalFacetedMinMaxValues) {
1313
1301
  return;
1314
1302
  }
1315
1303
 
1316
- return instance._getGlobalFacetedMinMaxValues();
1304
+ return table._getGlobalFacetedMinMaxValues();
1317
1305
  }
1318
1306
  };
1319
1307
  }
@@ -1434,9 +1422,9 @@
1434
1422
  getDefaultColumnDef: () => {
1435
1423
  return {
1436
1424
  aggregatedCell: props => {
1437
- var _props$getValue$toStr, _props$getValue;
1425
+ var _toString, _props$getValue;
1438
1426
 
1439
- 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;
1427
+ return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1440
1428
  },
1441
1429
  aggregationFn: 'auto'
1442
1430
  };
@@ -1447,16 +1435,16 @@
1447
1435
  ...state
1448
1436
  };
1449
1437
  },
1450
- getDefaultOptions: instance => {
1438
+ getDefaultOptions: table => {
1451
1439
  return {
1452
- onGroupingChange: makeStateUpdater('grouping', instance),
1440
+ onGroupingChange: makeStateUpdater('grouping', table),
1453
1441
  groupedColumnMode: 'reorder'
1454
1442
  };
1455
1443
  },
1456
- createColumn: (column, instance) => {
1444
+ createColumn: (column, table) => {
1457
1445
  return {
1458
1446
  toggleGrouping: () => {
1459
- instance.setGrouping(old => {
1447
+ table.setGrouping(old => {
1460
1448
  // Find any existing grouping for this column
1461
1449
  if (old != null && old.includes(column.id)) {
1462
1450
  return old.filter(d => d !== column.id);
@@ -1468,17 +1456,17 @@
1468
1456
  getCanGroup: () => {
1469
1457
  var _ref, _ref2, _ref3, _column$columnDef$ena;
1470
1458
 
1471
- 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;
1459
+ 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;
1472
1460
  },
1473
1461
  getIsGrouped: () => {
1474
- var _instance$getState$gr;
1462
+ var _table$getState$group;
1475
1463
 
1476
- return (_instance$getState$gr = instance.getState().grouping) == null ? void 0 : _instance$getState$gr.includes(column.id);
1464
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1477
1465
  },
1478
1466
  getGroupedIndex: () => {
1479
- var _instance$getState$gr2;
1467
+ var _table$getState$group2;
1480
1468
 
1481
- return (_instance$getState$gr2 = instance.getState().grouping) == null ? void 0 : _instance$getState$gr2.indexOf(column.id);
1469
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1482
1470
  },
1483
1471
  getToggleGroupingHandler: () => {
1484
1472
  const canGroup = column.getCanGroup();
@@ -1488,7 +1476,7 @@
1488
1476
  };
1489
1477
  },
1490
1478
  getAutoAggregationFn: () => {
1491
- const firstRow = instance.getCoreRowModel().flatRows[0];
1479
+ const firstRow = table.getCoreRowModel().flatRows[0];
1492
1480
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1493
1481
 
1494
1482
  if (typeof value === 'number') {
@@ -1500,37 +1488,33 @@
1500
1488
  }
1501
1489
  },
1502
1490
  getAggregationFn: () => {
1503
- var _ref4;
1504
-
1505
- const userAggregationFns = instance.options.aggregationFns;
1506
-
1507
1491
  if (!column) {
1508
1492
  throw new Error();
1509
1493
  }
1510
1494
 
1511
- 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];
1495
+ return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : aggregationFns[column.columnDef.aggregationFn];
1512
1496
  }
1513
1497
  };
1514
1498
  },
1515
- createInstance: instance => {
1499
+ createTable: table => {
1516
1500
  return {
1517
- setGrouping: updater => instance.options.onGroupingChange == null ? void 0 : instance.options.onGroupingChange(updater),
1501
+ setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1518
1502
  resetGrouping: defaultState => {
1519
- var _instance$initialStat, _instance$initialStat2;
1503
+ var _table$initialState$g, _table$initialState;
1520
1504
 
1521
- instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1505
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1522
1506
  },
1523
- getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1507
+ getPreGroupedRowModel: () => table.getFilteredRowModel(),
1524
1508
  getGroupedRowModel: () => {
1525
- if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1526
- instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
1509
+ if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
1510
+ table._getGroupedRowModel = table.options.getGroupedRowModel(table);
1527
1511
  }
1528
1512
 
1529
- if (instance.options.manualGrouping || !instance._getGroupedRowModel) {
1530
- return instance.getPreGroupedRowModel();
1513
+ if (table.options.manualGrouping || !table._getGroupedRowModel) {
1514
+ return table.getPreGroupedRowModel();
1531
1515
  }
1532
1516
 
1533
- return instance._getGroupedRowModel();
1517
+ return table._getGroupedRowModel();
1534
1518
  }
1535
1519
  };
1536
1520
  },
@@ -1540,12 +1524,7 @@
1540
1524
  _groupingValuesCache: {}
1541
1525
  };
1542
1526
  },
1543
- createCell: (cell, column, row, instance) => {
1544
- const getRenderValue = () => {
1545
- var _cell$getValue;
1546
-
1547
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
1548
- };
1527
+ createCell: (cell, column, row, table) => {
1549
1528
 
1550
1529
  return {
1551
1530
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
@@ -1554,22 +1533,6 @@
1554
1533
  var _row$subRows;
1555
1534
 
1556
1535
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1557
- },
1558
- renderAggregatedCell: () => {
1559
- {
1560
- if (!column.columnDef.aggregatedCell) {
1561
- console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
1562
- }
1563
- }
1564
-
1565
- const template = column.columnDef.aggregatedCell || column.columnDef.cell;
1566
- return template ? instance._render(template, {
1567
- instance,
1568
- column,
1569
- row,
1570
- cell,
1571
- getValue: getRenderValue
1572
- }) : null;
1573
1536
  }
1574
1537
  };
1575
1538
  }
@@ -1597,20 +1560,20 @@
1597
1560
  ...state
1598
1561
  };
1599
1562
  },
1600
- getDefaultOptions: instance => {
1563
+ getDefaultOptions: table => {
1601
1564
  return {
1602
- onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1565
+ onColumnOrderChange: makeStateUpdater('columnOrder', table)
1603
1566
  };
1604
1567
  },
1605
- createInstance: instance => {
1568
+ createTable: table => {
1606
1569
  return {
1607
- setColumnOrder: updater => instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater),
1570
+ setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1608
1571
  resetColumnOrder: defaultState => {
1609
- var _instance$initialStat;
1572
+ var _table$initialState$c;
1610
1573
 
1611
- instance.setColumnOrder(defaultState ? [] : (_instance$initialStat = instance.initialState.columnOrder) != null ? _instance$initialStat : []);
1574
+ table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
1612
1575
  },
1613
- _getOrderColumnsFn: memo(() => [instance.getState().columnOrder, instance.getState().grouping, instance.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1576
+ _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1614
1577
  // Sort grouped columns to the start of the column list
1615
1578
  // before the headers are built
1616
1579
  let orderedColumns = []; // If there is no order, return the normal columns
@@ -1638,7 +1601,7 @@
1638
1601
 
1639
1602
  return orderColumns(orderedColumns, grouping, groupedColumnMode);
1640
1603
  }, {
1641
- key: 'getOrderColumnsFn' // debug: () => instance.options.debugAll ?? instance.options.debugTable,
1604
+ key: 'getOrderColumnsFn' // debug: () => table.options.debugAll ?? table.options.debugTable,
1642
1605
 
1643
1606
  })
1644
1607
  };
@@ -1662,32 +1625,32 @@
1662
1625
  }
1663
1626
  };
1664
1627
  },
1665
- getDefaultOptions: instance => {
1628
+ getDefaultOptions: table => {
1666
1629
  return {
1667
- onPaginationChange: makeStateUpdater('pagination', instance)
1630
+ onPaginationChange: makeStateUpdater('pagination', table)
1668
1631
  };
1669
1632
  },
1670
- createInstance: instance => {
1633
+ createTable: table => {
1671
1634
  let registered = false;
1672
1635
  let queued = false;
1673
1636
  return {
1674
1637
  _autoResetPageIndex: () => {
1675
- var _ref, _instance$options$aut;
1638
+ var _ref, _table$options$autoRe;
1676
1639
 
1677
1640
  if (!registered) {
1678
- instance._queue(() => {
1641
+ table._queue(() => {
1679
1642
  registered = true;
1680
1643
  });
1681
1644
 
1682
1645
  return;
1683
1646
  }
1684
1647
 
1685
- if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetPageIndex) != null ? _ref : !instance.options.manualPagination) {
1648
+ if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
1686
1649
  if (queued) return;
1687
1650
  queued = true;
1688
1651
 
1689
- instance._queue(() => {
1690
- instance.resetPageIndex();
1652
+ table._queue(() => {
1653
+ table.resetPageIndex();
1691
1654
  queued = false;
1692
1655
  });
1693
1656
  }
@@ -1698,17 +1661,17 @@
1698
1661
  return newState;
1699
1662
  };
1700
1663
 
1701
- return instance.options.onPaginationChange == null ? void 0 : instance.options.onPaginationChange(safeUpdater);
1664
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1702
1665
  },
1703
1666
  resetPagination: defaultState => {
1704
- var _instance$initialStat;
1667
+ var _table$initialState$p;
1705
1668
 
1706
- instance.setPagination(defaultState ? getDefaultPaginationState() : (_instance$initialStat = instance.initialState.pagination) != null ? _instance$initialStat : getDefaultPaginationState());
1669
+ table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
1707
1670
  },
1708
1671
  setPageIndex: updater => {
1709
- instance.setPagination(old => {
1672
+ table.setPagination(old => {
1710
1673
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1711
- const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1674
+ const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
1712
1675
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1713
1676
  return { ...old,
1714
1677
  pageIndex
@@ -1716,17 +1679,17 @@
1716
1679
  });
1717
1680
  },
1718
1681
  resetPageIndex: defaultState => {
1719
- var _instance$initialStat2, _instance$initialStat3, _instance$initialStat4;
1682
+ var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1720
1683
 
1721
- 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);
1684
+ 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);
1722
1685
  },
1723
1686
  resetPageSize: defaultState => {
1724
- var _instance$initialStat5, _instance$initialStat6, _instance$initialStat7;
1687
+ var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1725
1688
 
1726
- 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);
1689
+ 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);
1727
1690
  },
1728
1691
  setPageSize: updater => {
1729
- instance.setPagination(old => {
1692
+ table.setPagination(old => {
1730
1693
  const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
1731
1694
  const topRowIndex = old.pageSize * old.pageIndex;
1732
1695
  const pageIndex = Math.floor(topRowIndex / pageSize);
@@ -1736,10 +1699,10 @@
1736
1699
  };
1737
1700
  });
1738
1701
  },
1739
- setPageCount: updater => instance.setPagination(old => {
1740
- var _instance$options$pag;
1702
+ setPageCount: updater => table.setPagination(old => {
1703
+ var _table$options$pageCo;
1741
1704
 
1742
- let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1705
+ let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
1743
1706
 
1744
1707
  if (typeof newPageCount === 'number') {
1745
1708
  newPageCount = Math.max(-1, newPageCount);
@@ -1749,7 +1712,7 @@
1749
1712
  pageCount: newPageCount
1750
1713
  };
1751
1714
  }),
1752
- getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1715
+ getPageOptions: memo(() => [table.getPageCount()], pageCount => {
1753
1716
  let pageOptions = [];
1754
1717
 
1755
1718
  if (pageCount && pageCount > 0) {
@@ -1760,17 +1723,17 @@
1760
1723
  }, {
1761
1724
  key: 'getPageOptions',
1762
1725
  debug: () => {
1763
- var _instance$options$deb;
1726
+ var _table$options$debugA;
1764
1727
 
1765
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
1728
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
1766
1729
  }
1767
1730
  }),
1768
- getCanPreviousPage: () => instance.getState().pagination.pageIndex > 0,
1731
+ getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
1769
1732
  getCanNextPage: () => {
1770
1733
  const {
1771
1734
  pageIndex
1772
- } = instance.getState().pagination;
1773
- const pageCount = instance.getPageCount();
1735
+ } = table.getState().pagination;
1736
+ const pageCount = table.getPageCount();
1774
1737
 
1775
1738
  if (pageCount === -1) {
1776
1739
  return true;
@@ -1783,29 +1746,29 @@
1783
1746
  return pageIndex < pageCount - 1;
1784
1747
  },
1785
1748
  previousPage: () => {
1786
- return instance.setPageIndex(old => old - 1);
1749
+ return table.setPageIndex(old => old - 1);
1787
1750
  },
1788
1751
  nextPage: () => {
1789
- return instance.setPageIndex(old => {
1752
+ return table.setPageIndex(old => {
1790
1753
  return old + 1;
1791
1754
  });
1792
1755
  },
1793
- getPrePaginationRowModel: () => instance.getExpandedRowModel(),
1756
+ getPrePaginationRowModel: () => table.getExpandedRowModel(),
1794
1757
  getPaginationRowModel: () => {
1795
- if (!instance._getPaginationRowModel && instance.options.getPaginationRowModel) {
1796
- instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
1758
+ if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
1759
+ table._getPaginationRowModel = table.options.getPaginationRowModel(table);
1797
1760
  }
1798
1761
 
1799
- if (instance.options.manualPagination || !instance._getPaginationRowModel) {
1800
- return instance.getPrePaginationRowModel();
1762
+ if (table.options.manualPagination || !table._getPaginationRowModel) {
1763
+ return table.getPrePaginationRowModel();
1801
1764
  }
1802
1765
 
1803
- return instance._getPaginationRowModel();
1766
+ return table._getPaginationRowModel();
1804
1767
  },
1805
1768
  getPageCount: () => {
1806
- var _instance$options$pag2;
1769
+ var _table$options$pageCo2;
1807
1770
 
1808
- return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1771
+ return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1809
1772
  }
1810
1773
  };
1811
1774
  }
@@ -1824,16 +1787,16 @@
1824
1787
  ...state
1825
1788
  };
1826
1789
  },
1827
- getDefaultOptions: instance => {
1790
+ getDefaultOptions: table => {
1828
1791
  return {
1829
- onColumnPinningChange: makeStateUpdater('columnPinning', instance)
1792
+ onColumnPinningChange: makeStateUpdater('columnPinning', table)
1830
1793
  };
1831
1794
  },
1832
- createColumn: (column, instance) => {
1795
+ createColumn: (column, table) => {
1833
1796
  return {
1834
1797
  pin: position => {
1835
1798
  const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
1836
- instance.setColumnPinning(old => {
1799
+ table.setColumnPinning(old => {
1837
1800
  var _old$left3, _old$right3;
1838
1801
 
1839
1802
  if (position === 'right') {
@@ -1863,9 +1826,9 @@
1863
1826
  getCanPin: () => {
1864
1827
  const leafColumns = column.getLeafColumns();
1865
1828
  return leafColumns.some(d => {
1866
- var _d$columnDef$enablePi, _instance$options$ena;
1829
+ var _d$columnDef$enablePi, _table$options$enable;
1867
1830
 
1868
- return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1831
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
1869
1832
  });
1870
1833
  },
1871
1834
  getIsPinned: () => {
@@ -1873,33 +1836,33 @@
1873
1836
  const {
1874
1837
  left,
1875
1838
  right
1876
- } = instance.getState().columnPinning;
1839
+ } = table.getState().columnPinning;
1877
1840
  const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
1878
1841
  const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
1879
1842
  return isLeft ? 'left' : isRight ? 'right' : false;
1880
1843
  },
1881
1844
  getPinnedIndex: () => {
1882
- var _instance$getState$co, _instance$getState$co2, _instance$getState$co3;
1845
+ var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1883
1846
 
1884
1847
  const position = column.getIsPinned();
1885
- 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;
1848
+ 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;
1886
1849
  }
1887
1850
  };
1888
1851
  },
1889
- createRow: (row, instance) => {
1852
+ createRow: (row, table) => {
1890
1853
  return {
1891
- getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1854
+ getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
1892
1855
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1893
1856
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
1894
1857
  }, {
1895
1858
  key: "development" === 'production' ,
1896
1859
  debug: () => {
1897
- var _instance$options$deb;
1860
+ var _table$options$debugA;
1898
1861
 
1899
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
1862
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
1900
1863
  }
1901
1864
  }),
1902
- getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1865
+ getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
1903
1866
  const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1904
1867
  position: 'left'
1905
1868
  }));
@@ -1907,12 +1870,12 @@
1907
1870
  }, {
1908
1871
  key: "development" === 'production' ,
1909
1872
  debug: () => {
1910
- var _instance$options$deb2;
1873
+ var _table$options$debugA2;
1911
1874
 
1912
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
1875
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
1913
1876
  }
1914
1877
  }),
1915
- getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1878
+ getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
1916
1879
  const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1917
1880
  position: 'left'
1918
1881
  }));
@@ -1920,25 +1883,25 @@
1920
1883
  }, {
1921
1884
  key: "development" === 'production' ,
1922
1885
  debug: () => {
1923
- var _instance$options$deb3;
1886
+ var _table$options$debugA3;
1924
1887
 
1925
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
1888
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
1926
1889
  }
1927
1890
  })
1928
1891
  };
1929
1892
  },
1930
- createInstance: instance => {
1893
+ createTable: table => {
1931
1894
  return {
1932
- setColumnPinning: updater => instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater),
1895
+ setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1933
1896
  resetColumnPinning: defaultState => {
1934
- var _instance$initialStat, _instance$initialStat2;
1897
+ var _table$initialState$c, _table$initialState;
1935
1898
 
1936
- return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1899
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1937
1900
  },
1938
1901
  getIsSomeColumnsPinned: position => {
1939
1902
  var _pinningState$positio;
1940
1903
 
1941
- const pinningState = instance.getState().columnPinning;
1904
+ const pinningState = table.getState().columnPinning;
1942
1905
 
1943
1906
  if (!position) {
1944
1907
  var _pinningState$left, _pinningState$right;
@@ -1948,35 +1911,35 @@
1948
1911
 
1949
1912
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1950
1913
  },
1951
- getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1914
+ getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1952
1915
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1953
1916
  }, {
1954
1917
  key: 'getLeftLeafColumns',
1955
1918
  debug: () => {
1956
- var _instance$options$deb4;
1919
+ var _table$options$debugA4;
1957
1920
 
1958
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
1921
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
1959
1922
  }
1960
1923
  }),
1961
- getRightLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.right], (allColumns, right) => {
1924
+ getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
1962
1925
  return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1963
1926
  }, {
1964
1927
  key: 'getRightLeafColumns',
1965
1928
  debug: () => {
1966
- var _instance$options$deb5;
1929
+ var _table$options$debugA5;
1967
1930
 
1968
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
1931
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
1969
1932
  }
1970
1933
  }),
1971
- getCenterLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, left, right) => {
1934
+ getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
1972
1935
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1973
1936
  return allColumns.filter(d => !leftAndRight.includes(d.id));
1974
1937
  }, {
1975
1938
  key: 'getCenterLeafColumns',
1976
1939
  debug: () => {
1977
- var _instance$options$deb6;
1940
+ var _table$options$debugA6;
1978
1941
 
1979
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
1942
+ return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
1980
1943
  }
1981
1944
  })
1982
1945
  };
@@ -1991,9 +1954,9 @@
1991
1954
  ...state
1992
1955
  };
1993
1956
  },
1994
- getDefaultOptions: instance => {
1957
+ getDefaultOptions: table => {
1995
1958
  return {
1996
- onRowSelectionChange: makeStateUpdater('rowSelection', instance),
1959
+ onRowSelectionChange: makeStateUpdater('rowSelection', table),
1997
1960
  enableRowSelection: true,
1998
1961
  enableMultiRowSelection: true,
1999
1962
  enableSubRowSelection: true // enableGroupingRowSelection: false,
@@ -2002,20 +1965,20 @@
2002
1965
 
2003
1966
  };
2004
1967
  },
2005
- createInstance: instance => {
1968
+ createTable: table => {
2006
1969
  return {
2007
- setRowSelection: updater => instance.options.onRowSelectionChange == null ? void 0 : instance.options.onRowSelectionChange(updater),
1970
+ setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
2008
1971
  resetRowSelection: defaultState => {
2009
- var _instance$initialStat;
1972
+ var _table$initialState$r;
2010
1973
 
2011
- return instance.setRowSelection(defaultState ? {} : (_instance$initialStat = instance.initialState.rowSelection) != null ? _instance$initialStat : {});
1974
+ return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
2012
1975
  },
2013
1976
  toggleAllRowsSelected: value => {
2014
- instance.setRowSelection(old => {
2015
- value = typeof value !== 'undefined' ? value : !instance.getIsAllRowsSelected();
1977
+ table.setRowSelection(old => {
1978
+ value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
2016
1979
  const rowSelection = { ...old
2017
1980
  };
2018
- const preGroupedFlatRows = instance.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
1981
+ const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
2019
1982
  // All of the rows are flat already, so it wouldn't be worth it
2020
1983
 
2021
1984
  if (value) {
@@ -2031,12 +1994,12 @@
2031
1994
  return rowSelection;
2032
1995
  });
2033
1996
  },
2034
- toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2035
- const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
1997
+ toggleAllPageRowsSelected: value => table.setRowSelection(old => {
1998
+ const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
2036
1999
  const rowSelection = { ...old
2037
2000
  };
2038
- instance.getRowModel().rows.forEach(row => {
2039
- mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2001
+ table.getRowModel().rows.forEach(row => {
2002
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
2040
2003
  });
2041
2004
  return rowSelection;
2042
2005
  }),
@@ -2045,7 +2008,7 @@
2045
2008
  // rows,
2046
2009
  // rowsById,
2047
2010
  // options: { selectGroupingRows, selectSubRows },
2048
- // } = instance
2011
+ // } = table
2049
2012
  // const findSelectedRow = (rows: Row[]) => {
2050
2013
  // let found
2051
2014
  // rows.find(d => {
@@ -2073,7 +2036,7 @@
2073
2036
  // selectSubRows: selectSubRows!,
2074
2037
  // })
2075
2038
  // }
2076
- // instance.rows.forEach(row => {
2039
+ // table.rows.forEach(row => {
2077
2040
  // const isFirstRow = row.id === firstRow.id
2078
2041
  // const isLastRow = row.id === lastRow.id
2079
2042
  // if (isFirstRow || isLastRow) {
@@ -2088,10 +2051,10 @@
2088
2051
  // addRow(row)
2089
2052
  // }
2090
2053
  // })
2091
- // instance.setRowSelection(selectedRowIds)
2054
+ // table.setRowSelection(selectedRowIds)
2092
2055
  // },
2093
- getPreSelectedRowModel: () => instance.getCoreRowModel(),
2094
- getSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getCoreRowModel()], (rowSelection, rowModel) => {
2056
+ getPreSelectedRowModel: () => table.getCoreRowModel(),
2057
+ getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
2095
2058
  if (!Object.keys(rowSelection).length) {
2096
2059
  return {
2097
2060
  rows: [],
@@ -2100,16 +2063,16 @@
2100
2063
  };
2101
2064
  }
2102
2065
 
2103
- return selectRowsFn(instance, rowModel);
2066
+ return selectRowsFn(table, rowModel);
2104
2067
  }, {
2105
2068
  key: 'getSelectedRowModel',
2106
2069
  debug: () => {
2107
- var _instance$options$deb;
2070
+ var _table$options$debugA;
2108
2071
 
2109
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
2072
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
2110
2073
  }
2111
2074
  }),
2112
- getFilteredSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getFilteredRowModel()], (rowSelection, rowModel) => {
2075
+ getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
2113
2076
  if (!Object.keys(rowSelection).length) {
2114
2077
  return {
2115
2078
  rows: [],
@@ -2118,16 +2081,16 @@
2118
2081
  };
2119
2082
  }
2120
2083
 
2121
- return selectRowsFn(instance, rowModel);
2084
+ return selectRowsFn(table, rowModel);
2122
2085
  }, {
2123
2086
  key: "development" === 'production' ,
2124
2087
  debug: () => {
2125
- var _instance$options$deb2;
2088
+ var _table$options$debugA2;
2126
2089
 
2127
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2090
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
2128
2091
  }
2129
2092
  }),
2130
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2093
+ getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
2131
2094
  if (!Object.keys(rowSelection).length) {
2132
2095
  return {
2133
2096
  rows: [],
@@ -2136,31 +2099,31 @@
2136
2099
  };
2137
2100
  }
2138
2101
 
2139
- return selectRowsFn(instance, rowModel);
2102
+ return selectRowsFn(table, rowModel);
2140
2103
  }, {
2141
2104
  key: "development" === 'production' ,
2142
2105
  debug: () => {
2143
- var _instance$options$deb3;
2106
+ var _table$options$debugA3;
2144
2107
 
2145
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugTable;
2108
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
2146
2109
  }
2147
2110
  }),
2148
2111
  ///
2149
2112
  // getGroupingRowCanSelect: rowId => {
2150
- // const row = instance.getRow(rowId)
2113
+ // const row = table.getRow(rowId)
2151
2114
  // if (!row) {
2152
2115
  // throw new Error()
2153
2116
  // }
2154
- // if (typeof instance.options.enableGroupingRowSelection === 'function') {
2155
- // return instance.options.enableGroupingRowSelection(row)
2117
+ // if (typeof table.options.enableGroupingRowSelection === 'function') {
2118
+ // return table.options.enableGroupingRowSelection(row)
2156
2119
  // }
2157
- // return instance.options.enableGroupingRowSelection ?? false
2120
+ // return table.options.enableGroupingRowSelection ?? false
2158
2121
  // },
2159
2122
  getIsAllRowsSelected: () => {
2160
- const preFilteredFlatRows = instance.getPreFilteredRowModel().flatRows;
2123
+ const preFilteredFlatRows = table.getPreFilteredRowModel().flatRows;
2161
2124
  const {
2162
2125
  rowSelection
2163
- } = instance.getState();
2126
+ } = table.getState();
2164
2127
  let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
2165
2128
 
2166
2129
  if (isAllRowsSelected) {
@@ -2172,10 +2135,10 @@
2172
2135
  return isAllRowsSelected;
2173
2136
  },
2174
2137
  getIsAllPageRowsSelected: () => {
2175
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2138
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2176
2139
  const {
2177
2140
  rowSelection
2178
- } = instance.getState();
2141
+ } = table.getState();
2179
2142
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2180
2143
 
2181
2144
  if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
@@ -2185,31 +2148,31 @@
2185
2148
  return isAllPageRowsSelected;
2186
2149
  },
2187
2150
  getIsSomeRowsSelected: () => {
2188
- var _instance$getState$ro;
2151
+ var _table$getState$rowSe;
2189
2152
 
2190
- return !instance.getIsAllRowsSelected() && !!Object.keys((_instance$getState$ro = instance.getState().rowSelection) != null ? _instance$getState$ro : {}).length;
2153
+ return !table.getIsAllRowsSelected() && !!Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
2191
2154
  },
2192
2155
  getIsSomePageRowsSelected: () => {
2193
- const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2194
- return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2156
+ const paginationFlatRows = table.getPaginationRowModel().flatRows;
2157
+ return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2195
2158
  },
2196
2159
  getToggleAllRowsSelectedHandler: () => {
2197
2160
  return e => {
2198
- instance.toggleAllRowsSelected(e.target.checked);
2161
+ table.toggleAllRowsSelected(e.target.checked);
2199
2162
  };
2200
2163
  },
2201
2164
  getToggleAllPageRowsSelectedHandler: () => {
2202
2165
  return e => {
2203
- instance.toggleAllPageRowsSelected(e.target.checked);
2166
+ table.toggleAllPageRowsSelected(e.target.checked);
2204
2167
  };
2205
2168
  }
2206
2169
  };
2207
2170
  },
2208
- createRow: (row, instance) => {
2171
+ createRow: (row, table) => {
2209
2172
  return {
2210
2173
  toggleSelected: value => {
2211
2174
  const isSelected = row.getIsSelected();
2212
- instance.setRowSelection(old => {
2175
+ table.setRowSelection(old => {
2213
2176
  value = typeof value !== 'undefined' ? value : !isSelected;
2214
2177
 
2215
2178
  if (isSelected === value) {
@@ -2218,48 +2181,48 @@
2218
2181
 
2219
2182
  const selectedRowIds = { ...old
2220
2183
  };
2221
- mutateRowIsSelected(selectedRowIds, row.id, value, instance);
2184
+ mutateRowIsSelected(selectedRowIds, row.id, value, table);
2222
2185
  return selectedRowIds;
2223
2186
  });
2224
2187
  },
2225
2188
  getIsSelected: () => {
2226
2189
  const {
2227
2190
  rowSelection
2228
- } = instance.getState();
2191
+ } = table.getState();
2229
2192
  return isRowSelected(row, rowSelection) === true;
2230
2193
  },
2231
2194
  getIsSomeSelected: () => {
2232
2195
  const {
2233
2196
  rowSelection
2234
- } = instance.getState();
2197
+ } = table.getState();
2235
2198
  return isRowSelected(row, rowSelection) === 'some';
2236
2199
  },
2237
2200
  getCanSelect: () => {
2238
- var _instance$options$ena;
2201
+ var _table$options$enable;
2239
2202
 
2240
- if (typeof instance.options.enableRowSelection === 'function') {
2241
- return instance.options.enableRowSelection(row);
2203
+ if (typeof table.options.enableRowSelection === 'function') {
2204
+ return table.options.enableRowSelection(row);
2242
2205
  }
2243
2206
 
2244
- return (_instance$options$ena = instance.options.enableRowSelection) != null ? _instance$options$ena : true;
2207
+ return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
2245
2208
  },
2246
2209
  getCanSelectSubRows: () => {
2247
- var _instance$options$ena2;
2210
+ var _table$options$enable2;
2248
2211
 
2249
- if (typeof instance.options.enableSubRowSelection === 'function') {
2250
- return instance.options.enableSubRowSelection(row);
2212
+ if (typeof table.options.enableSubRowSelection === 'function') {
2213
+ return table.options.enableSubRowSelection(row);
2251
2214
  }
2252
2215
 
2253
- return (_instance$options$ena2 = instance.options.enableSubRowSelection) != null ? _instance$options$ena2 : true;
2216
+ return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
2254
2217
  },
2255
2218
  getCanMultiSelect: () => {
2256
- var _instance$options$ena3;
2219
+ var _table$options$enable3;
2257
2220
 
2258
- if (typeof instance.options.enableMultiRowSelection === 'function') {
2259
- return instance.options.enableMultiRowSelection(row);
2221
+ if (typeof table.options.enableMultiRowSelection === 'function') {
2222
+ return table.options.enableMultiRowSelection(row);
2260
2223
  }
2261
2224
 
2262
- return (_instance$options$ena3 = instance.options.enableMultiRowSelection) != null ? _instance$options$ena3 : true;
2225
+ return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
2263
2226
  },
2264
2227
  getToggleSelectedHandler: () => {
2265
2228
  const canSelect = row.getCanSelect();
@@ -2274,13 +2237,13 @@
2274
2237
  }
2275
2238
  };
2276
2239
 
2277
- const mutateRowIsSelected = (selectedRowIds, id, value, instance) => {
2240
+ const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2278
2241
  var _row$subRows;
2279
2242
 
2280
- const row = instance.getRow(id);
2243
+ const row = table.getRow(id);
2281
2244
  row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
2282
2245
  // !isGrouped ||
2283
- // (isGrouped && instance.options.enableGroupingRowSelection)
2246
+ // (isGrouped && table.options.enableGroupingRowSelection)
2284
2247
  // ) {
2285
2248
 
2286
2249
  if (value) {
@@ -2291,12 +2254,12 @@
2291
2254
 
2292
2255
 
2293
2256
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2294
- row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, instance));
2257
+ row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2295
2258
  }
2296
2259
  };
2297
2260
 
2298
- function selectRowsFn(instance, rowModel) {
2299
- const rowSelection = instance.getState().rowSelection;
2261
+ function selectRowsFn(table, rowModel) {
2262
+ const rowSelection = table.getState().rowSelection;
2300
2263
  const newSelectedFlatRows = [];
2301
2264
  const newSelectedRowsById = {}; // Filters top level and nested rows
2302
2265
 
@@ -2330,7 +2293,7 @@
2330
2293
  rowsById: newSelectedRowsById
2331
2294
  };
2332
2295
  }
2333
- function isRowSelected(row, selection, instance) {
2296
+ function isRowSelected(row, selection, table) {
2334
2297
  if (selection[row.id]) {
2335
2298
  return true;
2336
2299
  }
@@ -2476,18 +2439,18 @@
2476
2439
  sortingFn: 'auto'
2477
2440
  };
2478
2441
  },
2479
- getDefaultOptions: instance => {
2442
+ getDefaultOptions: table => {
2480
2443
  return {
2481
- onSortingChange: makeStateUpdater('sorting', instance),
2444
+ onSortingChange: makeStateUpdater('sorting', table),
2482
2445
  isMultiSortEvent: e => {
2483
2446
  return e.shiftKey;
2484
2447
  }
2485
2448
  };
2486
2449
  },
2487
- createColumn: (column, instance) => {
2450
+ createColumn: (column, table) => {
2488
2451
  return {
2489
2452
  getAutoSortingFn: () => {
2490
- const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2453
+ const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2491
2454
  let isString = false;
2492
2455
 
2493
2456
  for (const row of firstRows) {
@@ -2513,7 +2476,7 @@
2513
2476
  return sortingFns.basic;
2514
2477
  },
2515
2478
  getAutoSortDir: () => {
2516
- const firstRow = instance.getFilteredRowModel().flatRows[0];
2479
+ const firstRow = table.getFilteredRowModel().flatRows[0];
2517
2480
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2518
2481
 
2519
2482
  if (typeof value === 'string') {
@@ -2523,29 +2486,25 @@
2523
2486
  return 'desc';
2524
2487
  },
2525
2488
  getSortingFn: () => {
2526
- var _ref;
2527
-
2528
- const userSortingFn = instance.options.sortingFns;
2529
-
2530
2489
  if (!column) {
2531
2490
  throw new Error();
2532
2491
  }
2533
2492
 
2534
- 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];
2493
+ return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : sortingFns[column.columnDef.sortingFn];
2535
2494
  },
2536
2495
  toggleSorting: (desc, multi) => {
2537
2496
  // if (column.columns.length) {
2538
2497
  // column.columns.forEach((c, i) => {
2539
2498
  // if (c.id) {
2540
- // instance.toggleColumnSorting(c.id, undefined, multi || !!i)
2499
+ // table.toggleColumnSorting(c.id, undefined, multi || !!i)
2541
2500
  // }
2542
2501
  // })
2543
2502
  // return
2544
2503
  // }
2545
- // this needs to be outside of instance.setSorting to be in sync with rerender
2504
+ // this needs to be outside of table.setSorting to be in sync with rerender
2546
2505
  const nextSortingOrder = column.getNextSortingOrder();
2547
- instance.setSorting(old => {
2548
- var _instance$options$ena, _instance$options$ena2;
2506
+ table.setSorting(old => {
2507
+ var _table$options$enable, _table$options$enable2;
2549
2508
 
2550
2509
  // Find any existing sorting for this column
2551
2510
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2574,9 +2533,9 @@
2574
2533
 
2575
2534
 
2576
2535
  if (sortAction === 'toggle' && ( // Must be toggling
2577
- (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
2536
+ (_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && // If enableSortRemove, enable in general
2578
2537
  !hasDescDefined && ( // Must not be setting desc
2579
- multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
2538
+ multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) && // If multi, don't allow if enableMultiRemove
2580
2539
  !nextSortingOrder // Finally, detect if it should indeed be removed
2581
2540
  ) {
2582
2541
  sortAction = 'remove';
@@ -2588,14 +2547,14 @@
2588
2547
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2589
2548
  }];
2590
2549
  } else if (sortAction === 'add' && old != null && old.length) {
2591
- var _instance$options$max;
2550
+ var _table$options$maxMul;
2592
2551
 
2593
2552
  newSorting = [...old, {
2594
2553
  id: column.id,
2595
2554
  desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
2596
2555
  }]; // Take latest n columns
2597
2556
 
2598
- newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
2557
+ newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
2599
2558
  } else if (sortAction === 'toggle' && old != null && old.length) {
2600
2559
  // This flips (or sets) the
2601
2560
  newSorting = old.map(d => {
@@ -2615,9 +2574,9 @@
2615
2574
  });
2616
2575
  },
2617
2576
  getNextSortingOrder: () => {
2618
- var _ref2, _column$columnDef$sor;
2577
+ var _ref, _column$columnDef$sor;
2619
2578
 
2620
- const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
2579
+ const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
2621
2580
  const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
2622
2581
  const isSorted = column.getIsSorted();
2623
2582
 
@@ -2632,59 +2591,59 @@
2632
2591
  }
2633
2592
  },
2634
2593
  getCanSort: () => {
2635
- var _column$columnDef$ena, _instance$options$ena3;
2594
+ var _column$columnDef$ena, _table$options$enable3;
2636
2595
 
2637
- 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;
2596
+ 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;
2638
2597
  },
2639
2598
  getCanMultiSort: () => {
2640
- var _ref3, _column$columnDef$ena2;
2599
+ var _ref2, _column$columnDef$ena2;
2641
2600
 
2642
- return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2601
+ return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2643
2602
  },
2644
2603
  getIsSorted: () => {
2645
- var _instance$getState$so;
2604
+ var _table$getState$sorti;
2646
2605
 
2647
- const columnSort = (_instance$getState$so = instance.getState().sorting) == null ? void 0 : _instance$getState$so.find(d => d.id === column.id);
2606
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2648
2607
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2649
2608
  },
2650
2609
  getSortIndex: () => {
2651
- var _instance$getState$so2, _instance$getState$so3;
2610
+ var _table$getState$sorti2, _table$getState$sorti3;
2652
2611
 
2653
- 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;
2612
+ 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;
2654
2613
  },
2655
2614
  clearSorting: () => {
2656
2615
  //clear sorting for just 1 column
2657
- instance.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2616
+ table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2658
2617
  },
2659
2618
  getToggleSortingHandler: () => {
2660
2619
  const canSort = column.getCanSort();
2661
2620
  return e => {
2662
2621
  if (!canSort) return;
2663
2622
  e.persist == null ? void 0 : e.persist();
2664
- column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? instance.options.isMultiSortEvent == null ? void 0 : instance.options.isMultiSortEvent(e) : false);
2623
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2665
2624
  };
2666
2625
  }
2667
2626
  };
2668
2627
  },
2669
- createInstance: instance => {
2628
+ createTable: table => {
2670
2629
  return {
2671
- setSorting: updater => instance.options.onSortingChange == null ? void 0 : instance.options.onSortingChange(updater),
2630
+ setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2672
2631
  resetSorting: defaultState => {
2673
- var _instance$initialStat, _instance$initialStat2;
2632
+ var _table$initialState$s, _table$initialState;
2674
2633
 
2675
- instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2634
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2676
2635
  },
2677
- getPreSortedRowModel: () => instance.getGroupedRowModel(),
2636
+ getPreSortedRowModel: () => table.getGroupedRowModel(),
2678
2637
  getSortedRowModel: () => {
2679
- if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2680
- instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
2638
+ if (!table._getSortedRowModel && table.options.getSortedRowModel) {
2639
+ table._getSortedRowModel = table.options.getSortedRowModel(table);
2681
2640
  }
2682
2641
 
2683
- if (instance.options.manualSorting || !instance._getSortedRowModel) {
2684
- return instance.getPreSortedRowModel();
2642
+ if (table.options.manualSorting || !table._getSortedRowModel) {
2643
+ return table.getPreSortedRowModel();
2685
2644
  }
2686
2645
 
2687
- return instance._getSortedRowModel();
2646
+ return table._getSortedRowModel();
2688
2647
  }
2689
2648
  };
2690
2649
  }
@@ -2698,29 +2657,29 @@
2698
2657
  ...state
2699
2658
  };
2700
2659
  },
2701
- getDefaultOptions: instance => {
2660
+ getDefaultOptions: table => {
2702
2661
  return {
2703
- onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2662
+ onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
2704
2663
  };
2705
2664
  },
2706
- createColumn: (column, instance) => {
2665
+ createColumn: (column, table) => {
2707
2666
  return {
2708
2667
  toggleVisibility: value => {
2709
2668
  if (column.getCanHide()) {
2710
- instance.setColumnVisibility(old => ({ ...old,
2669
+ table.setColumnVisibility(old => ({ ...old,
2711
2670
  [column.id]: value != null ? value : !column.getIsVisible()
2712
2671
  }));
2713
2672
  }
2714
2673
  },
2715
2674
  getIsVisible: () => {
2716
- var _instance$getState$co, _instance$getState$co2;
2675
+ var _table$getState$colum, _table$getState$colum2;
2717
2676
 
2718
- return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2677
+ return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2719
2678
  },
2720
2679
  getCanHide: () => {
2721
- var _column$columnDef$ena, _instance$options$ena;
2680
+ var _column$columnDef$ena, _table$options$enable;
2722
2681
 
2723
- return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2682
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
2724
2683
  },
2725
2684
  getToggleVisibilityHandler: () => {
2726
2685
  return e => {
@@ -2729,69 +2688,69 @@
2729
2688
  }
2730
2689
  };
2731
2690
  },
2732
- createRow: (row, instance) => {
2691
+ createRow: (row, table) => {
2733
2692
  return {
2734
- _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2693
+ _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
2735
2694
  return cells.filter(cell => cell.column.getIsVisible());
2736
2695
  }, {
2737
2696
  key: "development" === 'production' ,
2738
2697
  debug: () => {
2739
- var _instance$options$deb;
2698
+ var _table$options$debugA;
2740
2699
 
2741
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2700
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
2742
2701
  }
2743
2702
  }),
2744
2703
  getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2745
2704
  key: 'row.getVisibleCells',
2746
2705
  debug: () => {
2747
- var _instance$options$deb2;
2706
+ var _table$options$debugA2;
2748
2707
 
2749
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2708
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
2750
2709
  }
2751
2710
  })
2752
2711
  };
2753
2712
  },
2754
- createInstance: instance => {
2713
+ createTable: table => {
2755
2714
  const makeVisibleColumnsMethod = (key, getColumns) => {
2756
2715
  return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2757
2716
  return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2758
2717
  }, {
2759
2718
  key,
2760
2719
  debug: () => {
2761
- var _instance$options$deb3;
2720
+ var _table$options$debugA3;
2762
2721
 
2763
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2722
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2764
2723
  }
2765
2724
  });
2766
2725
  };
2767
2726
 
2768
2727
  return {
2769
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2770
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2771
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2772
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2773
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2774
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2728
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
2729
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
2730
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
2731
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
2732
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2733
+ setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2775
2734
  resetColumnVisibility: defaultState => {
2776
- var _instance$initialStat;
2735
+ var _table$initialState$c;
2777
2736
 
2778
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2737
+ table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
2779
2738
  },
2780
2739
  toggleAllColumnsVisible: value => {
2781
2740
  var _value;
2782
2741
 
2783
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2784
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2742
+ value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2743
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2785
2744
  [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2786
2745
  }), {}));
2787
2746
  },
2788
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2789
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2747
+ getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2748
+ getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2790
2749
  getToggleAllColumnsVisibilityHandler: () => {
2791
2750
  return e => {
2792
2751
  var _target;
2793
2752
 
2794
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2753
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2795
2754
  };
2796
2755
  }
2797
2756
  };
@@ -2800,24 +2759,24 @@
2800
2759
 
2801
2760
  const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
2802
2761
 
2803
- function createTableInstance(options) {
2762
+ function createTable(options) {
2804
2763
  var _options$initialState;
2805
2764
 
2806
2765
  if (options.debugAll || options.debugTable) {
2807
2766
  console.info('Creating Table Instance...');
2808
2767
  }
2809
2768
 
2810
- let instance = {
2769
+ let table = {
2811
2770
  _features: features
2812
2771
  };
2813
2772
 
2814
- const defaultOptions = instance._features.reduce((obj, feature) => {
2815
- return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
2773
+ const defaultOptions = table._features.reduce((obj, feature) => {
2774
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2816
2775
  }, {});
2817
2776
 
2818
2777
  const mergeOptions = options => {
2819
- if (instance.options.mergeOptions) {
2820
- return instance.options.mergeOptions(defaultOptions, options);
2778
+ if (table.options.mergeOptions) {
2779
+ return table.options.mergeOptions(defaultOptions, options);
2821
2780
  }
2822
2781
 
2823
2782
  return { ...defaultOptions,
@@ -2830,7 +2789,7 @@
2830
2789
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
2831
2790
  };
2832
2791
 
2833
- instance._features.forEach(feature => {
2792
+ table._features.forEach(feature => {
2834
2793
  var _feature$getInitialSt;
2835
2794
 
2836
2795
  initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
@@ -2863,48 +2822,37 @@
2863
2822
  }
2864
2823
  },
2865
2824
  reset: () => {
2866
- instance.setState(instance.initialState);
2825
+ table.setState(table.initialState);
2867
2826
  },
2868
2827
  setOptions: updater => {
2869
- const newOptions = functionalUpdate(updater, instance.options);
2870
- instance.options = mergeOptions(newOptions);
2871
- },
2872
- _render: (template, props) => {
2873
- if (typeof instance.options.render === 'function') {
2874
- return instance.options.render(template, props);
2875
- }
2876
-
2877
- if (typeof template === 'function') {
2878
- return template(props);
2879
- }
2880
-
2881
- return template;
2828
+ const newOptions = functionalUpdate(updater, table.options);
2829
+ table.options = mergeOptions(newOptions);
2882
2830
  },
2883
2831
  getState: () => {
2884
- return instance.options.state;
2832
+ return table.options.state;
2885
2833
  },
2886
2834
  setState: updater => {
2887
- instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
2835
+ table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2888
2836
  },
2889
2837
  _getRowId: (row, index, parent) => {
2890
- var _instance$options$get;
2838
+ var _table$options$getRow;
2891
2839
 
2892
- 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);
2840
+ 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);
2893
2841
  },
2894
2842
  getCoreRowModel: () => {
2895
- if (!instance._getCoreRowModel) {
2896
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2843
+ if (!table._getCoreRowModel) {
2844
+ table._getCoreRowModel = table.options.getCoreRowModel(table);
2897
2845
  }
2898
2846
 
2899
- return instance._getCoreRowModel();
2847
+ return table._getCoreRowModel();
2900
2848
  },
2901
2849
  // The final calls start at the bottom of the model,
2902
2850
  // expanded rows, which then work their way up
2903
2851
  getRowModel: () => {
2904
- return instance.getPaginationRowModel();
2852
+ return table.getPaginationRowModel();
2905
2853
  },
2906
2854
  getRow: id => {
2907
- const row = instance.getRowModel().rowsById[id];
2855
+ const row = table.getRowModel().rowsById[id];
2908
2856
 
2909
2857
  if (!row) {
2910
2858
  {
@@ -2914,7 +2862,7 @@
2914
2862
 
2915
2863
  return row;
2916
2864
  },
2917
- _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2865
+ _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
2918
2866
  var _defaultColumn;
2919
2867
 
2920
2868
  defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
@@ -2922,32 +2870,32 @@
2922
2870
  header: props => props.header.column.id,
2923
2871
  footer: props => props.header.column.id,
2924
2872
  cell: props => {
2925
- var _props$getValue$toStr, _props$getValue;
2873
+ var _toString, _props$renderValue;
2926
2874
 
2927
- 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;
2875
+ return (_toString = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _toString : null;
2928
2876
  },
2929
- ...instance._features.reduce((obj, feature) => {
2877
+ ...table._features.reduce((obj, feature) => {
2930
2878
  return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2931
2879
  }, {}),
2932
2880
  ...defaultColumn
2933
2881
  };
2934
2882
  }, {
2935
2883
  debug: () => {
2936
- var _instance$options$deb;
2884
+ var _table$options$debugA;
2937
2885
 
2938
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2886
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
2939
2887
  },
2940
2888
  key: 'getDefaultColumnDef'
2941
2889
  }),
2942
- _getColumnDefs: () => instance.options.columns,
2943
- getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2890
+ _getColumnDefs: () => table.options.columns,
2891
+ getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
2944
2892
  const recurseColumns = function (columnDefs, parent, depth) {
2945
2893
  if (depth === void 0) {
2946
2894
  depth = 0;
2947
2895
  }
2948
2896
 
2949
2897
  return columnDefs.map(columnDef => {
2950
- const column = createColumn(instance, columnDef, depth, parent);
2898
+ const column = createColumn(table, columnDef, depth, parent);
2951
2899
  column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2952
2900
  return column;
2953
2901
  });
@@ -2957,24 +2905,24 @@
2957
2905
  }, {
2958
2906
  key: 'getAllColumns',
2959
2907
  debug: () => {
2960
- var _instance$options$deb2;
2908
+ var _table$options$debugA2;
2961
2909
 
2962
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2910
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
2963
2911
  }
2964
2912
  }),
2965
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2913
+ getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
2966
2914
  return allColumns.flatMap(column => {
2967
2915
  return column.getFlatColumns();
2968
2916
  });
2969
2917
  }, {
2970
2918
  key: 'getAllFlatColumns',
2971
2919
  debug: () => {
2972
- var _instance$options$deb3;
2920
+ var _table$options$debugA3;
2973
2921
 
2974
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2922
+ return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2975
2923
  }
2976
2924
  }),
2977
- _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2925
+ _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
2978
2926
  return flatColumns.reduce((acc, column) => {
2979
2927
  acc[column.id] = column;
2980
2928
  return acc;
@@ -2982,24 +2930,24 @@
2982
2930
  }, {
2983
2931
  key: 'getAllFlatColumnsById',
2984
2932
  debug: () => {
2985
- var _instance$options$deb4;
2933
+ var _table$options$debugA4;
2986
2934
 
2987
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2935
+ return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
2988
2936
  }
2989
2937
  }),
2990
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2938
+ getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
2991
2939
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
2992
2940
  return orderColumns(leafColumns);
2993
2941
  }, {
2994
2942
  key: 'getAllLeafColumns',
2995
2943
  debug: () => {
2996
- var _instance$options$deb5;
2944
+ var _table$options$debugA5;
2997
2945
 
2998
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2946
+ return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
2999
2947
  }
3000
2948
  }),
3001
2949
  getColumn: columnId => {
3002
- const column = instance._getAllFlatColumnsById()[columnId];
2950
+ const column = table._getAllFlatColumnsById()[columnId];
3003
2951
 
3004
2952
  if (!column) {
3005
2953
  {
@@ -3012,76 +2960,20 @@
3012
2960
  return column;
3013
2961
  }
3014
2962
  };
3015
- Object.assign(instance, coreInstance);
2963
+ Object.assign(table, coreInstance);
3016
2964
 
3017
- instance._features.forEach(feature => {
3018
- return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
2965
+ table._features.forEach(feature => {
2966
+ return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
3019
2967
  });
3020
2968
 
3021
- return instance;
3022
- }
3023
-
3024
- //
3025
- function createTableFactory(opts) {
3026
- return () => createTable(undefined, undefined, opts);
3027
- } // A lot of returns in here are `as any` for a reason. Unless you
3028
- // can find a better way to do this, then don't worry about them
3029
-
3030
- function createTable(_, __, options) {
3031
- const table = {
3032
- generics: undefined,
3033
- options: options != null ? options : {
3034
- render: (() => {
3035
- throw new Error('');
3036
- })()
3037
- },
3038
- // setGenerics: () => table as any,
3039
- setRowType: () => table,
3040
- setTableMetaType: () => table,
3041
- setColumnMetaType: () => table,
3042
- setFilterMetaType: () => table,
3043
- setOptions: newOptions => createTable(_, __, { ...options,
3044
- ...newOptions
3045
- }),
3046
- createDisplayColumn: column => ({ ...column,
3047
- columnDefType: 'display'
3048
- }),
3049
- createGroup: column => ({ ...column,
3050
- columnDefType: 'group'
3051
- }),
3052
- createDataColumn: (accessor, column) => {
3053
- column = { ...column,
3054
- columnDefType: 'data',
3055
- id: column.id
3056
- };
3057
-
3058
- if (typeof accessor === 'string') {
3059
- var _column$id;
3060
-
3061
- return { ...column,
3062
- id: (_column$id = column.id) != null ? _column$id : accessor,
3063
- accessorKey: accessor
3064
- };
3065
- }
3066
-
3067
- if (typeof accessor === 'function') {
3068
- return { ...column,
3069
- accessorFn: accessor
3070
- };
3071
- }
3072
-
3073
- throw new Error('Invalid accessor');
3074
- },
3075
- createOptions: options => options
3076
- };
3077
2969
  return table;
3078
2970
  }
3079
2971
 
3080
- function createCell(instance, row, column, columnId) {
2972
+ function createCell(table, row, column, columnId) {
3081
2973
  const getRenderValue = () => {
3082
2974
  var _cell$getValue;
3083
2975
 
3084
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
2976
+ return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
3085
2977
  };
3086
2978
 
3087
2979
  const cell = {
@@ -3089,25 +2981,25 @@
3089
2981
  row,
3090
2982
  column,
3091
2983
  getValue: () => row.getValue(columnId),
3092
- renderCell: () => {
3093
- return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3094
- instance,
3095
- column,
3096
- row,
3097
- cell: cell,
3098
- getValue: getRenderValue
3099
- }) : null;
3100
- }
2984
+ renderValue: getRenderValue,
2985
+ getContext: () => ({
2986
+ table,
2987
+ column,
2988
+ row,
2989
+ cell: cell,
2990
+ getValue: cell.getValue,
2991
+ renderValue: cell.renderValue
2992
+ })
3101
2993
  };
3102
2994
 
3103
- instance._features.forEach(feature => {
3104
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
2995
+ table._features.forEach(feature => {
2996
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
3105
2997
  }, {});
3106
2998
 
3107
2999
  return cell;
3108
3000
  }
3109
3001
 
3110
- const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3002
+ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3111
3003
  let row = {
3112
3004
  id,
3113
3005
  index: rowIndex,
@@ -3119,7 +3011,7 @@
3119
3011
  return row._valuesCache[columnId];
3120
3012
  }
3121
3013
 
3122
- const column = instance.getColumn(columnId);
3014
+ const column = table.getColumn(columnId);
3123
3015
 
3124
3016
  if (!column.accessorFn) {
3125
3017
  return undefined;
@@ -3128,18 +3020,23 @@
3128
3020
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3129
3021
  return row._valuesCache[columnId];
3130
3022
  },
3023
+ renderValue: columnId => {
3024
+ var _row$getValue;
3025
+
3026
+ return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
3027
+ },
3131
3028
  subRows: subRows != null ? subRows : [],
3132
3029
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3133
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3030
+ getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
3134
3031
  return leafColumns.map(column => {
3135
- return createCell(instance, row, column, column.id);
3032
+ return createCell(table, row, column, column.id);
3136
3033
  });
3137
3034
  }, {
3138
3035
  key: 'row.getAllCells',
3139
3036
  debug: () => {
3140
- var _instance$options$deb;
3037
+ var _table$options$debugA;
3141
3038
 
3142
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3039
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
3143
3040
  }
3144
3041
  }),
3145
3042
  _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
@@ -3150,23 +3047,23 @@
3150
3047
  }, {
3151
3048
  key: "development" === 'production' ,
3152
3049
  debug: () => {
3153
- var _instance$options$deb2;
3050
+ var _table$options$debugA2;
3154
3051
 
3155
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3052
+ return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
3156
3053
  }
3157
3054
  })
3158
3055
  };
3159
3056
 
3160
- for (let i = 0; i < instance._features.length; i++) {
3161
- const feature = instance._features[i];
3162
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3057
+ for (let i = 0; i < table._features.length; i++) {
3058
+ const feature = table._features[i];
3059
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
3163
3060
  }
3164
3061
 
3165
3062
  return row;
3166
3063
  };
3167
3064
 
3168
3065
  function getCoreRowModel() {
3169
- return instance => memo(() => [instance.options.data], data => {
3066
+ return table => memo(() => [table.options.data], data => {
3170
3067
  const rowModel = {
3171
3068
  rows: [],
3172
3069
  flatRows: [],
@@ -3188,18 +3085,18 @@
3188
3085
  // }
3189
3086
  // }
3190
3087
  // Make the row
3191
- const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3088
+ const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3192
3089
 
3193
3090
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3194
3091
 
3195
- rowModel.rowsById[row.id] = row; // Push instance row into parent
3092
+ rowModel.rowsById[row.id] = row; // Push table row into parent
3196
3093
 
3197
3094
  rows.push(row); // Get the original subrows
3198
3095
 
3199
- if (instance.options.getSubRows) {
3096
+ if (table.options.getSubRows) {
3200
3097
  var _row$originalSubRows;
3201
3098
 
3202
- row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3099
+ row.originalSubRows = table.options.getSubRows(originalRows[i], i); // Then recursively access them
3203
3100
 
3204
3101
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3205
3102
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
@@ -3215,24 +3112,24 @@
3215
3112
  }, {
3216
3113
  key: 'getRowModel',
3217
3114
  debug: () => {
3218
- var _instance$options$deb;
3115
+ var _table$options$debugA;
3219
3116
 
3220
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3117
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3221
3118
  },
3222
3119
  onChange: () => {
3223
- instance._autoResetPageIndex();
3120
+ table._autoResetPageIndex();
3224
3121
  }
3225
3122
  });
3226
3123
  }
3227
3124
 
3228
- function filterRows(rows, filterRowImpl, instance) {
3229
- if (instance.options.filterFromLeafRows) {
3230
- return filterRowModelFromLeafs(rows, filterRowImpl, instance);
3125
+ function filterRows(rows, filterRowImpl, table) {
3126
+ if (table.options.filterFromLeafRows) {
3127
+ return filterRowModelFromLeafs(rows, filterRowImpl, table);
3231
3128
  }
3232
3129
 
3233
- return filterRowModelFromRoot(rows, filterRowImpl, instance);
3130
+ return filterRowModelFromRoot(rows, filterRowImpl, table);
3234
3131
  }
3235
- function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3132
+ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3236
3133
  const newFilteredFlatRows = [];
3237
3134
  const newFilteredRowsById = {};
3238
3135
 
@@ -3246,7 +3143,7 @@
3246
3143
  let row = rowsToFilter[i];
3247
3144
 
3248
3145
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3249
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3146
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3250
3147
  newRow.columnFilters = row.columnFilters;
3251
3148
  newRow.subRows = recurseFilterRows(row.subRows);
3252
3149
 
@@ -3273,7 +3170,7 @@
3273
3170
  rowsById: newFilteredRowsById
3274
3171
  };
3275
3172
  }
3276
- function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3173
+ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3277
3174
  const newFilteredFlatRows = [];
3278
3175
  const newFilteredRowsById = {}; // Filters top level and nested rows
3279
3176
 
@@ -3290,7 +3187,7 @@
3290
3187
  var _row$subRows2;
3291
3188
 
3292
3189
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3293
- const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3190
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3294
3191
  newRow.subRows = recurseFilterRows(row.subRows);
3295
3192
  row = newRow;
3296
3193
  }
@@ -3312,7 +3209,7 @@
3312
3209
  }
3313
3210
 
3314
3211
  function getFilteredRowModel() {
3315
- return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3212
+ return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3316
3213
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3317
3214
  for (let i = 0; i < rowModel.flatRows.length; i++) {
3318
3215
  rowModel.flatRows[i].columnFilters = {};
@@ -3327,7 +3224,7 @@
3327
3224
  (columnFilters != null ? columnFilters : []).forEach(d => {
3328
3225
  var _filterFn$resolveFilt;
3329
3226
 
3330
- const column = instance.getColumn(d.id);
3227
+ const column = table.getColumn(d.id);
3331
3228
 
3332
3229
  if (!column) {
3333
3230
  {
@@ -3352,8 +3249,8 @@
3352
3249
  });
3353
3250
  });
3354
3251
  const filterableIds = columnFilters.map(d => d.id);
3355
- const globalFilterFn = instance.getGlobalFilterFn();
3356
- const globallyFilterableColumns = instance.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3252
+ const globalFilterFn = table.getGlobalFilterFn();
3253
+ const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3357
3254
 
3358
3255
  if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
3359
3256
  filterableIds.push('__global__');
@@ -3417,22 +3314,22 @@
3417
3314
  }; // Filter final rows using all of the active filters
3418
3315
 
3419
3316
 
3420
- return filterRows(rowModel.rows, filterRowsImpl, instance);
3317
+ return filterRows(rowModel.rows, filterRowsImpl, table);
3421
3318
  }, {
3422
3319
  key: 'getFilteredRowModel',
3423
3320
  debug: () => {
3424
- var _instance$options$deb;
3321
+ var _table$options$debugA;
3425
3322
 
3426
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3323
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3427
3324
  },
3428
3325
  onChange: () => {
3429
- instance._autoResetPageIndex();
3326
+ table._autoResetPageIndex();
3430
3327
  }
3431
3328
  });
3432
3329
  }
3433
3330
 
3434
3331
  function getFacetedRowModel() {
3435
- return (instance, columnId) => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter, instance.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3332
+ return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3436
3333
  if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3437
3334
  return preRowModel;
3438
3335
  }
@@ -3450,20 +3347,20 @@
3450
3347
  return true;
3451
3348
  };
3452
3349
 
3453
- return filterRows(preRowModel.rows, filterRowsImpl, instance);
3350
+ return filterRows(preRowModel.rows, filterRowsImpl, table);
3454
3351
  }, {
3455
3352
  key: 'getFacetedRowModel_' + columnId,
3456
3353
  debug: () => {
3457
- var _instance$options$deb;
3354
+ var _table$options$debugA;
3458
3355
 
3459
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3356
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3460
3357
  },
3461
3358
  onChange: () => {}
3462
3359
  });
3463
3360
  }
3464
3361
 
3465
3362
  function getFacetedUniqueValues() {
3466
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3363
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3467
3364
  let facetedUniqueValues = new Map();
3468
3365
 
3469
3366
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
@@ -3484,16 +3381,16 @@
3484
3381
  }, {
3485
3382
  key: 'getFacetedUniqueValues_' + columnId,
3486
3383
  debug: () => {
3487
- var _instance$options$deb;
3384
+ var _table$options$debugA;
3488
3385
 
3489
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3386
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3490
3387
  },
3491
3388
  onChange: () => {}
3492
3389
  });
3493
3390
  }
3494
3391
 
3495
3392
  function getFacetedMinMaxValues() {
3496
- return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3393
+ return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3497
3394
  var _facetedRowModel$flat;
3498
3395
 
3499
3396
  const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
@@ -3520,27 +3417,27 @@
3520
3417
  }, {
3521
3418
  key: 'getFacetedMinMaxValues_' + columnId,
3522
3419
  debug: () => {
3523
- var _instance$options$deb;
3420
+ var _table$options$debugA;
3524
3421
 
3525
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3422
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3526
3423
  },
3527
3424
  onChange: () => {}
3528
3425
  });
3529
3426
  }
3530
3427
 
3531
3428
  function getSortedRowModel() {
3532
- return instance => memo(() => [instance.getState().sorting, instance.getPreSortedRowModel()], (sorting, rowModel) => {
3429
+ return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
3533
3430
  if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3534
3431
  return rowModel;
3535
3432
  }
3536
3433
 
3537
- const sortingState = instance.getState().sorting;
3434
+ const sortingState = table.getState().sorting;
3538
3435
  const sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
3539
3436
 
3540
- const availableSorting = sortingState.filter(sort => instance.getColumn(sort.id).getCanSort());
3437
+ const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3541
3438
  const columnInfoById = {};
3542
3439
  availableSorting.forEach(sortEntry => {
3543
- const column = instance.getColumn(sortEntry.id);
3440
+ const column = table.getColumn(sortEntry.id);
3544
3441
  columnInfoById[sortEntry.id] = {
3545
3442
  sortUndefined: column.columnDef.sortUndefined,
3546
3443
  invertSorting: column.columnDef.invertSorting,
@@ -3610,24 +3507,24 @@
3610
3507
  }, {
3611
3508
  key: 'getSortedRowModel',
3612
3509
  debug: () => {
3613
- var _instance$options$deb;
3510
+ var _table$options$debugA;
3614
3511
 
3615
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3512
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3616
3513
  },
3617
3514
  onChange: () => {
3618
- instance._autoResetPageIndex();
3515
+ table._autoResetPageIndex();
3619
3516
  }
3620
3517
  });
3621
3518
  }
3622
3519
 
3623
3520
  function getGroupedRowModel() {
3624
- return instance => memo(() => [instance.getState().grouping, instance.getPreGroupedRowModel()], (grouping, rowModel) => {
3521
+ return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
3625
3522
  if (!rowModel.rows.length || !grouping.length) {
3626
3523
  return rowModel;
3627
3524
  } // Filter the grouping list down to columns that exist
3628
3525
 
3629
3526
 
3630
- const existingGrouping = grouping.filter(columnId => instance.getColumn(columnId));
3527
+ const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
3631
3528
  const groupedFlatRows = [];
3632
3529
  const groupedRowsById = {}; // const onlyGroupedFlatRows: Row[] = [];
3633
3530
  // const onlyGroupedRowsById: Record<RowId, Row> = {};
@@ -3657,7 +3554,7 @@
3657
3554
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3658
3555
 
3659
3556
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3660
- const row = createRow(instance, id, undefined, index, depth);
3557
+ const row = createRow(table, id, undefined, index, depth);
3661
3558
  Object.assign(row, {
3662
3559
  groupingColumnId: columnId,
3663
3560
  groupingValue,
@@ -3684,7 +3581,7 @@
3684
3581
  } // Aggregate the values
3685
3582
 
3686
3583
 
3687
- const column = instance.getColumn(columnId);
3584
+ const column = table.getColumn(columnId);
3688
3585
  const aggregateFn = column.getAggregationFn();
3689
3586
 
3690
3587
  if (aggregateFn) {
@@ -3727,15 +3624,15 @@
3727
3624
  }, {
3728
3625
  key: 'getGroupedRowModel',
3729
3626
  debug: () => {
3730
- var _instance$options$deb;
3627
+ var _table$options$debugA;
3731
3628
 
3732
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3629
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3733
3630
  },
3734
3631
  onChange: () => {
3735
- instance._queue(() => {
3736
- instance._autoResetExpanded();
3632
+ table._queue(() => {
3633
+ table._autoResetExpanded();
3737
3634
 
3738
- instance._autoResetPageIndex();
3635
+ table._autoResetPageIndex();
3739
3636
  });
3740
3637
  }
3741
3638
  });
@@ -3758,7 +3655,7 @@
3758
3655
  }
3759
3656
 
3760
3657
  function getExpandedRowModel() {
3761
- return instance => memo(() => [instance.getState().expanded, instance.getPreExpandedRowModel(), instance.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3658
+ return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3762
3659
  if (!rowModel.rows.length || // Do not expand if rows are not included in pagination
3763
3660
  !paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3764
3661
  return rowModel;
@@ -3768,13 +3665,13 @@
3768
3665
  }, {
3769
3666
  key: 'getExpandedRowModel',
3770
3667
  debug: () => {
3771
- var _instance$options$deb;
3668
+ var _table$options$debugA;
3772
3669
 
3773
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3670
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3774
3671
  }
3775
3672
  });
3776
3673
  }
3777
- function expandRows(rowModel, instance) {
3674
+ function expandRows(rowModel, table) {
3778
3675
  const expandedRows = [];
3779
3676
 
3780
3677
  const handleRow = row => {
@@ -3796,7 +3693,7 @@
3796
3693
  }
3797
3694
 
3798
3695
  function getPaginationRowModel(opts) {
3799
- return instance => memo(() => [instance.getState().pagination, instance.getPrePaginationRowModel()], (pagination, rowModel) => {
3696
+ return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
3800
3697
  if (!rowModel.rows.length) {
3801
3698
  return rowModel;
3802
3699
  }
@@ -3815,7 +3712,7 @@
3815
3712
  rows = rows.slice(pageStart, pageEnd);
3816
3713
  let paginatedRowModel;
3817
3714
 
3818
- if (!instance.options.paginateExpandedRows) {
3715
+ if (!table.options.paginateExpandedRows) {
3819
3716
  paginatedRowModel = expandRows({
3820
3717
  rows,
3821
3718
  flatRows,
@@ -3844,9 +3741,9 @@
3844
3741
  }, {
3845
3742
  key: 'getPaginationRowModel',
3846
3743
  debug: () => {
3847
- var _instance$options$deb;
3744
+ var _table$options$debugA;
3848
3745
 
3849
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3746
+ return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3850
3747
  }
3851
3748
  });
3852
3749
  }
@@ -3866,8 +3763,7 @@
3866
3763
  exports.buildHeaderGroups = buildHeaderGroups;
3867
3764
  exports.createColumn = createColumn;
3868
3765
  exports.createRow = createRow;
3869
- exports.createTableFactory = createTableFactory;
3870
- exports.createTableInstance = createTableInstance;
3766
+ exports.createTable = createTable;
3871
3767
  exports.defaultColumnSizing = defaultColumnSizing;
3872
3768
  exports.expandRows = expandRows;
3873
3769
  exports.filterFns = filterFns;