@tanstack/react-table 8.5.13 → 8.5.16

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.
@@ -23,17 +23,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
23
23
  * @license MIT
24
24
  */
25
25
  // Is this type a tuple?
26
+
26
27
  // If this type is a tuple, what indices are allowed?
28
+
27
29
  ///
30
+
28
31
  function functionalUpdate(updater, input) {
29
32
  return typeof updater === 'function' ? updater(input) : updater;
30
33
  }
31
- function noop() {//
34
+ function noop() {
35
+ //
32
36
  }
33
37
  function makeStateUpdater(key, instance) {
34
38
  return updater => {
35
39
  instance.setState(old => {
36
- return { ...old,
40
+ return {
41
+ ...old,
37
42
  [key]: functionalUpdate(updater, old[key])
38
43
  };
39
44
  });
@@ -44,18 +49,15 @@ function isFunction(d) {
44
49
  }
45
50
  function flattenBy(arr, getChildren) {
46
51
  const flat = [];
47
-
48
52
  const recurse = subArr => {
49
53
  subArr.forEach(item => {
50
54
  flat.push(item);
51
55
  const children = getChildren(item);
52
-
53
56
  if (children != null && children.length) {
54
57
  recurse(children);
55
58
  }
56
59
  });
57
60
  };
58
-
59
61
  recurse(arr);
60
62
  return flat;
61
63
  }
@@ -67,53 +69,45 @@ function memo(getDeps, fn, opts) {
67
69
  if (opts.key && opts.debug) depTime = Date.now();
68
70
  const newDeps = getDeps();
69
71
  const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
70
-
71
72
  if (!depsChanged) {
72
73
  return result;
73
74
  }
74
-
75
75
  deps = newDeps;
76
76
  let resultTime;
77
77
  if (opts.key && opts.debug) resultTime = Date.now();
78
78
  result = fn(...newDeps);
79
79
  opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
80
-
81
80
  if (opts.key && opts.debug) {
82
81
  if (opts != null && opts.debug()) {
83
82
  const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
84
83
  const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
85
84
  const resultFpsPercentage = resultEndTime / 16;
86
-
87
85
  const pad = (str, num) => {
88
86
  str = String(str);
89
-
90
87
  while (str.length < num) {
91
88
  str = ' ' + str;
92
89
  }
93
-
94
90
  return str;
95
91
  };
96
-
97
- console.info("%c\u23F1 " + pad(resultEndTime, 5) + " /" + pad(depEndTime, 5) + " ms", "\n font-size: .6rem;\n font-weight: bold;\n color: hsl(" + Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120)) + "deg 100% 31%);", opts == null ? void 0 : opts.key);
92
+ console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
93
+ font-size: .6rem;
94
+ font-weight: bold;
95
+ color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
98
96
  }
99
97
  }
100
-
101
98
  return result;
102
99
  };
103
100
  }
104
101
 
105
102
  function createColumn(table, columnDef, depth, parent) {
106
- var _ref, _resolvedColumnDef$id;
107
-
108
103
  const defaultColumn = table._getDefaultColumnDef();
109
-
110
- const resolvedColumnDef = { ...defaultColumn,
104
+ const resolvedColumnDef = {
105
+ ...defaultColumn,
111
106
  ...columnDef
112
107
  };
113
108
  const accessorKey = resolvedColumnDef.accessorKey;
114
- let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace('.', '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
109
+ let id = resolvedColumnDef.id ?? (accessorKey ? accessorKey.replace('.', '_') : undefined) ?? (typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined);
115
110
  let accessorFn;
116
-
117
111
  if (resolvedColumnDef.accessorFn) {
118
112
  accessorFn = resolvedColumnDef.accessorFn;
119
113
  } else if (accessorKey) {
@@ -121,28 +115,23 @@ function createColumn(table, columnDef, depth, parent) {
121
115
  if (accessorKey.includes('.')) {
122
116
  accessorFn = originalRow => {
123
117
  let result = originalRow;
124
-
125
118
  for (const key of accessorKey.split('.')) {
126
119
  result = result[key];
127
120
  }
128
-
129
121
  return result;
130
122
  };
131
123
  } else {
132
124
  accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
133
125
  }
134
126
  }
135
-
136
127
  if (!id) {
137
128
  if (process.env.NODE_ENV !== 'production') {
138
- throw new Error(resolvedColumnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
129
+ throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`);
139
130
  }
140
-
141
131
  throw new Error();
142
132
  }
143
-
144
133
  let column = {
145
- id: "" + String(id),
134
+ id: `${String(id)}`,
146
135
  accessorFn,
147
136
  parent: parent,
148
137
  depth,
@@ -150,46 +139,35 @@ function createColumn(table, columnDef, depth, parent) {
150
139
  columns: [],
151
140
  getFlatColumns: memo(() => [true], () => {
152
141
  var _column$columns;
153
-
154
142
  return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
155
143
  }, {
156
144
  key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',
157
- debug: () => {
158
- var _table$options$debugA;
159
-
160
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
161
- }
145
+ debug: () => table.options.debugAll ?? table.options.debugColumns
162
146
  }),
163
147
  getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
164
148
  var _column$columns2;
165
-
166
149
  if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
167
150
  let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
168
151
  return orderColumns(leafColumns);
169
152
  }
170
-
171
153
  return [column];
172
154
  }, {
173
155
  key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',
174
- debug: () => {
175
- var _table$options$debugA2;
176
-
177
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
178
- }
156
+ debug: () => table.options.debugAll ?? table.options.debugColumns
179
157
  })
180
158
  };
181
159
  column = table._features.reduce((obj, feature) => {
182
160
  return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
183
- }, column); // Yes, we have to convert table to uknown, because we know more than the compiler here.
161
+ }, column);
184
162
 
163
+ // Yes, we have to convert table to uknown, because we know more than the compiler here.
185
164
  return column;
186
165
  }
187
166
 
188
167
  //
189
- function createHeader(table, column, options) {
190
- var _options$id;
191
168
 
192
- const id = (_options$id = options.id) != null ? _options$id : column.id;
169
+ function createHeader(table, column, options) {
170
+ const id = options.id ?? column.id;
193
171
  let header = {
194
172
  id,
195
173
  column,
@@ -203,15 +181,12 @@ function createHeader(table, column, options) {
203
181
  headerGroup: null,
204
182
  getLeafHeaders: () => {
205
183
  const leafHeaders = [];
206
-
207
184
  const recurseHeader = h => {
208
185
  if (h.subHeaders && h.subHeaders.length) {
209
186
  h.subHeaders.map(recurseHeader);
210
187
  }
211
-
212
188
  leafHeaders.push(h);
213
189
  };
214
-
215
190
  recurseHeader(header);
216
191
  return leafHeaders;
217
192
  },
@@ -221,124 +196,82 @@ function createHeader(table, column, options) {
221
196
  column
222
197
  })
223
198
  };
224
-
225
199
  table._features.forEach(feature => {
226
200
  Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
227
201
  });
228
-
229
202
  return header;
230
203
  }
231
-
232
204
  const Headers = {
233
205
  createTable: table => {
234
206
  return {
235
207
  // Header Groups
236
- getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
237
- var _left$map$filter, _right$map$filter;
238
208
 
239
- const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
240
- const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
209
+ getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
210
+ const leftColumns = (left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) ?? [];
211
+ const rightColumns = (right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) ?? [];
241
212
  const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
242
213
  const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
243
214
  return headerGroups;
244
215
  }, {
245
216
  key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
246
- debug: () => {
247
- var _table$options$debugA;
248
-
249
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
250
- }
217
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
251
218
  }),
252
219
  getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
253
220
  leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
254
221
  return buildHeaderGroups(allColumns, leafColumns, table, 'center');
255
222
  }, {
256
223
  key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
257
- debug: () => {
258
- var _table$options$debugA2;
259
-
260
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
261
- }
224
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
262
225
  }),
263
226
  getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
264
- var _left$map$filter2;
265
-
266
- const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
227
+ const orderedLeafColumns = (left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) ?? [];
267
228
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
268
229
  }, {
269
230
  key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
270
- debug: () => {
271
- var _table$options$debugA3;
272
-
273
- return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
274
- }
231
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
275
232
  }),
276
233
  getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
277
- var _right$map$filter2;
278
-
279
- const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
234
+ const orderedLeafColumns = (right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) ?? [];
280
235
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
281
236
  }, {
282
237
  key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
283
- debug: () => {
284
- var _table$options$debugA4;
285
-
286
- return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
287
- }
238
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
288
239
  }),
289
240
  // Footer Groups
241
+
290
242
  getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
291
243
  return [...headerGroups].reverse();
292
244
  }, {
293
245
  key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
294
- debug: () => {
295
- var _table$options$debugA5;
296
-
297
- return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
298
- }
246
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
299
247
  }),
300
248
  getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
301
249
  return [...headerGroups].reverse();
302
250
  }, {
303
251
  key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
304
- debug: () => {
305
- var _table$options$debugA6;
306
-
307
- return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
308
- }
252
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
309
253
  }),
310
254
  getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
311
255
  return [...headerGroups].reverse();
312
256
  }, {
313
257
  key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
314
- debug: () => {
315
- var _table$options$debugA7;
316
-
317
- return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
318
- }
258
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
319
259
  }),
320
260
  getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
321
261
  return [...headerGroups].reverse();
322
262
  }, {
323
263
  key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
324
- debug: () => {
325
- var _table$options$debugA8;
326
-
327
- return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
328
- }
264
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
329
265
  }),
330
266
  // Flat Headers
267
+
331
268
  getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
332
269
  return headerGroups.map(headerGroup => {
333
270
  return headerGroup.headers;
334
271
  }).flat();
335
272
  }, {
336
273
  key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
337
- debug: () => {
338
- var _table$options$debugA9;
339
-
340
- return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
341
- }
274
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
342
275
  }),
343
276
  getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
344
277
  return left.map(headerGroup => {
@@ -346,11 +279,7 @@ const Headers = {
346
279
  }).flat();
347
280
  }, {
348
281
  key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
349
- debug: () => {
350
- var _table$options$debugA10;
351
-
352
- return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
353
- }
282
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
354
283
  }),
355
284
  getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
356
285
  return left.map(headerGroup => {
@@ -358,11 +287,7 @@ const Headers = {
358
287
  }).flat();
359
288
  }, {
360
289
  key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
361
- debug: () => {
362
- var _table$options$debugA11;
363
-
364
- return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
365
- }
290
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
366
291
  }),
367
292
  getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
368
293
  return left.map(headerGroup => {
@@ -370,117 +295,91 @@ const Headers = {
370
295
  }).flat();
371
296
  }, {
372
297
  key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
373
- debug: () => {
374
- var _table$options$debugA12;
375
-
376
- return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
377
- }
298
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
378
299
  }),
379
300
  // Leaf Headers
301
+
380
302
  getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
381
303
  return flatHeaders.filter(header => {
382
304
  var _header$subHeaders;
383
-
384
305
  return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
385
306
  });
386
307
  }, {
387
308
  key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
388
- debug: () => {
389
- var _table$options$debugA13;
390
-
391
- return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
392
- }
309
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
393
310
  }),
394
311
  getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
395
312
  return flatHeaders.filter(header => {
396
313
  var _header$subHeaders2;
397
-
398
314
  return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
399
315
  });
400
316
  }, {
401
317
  key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
402
- debug: () => {
403
- var _table$options$debugA14;
404
-
405
- return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
406
- }
318
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
407
319
  }),
408
320
  getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
409
321
  return flatHeaders.filter(header => {
410
322
  var _header$subHeaders3;
411
-
412
323
  return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
413
324
  });
414
325
  }, {
415
326
  key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
416
- debug: () => {
417
- var _table$options$debugA15;
418
-
419
- return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
420
- }
327
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
421
328
  }),
422
329
  getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
423
- var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
424
-
425
- 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 => {
330
+ var _left$, _center$, _right$;
331
+ return [...(((_left$ = left[0]) == null ? void 0 : _left$.headers) ?? []), ...(((_center$ = center[0]) == null ? void 0 : _center$.headers) ?? []), ...(((_right$ = right[0]) == null ? void 0 : _right$.headers) ?? [])].map(header => {
426
332
  return header.getLeafHeaders();
427
333
  }).flat();
428
334
  }, {
429
335
  key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
430
- debug: () => {
431
- var _table$options$debugA16;
432
-
433
- return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
434
- }
336
+ debug: () => table.options.debugAll ?? table.options.debugHeaders
435
337
  })
436
338
  };
437
339
  }
438
340
  };
439
341
  function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
440
- var _headerGroups$0$heade, _headerGroups$;
441
-
342
+ var _headerGroups$;
442
343
  // Find the max depth of the columns:
443
344
  // build the leaf column row
444
345
  // build each buffer row going up
445
346
  // placeholder for non-existent level
446
347
  // real column for existing level
447
- let maxDepth = 0;
448
348
 
349
+ let maxDepth = 0;
449
350
  const findMaxDepth = function (columns, depth) {
450
351
  if (depth === void 0) {
451
352
  depth = 1;
452
353
  }
453
-
454
354
  maxDepth = Math.max(maxDepth, depth);
455
355
  columns.filter(column => column.getIsVisible()).forEach(column => {
456
356
  var _column$columns;
457
-
458
357
  if ((_column$columns = column.columns) != null && _column$columns.length) {
459
358
  findMaxDepth(column.columns, depth + 1);
460
359
  }
461
360
  }, 0);
462
361
  };
463
-
464
362
  findMaxDepth(allColumns);
465
363
  let headerGroups = [];
466
-
467
364
  const createHeaderGroup = (headersToGroup, depth) => {
468
365
  // The header group we are creating
469
366
  const headerGroup = {
470
367
  depth,
471
- id: [headerFamily, "" + depth].filter(Boolean).join('_'),
368
+ id: [headerFamily, `${depth}`].filter(Boolean).join('_'),
472
369
  headers: []
473
- }; // The parent columns we're going to scan next
370
+ };
474
371
 
475
- const pendingParentHeaders = []; // Scan each column for parents
372
+ // The parent columns we're going to scan next
373
+ const pendingParentHeaders = [];
476
374
 
375
+ // Scan each column for parents
477
376
  headersToGroup.forEach(headerToGroup => {
478
377
  // What is the latest (last) parent column?
378
+
479
379
  const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
480
380
  const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
481
381
  let column;
482
382
  let isPlaceholder = false;
483
-
484
383
  if (isLeafHeader && headerToGroup.column.parent) {
485
384
  // The parent header is new
486
385
  column = headerToGroup.column.parent;
@@ -489,7 +388,6 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
489
388
  column = headerToGroup.column;
490
389
  isPlaceholder = true;
491
390
  }
492
-
493
391
  if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
494
392
  // This column is repeated. Add it as a sub header to the next batch
495
393
  latestPendingParentHeader.subHeaders.push(headerToGroup);
@@ -498,33 +396,33 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
498
396
  const header = createHeader(table, column, {
499
397
  id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
500
398
  isPlaceholder,
501
- placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
399
+ placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,
502
400
  depth,
503
401
  index: pendingParentHeaders.length
504
- }); // Add the headerToGroup as a subHeader of the new header
402
+ });
505
403
 
506
- header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
404
+ // Add the headerToGroup as a subHeader of the new header
405
+ header.subHeaders.push(headerToGroup);
406
+ // Add the new header to the pendingParentHeaders to get grouped
507
407
  // in the next batch
508
-
509
408
  pendingParentHeaders.push(header);
510
409
  }
511
-
512
410
  headerGroup.headers.push(headerToGroup);
513
411
  headerToGroup.headerGroup = headerGroup;
514
412
  });
515
413
  headerGroups.push(headerGroup);
516
-
517
414
  if (depth > 0) {
518
415
  createHeaderGroup(pendingParentHeaders, depth - 1);
519
416
  }
520
417
  };
521
-
522
418
  const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
523
419
  depth: maxDepth,
524
420
  index
525
421
  }));
526
422
  createHeaderGroup(bottomHeaders, maxDepth - 1);
527
- headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
423
+ headerGroups.reverse();
424
+
425
+ // headerGroups = headerGroups.filter(headerGroup => {
528
426
  // return !headerGroup.headers.every(header => header.isPlaceholder)
529
427
  // })
530
428
 
@@ -534,7 +432,6 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
534
432
  let colSpan = 0;
535
433
  let rowSpan = 0;
536
434
  let childRowSpans = [0];
537
-
538
435
  if (header.subHeaders && header.subHeaders.length) {
539
436
  childRowSpans = [];
540
437
  recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
@@ -548,7 +445,6 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
548
445
  } else {
549
446
  colSpan = 1;
550
447
  }
551
-
552
448
  const minChildRowSpan = Math.min(...childRowSpans);
553
449
  rowSpan = rowSpan + minChildRowSpan;
554
450
  header.colSpan = colSpan;
@@ -559,18 +455,17 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
559
455
  };
560
456
  });
561
457
  };
562
-
563
- recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
458
+ recurseHeadersForSpans(((_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) ?? []);
564
459
  return headerGroups;
565
460
  }
566
461
 
567
462
  //
463
+
568
464
  const defaultColumnSizing = {
569
465
  size: 150,
570
466
  minSize: 20,
571
467
  maxSize: Number.MAX_SAFE_INTEGER
572
468
  };
573
-
574
469
  const getDefaultColumnSizingInfoState = () => ({
575
470
  startOffset: null,
576
471
  startSize: null,
@@ -579,7 +474,6 @@ const getDefaultColumnSizingInfoState = () => ({
579
474
  isResizingColumn: false,
580
475
  columnSizingStart: []
581
476
  });
582
-
583
477
  const ColumnSizing = {
584
478
  getDefaultColumnDef: () => {
585
479
  return defaultColumnSizing;
@@ -601,35 +495,29 @@ const ColumnSizing = {
601
495
  createColumn: (column, table) => {
602
496
  return {
603
497
  getSize: () => {
604
- var _column$columnDef$min, _ref, _column$columnDef$max;
605
-
606
498
  const columnSize = table.getState().columnSizing[column.id];
607
- 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);
499
+ return Math.min(Math.max(column.columnDef.minSize ?? defaultColumnSizing.minSize, columnSize ?? column.columnDef.size ?? defaultColumnSizing.size), column.columnDef.maxSize ?? defaultColumnSizing.maxSize);
608
500
  },
609
501
  getStart: position => {
610
502
  const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
611
503
  const index = columns.findIndex(d => d.id === column.id);
612
-
613
504
  if (index > 0) {
614
505
  const prevSiblingColumn = columns[index - 1];
615
506
  return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize();
616
507
  }
617
-
618
508
  return 0;
619
509
  },
620
510
  resetSize: () => {
621
- table.setColumnSizing(_ref2 => {
511
+ table.setColumnSizing(_ref => {
622
512
  let {
623
513
  [column.id]: _,
624
514
  ...rest
625
- } = _ref2;
515
+ } = _ref;
626
516
  return rest;
627
517
  });
628
518
  },
629
519
  getCanResize: () => {
630
- var _column$columnDef$ena, _table$options$enable;
631
-
632
- return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
520
+ return (column.columnDef.enableResizing ?? true) && (table.options.enableColumnResizing ?? true);
633
521
  },
634
522
  getIsResizing: () => {
635
523
  return table.getState().columnSizingInfo.isResizingColumn === column.id;
@@ -640,17 +528,13 @@ const ColumnSizing = {
640
528
  return {
641
529
  getSize: () => {
642
530
  let sum = 0;
643
-
644
531
  const recurse = header => {
645
532
  if (header.subHeaders.length) {
646
533
  header.subHeaders.forEach(recurse);
647
534
  } else {
648
- var _header$column$getSiz;
649
-
650
- sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
535
+ sum += header.column.getSize() ?? 0;
651
536
  }
652
537
  };
653
-
654
538
  recurse(header);
655
539
  return sum;
656
540
  },
@@ -659,7 +543,6 @@ const ColumnSizing = {
659
543
  const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
660
544
  return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
661
545
  }
662
-
663
546
  return 0;
664
547
  },
665
548
  getResizeHandler: () => {
@@ -670,51 +553,45 @@ const ColumnSizing = {
670
553
  return;
671
554
  }
672
555
  e.persist == null ? void 0 : e.persist();
673
-
674
556
  if (isTouchStartEvent(e)) {
675
557
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
676
558
  if (e.touches && e.touches.length > 1) {
677
559
  return;
678
560
  }
679
561
  }
680
-
681
562
  const startSize = header.getSize();
682
563
  const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
683
564
  const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
684
-
685
565
  const updateOffset = (eventType, clientXPos) => {
686
566
  if (typeof clientXPos !== 'number') {
687
567
  return;
688
568
  }
689
-
690
569
  let newColumnSizing = {};
691
570
  table.setColumnSizingInfo(old => {
692
- var _old$startOffset, _old$startSize;
693
-
694
- const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
695
- const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
696
- old.columnSizingStart.forEach(_ref3 => {
697
- let [columnId, headerSize] = _ref3;
571
+ const deltaOffset = clientXPos - ((old == null ? void 0 : old.startOffset) ?? 0);
572
+ const deltaPercentage = Math.max(deltaOffset / ((old == null ? void 0 : old.startSize) ?? 0), -0.999999);
573
+ old.columnSizingStart.forEach(_ref2 => {
574
+ let [columnId, headerSize] = _ref2;
698
575
  newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
699
576
  });
700
- return { ...old,
577
+ return {
578
+ ...old,
701
579
  deltaOffset,
702
580
  deltaPercentage
703
581
  };
704
582
  });
705
-
706
583
  if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
707
- table.setColumnSizing(old => ({ ...old,
584
+ table.setColumnSizing(old => ({
585
+ ...old,
708
586
  ...newColumnSizing
709
587
  }));
710
588
  }
711
589
  };
712
-
713
590
  const onMove = clientXPos => updateOffset('move', clientXPos);
714
-
715
591
  const onEnd = clientXPos => {
716
592
  updateOffset('end', clientXPos);
717
- table.setColumnSizingInfo(old => ({ ...old,
593
+ table.setColumnSizingInfo(old => ({
594
+ ...old,
718
595
  isResizingColumn: false,
719
596
  startOffset: null,
720
597
  startSize: null,
@@ -723,7 +600,6 @@ const ColumnSizing = {
723
600
  columnSizingStart: []
724
601
  }));
725
602
  };
726
-
727
603
  const mouseEvents = {
728
604
  moveHandler: e => onMove(e.clientX),
729
605
  upHandler: e => {
@@ -732,16 +608,38 @@ const ColumnSizing = {
732
608
  onEnd(e.clientX);
733
609
  }
734
610
  };
611
+ const touchEvents = {
612
+ moveHandler: e => {
613
+ if (e.cancelable) {
614
+ e.preventDefault();
615
+ e.stopPropagation();
616
+ }
617
+ onMove(e.touches[0].clientX);
618
+ return false;
619
+ },
620
+ upHandler: e => {
621
+ var _e$touches$;
622
+ document.removeEventListener('touchmove', touchEvents.moveHandler);
623
+ document.removeEventListener('touchend', touchEvents.upHandler);
624
+ if (e.cancelable) {
625
+ e.preventDefault();
626
+ e.stopPropagation();
627
+ }
628
+ onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
629
+ }
630
+ };
735
631
  const passiveIfSupported = passiveEventSupported() ? {
736
632
  passive: false
737
633
  } : false;
738
-
739
- if (isTouchStartEvent(e)) ; else {
634
+ if (isTouchStartEvent(e)) {
635
+ document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
636
+ document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
637
+ } else {
740
638
  document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
741
639
  document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
742
640
  }
743
-
744
- table.setColumnSizingInfo(old => ({ ...old,
641
+ table.setColumnSizingInfo(old => ({
642
+ ...old,
745
643
  startOffset: clientX,
746
644
  startSize,
747
645
  deltaOffset: 0,
@@ -758,42 +656,34 @@ const ColumnSizing = {
758
656
  setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
759
657
  setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
760
658
  resetColumnSizing: defaultState => {
761
- var _table$initialState$c;
762
-
763
- table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
659
+ table.setColumnSizing(defaultState ? {} : table.initialState.columnSizing ?? {});
764
660
  },
765
661
  resetHeaderSizeInfo: defaultState => {
766
- var _table$initialState$c2;
767
-
768
- table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
662
+ table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : table.initialState.columnSizingInfo ?? getDefaultColumnSizingInfoState());
769
663
  },
770
664
  getTotalSize: () => {
771
- var _table$getHeaderGroup, _table$getHeaderGroup2;
772
-
773
- return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
665
+ var _table$getHeaderGroup;
666
+ return ((_table$getHeaderGroup = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup.headers.reduce((sum, header) => {
774
667
  return sum + header.getSize();
775
- }, 0)) != null ? _table$getHeaderGroup : 0;
668
+ }, 0)) ?? 0;
776
669
  },
777
670
  getLeftTotalSize: () => {
778
- var _table$getLeftHeaderG, _table$getLeftHeaderG2;
779
-
780
- return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
671
+ var _table$getLeftHeaderG;
672
+ return ((_table$getLeftHeaderG = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG.headers.reduce((sum, header) => {
781
673
  return sum + header.getSize();
782
- }, 0)) != null ? _table$getLeftHeaderG : 0;
674
+ }, 0)) ?? 0;
783
675
  },
784
676
  getCenterTotalSize: () => {
785
- var _table$getCenterHeade, _table$getCenterHeade2;
786
-
787
- return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
677
+ var _table$getCenterHeade;
678
+ return ((_table$getCenterHeade = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade.headers.reduce((sum, header) => {
788
679
  return sum + header.getSize();
789
- }, 0)) != null ? _table$getCenterHeade : 0;
680
+ }, 0)) ?? 0;
790
681
  },
791
682
  getRightTotalSize: () => {
792
- var _table$getRightHeader, _table$getRightHeader2;
793
-
794
- return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
683
+ var _table$getRightHeader;
684
+ return ((_table$getRightHeader = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader.headers.reduce((sum, header) => {
795
685
  return sum + header.getSize();
796
- }, 0)) != null ? _table$getRightHeader : 0;
686
+ }, 0)) ?? 0;
797
687
  }
798
688
  };
799
689
  }
@@ -802,33 +692,28 @@ let passiveSupported = null;
802
692
  function passiveEventSupported() {
803
693
  if (typeof passiveSupported === 'boolean') return passiveSupported;
804
694
  let supported = false;
805
-
806
695
  try {
807
696
  const options = {
808
697
  get passive() {
809
698
  supported = true;
810
699
  return false;
811
700
  }
812
-
813
701
  };
814
-
815
702
  const noop = () => {};
816
-
817
703
  window.addEventListener('test', noop, options);
818
704
  window.removeEventListener('test', noop);
819
705
  } catch (err) {
820
706
  supported = false;
821
707
  }
822
-
823
708
  passiveSupported = supported;
824
709
  return passiveSupported;
825
710
  }
826
-
827
711
  function isTouchStartEvent(e) {
828
712
  return e.type === 'touchstart';
829
713
  }
830
714
 
831
715
  //
716
+
832
717
  const Expanding = {
833
718
  getInitialState: state => {
834
719
  return {
@@ -847,20 +732,15 @@ const Expanding = {
847
732
  let queued = false;
848
733
  return {
849
734
  _autoResetExpanded: () => {
850
- var _ref, _table$options$autoRe;
851
-
852
735
  if (!registered) {
853
736
  table._queue(() => {
854
737
  registered = true;
855
738
  });
856
-
857
739
  return;
858
740
  }
859
-
860
- if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
741
+ if (table.options.autoResetAll ?? table.options.autoResetExpanded ?? !table.options.manualExpanding) {
861
742
  if (queued) return;
862
743
  queued = true;
863
-
864
744
  table._queue(() => {
865
745
  table.resetExpanded();
866
746
  queued = false;
@@ -869,16 +749,15 @@ const Expanding = {
869
749
  },
870
750
  setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
871
751
  toggleAllRowsExpanded: expanded => {
872
- if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
752
+ if (expanded ?? !table.getIsAllRowsExpanded()) {
873
753
  table.setExpanded(true);
874
754
  } else {
875
755
  table.setExpanded({});
876
756
  }
877
757
  },
878
758
  resetExpanded: defaultState => {
879
- var _table$initialState$e, _table$initialState;
880
-
881
- table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
759
+ var _table$initialState;
760
+ table.setExpanded(defaultState ? {} : ((_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) ?? {});
882
761
  },
883
762
  getCanSomeRowsExpand: () => {
884
763
  return table.getRowModel().flatRows.some(row => row.getCanExpand());
@@ -894,22 +773,22 @@ const Expanding = {
894
773
  return expanded === true || Object.values(expanded).some(Boolean);
895
774
  },
896
775
  getIsAllRowsExpanded: () => {
897
- const expanded = table.getState().expanded; // If expanded is true, save some cycles and return true
776
+ const expanded = table.getState().expanded;
898
777
 
778
+ // If expanded is true, save some cycles and return true
899
779
  if (typeof expanded === 'boolean') {
900
780
  return expanded === true;
901
781
  }
902
-
903
782
  if (!Object.keys(expanded).length) {
904
783
  return false;
905
- } // If any row is not expanded, return false
906
-
784
+ }
907
785
 
908
- if (table.getRowModel().flatRows.some(row => row.getIsExpanded())) {
786
+ // If any row is not expanded, return false
787
+ if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
909
788
  return false;
910
- } // They must all be expanded :shrug:
911
-
789
+ }
912
790
 
791
+ // They must all be expanded :shrug:
913
792
  return true;
914
793
  },
915
794
  getExpandedDepth: () => {
@@ -926,11 +805,9 @@ const Expanding = {
926
805
  if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
927
806
  table._getExpandedRowModel = table.options.getExpandedRowModel(table);
928
807
  }
929
-
930
808
  if (table.options.manualExpanding || !table._getExpandedRowModel) {
931
809
  return table.getPreExpandedRowModel();
932
810
  }
933
-
934
811
  return table._getExpandedRowModel();
935
812
  }
936
813
  };
@@ -939,11 +816,8 @@ const Expanding = {
939
816
  return {
940
817
  toggleExpanded: expanded => {
941
818
  table.setExpanded(old => {
942
- var _expanded;
943
-
944
819
  const exists = old === true ? true : !!(old != null && old[row.id]);
945
820
  let oldExpanded = {};
946
-
947
821
  if (old === true) {
948
822
  Object.keys(table.getRowModel().rowsById).forEach(rowId => {
949
823
  oldExpanded[rowId] = true;
@@ -951,15 +825,13 @@ const Expanding = {
951
825
  } else {
952
826
  oldExpanded = old;
953
827
  }
954
-
955
- expanded = (_expanded = expanded) != null ? _expanded : !exists;
956
-
828
+ expanded = expanded ?? !exists;
957
829
  if (!exists && expanded) {
958
- return { ...oldExpanded,
830
+ return {
831
+ ...oldExpanded,
959
832
  [row.id]: true
960
833
  };
961
834
  }
962
-
963
835
  if (exists && !expanded) {
964
836
  const {
965
837
  [row.id]: _,
@@ -967,20 +839,16 @@ const Expanding = {
967
839
  } = oldExpanded;
968
840
  return rest;
969
841
  }
970
-
971
842
  return old;
972
843
  });
973
844
  },
974
845
  getIsExpanded: () => {
975
- var _table$options$getIsR;
976
-
977
846
  const expanded = table.getState().expanded;
978
- 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]));
847
+ return !!((table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) ?? (expanded === true || expanded != null && expanded[row.id]));
979
848
  },
980
849
  getCanExpand: () => {
981
- var _table$options$getRow, _table$options$enable, _row$subRows;
982
-
983
- return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
850
+ var _row$subRows;
851
+ return (table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) ?? ((table.options.enableExpanding ?? true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length));
984
852
  },
985
853
  getToggleExpandedHandler: () => {
986
854
  const canExpand = row.getCanExpand();
@@ -995,93 +863,68 @@ const Expanding = {
995
863
 
996
864
  const includesString = (row, columnId, filterValue) => {
997
865
  var _row$getValue;
998
-
999
866
  const search = filterValue.toLowerCase();
1000
867
  return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
1001
868
  };
1002
-
1003
869
  includesString.autoRemove = val => testFalsey(val);
1004
-
1005
870
  const includesStringSensitive = (row, columnId, filterValue) => {
1006
871
  var _row$getValue2;
1007
-
1008
872
  return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
1009
873
  };
1010
-
1011
874
  includesStringSensitive.autoRemove = val => testFalsey(val);
1012
-
1013
875
  const equalsString = (row, columnId, filterValue) => {
1014
876
  var _row$getValue3;
1015
-
1016
877
  return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
1017
878
  };
1018
-
1019
879
  equalsString.autoRemove = val => testFalsey(val);
1020
-
1021
880
  const arrIncludes = (row, columnId, filterValue) => {
1022
881
  var _row$getValue4;
1023
-
1024
882
  return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
1025
883
  };
1026
-
1027
884
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1028
-
1029
885
  const arrIncludesAll = (row, columnId, filterValue) => {
1030
886
  return !filterValue.some(val => {
1031
887
  var _row$getValue5;
1032
-
1033
888
  return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1034
889
  });
1035
890
  };
1036
-
1037
891
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1038
-
1039
892
  const arrIncludesSome = (row, columnId, filterValue) => {
1040
893
  return filterValue.some(val => {
1041
894
  var _row$getValue6;
1042
-
1043
895
  return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1044
896
  });
1045
897
  };
1046
-
1047
898
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1048
-
1049
899
  const equals = (row, columnId, filterValue) => {
1050
900
  return row.getValue(columnId) === filterValue;
1051
901
  };
1052
-
1053
902
  equals.autoRemove = val => testFalsey(val);
1054
-
1055
903
  const weakEquals = (row, columnId, filterValue) => {
1056
904
  return row.getValue(columnId) == filterValue;
1057
905
  };
1058
-
1059
906
  weakEquals.autoRemove = val => testFalsey(val);
1060
-
1061
907
  const inNumberRange = (row, columnId, filterValue) => {
1062
908
  let [min, max] = filterValue;
1063
909
  const rowValue = row.getValue(columnId);
1064
910
  return rowValue >= min && rowValue <= max;
1065
911
  };
1066
-
1067
912
  inNumberRange.resolveFilterValue = val => {
1068
913
  let [unsafeMin, unsafeMax] = val;
1069
914
  let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;
1070
915
  let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;
1071
916
  let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;
1072
917
  let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;
1073
-
1074
918
  if (min > max) {
1075
919
  const temp = min;
1076
920
  min = max;
1077
921
  max = temp;
1078
922
  }
1079
-
1080
923
  return [min, max];
1081
924
  };
925
+ inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);
1082
926
 
1083
- inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); // Export
1084
-
927
+ // Export
1085
928
 
1086
929
  const filterFns = {
1087
930
  includesString,
@@ -1094,13 +937,14 @@ const filterFns = {
1094
937
  weakEquals,
1095
938
  inNumberRange
1096
939
  };
1097
-
1098
940
  // Utils
941
+
1099
942
  function testFalsey(val) {
1100
943
  return val === undefined || val === null || val === '';
1101
944
  }
1102
945
 
1103
946
  //
947
+
1104
948
  const Filters = {
1105
949
  getDefaultColumnDef: () => {
1106
950
  return {
@@ -1124,7 +968,6 @@ const Filters = {
1124
968
  globalFilterFn: 'auto',
1125
969
  getColumnCanGlobalFilter: column => {
1126
970
  var _table$getCoreRowMode, _table$getCoreRowMode2;
1127
-
1128
971
  const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1129
972
  return typeof value === 'string' || typeof value === 'number';
1130
973
  }
@@ -1135,88 +978,67 @@ const Filters = {
1135
978
  getAutoFilterFn: () => {
1136
979
  const firstRow = table.getCoreRowModel().flatRows[0];
1137
980
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1138
-
1139
981
  if (typeof value === 'string') {
1140
982
  return filterFns.includesString;
1141
983
  }
1142
-
1143
984
  if (typeof value === 'number') {
1144
985
  return filterFns.inNumberRange;
1145
986
  }
1146
-
1147
987
  if (typeof value === 'boolean') {
1148
988
  return filterFns.equals;
1149
989
  }
1150
-
1151
990
  if (value !== null && typeof value === 'object') {
1152
991
  return filterFns.equals;
1153
992
  }
1154
-
1155
993
  if (Array.isArray(value)) {
1156
994
  return filterFns.arrIncludes;
1157
995
  }
1158
-
1159
996
  return filterFns.weakEquals;
1160
997
  },
1161
998
  getFilterFn: () => {
1162
- var _table$options$filter, _table$options$filter2;
1163
-
1164
- return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
999
+ var _table$options$filter;
1000
+ return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : ((_table$options$filter = table.options.filterFns) == null ? void 0 : _table$options$filter[column.columnDef.filterFn]) ?? filterFns[column.columnDef.filterFn];
1165
1001
  },
1166
1002
  getCanFilter: () => {
1167
- var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
1168
-
1169
- 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;
1003
+ return (column.columnDef.enableColumnFilter ?? true) && (table.options.enableColumnFilters ?? true) && (table.options.enableFilters ?? true) && !!column.accessorFn;
1170
1004
  },
1171
1005
  getCanGlobalFilter: () => {
1172
- var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1173
-
1174
- 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;
1006
+ return (column.columnDef.enableGlobalFilter ?? true) && (table.options.enableGlobalFilter ?? true) && (table.options.enableFilters ?? true) && ((table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) ?? true) && !!column.accessorFn;
1175
1007
  },
1176
1008
  getIsFiltered: () => column.getFilterIndex() > -1,
1177
1009
  getFilterValue: () => {
1178
1010
  var _table$getState$colum, _table$getState$colum2;
1179
-
1180
1011
  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;
1181
1012
  },
1182
1013
  getFilterIndex: () => {
1183
- var _table$getState$colum3, _table$getState$colum4;
1184
-
1185
- 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;
1014
+ var _table$getState$colum3;
1015
+ return ((_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) ?? -1;
1186
1016
  },
1187
1017
  setFilterValue: value => {
1188
1018
  table.setColumnFilters(old => {
1189
1019
  const filterFn = column.getFilterFn();
1190
1020
  const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1191
- const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined); //
1021
+ const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
1192
1022
 
1023
+ //
1193
1024
  if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
1194
- var _old$filter;
1195
-
1196
- return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
1025
+ return (old == null ? void 0 : old.filter(d => d.id !== column.id)) ?? [];
1197
1026
  }
1198
-
1199
1027
  const newFilterObj = {
1200
1028
  id: column.id,
1201
1029
  value: newFilter
1202
1030
  };
1203
-
1204
1031
  if (previousfilter) {
1205
- var _old$map;
1206
-
1207
- return (_old$map = old == null ? void 0 : old.map(d => {
1032
+ return (old == null ? void 0 : old.map(d => {
1208
1033
  if (d.id === column.id) {
1209
1034
  return newFilterObj;
1210
1035
  }
1211
-
1212
1036
  return d;
1213
- })) != null ? _old$map : [];
1037
+ })) ?? [];
1214
1038
  }
1215
-
1216
1039
  if (old != null && old.length) {
1217
1040
  return [...old, newFilterObj];
1218
1041
  }
1219
-
1220
1042
  return [newFilterObj];
1221
1043
  });
1222
1044
  },
@@ -1225,7 +1047,6 @@ const Filters = {
1225
1047
  if (!column._getFacetedRowModel) {
1226
1048
  return table.getPreFilteredRowModel();
1227
1049
  }
1228
-
1229
1050
  return column._getFacetedRowModel();
1230
1051
  },
1231
1052
  _getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
@@ -1233,7 +1054,6 @@ const Filters = {
1233
1054
  if (!column._getFacetedUniqueValues) {
1234
1055
  return new Map();
1235
1056
  }
1236
-
1237
1057
  return column._getFacetedUniqueValues();
1238
1058
  },
1239
1059
  _getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
@@ -1241,13 +1061,13 @@ const Filters = {
1241
1061
  if (!column._getFacetedMinMaxValues) {
1242
1062
  return undefined;
1243
1063
  }
1244
-
1245
1064
  return column._getFacetedMinMaxValues();
1246
- } // () => [column.getFacetedRowModel()],
1065
+ }
1066
+ // () => [column.getFacetedRowModel()],
1247
1067
  // facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
1248
-
1249
1068
  };
1250
1069
  },
1070
+
1251
1071
  createRow: (row, table) => {
1252
1072
  return {
1253
1073
  columnFilters: {},
@@ -1260,34 +1080,27 @@ const Filters = {
1260
1080
  return filterFns.includesString;
1261
1081
  },
1262
1082
  getGlobalFilterFn: () => {
1263
- var _table$options$filter3, _table$options$filter4;
1264
-
1083
+ var _table$options$filter2;
1265
1084
  const {
1266
1085
  globalFilterFn: globalFilterFn
1267
1086
  } = table.options;
1268
- return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn];
1087
+ return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : ((_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) ?? filterFns[globalFilterFn];
1269
1088
  },
1270
1089
  setColumnFilters: updater => {
1271
1090
  const leafColumns = table.getAllLeafColumns();
1272
-
1273
1091
  const updateFn = old => {
1274
1092
  var _functionalUpdate;
1275
-
1276
1093
  return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
1277
1094
  const column = leafColumns.find(d => d.id === filter.id);
1278
-
1279
1095
  if (column) {
1280
1096
  const filterFn = column.getFilterFn();
1281
-
1282
1097
  if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
1283
1098
  return false;
1284
1099
  }
1285
1100
  }
1286
-
1287
1101
  return true;
1288
1102
  });
1289
1103
  };
1290
-
1291
1104
  table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1292
1105
  },
1293
1106
  setGlobalFilter: updater => {
@@ -1297,20 +1110,17 @@ const Filters = {
1297
1110
  table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1298
1111
  },
1299
1112
  resetColumnFilters: defaultState => {
1300
- var _table$initialState$c, _table$initialState;
1301
-
1302
- table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1113
+ var _table$initialState;
1114
+ table.setColumnFilters(defaultState ? [] : ((_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) ?? []);
1303
1115
  },
1304
1116
  getPreFilteredRowModel: () => table.getCoreRowModel(),
1305
1117
  getFilteredRowModel: () => {
1306
1118
  if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
1307
1119
  table._getFilteredRowModel = table.options.getFilteredRowModel(table);
1308
1120
  }
1309
-
1310
1121
  if (table.options.manualFiltering || !table._getFilteredRowModel) {
1311
1122
  return table.getPreFilteredRowModel();
1312
1123
  }
1313
-
1314
1124
  return table._getFilteredRowModel();
1315
1125
  },
1316
1126
  _getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
@@ -1318,7 +1128,6 @@ const Filters = {
1318
1128
  if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
1319
1129
  return table.getPreFilteredRowModel();
1320
1130
  }
1321
-
1322
1131
  return table._getGlobalFacetedRowModel();
1323
1132
  },
1324
1133
  _getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
@@ -1326,7 +1135,6 @@ const Filters = {
1326
1135
  if (!table._getGlobalFacetedUniqueValues) {
1327
1136
  return new Map();
1328
1137
  }
1329
-
1330
1138
  return table._getGlobalFacetedUniqueValues();
1331
1139
  },
1332
1140
  _getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
@@ -1334,7 +1142,6 @@ const Filters = {
1334
1142
  if (!table._getGlobalFacetedMinMaxValues) {
1335
1143
  return;
1336
1144
  }
1337
-
1338
1145
  return table._getGlobalFacetedMinMaxValues();
1339
1146
  }
1340
1147
  };
@@ -1352,37 +1159,31 @@ const sum = (columnId, _leafRows, childRows) => {
1352
1159
  return sum + (typeof nextValue === 'number' ? nextValue : 0);
1353
1160
  }, 0);
1354
1161
  };
1355
-
1356
1162
  const min = (columnId, _leafRows, childRows) => {
1357
1163
  let min;
1358
1164
  childRows.forEach(row => {
1359
1165
  const value = row.getValue(columnId);
1360
-
1361
1166
  if (value != null && (min > value || min === undefined && value >= value)) {
1362
1167
  min = value;
1363
1168
  }
1364
1169
  });
1365
1170
  return min;
1366
1171
  };
1367
-
1368
1172
  const max = (columnId, _leafRows, childRows) => {
1369
1173
  let max;
1370
1174
  childRows.forEach(row => {
1371
1175
  const value = row.getValue(columnId);
1372
-
1373
1176
  if (value != null && (max < value || max === undefined && value >= value)) {
1374
1177
  max = value;
1375
1178
  }
1376
1179
  });
1377
1180
  return max;
1378
1181
  };
1379
-
1380
1182
  const extent = (columnId, _leafRows, childRows) => {
1381
1183
  let min;
1382
1184
  let max;
1383
1185
  childRows.forEach(row => {
1384
1186
  const value = row.getValue(columnId);
1385
-
1386
1187
  if (value != null) {
1387
1188
  if (min === undefined) {
1388
1189
  if (value >= value) min = max = value;
@@ -1394,13 +1195,11 @@ const extent = (columnId, _leafRows, childRows) => {
1394
1195
  });
1395
1196
  return [min, max];
1396
1197
  };
1397
-
1398
1198
  const mean = (columnId, leafRows) => {
1399
1199
  let count = 0;
1400
1200
  let sum = 0;
1401
1201
  leafRows.forEach(row => {
1402
1202
  let value = row.getValue(columnId);
1403
-
1404
1203
  if (value != null && (value = +value) >= value) {
1405
1204
  ++count, sum += value;
1406
1205
  }
@@ -1408,17 +1207,14 @@ const mean = (columnId, leafRows) => {
1408
1207
  if (count) return sum / count;
1409
1208
  return;
1410
1209
  };
1411
-
1412
1210
  const median = (columnId, leafRows) => {
1413
1211
  if (!leafRows.length) {
1414
1212
  return;
1415
1213
  }
1416
-
1417
1214
  let min = 0;
1418
1215
  let max = 0;
1419
1216
  leafRows.forEach(row => {
1420
1217
  let value = row.getValue(columnId);
1421
-
1422
1218
  if (typeof value === 'number') {
1423
1219
  min = Math.min(min, value);
1424
1220
  max = Math.max(max, value);
@@ -1426,19 +1222,15 @@ const median = (columnId, leafRows) => {
1426
1222
  });
1427
1223
  return (min + max) / 2;
1428
1224
  };
1429
-
1430
1225
  const unique = (columnId, leafRows) => {
1431
1226
  return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
1432
1227
  };
1433
-
1434
1228
  const uniqueCount = (columnId, leafRows) => {
1435
1229
  return new Set(leafRows.map(d => d.getValue(columnId))).size;
1436
1230
  };
1437
-
1438
1231
  const count = (_columnId, leafRows) => {
1439
1232
  return leafRows.length;
1440
1233
  };
1441
-
1442
1234
  const aggregationFns = {
1443
1235
  sum,
1444
1236
  min,
@@ -1452,13 +1244,13 @@ const aggregationFns = {
1452
1244
  };
1453
1245
 
1454
1246
  //
1247
+
1455
1248
  const Grouping = {
1456
1249
  getDefaultColumnDef: () => {
1457
1250
  return {
1458
1251
  aggregatedCell: props => {
1459
- var _toString, _props$getValue;
1460
-
1461
- return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1252
+ var _props$getValue;
1253
+ return ((_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) ?? null;
1462
1254
  },
1463
1255
  aggregationFn: 'auto'
1464
1256
  };
@@ -1483,23 +1275,18 @@ const Grouping = {
1483
1275
  if (old != null && old.includes(column.id)) {
1484
1276
  return old.filter(d => d !== column.id);
1485
1277
  }
1486
-
1487
- return [...(old != null ? old : []), column.id];
1278
+ return [...(old ?? []), column.id];
1488
1279
  });
1489
1280
  },
1490
1281
  getCanGroup: () => {
1491
- var _ref, _ref2, _ref3, _column$columnDef$ena;
1492
-
1493
- 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;
1282
+ return column.columnDef.enableGrouping ?? true ?? table.options.enableGrouping ?? true ?? !!column.accessorFn;
1494
1283
  },
1495
1284
  getIsGrouped: () => {
1496
1285
  var _table$getState$group;
1497
-
1498
1286
  return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1499
1287
  },
1500
1288
  getGroupedIndex: () => {
1501
1289
  var _table$getState$group2;
1502
-
1503
1290
  return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1504
1291
  },
1505
1292
  getToggleGroupingHandler: () => {
@@ -1512,23 +1299,19 @@ const Grouping = {
1512
1299
  getAutoAggregationFn: () => {
1513
1300
  const firstRow = table.getCoreRowModel().flatRows[0];
1514
1301
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1515
-
1516
1302
  if (typeof value === 'number') {
1517
1303
  return aggregationFns.sum;
1518
1304
  }
1519
-
1520
1305
  if (Object.prototype.toString.call(value) === '[object Date]') {
1521
1306
  return aggregationFns.extent;
1522
1307
  }
1523
1308
  },
1524
1309
  getAggregationFn: () => {
1525
- var _table$options$aggreg, _table$options$aggreg2;
1526
-
1310
+ var _table$options$aggreg;
1527
1311
  if (!column) {
1528
1312
  throw new Error();
1529
1313
  }
1530
-
1531
- return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
1314
+ return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : ((_table$options$aggreg = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg[column.columnDef.aggregationFn]) ?? aggregationFns[column.columnDef.aggregationFn];
1532
1315
  }
1533
1316
  };
1534
1317
  },
@@ -1536,20 +1319,17 @@ const Grouping = {
1536
1319
  return {
1537
1320
  setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1538
1321
  resetGrouping: defaultState => {
1539
- var _table$initialState$g, _table$initialState;
1540
-
1541
- table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1322
+ var _table$initialState;
1323
+ table.setGrouping(defaultState ? [] : ((_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) ?? []);
1542
1324
  },
1543
1325
  getPreGroupedRowModel: () => table.getFilteredRowModel(),
1544
1326
  getGroupedRowModel: () => {
1545
1327
  if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
1546
1328
  table._getGroupedRowModel = table.options.getGroupedRowModel(table);
1547
1329
  }
1548
-
1549
1330
  if (table.options.manualGrouping || !table._getGroupedRowModel) {
1550
1331
  return table.getPreGroupedRowModel();
1551
1332
  }
1552
-
1553
1333
  return table._getGroupedRowModel();
1554
1334
  }
1555
1335
  };
@@ -1561,13 +1341,11 @@ const Grouping = {
1561
1341
  };
1562
1342
  },
1563
1343
  createCell: (cell, column, row, table) => {
1564
-
1565
1344
  return {
1566
1345
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
1567
1346
  getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
1568
1347
  getIsAggregated: () => {
1569
1348
  var _row$subRows;
1570
-
1571
1349
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1572
1350
  }
1573
1351
  };
@@ -1577,18 +1355,16 @@ function orderColumns(leafColumns, grouping, groupedColumnMode) {
1577
1355
  if (!(grouping != null && grouping.length) || !groupedColumnMode) {
1578
1356
  return leafColumns;
1579
1357
  }
1580
-
1581
1358
  const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
1582
-
1583
1359
  if (groupedColumnMode === 'remove') {
1584
1360
  return nonGroupingColumns;
1585
1361
  }
1586
-
1587
1362
  const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);
1588
1363
  return [...groupingColumns, ...nonGroupingColumns];
1589
1364
  }
1590
1365
 
1591
1366
  //
1367
+
1592
1368
  const Ordering = {
1593
1369
  getInitialState: state => {
1594
1370
  return {
@@ -1605,58 +1381,59 @@ const Ordering = {
1605
1381
  return {
1606
1382
  setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1607
1383
  resetColumnOrder: defaultState => {
1608
- var _table$initialState$c;
1609
-
1610
- table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
1384
+ table.setColumnOrder(defaultState ? [] : table.initialState.columnOrder ?? []);
1611
1385
  },
1612
1386
  _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
1613
1387
  // Sort grouped columns to the start of the column list
1614
1388
  // before the headers are built
1615
- let orderedColumns = []; // If there is no order, return the normal columns
1389
+ let orderedColumns = [];
1616
1390
 
1391
+ // If there is no order, return the normal columns
1617
1392
  if (!(columnOrder != null && columnOrder.length)) {
1618
1393
  orderedColumns = columns;
1619
1394
  } else {
1620
- const columnOrderCopy = [...columnOrder]; // If there is an order, make a copy of the columns
1395
+ const columnOrderCopy = [...columnOrder];
1621
1396
 
1622
- const columnsCopy = [...columns]; // And make a new ordered array of the columns
1623
- // Loop over the columns and place them in order into the new array
1397
+ // If there is an order, make a copy of the columns
1398
+ const columnsCopy = [...columns];
1399
+
1400
+ // And make a new ordered array of the columns
1624
1401
 
1402
+ // Loop over the columns and place them in order into the new array
1625
1403
  while (columnsCopy.length && columnOrderCopy.length) {
1626
1404
  const targetColumnId = columnOrderCopy.shift();
1627
1405
  const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
1628
-
1629
1406
  if (foundIndex > -1) {
1630
1407
  orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
1631
1408
  }
1632
- } // If there are any columns left, add them to the end
1633
-
1409
+ }
1634
1410
 
1411
+ // If there are any columns left, add them to the end
1635
1412
  orderedColumns = [...orderedColumns, ...columnsCopy];
1636
1413
  }
1637
-
1638
1414
  return orderColumns(orderedColumns, grouping, groupedColumnMode);
1639
1415
  }, {
1640
- key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn' // debug: () => table.options.debugAll ?? table.options.debugTable,
1641
-
1416
+ key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn'
1417
+ // debug: () => table.options.debugAll ?? table.options.debugTable,
1642
1418
  })
1643
1419
  };
1644
1420
  }
1645
1421
  };
1646
1422
 
1647
1423
  //
1424
+
1648
1425
  const defaultPageIndex = 0;
1649
1426
  const defaultPageSize = 10;
1650
-
1651
1427
  const getDefaultPaginationState = () => ({
1652
1428
  pageIndex: defaultPageIndex,
1653
1429
  pageSize: defaultPageSize
1654
1430
  });
1655
-
1656
1431
  const Pagination = {
1657
1432
  getInitialState: state => {
1658
- return { ...state,
1659
- pagination: { ...getDefaultPaginationState(),
1433
+ return {
1434
+ ...state,
1435
+ pagination: {
1436
+ ...getDefaultPaginationState(),
1660
1437
  ...(state == null ? void 0 : state.pagination)
1661
1438
  }
1662
1439
  };
@@ -1671,20 +1448,15 @@ const Pagination = {
1671
1448
  let queued = false;
1672
1449
  return {
1673
1450
  _autoResetPageIndex: () => {
1674
- var _ref, _table$options$autoRe;
1675
-
1676
1451
  if (!registered) {
1677
1452
  table._queue(() => {
1678
1453
  registered = true;
1679
1454
  });
1680
-
1681
1455
  return;
1682
1456
  }
1683
-
1684
- if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
1457
+ if (table.options.autoResetAll ?? table.options.autoResetPageIndex ?? !table.options.manualPagination) {
1685
1458
  if (queued) return;
1686
1459
  queued = true;
1687
-
1688
1460
  table._queue(() => {
1689
1461
  table.resetPageIndex();
1690
1462
  queued = false;
@@ -1696,73 +1468,61 @@ const Pagination = {
1696
1468
  let newState = functionalUpdate(updater, old);
1697
1469
  return newState;
1698
1470
  };
1699
-
1700
1471
  return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1701
1472
  },
1702
1473
  resetPagination: defaultState => {
1703
- var _table$initialState$p;
1704
-
1705
- table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
1474
+ table.setPagination(defaultState ? getDefaultPaginationState() : table.initialState.pagination ?? getDefaultPaginationState());
1706
1475
  },
1707
1476
  setPageIndex: updater => {
1708
1477
  table.setPagination(old => {
1709
1478
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1710
1479
  const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
1711
1480
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1712
- return { ...old,
1481
+ return {
1482
+ ...old,
1713
1483
  pageIndex
1714
1484
  };
1715
1485
  });
1716
1486
  },
1717
1487
  resetPageIndex: defaultState => {
1718
- var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1719
-
1720
- 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);
1488
+ var _table$initialState, _table$initialState$p;
1489
+ table.setPageIndex(defaultState ? defaultPageIndex : ((_table$initialState = table.initialState) == null ? void 0 : (_table$initialState$p = _table$initialState.pagination) == null ? void 0 : _table$initialState$p.pageIndex) ?? defaultPageIndex);
1721
1490
  },
1722
1491
  resetPageSize: defaultState => {
1723
- var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1724
-
1725
- 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);
1492
+ var _table$initialState2, _table$initialState2$;
1493
+ table.setPageSize(defaultState ? defaultPageSize : ((_table$initialState2 = table.initialState) == null ? void 0 : (_table$initialState2$ = _table$initialState2.pagination) == null ? void 0 : _table$initialState2$.pageSize) ?? defaultPageSize);
1726
1494
  },
1727
1495
  setPageSize: updater => {
1728
1496
  table.setPagination(old => {
1729
1497
  const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
1730
1498
  const topRowIndex = old.pageSize * old.pageIndex;
1731
1499
  const pageIndex = Math.floor(topRowIndex / pageSize);
1732
- return { ...old,
1500
+ return {
1501
+ ...old,
1733
1502
  pageIndex,
1734
1503
  pageSize
1735
1504
  };
1736
1505
  });
1737
1506
  },
1738
1507
  setPageCount: updater => table.setPagination(old => {
1739
- var _table$options$pageCo;
1740
-
1741
- let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
1742
-
1508
+ let newPageCount = functionalUpdate(updater, table.options.pageCount ?? -1);
1743
1509
  if (typeof newPageCount === 'number') {
1744
1510
  newPageCount = Math.max(-1, newPageCount);
1745
1511
  }
1746
-
1747
- return { ...old,
1512
+ return {
1513
+ ...old,
1748
1514
  pageCount: newPageCount
1749
1515
  };
1750
1516
  }),
1751
1517
  getPageOptions: memo(() => [table.getPageCount()], pageCount => {
1752
1518
  let pageOptions = [];
1753
-
1754
1519
  if (pageCount && pageCount > 0) {
1755
1520
  pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
1756
1521
  }
1757
-
1758
1522
  return pageOptions;
1759
1523
  }, {
1760
1524
  key: process.env.NODE_ENV === 'development' && 'getPageOptions',
1761
- debug: () => {
1762
- var _table$options$debugA;
1763
-
1764
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
1765
- }
1525
+ debug: () => table.options.debugAll ?? table.options.debugTable
1766
1526
  }),
1767
1527
  getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
1768
1528
  getCanNextPage: () => {
@@ -1770,15 +1530,12 @@ const Pagination = {
1770
1530
  pageIndex
1771
1531
  } = table.getState().pagination;
1772
1532
  const pageCount = table.getPageCount();
1773
-
1774
1533
  if (pageCount === -1) {
1775
1534
  return true;
1776
1535
  }
1777
-
1778
1536
  if (pageCount === 0) {
1779
1537
  return false;
1780
1538
  }
1781
-
1782
1539
  return pageIndex < pageCount - 1;
1783
1540
  },
1784
1541
  previousPage: () => {
@@ -1794,28 +1551,24 @@ const Pagination = {
1794
1551
  if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
1795
1552
  table._getPaginationRowModel = table.options.getPaginationRowModel(table);
1796
1553
  }
1797
-
1798
1554
  if (table.options.manualPagination || !table._getPaginationRowModel) {
1799
1555
  return table.getPrePaginationRowModel();
1800
1556
  }
1801
-
1802
1557
  return table._getPaginationRowModel();
1803
1558
  },
1804
1559
  getPageCount: () => {
1805
- var _table$options$pageCo2;
1806
-
1807
- return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1560
+ return table.options.pageCount ?? Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
1808
1561
  }
1809
1562
  };
1810
1563
  }
1811
1564
  };
1812
1565
 
1813
1566
  //
1567
+
1814
1568
  const getDefaultPinningState = () => ({
1815
1569
  left: [],
1816
1570
  right: []
1817
1571
  });
1818
-
1819
1572
  const Pinning = {
1820
1573
  getInitialState: state => {
1821
1574
  return {
@@ -1833,39 +1586,27 @@ const Pinning = {
1833
1586
  pin: position => {
1834
1587
  const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
1835
1588
  table.setColumnPinning(old => {
1836
- var _old$left3, _old$right3;
1837
-
1838
1589
  if (position === 'right') {
1839
- var _old$left, _old$right;
1840
-
1841
1590
  return {
1842
- left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1843
- right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
1591
+ left: ((old == null ? void 0 : old.left) ?? []).filter(d => !(columnIds != null && columnIds.includes(d))),
1592
+ right: [...((old == null ? void 0 : old.right) ?? []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
1844
1593
  };
1845
1594
  }
1846
-
1847
1595
  if (position === 'left') {
1848
- var _old$left2, _old$right2;
1849
-
1850
1596
  return {
1851
- left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
1852
- right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1597
+ left: [...((old == null ? void 0 : old.left) ?? []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
1598
+ right: ((old == null ? void 0 : old.right) ?? []).filter(d => !(columnIds != null && columnIds.includes(d)))
1853
1599
  };
1854
1600
  }
1855
-
1856
1601
  return {
1857
- left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1858
- right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1602
+ left: ((old == null ? void 0 : old.left) ?? []).filter(d => !(columnIds != null && columnIds.includes(d))),
1603
+ right: ((old == null ? void 0 : old.right) ?? []).filter(d => !(columnIds != null && columnIds.includes(d)))
1859
1604
  };
1860
1605
  });
1861
1606
  },
1862
1607
  getCanPin: () => {
1863
1608
  const leafColumns = column.getLeafColumns();
1864
- return leafColumns.some(d => {
1865
- var _d$columnDef$enablePi, _table$options$enable;
1866
-
1867
- return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
1868
- });
1609
+ return leafColumns.some(d => (d.columnDef.enablePinning ?? true) && (table.options.enablePinning ?? true));
1869
1610
  },
1870
1611
  getIsPinned: () => {
1871
1612
  const leafColumnIds = column.getLeafColumns().map(d => d.id);
@@ -1878,51 +1619,40 @@ const Pinning = {
1878
1619
  return isLeft ? 'left' : isRight ? 'right' : false;
1879
1620
  },
1880
1621
  getPinnedIndex: () => {
1881
- var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1882
-
1622
+ var _table$getState$colum, _table$getState$colum2;
1883
1623
  const position = column.getIsPinned();
1884
- 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;
1624
+ return position ? ((_table$getState$colum = table.getState().columnPinning) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) ?? -1 : 0;
1885
1625
  }
1886
1626
  };
1887
1627
  },
1888
1628
  createRow: (row, table) => {
1889
1629
  return {
1890
1630
  getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
1891
- const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1631
+ const leftAndRight = [...(left ?? []), ...(right ?? [])];
1892
1632
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
1893
1633
  }, {
1894
1634
  key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
1895
- debug: () => {
1896
- var _table$options$debugA;
1897
-
1898
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
1899
- }
1635
+ debug: () => table.options.debugAll ?? table.options.debugRows
1900
1636
  }),
1901
1637
  getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
1902
- const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1638
+ const cells = (left ?? []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
1639
+ ...d,
1903
1640
  position: 'left'
1904
1641
  }));
1905
1642
  return cells;
1906
1643
  }, {
1907
1644
  key: process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
1908
- debug: () => {
1909
- var _table$options$debugA2;
1910
-
1911
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
1912
- }
1645
+ debug: () => table.options.debugAll ?? table.options.debugRows
1913
1646
  }),
1914
1647
  getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
1915
- const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1648
+ const cells = (right ?? []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
1649
+ ...d,
1916
1650
  position: 'right'
1917
1651
  }));
1918
1652
  return cells;
1919
1653
  }, {
1920
1654
  key: process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
1921
- debug: () => {
1922
- var _table$options$debugA3;
1923
-
1924
- return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
1925
- }
1655
+ debug: () => table.options.debugAll ?? table.options.debugRows
1926
1656
  })
1927
1657
  };
1928
1658
  },
@@ -1930,59 +1660,43 @@ const Pinning = {
1930
1660
  return {
1931
1661
  setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1932
1662
  resetColumnPinning: defaultState => {
1933
- var _table$initialState$c, _table$initialState;
1934
-
1935
- return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1663
+ var _table$initialState;
1664
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : ((_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) ?? getDefaultPinningState());
1936
1665
  },
1937
1666
  getIsSomeColumnsPinned: position => {
1938
1667
  var _pinningState$positio;
1939
-
1940
1668
  const pinningState = table.getState().columnPinning;
1941
-
1942
1669
  if (!position) {
1943
1670
  var _pinningState$left, _pinningState$right;
1944
-
1945
1671
  return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1946
1672
  }
1947
-
1948
1673
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1949
1674
  },
1950
1675
  getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1951
- return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1676
+ return (left ?? []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1952
1677
  }, {
1953
1678
  key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
1954
- debug: () => {
1955
- var _table$options$debugA4;
1956
-
1957
- return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
1958
- }
1679
+ debug: () => table.options.debugAll ?? table.options.debugColumns
1959
1680
  }),
1960
1681
  getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
1961
- return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1682
+ return (right ?? []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
1962
1683
  }, {
1963
1684
  key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
1964
- debug: () => {
1965
- var _table$options$debugA5;
1966
-
1967
- return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
1968
- }
1685
+ debug: () => table.options.debugAll ?? table.options.debugColumns
1969
1686
  }),
1970
1687
  getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
1971
- const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1688
+ const leftAndRight = [...(left ?? []), ...(right ?? [])];
1972
1689
  return allColumns.filter(d => !leftAndRight.includes(d.id));
1973
1690
  }, {
1974
1691
  key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
1975
- debug: () => {
1976
- var _table$options$debugA6;
1977
-
1978
- return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
1979
- }
1692
+ debug: () => table.options.debugAll ?? table.options.debugColumns
1980
1693
  })
1981
1694
  };
1982
1695
  }
1983
1696
  };
1984
1697
 
1985
1698
  //
1699
+
1986
1700
  const RowSelection = {
1987
1701
  getInitialState: state => {
1988
1702
  return {
@@ -1995,34 +1709,32 @@ const RowSelection = {
1995
1709
  onRowSelectionChange: makeStateUpdater('rowSelection', table),
1996
1710
  enableRowSelection: true,
1997
1711
  enableMultiRowSelection: true,
1998
- enableSubRowSelection: true // enableGroupingRowSelection: false,
1712
+ enableSubRowSelection: true
1713
+ // enableGroupingRowSelection: false,
1999
1714
  // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
2000
1715
  // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
2001
-
2002
1716
  };
2003
1717
  },
1718
+
2004
1719
  createTable: table => {
2005
1720
  return {
2006
1721
  setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
2007
- resetRowSelection: defaultState => {
2008
- var _table$initialState$r;
2009
-
2010
- return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
2011
- },
1722
+ resetRowSelection: defaultState => table.setRowSelection(defaultState ? {} : table.initialState.rowSelection ?? {}),
2012
1723
  toggleAllRowsSelected: value => {
2013
1724
  table.setRowSelection(old => {
2014
1725
  value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
2015
- const rowSelection = { ...old
1726
+ const rowSelection = {
1727
+ ...old
2016
1728
  };
2017
- const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
2018
- // All of the rows are flat already, so it wouldn't be worth it
1729
+ const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
2019
1730
 
1731
+ // We don't use `mutateRowIsSelected` here for performance reasons.
1732
+ // All of the rows are flat already, so it wouldn't be worth it
2020
1733
  if (value) {
2021
1734
  preGroupedFlatRows.forEach(row => {
2022
1735
  if (!row.getCanSelect()) {
2023
1736
  return;
2024
1737
  }
2025
-
2026
1738
  rowSelection[row.id] = true;
2027
1739
  });
2028
1740
  } else {
@@ -2030,13 +1742,13 @@ const RowSelection = {
2030
1742
  delete rowSelection[row.id];
2031
1743
  });
2032
1744
  }
2033
-
2034
1745
  return rowSelection;
2035
1746
  });
2036
1747
  },
2037
1748
  toggleAllPageRowsSelected: value => table.setRowSelection(old => {
2038
1749
  const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
2039
- const rowSelection = { ...old
1750
+ const rowSelection = {
1751
+ ...old
2040
1752
  };
2041
1753
  table.getRowModel().rows.forEach(row => {
2042
1754
  mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
@@ -2049,6 +1761,7 @@ const RowSelection = {
2049
1761
  // rowsById,
2050
1762
  // options: { selectGroupingRows, selectSubRows },
2051
1763
  // } = table
1764
+
2052
1765
  // const findSelectedRow = (rows: Row[]) => {
2053
1766
  // let found
2054
1767
  // rows.find(d => {
@@ -2065,10 +1778,13 @@ const RowSelection = {
2065
1778
  // })
2066
1779
  // return found
2067
1780
  // }
1781
+
2068
1782
  // const firstRow = findSelectedRow(rows) || rows[0]
2069
1783
  // const lastRow = rowsById[rowId]
1784
+
2070
1785
  // let include = false
2071
1786
  // const selectedRowIds = {}
1787
+
2072
1788
  // const addRow = (row: Row) => {
2073
1789
  // mutateRowIsSelected(selectedRowIds, row.id, true, {
2074
1790
  // rowsById,
@@ -2076,9 +1792,11 @@ const RowSelection = {
2076
1792
  // selectSubRows: selectSubRows!,
2077
1793
  // })
2078
1794
  // }
1795
+
2079
1796
  // table.rows.forEach(row => {
2080
1797
  // const isFirstRow = row.id === firstRow.id
2081
1798
  // const isLastRow = row.id === lastRow.id
1799
+
2082
1800
  // if (isFirstRow || isLastRow) {
2083
1801
  // if (!include) {
2084
1802
  // include = true
@@ -2087,10 +1805,12 @@ const RowSelection = {
2087
1805
  // include = false
2088
1806
  // }
2089
1807
  // }
1808
+
2090
1809
  // if (include) {
2091
1810
  // addRow(row)
2092
1811
  // }
2093
1812
  // })
1813
+
2094
1814
  // table.setRowSelection(selectedRowIds)
2095
1815
  // },
2096
1816
  getPreSelectedRowModel: () => table.getCoreRowModel(),
@@ -2102,15 +1822,10 @@ const RowSelection = {
2102
1822
  rowsById: {}
2103
1823
  };
2104
1824
  }
2105
-
2106
1825
  return selectRowsFn(table, rowModel);
2107
1826
  }, {
2108
1827
  key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
2109
- debug: () => {
2110
- var _table$options$debugA;
2111
-
2112
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
2113
- }
1828
+ debug: () => table.options.debugAll ?? table.options.debugTable
2114
1829
  }),
2115
1830
  getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
2116
1831
  if (!Object.keys(rowSelection).length) {
@@ -2120,15 +1835,10 @@ const RowSelection = {
2120
1835
  rowsById: {}
2121
1836
  };
2122
1837
  }
2123
-
2124
1838
  return selectRowsFn(table, rowModel);
2125
1839
  }, {
2126
1840
  key: process.env.NODE_ENV === 'production' && 'getFilteredSelectedRowModel',
2127
- debug: () => {
2128
- var _table$options$debugA2;
2129
-
2130
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
2131
- }
1841
+ debug: () => table.options.debugAll ?? table.options.debugTable
2132
1842
  }),
2133
1843
  getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
2134
1844
  if (!Object.keys(rowSelection).length) {
@@ -2138,40 +1848,38 @@ const RowSelection = {
2138
1848
  rowsById: {}
2139
1849
  };
2140
1850
  }
2141
-
2142
1851
  return selectRowsFn(table, rowModel);
2143
1852
  }, {
2144
1853
  key: process.env.NODE_ENV === 'production' && 'getGroupedSelectedRowModel',
2145
- debug: () => {
2146
- var _table$options$debugA3;
2147
-
2148
- return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
2149
- }
1854
+ debug: () => table.options.debugAll ?? table.options.debugTable
2150
1855
  }),
2151
1856
  ///
1857
+
2152
1858
  // getGroupingRowCanSelect: rowId => {
2153
1859
  // const row = table.getRow(rowId)
1860
+
2154
1861
  // if (!row) {
2155
1862
  // throw new Error()
2156
1863
  // }
1864
+
2157
1865
  // if (typeof table.options.enableGroupingRowSelection === 'function') {
2158
1866
  // return table.options.enableGroupingRowSelection(row)
2159
1867
  // }
1868
+
2160
1869
  // return table.options.enableGroupingRowSelection ?? false
2161
1870
  // },
1871
+
2162
1872
  getIsAllRowsSelected: () => {
2163
1873
  const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
2164
1874
  const {
2165
1875
  rowSelection
2166
1876
  } = table.getState();
2167
1877
  let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
2168
-
2169
1878
  if (isAllRowsSelected) {
2170
1879
  if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
2171
1880
  isAllRowsSelected = false;
2172
1881
  }
2173
1882
  }
2174
-
2175
1883
  return isAllRowsSelected;
2176
1884
  },
2177
1885
  getIsAllPageRowsSelected: () => {
@@ -2180,17 +1888,13 @@ const RowSelection = {
2180
1888
  rowSelection
2181
1889
  } = table.getState();
2182
1890
  let isAllPageRowsSelected = !!paginationFlatRows.length;
2183
-
2184
1891
  if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
2185
1892
  isAllPageRowsSelected = false;
2186
1893
  }
2187
-
2188
1894
  return isAllPageRowsSelected;
2189
1895
  },
2190
1896
  getIsSomeRowsSelected: () => {
2191
- var _table$getState$rowSe;
2192
-
2193
- const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
1897
+ const totalSelected = Object.keys(table.getState().rowSelection ?? {}).length;
2194
1898
  return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
2195
1899
  },
2196
1900
  getIsSomePageRowsSelected: () => {
@@ -2215,12 +1919,11 @@ const RowSelection = {
2215
1919
  const isSelected = row.getIsSelected();
2216
1920
  table.setRowSelection(old => {
2217
1921
  value = typeof value !== 'undefined' ? value : !isSelected;
2218
-
2219
1922
  if (isSelected === value) {
2220
1923
  return old;
2221
1924
  }
2222
-
2223
- const selectedRowIds = { ...old
1925
+ const selectedRowIds = {
1926
+ ...old
2224
1927
  };
2225
1928
  mutateRowIsSelected(selectedRowIds, row.id, value, table);
2226
1929
  return selectedRowIds;
@@ -2245,37 +1948,27 @@ const RowSelection = {
2245
1948
  return isSubRowSelected(row, rowSelection) === 'all';
2246
1949
  },
2247
1950
  getCanSelect: () => {
2248
- var _table$options$enable;
2249
-
2250
1951
  if (typeof table.options.enableRowSelection === 'function') {
2251
1952
  return table.options.enableRowSelection(row);
2252
1953
  }
2253
-
2254
- return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
1954
+ return table.options.enableRowSelection ?? true;
2255
1955
  },
2256
1956
  getCanSelectSubRows: () => {
2257
- var _table$options$enable2;
2258
-
2259
1957
  if (typeof table.options.enableSubRowSelection === 'function') {
2260
1958
  return table.options.enableSubRowSelection(row);
2261
1959
  }
2262
-
2263
- return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
1960
+ return table.options.enableSubRowSelection ?? true;
2264
1961
  },
2265
1962
  getCanMultiSelect: () => {
2266
- var _table$options$enable3;
2267
-
2268
1963
  if (typeof table.options.enableMultiRowSelection === 'function') {
2269
1964
  return table.options.enableMultiRowSelection(row);
2270
1965
  }
2271
-
2272
- return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
1966
+ return table.options.enableMultiRowSelection ?? true;
2273
1967
  },
2274
1968
  getToggleSelectedHandler: () => {
2275
1969
  const canSelect = row.getCanSelect();
2276
1970
  return e => {
2277
1971
  var _target;
2278
-
2279
1972
  if (!canSelect) return;
2280
1973
  row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
2281
1974
  };
@@ -2283,63 +1976,57 @@ const RowSelection = {
2283
1976
  };
2284
1977
  }
2285
1978
  };
2286
-
2287
1979
  const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2288
1980
  var _row$subRows;
1981
+ const row = table.getRow(id);
1982
+
1983
+ // const isGrouped = row.getIsGrouped()
2289
1984
 
2290
- const row = table.getRow(id); // const isGrouped = row.getIsGrouped()
2291
1985
  // if ( // TODO: enforce grouping row selection rules
2292
1986
  // !isGrouped ||
2293
1987
  // (isGrouped && table.options.enableGroupingRowSelection)
2294
1988
  // ) {
2295
-
2296
1989
  if (value) {
2297
1990
  if (!row.getCanMultiSelect()) {
2298
1991
  Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
2299
1992
  }
2300
-
2301
1993
  if (row.getCanSelect()) {
2302
1994
  selectedRowIds[id] = true;
2303
1995
  }
2304
1996
  } else {
2305
1997
  delete selectedRowIds[id];
2306
- } // }
2307
-
1998
+ }
1999
+ // }
2308
2000
 
2309
2001
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2310
2002
  row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2311
2003
  }
2312
2004
  };
2313
-
2314
2005
  function selectRowsFn(table, rowModel) {
2315
2006
  const rowSelection = table.getState().rowSelection;
2316
2007
  const newSelectedFlatRows = [];
2317
- const newSelectedRowsById = {}; // Filters top level and nested rows
2008
+ const newSelectedRowsById = {};
2318
2009
 
2010
+ // Filters top level and nested rows
2319
2011
  const recurseRows = function (rows, depth) {
2320
-
2321
2012
  return rows.map(row => {
2322
2013
  var _row$subRows2;
2323
-
2324
2014
  const isSelected = isRowSelected(row, rowSelection);
2325
-
2326
2015
  if (isSelected) {
2327
2016
  newSelectedFlatRows.push(row);
2328
2017
  newSelectedRowsById[row.id] = row;
2329
2018
  }
2330
-
2331
2019
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
2332
- row = { ...row,
2020
+ row = {
2021
+ ...row,
2333
2022
  subRows: recurseRows(row.subRows)
2334
2023
  };
2335
2024
  }
2336
-
2337
2025
  if (isSelected) {
2338
2026
  return row;
2339
2027
  }
2340
2028
  }).filter(Boolean);
2341
2029
  };
2342
-
2343
2030
  return {
2344
2031
  rows: recurseRows(rowModel.rows),
2345
2032
  flatRows: newSelectedFlatRows,
@@ -2347,9 +2034,7 @@ function selectRowsFn(table, rowModel) {
2347
2034
  };
2348
2035
  }
2349
2036
  function isRowSelected(row, selection) {
2350
- var _selection$row$id;
2351
-
2352
- return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
2037
+ return selection[row.id] ?? false;
2353
2038
  }
2354
2039
  function isSubRowSelected(row, selection, table) {
2355
2040
  if (row.subRows && row.subRows.length) {
@@ -2360,7 +2045,6 @@ function isSubRowSelected(row, selection, table) {
2360
2045
  if (someSelected && !allChildrenSelected) {
2361
2046
  return;
2362
2047
  }
2363
-
2364
2048
  if (isRowSelected(subRow, selection)) {
2365
2049
  someSelected = true;
2366
2050
  } else {
@@ -2369,112 +2053,104 @@ function isSubRowSelected(row, selection, table) {
2369
2053
  });
2370
2054
  return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
2371
2055
  }
2372
-
2373
2056
  return false;
2374
2057
  }
2375
2058
 
2376
2059
  const reSplitAlphaNumeric = /([0-9]+)/gm;
2377
-
2378
2060
  const alphanumeric = (rowA, rowB, columnId) => {
2379
2061
  return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2380
2062
  };
2381
-
2382
2063
  const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
2383
2064
  return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2384
- }; // The text filter is more basic (less numeric support)
2385
- // but is much faster
2386
-
2065
+ };
2387
2066
 
2067
+ // The text filter is more basic (less numeric support)
2068
+ // but is much faster
2388
2069
  const text = (rowA, rowB, columnId) => {
2389
2070
  return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2390
- }; // The text filter is more basic (less numeric support)
2391
- // but is much faster
2392
-
2071
+ };
2393
2072
 
2073
+ // The text filter is more basic (less numeric support)
2074
+ // but is much faster
2394
2075
  const textCaseSensitive = (rowA, rowB, columnId) => {
2395
2076
  return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2396
2077
  };
2397
-
2398
2078
  const datetime = (rowA, rowB, columnId) => {
2399
2079
  const a = rowA.getValue(columnId);
2400
- const b = rowB.getValue(columnId); // Can handle nullish values
2080
+ const b = rowB.getValue(columnId);
2081
+
2082
+ // Can handle nullish values
2401
2083
  // Use > and < because == (and ===) doesn't work with
2402
2084
  // Date objects (would require calling getTime()).
2403
-
2404
2085
  return a > b ? 1 : a < b ? -1 : 0;
2405
2086
  };
2406
-
2407
2087
  const basic = (rowA, rowB, columnId) => {
2408
2088
  return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
2409
- }; // Utils
2089
+ };
2410
2090
 
2091
+ // Utils
2411
2092
 
2412
2093
  function compareBasic(a, b) {
2413
2094
  return a === b ? 0 : a > b ? 1 : -1;
2414
2095
  }
2415
-
2416
2096
  function toString(a) {
2417
2097
  if (typeof a === 'number') {
2418
2098
  if (isNaN(a) || a === Infinity || a === -Infinity) {
2419
2099
  return '';
2420
2100
  }
2421
-
2422
2101
  return String(a);
2423
2102
  }
2424
-
2425
2103
  if (typeof a === 'string') {
2426
2104
  return a;
2427
2105
  }
2428
-
2429
2106
  return '';
2430
- } // Mixed sorting is slow, but very inclusive of many edge cases.
2107
+ }
2108
+
2109
+ // Mixed sorting is slow, but very inclusive of many edge cases.
2431
2110
  // It handles numbers, mixed alphanumeric combinations, and even
2432
2111
  // null, undefined, and Infinity
2433
-
2434
-
2435
2112
  function compareAlphanumeric(aStr, bStr) {
2436
2113
  // Split on number groups, but keep the delimiter
2437
2114
  // Then remove falsey split values
2438
2115
  const a = aStr.split(reSplitAlphaNumeric).filter(Boolean);
2439
- const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); // While
2116
+ const b = bStr.split(reSplitAlphaNumeric).filter(Boolean);
2440
2117
 
2118
+ // While
2441
2119
  while (a.length && b.length) {
2442
2120
  const aa = a.shift();
2443
2121
  const bb = b.shift();
2444
2122
  const an = parseInt(aa, 10);
2445
2123
  const bn = parseInt(bb, 10);
2446
- const combo = [an, bn].sort(); // Both are string
2124
+ const combo = [an, bn].sort();
2447
2125
 
2126
+ // Both are string
2448
2127
  if (isNaN(combo[0])) {
2449
2128
  if (aa > bb) {
2450
2129
  return 1;
2451
2130
  }
2452
-
2453
2131
  if (bb > aa) {
2454
2132
  return -1;
2455
2133
  }
2456
-
2457
2134
  continue;
2458
- } // One is a string, one is a number
2459
-
2135
+ }
2460
2136
 
2137
+ // One is a string, one is a number
2461
2138
  if (isNaN(combo[1])) {
2462
2139
  return isNaN(an) ? -1 : 1;
2463
- } // Both are numbers
2464
-
2140
+ }
2465
2141
 
2142
+ // Both are numbers
2466
2143
  if (an > bn) {
2467
2144
  return 1;
2468
2145
  }
2469
-
2470
2146
  if (bn > an) {
2471
2147
  return -1;
2472
2148
  }
2473
2149
  }
2474
-
2475
2150
  return a.length - b.length;
2476
- } // Exports
2151
+ }
2477
2152
 
2153
+ // Exports
2478
2154
 
2479
2155
  const sortingFns = {
2480
2156
  alphanumeric,
@@ -2486,6 +2162,7 @@ const sortingFns = {
2486
2162
  };
2487
2163
 
2488
2164
  //
2165
+
2489
2166
  const Sorting = {
2490
2167
  getInitialState: state => {
2491
2168
  return {
@@ -2511,47 +2188,37 @@ const Sorting = {
2511
2188
  getAutoSortingFn: () => {
2512
2189
  const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2513
2190
  let isString = false;
2514
-
2515
2191
  for (const row of firstRows) {
2516
2192
  const value = row == null ? void 0 : row.getValue(column.id);
2517
-
2518
2193
  if (Object.prototype.toString.call(value) === '[object Date]') {
2519
2194
  return sortingFns.datetime;
2520
2195
  }
2521
-
2522
2196
  if (typeof value === 'string') {
2523
2197
  isString = true;
2524
-
2525
2198
  if (value.split(reSplitAlphaNumeric).length > 1) {
2526
2199
  return sortingFns.alphanumeric;
2527
2200
  }
2528
2201
  }
2529
2202
  }
2530
-
2531
2203
  if (isString) {
2532
2204
  return sortingFns.text;
2533
2205
  }
2534
-
2535
2206
  return sortingFns.basic;
2536
2207
  },
2537
2208
  getAutoSortDir: () => {
2538
2209
  const firstRow = table.getFilteredRowModel().flatRows[0];
2539
2210
  const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2540
-
2541
2211
  if (typeof value === 'string') {
2542
2212
  return 'asc';
2543
2213
  }
2544
-
2545
2214
  return 'desc';
2546
2215
  },
2547
2216
  getSortingFn: () => {
2548
- var _table$options$sortin, _table$options$sortin2;
2549
-
2217
+ var _table$options$sortin;
2550
2218
  if (!column) {
2551
2219
  throw new Error();
2552
2220
  }
2553
-
2554
- return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];
2221
+ return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : ((_table$options$sortin = table.options.sortingFns) == null ? void 0 : _table$options$sortin[column.columnDef.sortingFn]) ?? sortingFns[column.columnDef.sortingFn];
2555
2222
  },
2556
2223
  toggleSorting: (desc, multi) => {
2557
2224
  // if (column.columns.length) {
@@ -2562,6 +2229,7 @@ const Sorting = {
2562
2229
  // })
2563
2230
  // return
2564
2231
  // }
2232
+
2565
2233
  // this needs to be outside of table.setSorting to be in sync with rerender
2566
2234
  const nextSortingOrder = column.getNextSortingOrder();
2567
2235
  const hasManualValue = typeof desc !== 'undefined' && desc !== null;
@@ -2569,11 +2237,13 @@ const Sorting = {
2569
2237
  // Find any existing sorting for this column
2570
2238
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
2571
2239
  const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
2572
- let newSorting = []; // What should we do with this sort action?
2240
+ let newSorting = [];
2573
2241
 
2242
+ // What should we do with this sort action?
2574
2243
  let sortAction;
2575
- let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; // Multi-mode
2244
+ let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
2576
2245
 
2246
+ // Multi-mode
2577
2247
  if (old != null && old.length && column.getCanMultiSort() && multi) {
2578
2248
  if (existingSorting) {
2579
2249
  sortAction = 'toggle';
@@ -2589,9 +2259,9 @@ const Sorting = {
2589
2259
  } else {
2590
2260
  sortAction = 'replace';
2591
2261
  }
2592
- } // Handle toggle states that will remove the sorting
2593
-
2262
+ }
2594
2263
 
2264
+ // Handle toggle states that will remove the sorting
2595
2265
  if (sortAction === 'toggle') {
2596
2266
  // If we are "actually" toggling (not a manual set value), should we remove the sorting?
2597
2267
  if (!hasManualValue) {
@@ -2601,25 +2271,22 @@ const Sorting = {
2601
2271
  }
2602
2272
  }
2603
2273
  }
2604
-
2605
2274
  if (sortAction === 'add') {
2606
- var _table$options$maxMul;
2607
-
2608
2275
  newSorting = [...old, {
2609
2276
  id: column.id,
2610
2277
  desc: nextDesc
2611
- }]; // Take latest n columns
2612
-
2613
- newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
2278
+ }];
2279
+ // Take latest n columns
2280
+ newSorting.splice(0, newSorting.length - (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER));
2614
2281
  } else if (sortAction === 'toggle') {
2615
2282
  // This flips (or sets) the
2616
2283
  newSorting = old.map(d => {
2617
2284
  if (d.id === column.id) {
2618
- return { ...d,
2285
+ return {
2286
+ ...d,
2619
2287
  desc: nextDesc
2620
2288
  };
2621
2289
  }
2622
-
2623
2290
  return d;
2624
2291
  });
2625
2292
  } else if (sortAction === 'remove') {
@@ -2630,54 +2297,41 @@ const Sorting = {
2630
2297
  desc: nextDesc
2631
2298
  }];
2632
2299
  }
2633
-
2634
2300
  return newSorting;
2635
2301
  });
2636
2302
  },
2637
2303
  getFirstSortDir: () => {
2638
- var _ref, _column$columnDef$sor;
2639
-
2640
- const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
2304
+ const sortDescFirst = column.columnDef.sortDescFirst ?? table.options.sortDescFirst ?? column.getAutoSortDir() === 'desc';
2641
2305
  return sortDescFirst ? 'desc' : 'asc';
2642
2306
  },
2643
2307
  getNextSortingOrder: multi => {
2644
- var _table$options$enable, _table$options$enable2;
2645
-
2646
2308
  const firstSortDirection = column.getFirstSortDir();
2647
2309
  const isSorted = column.getIsSorted();
2648
-
2649
2310
  if (!isSorted) {
2650
2311
  return firstSortDirection;
2651
2312
  }
2652
-
2653
- if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( // If enableSortRemove, enable in general
2654
- multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
2313
+ if (isSorted !== firstSortDirection && (table.options.enableSortingRemoval ?? true) && (
2314
+ // If enableSortRemove, enable in general
2315
+ multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))
2655
2316
  ) {
2656
2317
  return false;
2657
2318
  }
2658
-
2659
2319
  return isSorted === 'desc' ? 'asc' : 'desc';
2660
2320
  },
2661
2321
  getCanSort: () => {
2662
- var _column$columnDef$ena, _table$options$enable3;
2663
-
2664
- 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;
2322
+ return (column.columnDef.enableSorting ?? true) && (table.options.enableSorting ?? true) && !!column.accessorFn;
2665
2323
  },
2666
2324
  getCanMultiSort: () => {
2667
- var _ref2, _column$columnDef$ena2;
2668
-
2669
- return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2325
+ return column.columnDef.enableMultiSort ?? table.options.enableMultiSort ?? !!column.accessorFn;
2670
2326
  },
2671
2327
  getIsSorted: () => {
2672
2328
  var _table$getState$sorti;
2673
-
2674
2329
  const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2675
2330
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2676
2331
  },
2677
2332
  getSortIndex: () => {
2678
- var _table$getState$sorti2, _table$getState$sorti3;
2679
-
2680
- 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;
2333
+ var _table$getState$sorti2;
2334
+ return ((_table$getState$sorti2 = table.getState().sorting) == null ? void 0 : _table$getState$sorti2.findIndex(d => d.id === column.id)) ?? -1;
2681
2335
  },
2682
2336
  clearSorting: () => {
2683
2337
  //clear sorting for just 1 column
@@ -2697,20 +2351,17 @@ const Sorting = {
2697
2351
  return {
2698
2352
  setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2699
2353
  resetSorting: defaultState => {
2700
- var _table$initialState$s, _table$initialState;
2701
-
2702
- table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2354
+ var _table$initialState;
2355
+ table.setSorting(defaultState ? [] : ((_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) ?? []);
2703
2356
  },
2704
2357
  getPreSortedRowModel: () => table.getGroupedRowModel(),
2705
2358
  getSortedRowModel: () => {
2706
2359
  if (!table._getSortedRowModel && table.options.getSortedRowModel) {
2707
2360
  table._getSortedRowModel = table.options.getSortedRowModel(table);
2708
2361
  }
2709
-
2710
2362
  if (table.options.manualSorting || !table._getSortedRowModel) {
2711
2363
  return table.getPreSortedRowModel();
2712
2364
  }
2713
-
2714
2365
  return table._getSortedRowModel();
2715
2366
  }
2716
2367
  };
@@ -2718,6 +2369,7 @@ const Sorting = {
2718
2369
  };
2719
2370
 
2720
2371
  //
2372
+
2721
2373
  const Visibility = {
2722
2374
  getInitialState: state => {
2723
2375
  return {
@@ -2734,20 +2386,18 @@ const Visibility = {
2734
2386
  return {
2735
2387
  toggleVisibility: value => {
2736
2388
  if (column.getCanHide()) {
2737
- table.setColumnVisibility(old => ({ ...old,
2738
- [column.id]: value != null ? value : !column.getIsVisible()
2389
+ table.setColumnVisibility(old => ({
2390
+ ...old,
2391
+ [column.id]: value ?? !column.getIsVisible()
2739
2392
  }));
2740
2393
  }
2741
2394
  },
2742
2395
  getIsVisible: () => {
2743
- var _table$getState$colum, _table$getState$colum2;
2744
-
2745
- return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2396
+ var _table$getState$colum;
2397
+ return ((_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) ?? true;
2746
2398
  },
2747
2399
  getCanHide: () => {
2748
- var _column$columnDef$ena, _table$options$enable;
2749
-
2750
- return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
2400
+ return (column.columnDef.enableHiding ?? true) && (table.options.enableHiding ?? true);
2751
2401
  },
2752
2402
  getToggleVisibilityHandler: () => {
2753
2403
  return e => {
@@ -2762,19 +2412,11 @@ const Visibility = {
2762
2412
  return cells.filter(cell => cell.column.getIsVisible());
2763
2413
  }, {
2764
2414
  key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
2765
- debug: () => {
2766
- var _table$options$debugA;
2767
-
2768
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
2769
- }
2415
+ debug: () => table.options.debugAll ?? table.options.debugRows
2770
2416
  }),
2771
2417
  getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2772
2418
  key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
2773
- debug: () => {
2774
- var _table$options$debugA2;
2775
-
2776
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
2777
- }
2419
+ debug: () => table.options.debugAll ?? table.options.debugRows
2778
2420
  })
2779
2421
  };
2780
2422
  },
@@ -2784,14 +2426,9 @@ const Visibility = {
2784
2426
  return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2785
2427
  }, {
2786
2428
  key,
2787
- debug: () => {
2788
- var _table$options$debugA3;
2789
-
2790
- return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
2791
- }
2429
+ debug: () => table.options.debugAll ?? table.options.debugColumns
2792
2430
  });
2793
2431
  };
2794
-
2795
2432
  return {
2796
2433
  getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
2797
2434
  getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
@@ -2800,15 +2437,12 @@ const Visibility = {
2800
2437
  getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2801
2438
  setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2802
2439
  resetColumnVisibility: defaultState => {
2803
- var _table$initialState$c;
2804
-
2805
- table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
2440
+ table.setColumnVisibility(defaultState ? {} : table.initialState.columnVisibility ?? {});
2806
2441
  },
2807
2442
  toggleAllColumnsVisible: value => {
2808
- var _value;
2809
-
2810
- value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2811
- table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2443
+ value = value ?? !table.getIsAllColumnsVisible();
2444
+ table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
2445
+ ...obj,
2812
2446
  [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2813
2447
  }), {}));
2814
2448
  },
@@ -2817,7 +2451,6 @@ const Visibility = {
2817
2451
  getToggleAllColumnsVisibilityHandler: () => {
2818
2452
  return e => {
2819
2453
  var _target;
2820
-
2821
2454
  table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2822
2455
  };
2823
2456
  }
@@ -2825,64 +2458,57 @@ const Visibility = {
2825
2458
  }
2826
2459
  };
2827
2460
 
2828
- const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
2461
+ const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
2829
2462
 
2830
- function createTable(options) {
2831
- var _options$initialState;
2463
+ //
2832
2464
 
2465
+ function createTable(options) {
2833
2466
  if (options.debugAll || options.debugTable) {
2834
2467
  console.info('Creating Table Instance...');
2835
2468
  }
2836
-
2837
2469
  let table = {
2838
2470
  _features: features
2839
2471
  };
2840
-
2841
2472
  const defaultOptions = table._features.reduce((obj, feature) => {
2842
2473
  return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2843
2474
  }, {});
2844
-
2845
2475
  const mergeOptions = options => {
2846
2476
  if (table.options.mergeOptions) {
2847
2477
  return table.options.mergeOptions(defaultOptions, options);
2848
2478
  }
2849
-
2850
- return { ...defaultOptions,
2479
+ return {
2480
+ ...defaultOptions,
2851
2481
  ...options
2852
2482
  };
2853
2483
  };
2854
-
2855
2484
  const coreInitialState = {};
2856
- let initialState = { ...coreInitialState,
2857
- ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
2485
+ let initialState = {
2486
+ ...coreInitialState,
2487
+ ...(options.initialState ?? {})
2858
2488
  };
2859
-
2860
2489
  table._features.forEach(feature => {
2861
- var _feature$getInitialSt;
2862
-
2863
- initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
2490
+ initialState = (feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) ?? initialState;
2864
2491
  });
2865
-
2866
2492
  const queued = [];
2867
2493
  let queuedTimeout = false;
2868
2494
  const coreInstance = {
2869
2495
  _features: features,
2870
- options: { ...defaultOptions,
2496
+ options: {
2497
+ ...defaultOptions,
2871
2498
  ...options
2872
2499
  },
2873
2500
  initialState,
2874
2501
  _queue: cb => {
2875
2502
  queued.push(cb);
2876
-
2877
2503
  if (!queuedTimeout) {
2878
- queuedTimeout = true; // Schedule a microtask to run the queued callbacks after
2879
- // the current call stack (render, etc) has finished.
2504
+ queuedTimeout = true;
2880
2505
 
2506
+ // Schedule a microtask to run the queued callbacks after
2507
+ // the current call stack (render, etc) has finished.
2881
2508
  Promise.resolve().then(() => {
2882
2509
  while (queued.length) {
2883
2510
  queued.shift()();
2884
2511
  }
2885
-
2886
2512
  queuedTimeout = false;
2887
2513
  }).catch(error => setTimeout(() => {
2888
2514
  throw error;
@@ -2902,59 +2528,46 @@ function createTable(options) {
2902
2528
  setState: updater => {
2903
2529
  table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2904
2530
  },
2905
- _getRowId: (row, index, parent) => {
2906
- var _table$options$getRow;
2907
-
2908
- 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);
2909
- },
2531
+ _getRowId: (row, index, parent) => (table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) ?? `${parent ? [parent.id, index].join('.') : index}`,
2910
2532
  getCoreRowModel: () => {
2911
2533
  if (!table._getCoreRowModel) {
2912
2534
  table._getCoreRowModel = table.options.getCoreRowModel(table);
2913
2535
  }
2914
-
2915
2536
  return table._getCoreRowModel();
2916
2537
  },
2917
2538
  // The final calls start at the bottom of the model,
2918
2539
  // expanded rows, which then work their way up
2540
+
2919
2541
  getRowModel: () => {
2920
2542
  return table.getPaginationRowModel();
2921
2543
  },
2922
2544
  getRow: id => {
2923
2545
  const row = table.getRowModel().rowsById[id];
2924
-
2925
2546
  if (!row) {
2926
2547
  if (process.env.NODE_ENV !== 'production') {
2927
- throw new Error("getRow expected an ID, but got " + id);
2548
+ throw new Error(`getRow expected an ID, but got ${id}`);
2928
2549
  }
2929
-
2930
2550
  throw new Error();
2931
2551
  }
2932
-
2933
2552
  return row;
2934
2553
  },
2935
2554
  _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
2936
- var _defaultColumn;
2937
-
2938
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
2555
+ defaultColumn = defaultColumn ?? {};
2939
2556
  return {
2940
2557
  header: props => {
2941
2558
  const resolvedColumnDef = props.header.column.columnDef;
2942
-
2943
2559
  if (resolvedColumnDef.accessorKey) {
2944
2560
  return resolvedColumnDef.accessorKey;
2945
2561
  }
2946
-
2947
2562
  if (resolvedColumnDef.accessorFn) {
2948
2563
  return resolvedColumnDef.id;
2949
2564
  }
2950
-
2951
2565
  return null;
2952
2566
  },
2953
2567
  // footer: props => props.header.column.id,
2954
2568
  cell: props => {
2955
- var _props$renderValue$to, _props$renderValue;
2956
-
2957
- return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;
2569
+ var _props$renderValue;
2570
+ return ((_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) ?? null;
2958
2571
  },
2959
2572
  ...table._features.reduce((obj, feature) => {
2960
2573
  return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
@@ -2962,11 +2575,7 @@ function createTable(options) {
2962
2575
  ...defaultColumn
2963
2576
  };
2964
2577
  }, {
2965
- debug: () => {
2966
- var _table$options$debugA;
2967
-
2968
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
2969
- },
2578
+ debug: () => table.options.debugAll ?? table.options.debugColumns,
2970
2579
  key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
2971
2580
  }),
2972
2581
  _getColumnDefs: () => table.options.columns,
@@ -2975,7 +2584,6 @@ function createTable(options) {
2975
2584
  if (depth === void 0) {
2976
2585
  depth = 0;
2977
2586
  }
2978
-
2979
2587
  return columnDefs.map(columnDef => {
2980
2588
  const column = createColumn(table, columnDef, depth, parent);
2981
2589
  const groupingColumnDef = columnDef;
@@ -2983,15 +2591,10 @@ function createTable(options) {
2983
2591
  return column;
2984
2592
  });
2985
2593
  };
2986
-
2987
2594
  return recurseColumns(columnDefs);
2988
2595
  }, {
2989
2596
  key: process.env.NODE_ENV === 'development' && 'getAllColumns',
2990
- debug: () => {
2991
- var _table$options$debugA2;
2992
-
2993
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
2994
- }
2597
+ debug: () => table.options.debugAll ?? table.options.debugColumns
2995
2598
  }),
2996
2599
  getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
2997
2600
  return allColumns.flatMap(column => {
@@ -2999,11 +2602,7 @@ function createTable(options) {
2999
2602
  });
3000
2603
  }, {
3001
2604
  key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
3002
- debug: () => {
3003
- var _table$options$debugA3;
3004
-
3005
- return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
3006
- }
2605
+ debug: () => table.options.debugAll ?? table.options.debugColumns
3007
2606
  }),
3008
2607
  _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
3009
2608
  return flatColumns.reduce((acc, column) => {
@@ -3012,55 +2611,37 @@ function createTable(options) {
3012
2611
  }, {});
3013
2612
  }, {
3014
2613
  key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
3015
- debug: () => {
3016
- var _table$options$debugA4;
3017
-
3018
- return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
3019
- }
2614
+ debug: () => table.options.debugAll ?? table.options.debugColumns
3020
2615
  }),
3021
2616
  getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
3022
2617
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
3023
2618
  return orderColumns(leafColumns);
3024
2619
  }, {
3025
2620
  key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
3026
- debug: () => {
3027
- var _table$options$debugA5;
3028
-
3029
- return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
3030
- }
2621
+ debug: () => table.options.debugAll ?? table.options.debugColumns
3031
2622
  }),
3032
2623
  getColumn: columnId => {
3033
2624
  const column = table._getAllFlatColumnsById()[columnId];
3034
-
3035
2625
  if (!column) {
3036
2626
  if (process.env.NODE_ENV !== 'production') {
3037
- console.warn("[Table] Column with id " + columnId + " does not exist.");
2627
+ console.warn(`[Table] Column with id ${columnId} does not exist.`);
3038
2628
  }
3039
-
3040
2629
  throw new Error();
3041
2630
  }
3042
-
3043
2631
  return column;
3044
2632
  }
3045
2633
  };
3046
2634
  Object.assign(table, coreInstance);
3047
-
3048
2635
  table._features.forEach(feature => {
3049
2636
  return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
3050
2637
  });
3051
-
3052
2638
  return table;
3053
2639
  }
3054
2640
 
3055
2641
  function createCell(table, row, column, columnId) {
3056
- const getRenderValue = () => {
3057
- var _cell$getValue;
3058
-
3059
- return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
3060
- };
3061
-
2642
+ const getRenderValue = () => cell.getValue() ?? table.options.renderFallbackValue;
3062
2643
  const cell = {
3063
- id: row.id + "_" + column.id,
2644
+ id: `${row.id}_${column.id}`,
3064
2645
  row,
3065
2646
  column,
3066
2647
  getValue: () => row.getValue(columnId),
@@ -3077,11 +2658,9 @@ function createCell(table, row, column, columnId) {
3077
2658
  debug: () => table.options.debugAll
3078
2659
  })
3079
2660
  };
3080
-
3081
2661
  table._features.forEach(feature => {
3082
2662
  Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
3083
2663
  }, {});
3084
-
3085
2664
  return cell;
3086
2665
  }
3087
2666
 
@@ -3096,22 +2675,15 @@ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3096
2675
  if (row._valuesCache.hasOwnProperty(columnId)) {
3097
2676
  return row._valuesCache[columnId];
3098
2677
  }
3099
-
3100
2678
  const column = table.getColumn(columnId);
3101
-
3102
2679
  if (!column.accessorFn) {
3103
2680
  return undefined;
3104
2681
  }
3105
-
3106
2682
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3107
2683
  return row._valuesCache[columnId];
3108
2684
  },
3109
- renderValue: columnId => {
3110
- var _row$getValue;
3111
-
3112
- return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
3113
- },
3114
- subRows: subRows != null ? subRows : [],
2685
+ renderValue: columnId => row.getValue(columnId) ?? table.options.renderFallbackValue,
2686
+ subRows: subRows ?? [],
3115
2687
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3116
2688
  getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
3117
2689
  return leafColumns.map(column => {
@@ -3119,11 +2691,7 @@ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3119
2691
  });
3120
2692
  }, {
3121
2693
  key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
3122
- debug: () => {
3123
- var _table$options$debugA;
3124
-
3125
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
3126
- }
2694
+ debug: () => table.options.debugAll ?? table.options.debugRows
3127
2695
  }),
3128
2696
  _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
3129
2697
  return allCells.reduce((acc, cell) => {
@@ -3132,19 +2700,13 @@ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3132
2700
  }, {});
3133
2701
  }, {
3134
2702
  key: process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
3135
- debug: () => {
3136
- var _table$options$debugA2;
3137
-
3138
- return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
3139
- }
2703
+ debug: () => table.options.debugAll ?? table.options.debugRows
3140
2704
  })
3141
2705
  };
3142
-
3143
2706
  for (let i = 0; i < table._features.length; i++) {
3144
2707
  const feature = table._features[i];
3145
2708
  Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
3146
2709
  }
3147
-
3148
2710
  return row;
3149
2711
  };
3150
2712
 
@@ -3171,24 +2733,32 @@ const createRow = (table, id, original, rowIndex, depth, subRows) => {
3171
2733
  // }
3172
2734
  // }
3173
2735
  // }
2736
+
3174
2737
  // const test: DeepKeys<Person> = 'nested.foo.0.bar'
3175
2738
  // const test2: DeepKeys<Person> = 'nested.bar'
2739
+
3176
2740
  // const helper = createColumnHelper<Person>()
2741
+
3177
2742
  // helper.accessor('nested.foo', {
3178
2743
  // cell: info => info.getValue(),
3179
2744
  // })
2745
+
3180
2746
  // helper.accessor('nested.foo.0.bar', {
3181
2747
  // cell: info => info.getValue(),
3182
2748
  // })
2749
+
3183
2750
  // helper.accessor('nested.bar', {
3184
2751
  // cell: info => info.getValue(),
3185
2752
  // })
2753
+
3186
2754
  function createColumnHelper() {
3187
2755
  return {
3188
2756
  accessor: (accessor, column) => {
3189
- return typeof accessor === 'function' ? { ...column,
2757
+ return typeof accessor === 'function' ? {
2758
+ ...column,
3190
2759
  accessorFn: accessor
3191
- } : { ...column,
2760
+ } : {
2761
+ ...column,
3192
2762
  accessorKey: accessor
3193
2763
  };
3194
2764
  },
@@ -3204,14 +2774,11 @@ function getCoreRowModel() {
3204
2774
  flatRows: [],
3205
2775
  rowsById: {}
3206
2776
  };
3207
-
3208
2777
  const accessRows = function (originalRows, depth, parent) {
3209
2778
  if (depth === void 0) {
3210
2779
  depth = 0;
3211
2780
  }
3212
-
3213
2781
  const rows = [];
3214
-
3215
2782
  for (let i = 0; i < originalRows.length; i++) {
3216
2783
  // This could be an expensive check at scale, so we should move it somewhere else, but where?
3217
2784
  // if (!id) {
@@ -3219,38 +2786,35 @@ function getCoreRowModel() {
3219
2786
  // throw new Error(`getRowId expected an ID, but got ${id}`)
3220
2787
  // }
3221
2788
  // }
3222
- // Make the row
3223
- const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3224
-
3225
- rowModel.flatRows.push(row); // Also keep track of every row by its ID
3226
2789
 
3227
- rowModel.rowsById[row.id] = row; // Push table row into parent
2790
+ // Make the row
2791
+ const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth);
3228
2792
 
3229
- rows.push(row); // Get the original subrows
2793
+ // Keep track of every row in a flat array
2794
+ rowModel.flatRows.push(row);
2795
+ // Also keep track of every row by its ID
2796
+ rowModel.rowsById[row.id] = row;
2797
+ // Push table row into parent
2798
+ rows.push(row);
3230
2799
 
2800
+ // Get the original subrows
3231
2801
  if (table.options.getSubRows) {
3232
2802
  var _row$originalSubRows;
2803
+ row.originalSubRows = table.options.getSubRows(originalRows[i], i);
3233
2804
 
3234
- row.originalSubRows = table.options.getSubRows(originalRows[i], i); // Then recursively access them
3235
-
2805
+ // Then recursively access them
3236
2806
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3237
2807
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
3238
2808
  }
3239
2809
  }
3240
2810
  }
3241
-
3242
2811
  return rows;
3243
2812
  };
3244
-
3245
2813
  rowModel.rows = accessRows(data);
3246
2814
  return rowModel;
3247
2815
  }, {
3248
2816
  key: process.env.NODE_ENV === 'development' && 'getRowModel',
3249
- debug: () => {
3250
- var _table$options$debugA;
3251
-
3252
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3253
- },
2817
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3254
2818
  onChange: () => {
3255
2819
  table._autoResetPageIndex();
3256
2820
  }
@@ -3261,44 +2825,35 @@ function filterRows(rows, filterRowImpl, table) {
3261
2825
  if (table.options.filterFromLeafRows) {
3262
2826
  return filterRowModelFromLeafs(rows, filterRowImpl, table);
3263
2827
  }
3264
-
3265
2828
  return filterRowModelFromRoot(rows, filterRowImpl, table);
3266
2829
  }
3267
2830
  function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3268
2831
  const newFilteredFlatRows = [];
3269
2832
  const newFilteredRowsById = {};
3270
-
3271
2833
  const recurseFilterRows = function (rowsToFilter, depth) {
2834
+ const rows = [];
3272
2835
 
3273
- const rows = []; // Filter from children up first
3274
-
2836
+ // Filter from children up first
3275
2837
  for (let i = 0; i < rowsToFilter.length; i++) {
3276
2838
  var _row$subRows;
3277
-
3278
2839
  let row = rowsToFilter[i];
3279
-
3280
2840
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3281
2841
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3282
2842
  newRow.columnFilters = row.columnFilters;
3283
2843
  newRow.subRows = recurseFilterRows(row.subRows);
3284
-
3285
2844
  if (!newRow.subRows.length) {
3286
2845
  continue;
3287
2846
  }
3288
-
3289
2847
  row = newRow;
3290
2848
  }
3291
-
3292
2849
  if (filterRow(row)) {
3293
2850
  rows.push(row);
3294
2851
  newFilteredRowsById[row.id] = row;
3295
2852
  newFilteredRowsById[i] = row;
3296
2853
  }
3297
2854
  }
3298
-
3299
2855
  return rows;
3300
2856
  };
3301
-
3302
2857
  return {
3303
2858
  rows: recurseFilterRows(rowsToFilter),
3304
2859
  flatRows: newFilteredFlatRows,
@@ -3307,35 +2862,32 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3307
2862
  }
3308
2863
  function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3309
2864
  const newFilteredFlatRows = [];
3310
- const newFilteredRowsById = {}; // Filters top level and nested rows
2865
+ const newFilteredRowsById = {};
3311
2866
 
2867
+ // Filters top level and nested rows
3312
2868
  const recurseFilterRows = function (rowsToFilter, depth) {
3313
-
3314
2869
  // Filter from parents downward first
3315
- const rows = []; // Apply the filter to any subRows
3316
2870
 
2871
+ const rows = [];
2872
+
2873
+ // Apply the filter to any subRows
3317
2874
  for (let i = 0; i < rowsToFilter.length; i++) {
3318
2875
  let row = rowsToFilter[i];
3319
2876
  const pass = filterRow(row);
3320
-
3321
2877
  if (pass) {
3322
2878
  var _row$subRows2;
3323
-
3324
2879
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3325
2880
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3326
2881
  newRow.subRows = recurseFilterRows(row.subRows);
3327
2882
  row = newRow;
3328
2883
  }
3329
-
3330
2884
  rows.push(row);
3331
2885
  newFilteredFlatRows.push(row);
3332
2886
  newFilteredRowsById[row.id] = row;
3333
2887
  }
3334
2888
  }
3335
-
3336
2889
  return rows;
3337
2890
  };
3338
-
3339
2891
  return {
3340
2892
  rows: recurseFilterRows(rowsToFilter),
3341
2893
  flatRows: newFilteredFlatRows,
@@ -3350,79 +2902,66 @@ function getFilteredRowModel() {
3350
2902
  rowModel.flatRows[i].columnFilters = {};
3351
2903
  rowModel.flatRows[i].columnFiltersMeta = {};
3352
2904
  }
3353
-
3354
2905
  return rowModel;
3355
2906
  }
3356
-
3357
2907
  const resolvedColumnFilters = [];
3358
2908
  const resolvedGlobalFilters = [];
3359
- (columnFilters != null ? columnFilters : []).forEach(d => {
3360
- var _filterFn$resolveFilt;
3361
-
2909
+ (columnFilters ?? []).forEach(d => {
3362
2910
  const column = table.getColumn(d.id);
3363
-
3364
2911
  if (!column) {
3365
2912
  if (process.env.NODE_ENV !== 'production') {
3366
- console.warn("Table: Could not find a column to filter with columnId: " + d.id);
2913
+ console.warn(`Table: Could not find a column to filter with columnId: ${d.id}`);
3367
2914
  }
3368
2915
  }
3369
-
3370
2916
  const filterFn = column.getFilterFn();
3371
-
3372
2917
  if (!filterFn) {
3373
2918
  if (process.env.NODE_ENV !== 'production') {
3374
- console.warn("Could not find a valid 'column.filterFn' for column with the ID: " + column.id + ".");
2919
+ console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`);
3375
2920
  }
3376
-
3377
2921
  return;
3378
2922
  }
3379
-
3380
2923
  resolvedColumnFilters.push({
3381
2924
  id: d.id,
3382
2925
  filterFn,
3383
- resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value
2926
+ resolvedValue: (filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) ?? d.value
3384
2927
  });
3385
2928
  });
3386
2929
  const filterableIds = columnFilters.map(d => d.id);
3387
2930
  const globalFilterFn = table.getGlobalFilterFn();
3388
2931
  const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
3389
-
3390
2932
  if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
3391
2933
  filterableIds.push('__global__');
3392
2934
  globallyFilterableColumns.forEach(column => {
3393
- var _globalFilterFn$resol;
3394
-
3395
2935
  resolvedGlobalFilters.push({
3396
2936
  id: column.id,
3397
2937
  filterFn: globalFilterFn,
3398
- resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
2938
+ resolvedValue: (globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) ?? globalFilter
3399
2939
  });
3400
2940
  });
3401
2941
  }
3402
-
3403
2942
  let currentColumnFilter;
3404
- let currentGlobalFilter; // Flag the prefiltered row model with each filter state
2943
+ let currentGlobalFilter;
3405
2944
 
2945
+ // Flag the prefiltered row model with each filter state
3406
2946
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3407
2947
  const row = rowModel.flatRows[j];
3408
2948
  row.columnFilters = {};
3409
-
3410
2949
  if (resolvedColumnFilters.length) {
3411
2950
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3412
2951
  currentColumnFilter = resolvedColumnFilters[i];
3413
- const id = currentColumnFilter.id; // Tag the row with the column filter state
2952
+ const id = currentColumnFilter.id;
3414
2953
 
2954
+ // Tag the row with the column filter state
3415
2955
  row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3416
2956
  row.columnFiltersMeta[id] = filterMeta;
3417
2957
  });
3418
2958
  }
3419
2959
  }
3420
-
3421
2960
  if (resolvedGlobalFilters.length) {
3422
2961
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3423
2962
  currentGlobalFilter = resolvedGlobalFilters[i];
3424
- const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3425
-
2963
+ const id = currentGlobalFilter.id;
2964
+ // Tag the row with the first truthy global filter state
3426
2965
  if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3427
2966
  row.columnFiltersMeta[id] = filterMeta;
3428
2967
  })) {
@@ -3430,13 +2969,11 @@ function getFilteredRowModel() {
3430
2969
  break;
3431
2970
  }
3432
2971
  }
3433
-
3434
2972
  if (row.columnFilters.__global__ !== true) {
3435
2973
  row.columnFilters.__global__ = false;
3436
2974
  }
3437
2975
  }
3438
2976
  }
3439
-
3440
2977
  const filterRowsImpl = row => {
3441
2978
  // Horizontally filter rows through each column
3442
2979
  for (let i = 0; i < filterableIds.length; i++) {
@@ -3444,19 +2981,14 @@ function getFilteredRowModel() {
3444
2981
  return false;
3445
2982
  }
3446
2983
  }
3447
-
3448
2984
  return true;
3449
- }; // Filter final rows using all of the active filters
3450
-
2985
+ };
3451
2986
 
2987
+ // Filter final rows using all of the active filters
3452
2988
  return filterRows(rowModel.rows, filterRowsImpl, table);
3453
2989
  }, {
3454
2990
  key: process.env.NODE_ENV === 'development' && 'getFilteredRowModel',
3455
- debug: () => {
3456
- var _table$options$debugA;
3457
-
3458
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3459
- },
2991
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3460
2992
  onChange: () => {
3461
2993
  table._autoResetPageIndex();
3462
2994
  }
@@ -3468,9 +3000,7 @@ function getFacetedRowModel() {
3468
3000
  if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3469
3001
  return preRowModel;
3470
3002
  }
3471
-
3472
3003
  const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean);
3473
-
3474
3004
  const filterRowsImpl = row => {
3475
3005
  // Horizontally filter rows through each column
3476
3006
  for (let i = 0; i < filterableIds.length; i++) {
@@ -3478,18 +3008,12 @@ function getFacetedRowModel() {
3478
3008
  return false;
3479
3009
  }
3480
3010
  }
3481
-
3482
3011
  return true;
3483
3012
  };
3484
-
3485
3013
  return filterRows(preRowModel.rows, filterRowsImpl, table);
3486
3014
  }, {
3487
3015
  key: process.env.NODE_ENV === 'development' && 'getFacetedRowModel_' + columnId,
3488
- debug: () => {
3489
- var _table$options$debugA;
3490
-
3491
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3492
- },
3016
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3493
3017
  onChange: () => {}
3494
3018
  });
3495
3019
  }
@@ -3497,29 +3021,19 @@ function getFacetedRowModel() {
3497
3021
  function getFacetedUniqueValues() {
3498
3022
  return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3499
3023
  let facetedUniqueValues = new Map();
3500
-
3501
3024
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3502
3025
  var _facetedRowModel$flat;
3503
-
3504
3026
  const value = (_facetedRowModel$flat = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3505
-
3506
3027
  if (facetedUniqueValues.has(value)) {
3507
- var _facetedUniqueValues$;
3508
-
3509
- facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1);
3028
+ facetedUniqueValues.set(value, (facetedUniqueValues.get(value) ?? 0) + 1);
3510
3029
  } else {
3511
3030
  facetedUniqueValues.set(value, 1);
3512
3031
  }
3513
3032
  }
3514
-
3515
3033
  return facetedUniqueValues;
3516
3034
  }, {
3517
3035
  key: process.env.NODE_ENV === 'development' && 'getFacetedUniqueValues_' + columnId,
3518
- debug: () => {
3519
- var _table$options$debugA;
3520
-
3521
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3522
- },
3036
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3523
3037
  onChange: () => {}
3524
3038
  });
3525
3039
  }
@@ -3527,33 +3041,23 @@ function getFacetedUniqueValues() {
3527
3041
  function getFacetedMinMaxValues() {
3528
3042
  return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3529
3043
  var _facetedRowModel$flat;
3530
-
3531
3044
  const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3532
-
3533
3045
  if (typeof firstValue === 'undefined') {
3534
3046
  return undefined;
3535
3047
  }
3536
-
3537
3048
  let facetedMinMaxValues = [firstValue, firstValue];
3538
-
3539
3049
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3540
3050
  const value = facetedRowModel.flatRows[i].getValue(columnId);
3541
-
3542
3051
  if (value < facetedMinMaxValues[0]) {
3543
3052
  facetedMinMaxValues[0] = value;
3544
3053
  } else if (value > facetedMinMaxValues[1]) {
3545
3054
  facetedMinMaxValues[1] = value;
3546
3055
  }
3547
3056
  }
3548
-
3549
3057
  return facetedMinMaxValues;
3550
3058
  }, {
3551
3059
  key: process.env.NODE_ENV === 'development' && 'getFacetedMinMaxValues_' + columnId,
3552
- debug: () => {
3553
- var _table$options$debugA;
3554
-
3555
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3556
- },
3060
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3557
3061
  onChange: () => {}
3558
3062
  });
3559
3063
  }
@@ -3563,10 +3067,10 @@ function getSortedRowModel() {
3563
3067
  if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3564
3068
  return rowModel;
3565
3069
  }
3566
-
3567
3070
  const sortingState = table.getState().sorting;
3568
- const sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
3071
+ const sortedFlatRows = [];
3569
3072
 
3073
+ // Filter out sortings that correspond to non existing columns
3570
3074
  const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3571
3075
  const columnInfoById = {};
3572
3076
  availableSorting.forEach(sortEntry => {
@@ -3577,61 +3081,50 @@ function getSortedRowModel() {
3577
3081
  sortingFn: column.getSortingFn()
3578
3082
  };
3579
3083
  });
3580
-
3581
3084
  const sortData = rows => {
3582
3085
  // This will also perform a stable sorting using the row index
3583
3086
  // if needed.
3584
3087
  const sortedData = rows.slice();
3585
3088
  sortedData.sort((rowA, rowB) => {
3586
3089
  for (let i = 0; i < availableSorting.length; i += 1) {
3587
- var _sortEntry$desc;
3588
-
3589
3090
  const sortEntry = availableSorting[i];
3590
3091
  const columnInfo = columnInfoById[sortEntry.id];
3591
- const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
3592
-
3092
+ const isDesc = (sortEntry == null ? void 0 : sortEntry.desc) ?? false;
3593
3093
  if (columnInfo.sortUndefined) {
3594
3094
  const aValue = rowA.getValue(sortEntry.id);
3595
3095
  const bValue = rowB.getValue(sortEntry.id);
3596
3096
  const aUndefined = typeof aValue === 'undefined';
3597
3097
  const bUndefined = typeof bValue === 'undefined';
3598
-
3599
3098
  if (aUndefined || bUndefined) {
3600
3099
  return aUndefined && bUndefined ? 0 : aUndefined ? columnInfo.sortUndefined : -columnInfo.sortUndefined;
3601
3100
  }
3602
- } // This function should always return in ascending order
3603
-
3101
+ }
3604
3102
 
3103
+ // This function should always return in ascending order
3605
3104
  let sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
3606
-
3607
3105
  if (sortInt !== 0) {
3608
3106
  if (isDesc) {
3609
3107
  sortInt *= -1;
3610
3108
  }
3611
-
3612
3109
  if (columnInfo.invertSorting) {
3613
3110
  sortInt *= -1;
3614
3111
  }
3615
-
3616
3112
  return sortInt;
3617
3113
  }
3618
3114
  }
3619
-
3620
3115
  return rowA.index - rowB.index;
3621
- }); // If there are sub-rows, sort them
3116
+ });
3622
3117
 
3118
+ // If there are sub-rows, sort them
3623
3119
  sortedData.forEach(row => {
3624
3120
  sortedFlatRows.push(row);
3625
-
3626
3121
  if (!row.subRows || row.subRows.length <= 1) {
3627
3122
  return;
3628
3123
  }
3629
-
3630
3124
  row.subRows = sortData(row.subRows);
3631
3125
  });
3632
3126
  return sortedData;
3633
3127
  };
3634
-
3635
3128
  return {
3636
3129
  rows: sortData(rowModel.rows),
3637
3130
  flatRows: sortedFlatRows,
@@ -3639,11 +3132,7 @@ function getSortedRowModel() {
3639
3132
  };
3640
3133
  }, {
3641
3134
  key: process.env.NODE_ENV === 'development' && 'getSortedRowModel',
3642
- debug: () => {
3643
- var _table$options$debugA;
3644
-
3645
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3646
- },
3135
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3647
3136
  onChange: () => {
3648
3137
  table._autoResetPageIndex();
3649
3138
  }
@@ -3654,22 +3143,22 @@ function getGroupedRowModel() {
3654
3143
  return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
3655
3144
  if (!rowModel.rows.length || !grouping.length) {
3656
3145
  return rowModel;
3657
- } // Filter the grouping list down to columns that exist
3658
-
3146
+ }
3659
3147
 
3148
+ // Filter the grouping list down to columns that exist
3660
3149
  const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
3661
3150
  const groupedFlatRows = [];
3662
- const groupedRowsById = {}; // const onlyGroupedFlatRows: Row[] = [];
3151
+ const groupedRowsById = {};
3152
+ // const onlyGroupedFlatRows: Row[] = [];
3663
3153
  // const onlyGroupedRowsById: Record<RowId, Row> = {};
3664
3154
  // const nonGroupedFlatRows: Row[] = [];
3665
3155
  // const nonGroupedRowsById: Record<RowId, Row> = {};
3666
- // Recursively group the data
3667
3156
 
3157
+ // Recursively group the data
3668
3158
  const groupUpRecursively = function (rows, depth, parentId) {
3669
3159
  if (depth === void 0) {
3670
3160
  depth = 0;
3671
3161
  }
3672
-
3673
3162
  // Grouping depth has been been met
3674
3163
  // Stop grouping and simply rewrite thd depth and row relationships
3675
3164
  if (depth >= existingGrouping.length) {
@@ -3677,26 +3166,27 @@ function getGroupedRowModel() {
3677
3166
  row.depth = depth;
3678
3167
  groupedFlatRows.push(row);
3679
3168
  groupedRowsById[row.id] = row;
3680
-
3681
3169
  if (row.subRows) {
3682
3170
  row.subRows = groupUpRecursively(row.subRows, depth + 1);
3683
3171
  }
3684
-
3685
3172
  return row;
3686
3173
  });
3687
3174
  }
3175
+ const columnId = existingGrouping[depth];
3688
3176
 
3689
- const columnId = existingGrouping[depth]; // Group the rows together for this level
3690
-
3691
- const rowGroupsMap = groupBy(rows, columnId); // Peform aggregations for each group
3177
+ // Group the rows together for this level
3178
+ const rowGroupsMap = groupBy(rows, columnId);
3692
3179
 
3180
+ // Peform aggregations for each group
3693
3181
  const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {
3694
3182
  let [groupingValue, groupedRows] = _ref;
3695
- let id = columnId + ":" + groupingValue;
3696
- id = parentId ? parentId + ">" + id : id; // First, Recurse to group sub rows before aggregation
3183
+ let id = `${columnId}:${groupingValue}`;
3184
+ id = parentId ? `${parentId}>${id}` : id;
3697
3185
 
3698
- const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3186
+ // First, Recurse to group sub rows before aggregation
3187
+ const subRows = groupUpRecursively(groupedRows, depth + 1, id);
3699
3188
 
3189
+ // Flatten the leaf rows of the rows in this group
3700
3190
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3701
3191
  const row = createRow(table, id, leafRows[0].original, index, depth);
3702
3192
  Object.assign(row, {
@@ -3710,24 +3200,18 @@ function getGroupedRowModel() {
3710
3200
  if (row._valuesCache.hasOwnProperty(columnId)) {
3711
3201
  return row._valuesCache[columnId];
3712
3202
  }
3713
-
3714
3203
  if (groupedRows[0]) {
3715
- var _groupedRows$0$getVal;
3716
-
3717
- row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3204
+ row._valuesCache[columnId] = groupedRows[0].getValue(columnId) ?? undefined;
3718
3205
  }
3719
-
3720
3206
  return row._valuesCache[columnId];
3721
3207
  }
3722
-
3723
3208
  if (row._groupingValuesCache.hasOwnProperty(columnId)) {
3724
3209
  return row._groupingValuesCache[columnId];
3725
- } // Aggregate the values
3726
-
3210
+ }
3727
3211
 
3212
+ // Aggregate the values
3728
3213
  const column = table.getColumn(columnId);
3729
3214
  const aggregateFn = column.getAggregationFn();
3730
-
3731
3215
  if (aggregateFn) {
3732
3216
  row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
3733
3217
  return row._groupingValuesCache[columnId];
@@ -3736,7 +3220,8 @@ function getGroupedRowModel() {
3736
3220
  });
3737
3221
  subRows.forEach(subRow => {
3738
3222
  groupedFlatRows.push(subRow);
3739
- groupedRowsById[subRow.id] = subRow; // if (subRow.getIsGrouped?.()) {
3223
+ groupedRowsById[subRow.id] = subRow;
3224
+ // if (subRow.getIsGrouped?.()) {
3740
3225
  // onlyGroupedFlatRows.push(subRow);
3741
3226
  // onlyGroupedRowsById[subRow.id] = subRow;
3742
3227
  // } else {
@@ -3744,15 +3229,16 @@ function getGroupedRowModel() {
3744
3229
  // nonGroupedRowsById[subRow.id] = subRow;
3745
3230
  // }
3746
3231
  });
3232
+
3747
3233
  return row;
3748
3234
  });
3749
3235
  return aggregatedGroupedRows;
3750
3236
  };
3751
-
3752
3237
  const groupedRows = groupUpRecursively(rowModel.rows, 0, '');
3753
3238
  groupedRows.forEach(subRow => {
3754
3239
  groupedFlatRows.push(subRow);
3755
- groupedRowsById[subRow.id] = subRow; // if (subRow.getIsGrouped?.()) {
3240
+ groupedRowsById[subRow.id] = subRow;
3241
+ // if (subRow.getIsGrouped?.()) {
3756
3242
  // onlyGroupedFlatRows.push(subRow);
3757
3243
  // onlyGroupedRowsById[subRow.id] = subRow;
3758
3244
  // } else {
@@ -3760,6 +3246,7 @@ function getGroupedRowModel() {
3760
3246
  // nonGroupedRowsById[subRow.id] = subRow;
3761
3247
  // }
3762
3248
  });
3249
+
3763
3250
  return {
3764
3251
  rows: groupedRows,
3765
3252
  flatRows: groupedFlatRows,
@@ -3767,71 +3254,53 @@ function getGroupedRowModel() {
3767
3254
  };
3768
3255
  }, {
3769
3256
  key: process.env.NODE_ENV === 'development' && 'getGroupedRowModel',
3770
- debug: () => {
3771
- var _table$options$debugA;
3772
-
3773
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3774
- },
3257
+ debug: () => table.options.debugAll ?? table.options.debugTable,
3775
3258
  onChange: () => {
3776
3259
  table._queue(() => {
3777
3260
  table._autoResetExpanded();
3778
-
3779
3261
  table._autoResetPageIndex();
3780
3262
  });
3781
3263
  }
3782
3264
  });
3783
3265
  }
3784
-
3785
3266
  function groupBy(rows, columnId) {
3786
3267
  const groupMap = new Map();
3787
3268
  return rows.reduce((map, row) => {
3788
- const resKey = "" + row.getValue(columnId);
3269
+ const resKey = `${row.getValue(columnId)}`;
3789
3270
  const previous = map.get(resKey);
3790
-
3791
3271
  if (!previous) {
3792
3272
  map.set(resKey, [row]);
3793
3273
  } else {
3794
3274
  map.set(resKey, [...previous, row]);
3795
3275
  }
3796
-
3797
3276
  return map;
3798
3277
  }, groupMap);
3799
3278
  }
3800
3279
 
3801
3280
  function getExpandedRowModel() {
3802
3281
  return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3803
- if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3282
+ if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded ?? {}).length) {
3804
3283
  return rowModel;
3805
3284
  }
3806
-
3807
3285
  if (!paginateExpandedRows) {
3808
3286
  // Only expand rows at this point if they are being paginated
3809
3287
  return rowModel;
3810
3288
  }
3811
-
3812
3289
  return expandRows(rowModel);
3813
3290
  }, {
3814
3291
  key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',
3815
- debug: () => {
3816
- var _table$options$debugA;
3817
-
3818
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3819
- }
3292
+ debug: () => table.options.debugAll ?? table.options.debugTable
3820
3293
  });
3821
3294
  }
3822
3295
  function expandRows(rowModel) {
3823
3296
  const expandedRows = [];
3824
-
3825
3297
  const handleRow = row => {
3826
3298
  var _row$subRows;
3827
-
3828
3299
  expandedRows.push(row);
3829
-
3830
3300
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
3831
3301
  row.subRows.forEach(handleRow);
3832
3302
  }
3833
3303
  };
3834
-
3835
3304
  rowModel.rows.forEach(handleRow);
3836
3305
  return {
3837
3306
  rows: expandedRows,
@@ -3845,7 +3314,6 @@ function getPaginationRowModel(opts) {
3845
3314
  if (!rowModel.rows.length) {
3846
3315
  return rowModel;
3847
3316
  }
3848
-
3849
3317
  const {
3850
3318
  pageSize,
3851
3319
  pageIndex
@@ -3859,7 +3327,6 @@ function getPaginationRowModel(opts) {
3859
3327
  const pageEnd = pageStart + pageSize;
3860
3328
  rows = rows.slice(pageStart, pageEnd);
3861
3329
  let paginatedRowModel;
3862
-
3863
3330
  if (!table.options.paginateExpandedRows) {
3864
3331
  paginatedRowModel = expandRows({
3865
3332
  rows,
@@ -3873,26 +3340,18 @@ function getPaginationRowModel(opts) {
3873
3340
  rowsById
3874
3341
  };
3875
3342
  }
3876
-
3877
3343
  paginatedRowModel.flatRows = [];
3878
-
3879
3344
  const handleRow = row => {
3880
3345
  paginatedRowModel.flatRows.push(row);
3881
-
3882
3346
  if (row.subRows.length) {
3883
3347
  row.subRows.forEach(handleRow);
3884
3348
  }
3885
3349
  };
3886
-
3887
3350
  paginatedRowModel.rows.forEach(handleRow);
3888
3351
  return paginatedRowModel;
3889
3352
  }, {
3890
3353
  key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',
3891
- debug: () => {
3892
- var _table$options$debugA;
3893
-
3894
- return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
3895
- }
3354
+ debug: () => table.options.debugAll ?? table.options.debugTable
3896
3355
  });
3897
3356
  }
3898
3357