@tanstack/react-table 8.7.4 → 8.7.8

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.
@@ -75,7 +75,7 @@
75
75
  subArr.forEach(item => {
76
76
  flat.push(item);
77
77
  const children = getChildren(item);
78
- if (children?.length) {
78
+ if (children != null && children.length) {
79
79
  recurse(children);
80
80
  }
81
81
  });
@@ -98,9 +98,9 @@
98
98
  let resultTime;
99
99
  if (opts.key && opts.debug) resultTime = Date.now();
100
100
  result = fn(...newDeps);
101
- opts?.onChange?.(result);
101
+ opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
102
102
  if (opts.key && opts.debug) {
103
- if (opts?.debug()) {
103
+ if (opts != null && opts.debug()) {
104
104
  const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
105
105
  const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
106
106
  const resultFpsPercentage = resultEndTime / 16;
@@ -114,7 +114,7 @@
114
114
  console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
115
115
  font-size: .6rem;
116
116
  font-weight: bold;
117
- color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts?.key);
117
+ color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
118
118
  }
119
119
  }
120
120
  return result;
@@ -139,9 +139,10 @@
139
139
  accessorFn = originalRow => {
140
140
  let result = originalRow;
141
141
  for (const key of accessorKey.split('.')) {
142
- result = result[key];
142
+ var _result;
143
+ result = (_result = result) == null ? void 0 : _result[key];
143
144
  if (result === undefined) {
144
- throw new Error(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
145
+ console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
145
146
  }
146
147
  }
147
148
  return result;
@@ -163,7 +164,8 @@
163
164
  columnDef: resolvedColumnDef,
164
165
  columns: [],
165
166
  getFlatColumns: memo(() => [true], () => {
166
- return [column, ...column.columns?.flatMap(d => d.getFlatColumns())];
167
+ var _column$columns;
168
+ return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
167
169
  }, {
168
170
  key: "development" === 'production' ,
169
171
  debug: () => {
@@ -172,7 +174,8 @@
172
174
  }
173
175
  }),
174
176
  getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
175
- if (column.columns?.length) {
177
+ var _column$columns2;
178
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
176
179
  let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
177
180
  return orderColumns(leafColumns);
178
181
  }
@@ -186,7 +189,7 @@
186
189
  })
187
190
  };
188
191
  column = table._features.reduce((obj, feature) => {
189
- return Object.assign(obj, feature.createColumn?.(column, table));
192
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
190
193
  }, column);
191
194
 
192
195
  // Yes, we have to convert table to uknown, because we know more than the compiler here.
@@ -227,7 +230,7 @@
227
230
  })
228
231
  };
229
232
  table._features.forEach(feature => {
230
- Object.assign(header, feature.createHeader?.(header, table));
233
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
231
234
  });
232
235
  return header;
233
236
  }
@@ -238,9 +241,9 @@
238
241
 
239
242
  getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
240
243
  var _left$map$filter, _right$map$filter;
241
- const leftColumns = (_left$map$filter = left?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
242
- const rightColumns = (_right$map$filter = right?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
243
- const centerColumns = leafColumns.filter(column => !left?.includes(column.id) && !right?.includes(column.id));
244
+ const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
245
+ const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
246
+ const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
244
247
  const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
245
248
  return headerGroups;
246
249
  }, {
@@ -251,7 +254,7 @@
251
254
  }
252
255
  }),
253
256
  getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
254
- leafColumns = leafColumns.filter(column => !left?.includes(column.id) && !right?.includes(column.id));
257
+ leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
255
258
  return buildHeaderGroups(allColumns, leafColumns, table, 'center');
256
259
  }, {
257
260
  key: 'getCenterHeaderGroups',
@@ -262,7 +265,7 @@
262
265
  }),
263
266
  getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
264
267
  var _left$map$filter2;
265
- const orderedLeafColumns = (_left$map$filter2 = left?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
268
+ const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
266
269
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
267
270
  }, {
268
271
  key: 'getLeftHeaderGroups',
@@ -273,7 +276,7 @@
273
276
  }),
274
277
  getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
275
278
  var _right$map$filter2;
276
- const orderedLeafColumns = (_right$map$filter2 = right?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
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 : [];
277
280
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
278
281
  }, {
279
282
  key: 'getRightHeaderGroups',
@@ -369,7 +372,10 @@
369
372
  // Leaf Headers
370
373
 
371
374
  getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
372
- return flatHeaders.filter(header => !header.subHeaders?.length);
375
+ return flatHeaders.filter(header => {
376
+ var _header$subHeaders;
377
+ return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
378
+ });
373
379
  }, {
374
380
  key: 'getCenterLeafHeaders',
375
381
  debug: () => {
@@ -378,7 +384,10 @@
378
384
  }
379
385
  }),
380
386
  getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
381
- return flatHeaders.filter(header => !header.subHeaders?.length);
387
+ return flatHeaders.filter(header => {
388
+ var _header$subHeaders2;
389
+ return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
390
+ });
382
391
  }, {
383
392
  key: 'getLeftLeafHeaders',
384
393
  debug: () => {
@@ -387,7 +396,10 @@
387
396
  }
388
397
  }),
389
398
  getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
390
- return flatHeaders.filter(header => !header.subHeaders?.length);
399
+ return flatHeaders.filter(header => {
400
+ var _header$subHeaders3;
401
+ return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
402
+ });
391
403
  }, {
392
404
  key: 'getRightLeafHeaders',
393
405
  debug: () => {
@@ -396,8 +408,8 @@
396
408
  }
397
409
  }),
398
410
  getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
399
- var _left$0$headers, _center$0$headers, _right$0$headers;
400
- return [...((_left$0$headers = left[0]?.headers) != null ? _left$0$headers : []), ...((_center$0$headers = center[0]?.headers) != null ? _center$0$headers : []), ...((_right$0$headers = right[0]?.headers) != null ? _right$0$headers : [])].map(header => {
411
+ var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
412
+ 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 => {
401
413
  return header.getLeafHeaders();
402
414
  }).flat();
403
415
  }, {
@@ -411,7 +423,7 @@
411
423
  }
412
424
  };
413
425
  function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
414
- var _headerGroups$0$heade;
426
+ var _headerGroups$0$heade, _headerGroups$;
415
427
  // Find the max depth of the columns:
416
428
  // build the leaf column row
417
429
  // build each buffer row going up
@@ -425,7 +437,8 @@
425
437
  }
426
438
  maxDepth = Math.max(maxDepth, depth);
427
439
  columns.filter(column => column.getIsVisible()).forEach(column => {
428
- if (column.columns?.length) {
440
+ var _column$columns;
441
+ if ((_column$columns = column.columns) != null && _column$columns.length) {
429
442
  findMaxDepth(column.columns, depth + 1);
430
443
  }
431
444
  }, 0);
@@ -459,13 +472,13 @@
459
472
  column = headerToGroup.column;
460
473
  isPlaceholder = true;
461
474
  }
462
- if (latestPendingParentHeader && latestPendingParentHeader?.column === column) {
475
+ if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
463
476
  // This column is repeated. Add it as a sub header to the next batch
464
477
  latestPendingParentHeader.subHeaders.push(headerToGroup);
465
478
  } else {
466
479
  // This is a new header. Let's create it
467
480
  const header = createHeader(table, column, {
468
- id: [headerFamily, depth, column.id, headerToGroup?.id].filter(Boolean).join('_'),
481
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
469
482
  isPlaceholder,
470
483
  placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,
471
484
  depth,
@@ -526,7 +539,7 @@
526
539
  };
527
540
  });
528
541
  };
529
- recurseHeadersForSpans((_headerGroups$0$heade = headerGroups[0]?.headers) != null ? _headerGroups$0$heade : []);
542
+ recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
530
543
  return headerGroups;
531
544
  }
532
545
 
@@ -621,12 +634,12 @@
621
634
  },
622
635
  getResizeHandler: () => {
623
636
  const column = table.getColumn(header.column.id);
624
- const canResize = column.getCanResize();
637
+ const canResize = column == null ? void 0 : column.getCanResize();
625
638
  return e => {
626
- if (!canResize) {
639
+ if (!column || !canResize) {
627
640
  return;
628
641
  }
629
- e.persist?.();
642
+ e.persist == null ? void 0 : e.persist();
630
643
  if (isTouchStartEvent(e)) {
631
644
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
632
645
  if (e.touches && e.touches.length > 1) {
@@ -643,8 +656,8 @@
643
656
  }
644
657
  table.setColumnSizingInfo(old => {
645
658
  var _old$startOffset, _old$startSize;
646
- const deltaOffset = clientXPos - ((_old$startOffset = old?.startOffset) != null ? _old$startOffset : 0);
647
- const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old?.startSize) != null ? _old$startSize : 0), -0.999999);
659
+ const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
660
+ const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
648
661
  old.columnSizingStart.forEach(_ref3 => {
649
662
  let [columnId, headerSize] = _ref3;
650
663
  newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
@@ -693,13 +706,14 @@
693
706
  return false;
694
707
  },
695
708
  upHandler: e => {
709
+ var _e$touches$;
696
710
  document.removeEventListener('touchmove', touchEvents.moveHandler);
697
711
  document.removeEventListener('touchend', touchEvents.upHandler);
698
712
  if (e.cancelable) {
699
713
  e.preventDefault();
700
714
  e.stopPropagation();
701
715
  }
702
- onEnd(e.touches[0]?.clientX);
716
+ onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
703
717
  }
704
718
  };
705
719
  const passiveIfSupported = passiveEventSupported() ? {
@@ -727,8 +741,8 @@
727
741
  },
728
742
  createTable: table => {
729
743
  return {
730
- setColumnSizing: updater => table.options.onColumnSizingChange?.(updater),
731
- setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange?.(updater),
744
+ setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
745
+ setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
732
746
  resetColumnSizing: defaultState => {
733
747
  var _table$initialState$c;
734
748
  table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
@@ -738,26 +752,26 @@
738
752
  table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
739
753
  },
740
754
  getTotalSize: () => {
741
- var _table$getHeaderGroup;
742
- return (_table$getHeaderGroup = table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {
755
+ var _table$getHeaderGroup, _table$getHeaderGroup2;
756
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
743
757
  return sum + header.getSize();
744
758
  }, 0)) != null ? _table$getHeaderGroup : 0;
745
759
  },
746
760
  getLeftTotalSize: () => {
747
- var _table$getLeftHeaderG;
748
- return (_table$getLeftHeaderG = table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {
761
+ var _table$getLeftHeaderG, _table$getLeftHeaderG2;
762
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
749
763
  return sum + header.getSize();
750
764
  }, 0)) != null ? _table$getLeftHeaderG : 0;
751
765
  },
752
766
  getCenterTotalSize: () => {
753
- var _table$getCenterHeade;
754
- return (_table$getCenterHeade = table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {
767
+ var _table$getCenterHeade, _table$getCenterHeade2;
768
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
755
769
  return sum + header.getSize();
756
770
  }, 0)) != null ? _table$getCenterHeade : 0;
757
771
  },
758
772
  getRightTotalSize: () => {
759
- var _table$getRightHeader;
760
- return (_table$getRightHeader = table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {
773
+ var _table$getRightHeader, _table$getRightHeader2;
774
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
761
775
  return sum + header.getSize();
762
776
  }, 0)) != null ? _table$getRightHeader : 0;
763
777
  }
@@ -824,7 +838,7 @@
824
838
  });
825
839
  }
826
840
  },
827
- setExpanded: updater => table.options.onExpandedChange?.(updater),
841
+ setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
828
842
  toggleAllRowsExpanded: expanded => {
829
843
  if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
830
844
  table.setExpanded(true);
@@ -833,15 +847,15 @@
833
847
  }
834
848
  },
835
849
  resetExpanded: defaultState => {
836
- var _table$initialState$e;
837
- table.setExpanded(defaultState ? {} : (_table$initialState$e = table.initialState?.expanded) != null ? _table$initialState$e : {});
850
+ var _table$initialState$e, _table$initialState;
851
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
838
852
  },
839
853
  getCanSomeRowsExpand: () => {
840
854
  return table.getRowModel().flatRows.some(row => row.getCanExpand());
841
855
  },
842
856
  getToggleAllRowsExpandedHandler: () => {
843
857
  return e => {
844
- e.persist?.();
858
+ e.persist == null ? void 0 : e.persist();
845
859
  table.toggleAllRowsExpanded();
846
860
  };
847
861
  },
@@ -894,7 +908,7 @@
894
908
  toggleExpanded: expanded => {
895
909
  table.setExpanded(old => {
896
910
  var _expanded;
897
- const exists = old === true ? true : !!old?.[row.id];
911
+ const exists = old === true ? true : !!(old != null && old[row.id]);
898
912
  let oldExpanded = {};
899
913
  if (old === true) {
900
914
  Object.keys(table.getRowModel().rowsById).forEach(rowId => {
@@ -923,11 +937,11 @@
923
937
  getIsExpanded: () => {
924
938
  var _table$options$getIsR;
925
939
  const expanded = table.getState().expanded;
926
- return !!((_table$options$getIsR = table.options.getIsRowExpanded?.(row)) != null ? _table$options$getIsR : expanded === true || expanded?.[row.id]);
940
+ 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]));
927
941
  },
928
942
  getCanExpand: () => {
929
- var _table$options$getRow, _table$options$enable;
930
- return (_table$options$getRow = table.options.getRowCanExpand?.(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!row.subRows?.length;
943
+ var _table$options$getRow, _table$options$enable, _row$subRows;
944
+ 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);
931
945
  },
932
946
  getToggleExpandedHandler: () => {
933
947
  const canExpand = row.getCanExpand();
@@ -941,30 +955,40 @@
941
955
  };
942
956
 
943
957
  const includesString = (row, columnId, filterValue) => {
958
+ var _row$getValue;
944
959
  const search = filterValue.toLowerCase();
945
- return Boolean(row.getValue(columnId)?.toLowerCase().includes(search));
960
+ return Boolean((_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search));
946
961
  };
947
962
  includesString.autoRemove = val => testFalsey(val);
948
963
  const includesStringSensitive = (row, columnId, filterValue) => {
949
- return Boolean(row.getValue(columnId)?.includes(filterValue));
964
+ var _row$getValue2;
965
+ return Boolean((_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue));
950
966
  };
951
967
  includesStringSensitive.autoRemove = val => testFalsey(val);
952
968
  const equalsString = (row, columnId, filterValue) => {
953
- return row.getValue(columnId)?.toLowerCase() === filterValue.toLowerCase();
969
+ var _row$getValue3;
970
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
954
971
  };
955
972
  equalsString.autoRemove = val => testFalsey(val);
956
973
  const arrIncludes = (row, columnId, filterValue) => {
957
- return row.getValue(columnId)?.includes(filterValue);
974
+ var _row$getValue4;
975
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
958
976
  };
959
- arrIncludes.autoRemove = val => testFalsey(val) || !val?.length;
977
+ arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
960
978
  const arrIncludesAll = (row, columnId, filterValue) => {
961
- return !filterValue.some(val => !row.getValue(columnId)?.includes(val));
979
+ return !filterValue.some(val => {
980
+ var _row$getValue5;
981
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
982
+ });
962
983
  };
963
- arrIncludesAll.autoRemove = val => testFalsey(val) || !val?.length;
984
+ arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
964
985
  const arrIncludesSome = (row, columnId, filterValue) => {
965
- return filterValue.some(val => row.getValue(columnId)?.includes(val));
986
+ return filterValue.some(val => {
987
+ var _row$getValue6;
988
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
989
+ });
966
990
  };
967
- arrIncludesSome.autoRemove = val => testFalsey(val) || !val?.length;
991
+ arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
968
992
  const equals = (row, columnId, filterValue) => {
969
993
  return row.getValue(columnId) === filterValue;
970
994
  };
@@ -1037,7 +1061,8 @@
1037
1061
  maxLeafRowFilterDepth: 100,
1038
1062
  globalFilterFn: 'auto',
1039
1063
  getColumnCanGlobalFilter: column => {
1040
- const value = table.getCoreRowModel().flatRows[0]?._getAllCellsByColumnId()[column.id]?.getValue();
1064
+ var _table$getCoreRowMode, _table$getCoreRowMode2;
1065
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1041
1066
  return typeof value === 'string' || typeof value === 'number';
1042
1067
  }
1043
1068
  };
@@ -1046,7 +1071,7 @@
1046
1071
  return {
1047
1072
  getAutoFilterFn: () => {
1048
1073
  const firstRow = table.getCoreRowModel().flatRows[0];
1049
- const value = firstRow?.getValue(column.id);
1074
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1050
1075
  if (typeof value === 'string') {
1051
1076
  return filterFns.includesString;
1052
1077
  }
@@ -1065,10 +1090,10 @@
1065
1090
  return filterFns.weakEquals;
1066
1091
  },
1067
1092
  getFilterFn: () => {
1068
- var _table$options$filter;
1093
+ var _table$options$filter, _table$options$filter2;
1069
1094
  return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn()
1070
1095
  // @ts-ignore
1071
- : (_table$options$filter = table.options.filterFns?.[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
1096
+ : (_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];
1072
1097
  },
1073
1098
  getCanFilter: () => {
1074
1099
  var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
@@ -1076,24 +1101,27 @@
1076
1101
  },
1077
1102
  getCanGlobalFilter: () => {
1078
1103
  var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1079
- 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?.(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
1104
+ 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;
1080
1105
  },
1081
1106
  getIsFiltered: () => column.getFilterIndex() > -1,
1082
- getFilterValue: () => table.getState().columnFilters?.find(d => d.id === column.id)?.value,
1107
+ getFilterValue: () => {
1108
+ var _table$getState$colum, _table$getState$colum2;
1109
+ 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;
1110
+ },
1083
1111
  getFilterIndex: () => {
1084
- var _table$getState$colum;
1085
- return (_table$getState$colum = table.getState().columnFilters?.findIndex(d => d.id === column.id)) != null ? _table$getState$colum : -1;
1112
+ var _table$getState$colum3, _table$getState$colum4;
1113
+ 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;
1086
1114
  },
1087
1115
  setFilterValue: value => {
1088
1116
  table.setColumnFilters(old => {
1089
1117
  const filterFn = column.getFilterFn();
1090
- const previousfilter = old?.find(d => d.id === column.id);
1118
+ const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1091
1119
  const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
1092
1120
 
1093
1121
  //
1094
1122
  if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
1095
1123
  var _old$filter;
1096
- return (_old$filter = old?.filter(d => d.id !== column.id)) != null ? _old$filter : [];
1124
+ return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
1097
1125
  }
1098
1126
  const newFilterObj = {
1099
1127
  id: column.id,
@@ -1101,14 +1129,14 @@
1101
1129
  };
1102
1130
  if (previousfilter) {
1103
1131
  var _old$map;
1104
- return (_old$map = old?.map(d => {
1132
+ return (_old$map = old == null ? void 0 : old.map(d => {
1105
1133
  if (d.id === column.id) {
1106
1134
  return newFilterObj;
1107
1135
  }
1108
1136
  return d;
1109
1137
  })) != null ? _old$map : [];
1110
1138
  }
1111
- if (old?.length) {
1139
+ if (old != null && old.length) {
1112
1140
  return [...old, newFilterObj];
1113
1141
  }
1114
1142
  return [newFilterObj];
@@ -1152,18 +1180,19 @@
1152
1180
  return filterFns.includesString;
1153
1181
  },
1154
1182
  getGlobalFilterFn: () => {
1155
- var _table$options$filter2;
1183
+ var _table$options$filter3, _table$options$filter4;
1156
1184
  const {
1157
1185
  globalFilterFn: globalFilterFn
1158
1186
  } = table.options;
1159
1187
  return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn()
1160
1188
  // @ts-ignore
1161
- : (_table$options$filter2 = table.options.filterFns?.[globalFilterFn]) != null ? _table$options$filter2 : filterFns[globalFilterFn];
1189
+ : (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn];
1162
1190
  },
1163
1191
  setColumnFilters: updater => {
1164
1192
  const leafColumns = table.getAllLeafColumns();
1165
1193
  const updateFn = old => {
1166
- return functionalUpdate(updater, old)?.filter(filter => {
1194
+ var _functionalUpdate;
1195
+ return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
1167
1196
  const column = leafColumns.find(d => d.id === filter.id);
1168
1197
  if (column) {
1169
1198
  const filterFn = column.getFilterFn();
@@ -1174,17 +1203,17 @@
1174
1203
  return true;
1175
1204
  });
1176
1205
  };
1177
- table.options.onColumnFiltersChange?.(updateFn);
1206
+ table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1178
1207
  },
1179
1208
  setGlobalFilter: updater => {
1180
- table.options.onGlobalFilterChange?.(updater);
1209
+ table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1181
1210
  },
1182
1211
  resetGlobalFilter: defaultState => {
1183
1212
  table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1184
1213
  },
1185
1214
  resetColumnFilters: defaultState => {
1186
- var _table$initialState$c;
1187
- table.setColumnFilters(defaultState ? [] : (_table$initialState$c = table.initialState?.columnFilters) != null ? _table$initialState$c : []);
1215
+ var _table$initialState$c, _table$initialState;
1216
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1188
1217
  },
1189
1218
  getPreFilteredRowModel: () => table.getCoreRowModel(),
1190
1219
  getFilteredRowModel: () => {
@@ -1322,8 +1351,8 @@
1322
1351
  getDefaultColumnDef: () => {
1323
1352
  return {
1324
1353
  aggregatedCell: props => {
1325
- var _toString;
1326
- return (_toString = props.getValue()?.toString?.()) != null ? _toString : null;
1354
+ var _toString, _props$getValue;
1355
+ return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1327
1356
  },
1328
1357
  aggregationFn: 'auto'
1329
1358
  };
@@ -1345,7 +1374,7 @@
1345
1374
  toggleGrouping: () => {
1346
1375
  table.setGrouping(old => {
1347
1376
  // Find any existing grouping for this column
1348
- if (old?.includes(column.id)) {
1377
+ if (old != null && old.includes(column.id)) {
1349
1378
  return old.filter(d => d !== column.id);
1350
1379
  }
1351
1380
  return [...(old != null ? old : []), column.id];
@@ -1356,9 +1385,13 @@
1356
1385
  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;
1357
1386
  },
1358
1387
  getIsGrouped: () => {
1359
- return table.getState().grouping?.includes(column.id);
1388
+ var _table$getState$group;
1389
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1390
+ },
1391
+ getGroupedIndex: () => {
1392
+ var _table$getState$group2;
1393
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1360
1394
  },
1361
- getGroupedIndex: () => table.getState().grouping?.indexOf(column.id),
1362
1395
  getToggleGroupingHandler: () => {
1363
1396
  const canGroup = column.getCanGroup();
1364
1397
  return () => {
@@ -1368,7 +1401,7 @@
1368
1401
  },
1369
1402
  getAutoAggregationFn: () => {
1370
1403
  const firstRow = table.getCoreRowModel().flatRows[0];
1371
- const value = firstRow?.getValue(column.id);
1404
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1372
1405
  if (typeof value === 'number') {
1373
1406
  return aggregationFns.sum;
1374
1407
  }
@@ -1377,20 +1410,20 @@
1377
1410
  }
1378
1411
  },
1379
1412
  getAggregationFn: () => {
1380
- var _table$options$aggreg;
1413
+ var _table$options$aggreg, _table$options$aggreg2;
1381
1414
  if (!column) {
1382
1415
  throw new Error();
1383
1416
  }
1384
- return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = table.options.aggregationFns?.[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
1417
+ 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];
1385
1418
  }
1386
1419
  };
1387
1420
  },
1388
1421
  createTable: table => {
1389
1422
  return {
1390
- setGrouping: updater => table.options.onGroupingChange?.(updater),
1423
+ setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1391
1424
  resetGrouping: defaultState => {
1392
- var _table$initialState$g;
1393
- table.setGrouping(defaultState ? [] : (_table$initialState$g = table.initialState?.grouping) != null ? _table$initialState$g : []);
1425
+ var _table$initialState$g, _table$initialState;
1426
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1394
1427
  },
1395
1428
  getPreGroupedRowModel: () => table.getFilteredRowModel(),
1396
1429
  getGroupedRowModel: () => {
@@ -1414,12 +1447,15 @@
1414
1447
  return {
1415
1448
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
1416
1449
  getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
1417
- getIsAggregated: () => !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length
1450
+ getIsAggregated: () => {
1451
+ var _row$subRows;
1452
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1453
+ }
1418
1454
  };
1419
1455
  }
1420
1456
  };
1421
1457
  function orderColumns(leafColumns, grouping, groupedColumnMode) {
1422
- if (!grouping?.length || !groupedColumnMode) {
1458
+ if (!(grouping != null && grouping.length) || !groupedColumnMode) {
1423
1459
  return leafColumns;
1424
1460
  }
1425
1461
  const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
@@ -1446,7 +1482,7 @@
1446
1482
  },
1447
1483
  createTable: table => {
1448
1484
  return {
1449
- setColumnOrder: updater => table.options.onColumnOrderChange?.(updater),
1485
+ setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1450
1486
  resetColumnOrder: defaultState => {
1451
1487
  var _table$initialState$c;
1452
1488
  table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
@@ -1457,7 +1493,7 @@
1457
1493
  let orderedColumns = [];
1458
1494
 
1459
1495
  // If there is no order, return the normal columns
1460
- if (!columnOrder?.length) {
1496
+ if (!(columnOrder != null && columnOrder.length)) {
1461
1497
  orderedColumns = columns;
1462
1498
  } else {
1463
1499
  const columnOrderCopy = [...columnOrder];
@@ -1502,7 +1538,7 @@
1502
1538
  ...state,
1503
1539
  pagination: {
1504
1540
  ...getDefaultPaginationState(),
1505
- ...state?.pagination
1541
+ ...(state == null ? void 0 : state.pagination)
1506
1542
  }
1507
1543
  };
1508
1544
  },
@@ -1537,7 +1573,7 @@
1537
1573
  let newState = functionalUpdate(updater, old);
1538
1574
  return newState;
1539
1575
  };
1540
- return table.options.onPaginationChange?.(safeUpdater);
1576
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1541
1577
  },
1542
1578
  resetPagination: defaultState => {
1543
1579
  var _table$initialState$p;
@@ -1555,12 +1591,12 @@
1555
1591
  });
1556
1592
  },
1557
1593
  resetPageIndex: defaultState => {
1558
- var _table$initialState$p2;
1559
- table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = table.initialState?.pagination?.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
1594
+ var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1595
+ 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);
1560
1596
  },
1561
1597
  resetPageSize: defaultState => {
1562
- var _table$initialState$p3;
1563
- table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = table.initialState?.pagination?.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
1598
+ var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1599
+ 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);
1564
1600
  },
1565
1601
  setPageSize: updater => {
1566
1602
  table.setPagination(old => {
@@ -1665,20 +1701,20 @@
1665
1701
  if (position === 'right') {
1666
1702
  var _old$left, _old$right;
1667
1703
  return {
1668
- left: ((_old$left = old?.left) != null ? _old$left : []).filter(d => !columnIds?.includes(d)),
1669
- right: [...((_old$right = old?.right) != null ? _old$right : []).filter(d => !columnIds?.includes(d)), ...columnIds]
1704
+ left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1705
+ right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
1670
1706
  };
1671
1707
  }
1672
1708
  if (position === 'left') {
1673
1709
  var _old$left2, _old$right2;
1674
1710
  return {
1675
- left: [...((_old$left2 = old?.left) != null ? _old$left2 : []).filter(d => !columnIds?.includes(d)), ...columnIds],
1676
- right: ((_old$right2 = old?.right) != null ? _old$right2 : []).filter(d => !columnIds?.includes(d))
1711
+ left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
1712
+ right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1677
1713
  };
1678
1714
  }
1679
1715
  return {
1680
- left: ((_old$left3 = old?.left) != null ? _old$left3 : []).filter(d => !columnIds?.includes(d)),
1681
- right: ((_old$right3 = old?.right) != null ? _old$right3 : []).filter(d => !columnIds?.includes(d))
1716
+ left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1717
+ right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1682
1718
  };
1683
1719
  });
1684
1720
  },
@@ -1695,14 +1731,14 @@
1695
1731
  left,
1696
1732
  right
1697
1733
  } = table.getState().columnPinning;
1698
- const isLeft = leafColumnIds.some(d => left?.includes(d));
1699
- const isRight = leafColumnIds.some(d => right?.includes(d));
1734
+ const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
1735
+ const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
1700
1736
  return isLeft ? 'left' : isRight ? 'right' : false;
1701
1737
  },
1702
1738
  getPinnedIndex: () => {
1703
- var _table$getState$colum;
1739
+ var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1704
1740
  const position = column.getIsPinned();
1705
- return position ? (_table$getState$colum = table.getState().columnPinning?.[position]?.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
1741
+ 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;
1706
1742
  }
1707
1743
  };
1708
1744
  },
@@ -1748,17 +1784,19 @@
1748
1784
  },
1749
1785
  createTable: table => {
1750
1786
  return {
1751
- setColumnPinning: updater => table.options.onColumnPinningChange?.(updater),
1787
+ setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1752
1788
  resetColumnPinning: defaultState => {
1753
- var _table$initialState$c;
1754
- return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = table.initialState?.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1789
+ var _table$initialState$c, _table$initialState;
1790
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1755
1791
  },
1756
1792
  getIsSomeColumnsPinned: position => {
1793
+ var _pinningState$positio;
1757
1794
  const pinningState = table.getState().columnPinning;
1758
1795
  if (!position) {
1759
- return Boolean(pinningState.left?.length || pinningState.right?.length);
1796
+ var _pinningState$left, _pinningState$right;
1797
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1760
1798
  }
1761
- return Boolean(pinningState[position]?.length);
1799
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1762
1800
  },
1763
1801
  getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1764
1802
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
@@ -1815,7 +1853,7 @@
1815
1853
 
1816
1854
  createTable: table => {
1817
1855
  return {
1818
- setRowSelection: updater => table.options.onRowSelectionChange?.(updater),
1856
+ setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
1819
1857
  resetRowSelection: defaultState => {
1820
1858
  var _table$initialState$r;
1821
1859
  return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
@@ -2081,14 +2119,16 @@
2081
2119
  getToggleSelectedHandler: () => {
2082
2120
  const canSelect = row.getCanSelect();
2083
2121
  return e => {
2122
+ var _target;
2084
2123
  if (!canSelect) return;
2085
- row.toggleSelected(e.target?.checked);
2124
+ row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
2086
2125
  };
2087
2126
  }
2088
2127
  };
2089
2128
  }
2090
2129
  };
2091
2130
  const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2131
+ var _row$subRows;
2092
2132
  const row = table.getRow(id);
2093
2133
 
2094
2134
  // const isGrouped = row.getIsGrouped()
@@ -2109,7 +2149,7 @@
2109
2149
  }
2110
2150
  // }
2111
2151
 
2112
- if (row.subRows?.length && row.getCanSelectSubRows()) {
2152
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2113
2153
  row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2114
2154
  }
2115
2155
  };
@@ -2121,12 +2161,13 @@
2121
2161
  // Filters top level and nested rows
2122
2162
  const recurseRows = function (rows, depth) {
2123
2163
  return rows.map(row => {
2164
+ var _row$subRows2;
2124
2165
  const isSelected = isRowSelected(row, rowSelection);
2125
2166
  if (isSelected) {
2126
2167
  newSelectedFlatRows.push(row);
2127
2168
  newSelectedRowsById[row.id] = row;
2128
2169
  }
2129
- if (row.subRows?.length) {
2170
+ if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
2130
2171
  row = {
2131
2172
  ...row,
2132
2173
  subRows: recurseRows(row.subRows)
@@ -2300,7 +2341,7 @@
2300
2341
  const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2301
2342
  let isString = false;
2302
2343
  for (const row of firstRows) {
2303
- const value = row?.getValue(column.id);
2344
+ const value = row == null ? void 0 : row.getValue(column.id);
2304
2345
  if (Object.prototype.toString.call(value) === '[object Date]') {
2305
2346
  return sortingFns.datetime;
2306
2347
  }
@@ -2318,18 +2359,18 @@
2318
2359
  },
2319
2360
  getAutoSortDir: () => {
2320
2361
  const firstRow = table.getFilteredRowModel().flatRows[0];
2321
- const value = firstRow?.getValue(column.id);
2362
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2322
2363
  if (typeof value === 'string') {
2323
2364
  return 'asc';
2324
2365
  }
2325
2366
  return 'desc';
2326
2367
  },
2327
2368
  getSortingFn: () => {
2328
- var _table$options$sortin;
2369
+ var _table$options$sortin, _table$options$sortin2;
2329
2370
  if (!column) {
2330
2371
  throw new Error();
2331
2372
  }
2332
- return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = table.options.sortingFns?.[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];
2373
+ 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];
2333
2374
  },
2334
2375
  toggleSorting: (desc, multi) => {
2335
2376
  // if (column.columns.length) {
@@ -2346,8 +2387,8 @@
2346
2387
  const hasManualValue = typeof desc !== 'undefined' && desc !== null;
2347
2388
  table.setSorting(old => {
2348
2389
  // Find any existing sorting for this column
2349
- const existingSorting = old?.find(d => d.id === column.id);
2350
- const existingIndex = old?.findIndex(d => d.id === column.id);
2390
+ const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
2391
+ const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
2351
2392
  let newSorting = [];
2352
2393
 
2353
2394
  // What should we do with this sort action?
@@ -2355,7 +2396,7 @@
2355
2396
  let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
2356
2397
 
2357
2398
  // Multi-mode
2358
- if (old?.length && column.getCanMultiSort() && multi) {
2399
+ if (old != null && old.length && column.getCanMultiSort() && multi) {
2359
2400
  if (existingSorting) {
2360
2401
  sortAction = 'toggle';
2361
2402
  } else {
@@ -2363,7 +2404,7 @@
2363
2404
  }
2364
2405
  } else {
2365
2406
  // Normal mode
2366
- if (old?.length && existingIndex !== old.length - 1) {
2407
+ if (old != null && old.length && existingIndex !== old.length - 1) {
2367
2408
  sortAction = 'replace';
2368
2409
  } else if (existingSorting) {
2369
2410
  sortAction = 'toggle';
@@ -2441,33 +2482,34 @@
2441
2482
  return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2442
2483
  },
2443
2484
  getIsSorted: () => {
2444
- const columnSort = table.getState().sorting?.find(d => d.id === column.id);
2485
+ var _table$getState$sorti;
2486
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2445
2487
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2446
2488
  },
2447
2489
  getSortIndex: () => {
2448
- var _table$getState$sorti;
2449
- return (_table$getState$sorti = table.getState().sorting?.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti : -1;
2490
+ var _table$getState$sorti2, _table$getState$sorti3;
2491
+ 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;
2450
2492
  },
2451
2493
  clearSorting: () => {
2452
2494
  //clear sorting for just 1 column
2453
- table.setSorting(old => old?.length ? old.filter(d => d.id !== column.id) : []);
2495
+ table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2454
2496
  },
2455
2497
  getToggleSortingHandler: () => {
2456
2498
  const canSort = column.getCanSort();
2457
2499
  return e => {
2458
2500
  if (!canSort) return;
2459
- e.persist?.();
2460
- column.toggleSorting?.(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false);
2501
+ e.persist == null ? void 0 : e.persist();
2502
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2461
2503
  };
2462
2504
  }
2463
2505
  };
2464
2506
  },
2465
2507
  createTable: table => {
2466
2508
  return {
2467
- setSorting: updater => table.options.onSortingChange?.(updater),
2509
+ setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2468
2510
  resetSorting: defaultState => {
2469
- var _table$initialState$s;
2470
- table.setSorting(defaultState ? [] : (_table$initialState$s = table.initialState?.sorting) != null ? _table$initialState$s : []);
2511
+ var _table$initialState$s, _table$initialState;
2512
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2471
2513
  },
2472
2514
  getPreSortedRowModel: () => table.getGroupedRowModel(),
2473
2515
  getSortedRowModel: () => {
@@ -2508,8 +2550,8 @@
2508
2550
  }
2509
2551
  },
2510
2552
  getIsVisible: () => {
2511
- var _table$getState$colum;
2512
- return (_table$getState$colum = table.getState().columnVisibility?.[column.id]) != null ? _table$getState$colum : true;
2553
+ var _table$getState$colum, _table$getState$colum2;
2554
+ return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2513
2555
  },
2514
2556
  getCanHide: () => {
2515
2557
  var _column$columnDef$ena, _table$options$enable;
@@ -2517,7 +2559,7 @@
2517
2559
  },
2518
2560
  getToggleVisibilityHandler: () => {
2519
2561
  return e => {
2520
- column.toggleVisibility?.(e.target.checked);
2562
+ column.toggleVisibility == null ? void 0 : column.toggleVisibility(e.target.checked);
2521
2563
  };
2522
2564
  }
2523
2565
  };
@@ -2545,7 +2587,7 @@
2545
2587
  createTable: table => {
2546
2588
  const makeVisibleColumnsMethod = (key, getColumns) => {
2547
2589
  return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2548
- return columns.filter(d => d.getIsVisible?.());
2590
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2549
2591
  }, {
2550
2592
  key,
2551
2593
  debug: () => {
@@ -2560,7 +2602,7 @@
2560
2602
  getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
2561
2603
  getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
2562
2604
  getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2563
- setColumnVisibility: updater => table.options.onColumnVisibilityChange?.(updater),
2605
+ setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2564
2606
  resetColumnVisibility: defaultState => {
2565
2607
  var _table$initialState$c;
2566
2608
  table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
@@ -2570,14 +2612,15 @@
2570
2612
  value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2571
2613
  table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
2572
2614
  ...obj,
2573
- [column.id]: !value ? !column.getCanHide?.() : value
2615
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2574
2616
  }), {}));
2575
2617
  },
2576
- getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !column.getIsVisible?.()),
2577
- getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible?.()),
2618
+ getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2619
+ getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2578
2620
  getToggleAllColumnsVisibilityHandler: () => {
2579
2621
  return e => {
2580
- table.toggleAllColumnsVisible(e.target?.checked);
2622
+ var _target;
2623
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2581
2624
  };
2582
2625
  }
2583
2626
  };
@@ -2597,7 +2640,7 @@
2597
2640
  _features: features
2598
2641
  };
2599
2642
  const defaultOptions = table._features.reduce((obj, feature) => {
2600
- return Object.assign(obj, feature.getDefaultOptions?.(table));
2643
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2601
2644
  }, {});
2602
2645
  const mergeOptions = options => {
2603
2646
  if (table.options.mergeOptions) {
@@ -2615,7 +2658,7 @@
2615
2658
  };
2616
2659
  table._features.forEach(feature => {
2617
2660
  var _feature$getInitialSt;
2618
- initialState = (_feature$getInitialSt = feature.getInitialState?.(initialState)) != null ? _feature$getInitialSt : initialState;
2661
+ initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
2619
2662
  });
2620
2663
  const queued = [];
2621
2664
  let queuedTimeout = false;
@@ -2654,11 +2697,11 @@
2654
2697
  return table.options.state;
2655
2698
  },
2656
2699
  setState: updater => {
2657
- table.options.onStateChange?.(updater);
2700
+ table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2658
2701
  },
2659
2702
  _getRowId: (row, index, parent) => {
2660
2703
  var _table$options$getRow;
2661
- return (_table$options$getRow = table.options.getRowId?.(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`;
2704
+ 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}`;
2662
2705
  },
2663
2706
  getCoreRowModel: () => {
2664
2707
  if (!table._getCoreRowModel) {
@@ -2697,11 +2740,11 @@
2697
2740
  },
2698
2741
  // footer: props => props.header.column.id,
2699
2742
  cell: props => {
2700
- var _props$renderValue$to;
2701
- return (_props$renderValue$to = props.renderValue()?.toString?.()) != null ? _props$renderValue$to : null;
2743
+ var _props$renderValue$to, _props$renderValue;
2744
+ 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;
2702
2745
  },
2703
2746
  ...table._features.reduce((obj, feature) => {
2704
- return Object.assign(obj, feature.getDefaultColumnDef?.());
2747
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2705
2748
  }, {}),
2706
2749
  ...defaultColumn
2707
2750
  };
@@ -2769,17 +2812,14 @@
2769
2812
  getColumn: columnId => {
2770
2813
  const column = table._getAllFlatColumnsById()[columnId];
2771
2814
  if (!column) {
2772
- {
2773
- console.warn(`[Table] Column with id ${columnId} does not exist.`);
2774
- }
2775
- throw new Error();
2815
+ console.error(`[Table] Column with id '${columnId}' does not exist.`);
2776
2816
  }
2777
2817
  return column;
2778
2818
  }
2779
2819
  };
2780
2820
  Object.assign(table, coreInstance);
2781
2821
  table._features.forEach(feature => {
2782
- return Object.assign(table, feature.createTable?.(table));
2822
+ return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
2783
2823
  });
2784
2824
  return table;
2785
2825
  }
@@ -2808,7 +2848,7 @@
2808
2848
  })
2809
2849
  };
2810
2850
  table._features.forEach(feature => {
2811
- Object.assign(cell, feature.createCell?.(cell, column, row, table));
2851
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
2812
2852
  }, {});
2813
2853
  return cell;
2814
2854
  }
@@ -2826,7 +2866,7 @@
2826
2866
  return row._valuesCache[columnId];
2827
2867
  }
2828
2868
  const column = table.getColumn(columnId);
2829
- if (!column.accessorFn) {
2869
+ if (!(column != null && column.accessorFn)) {
2830
2870
  return undefined;
2831
2871
  }
2832
2872
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -2837,7 +2877,7 @@
2837
2877
  return row._uniqueValuesCache[columnId];
2838
2878
  }
2839
2879
  const column = table.getColumn(columnId);
2840
- if (!column.accessorFn) {
2880
+ if (!(column != null && column.accessorFn)) {
2841
2881
  return undefined;
2842
2882
  }
2843
2883
  if (!column.columnDef.getUniqueValues) {
@@ -2879,7 +2919,7 @@
2879
2919
  };
2880
2920
  for (let i = 0; i < table._features.length; i++) {
2881
2921
  const feature = table._features[i];
2882
- Object.assign(row, feature?.createRow?.(row, table));
2922
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
2883
2923
  }
2884
2924
  return row;
2885
2925
  };
@@ -2973,10 +3013,11 @@
2973
3013
 
2974
3014
  // Get the original subrows
2975
3015
  if (table.options.getSubRows) {
3016
+ var _row$originalSubRows;
2976
3017
  row.originalSubRows = table.options.getSubRows(originalRows[i], i);
2977
3018
 
2978
3019
  // Then recursively access them
2979
- if (row.originalSubRows?.length) {
3020
+ if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
2980
3021
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
2981
3022
  }
2982
3023
  }
@@ -3016,10 +3057,11 @@
3016
3057
 
3017
3058
  // Filter from children up first
3018
3059
  for (let i = 0; i < rowsToFilter.length; i++) {
3060
+ var _row$subRows;
3019
3061
  let row = rowsToFilter[i];
3020
3062
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3021
3063
  newRow.columnFilters = row.columnFilters;
3022
- if (row.subRows?.length && depth < maxDepth) {
3064
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
3023
3065
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3024
3066
  row = newRow;
3025
3067
  if (filterRow(row) && !newRow.subRows.length) {
@@ -3071,7 +3113,8 @@
3071
3113
  let row = rowsToFilter[i];
3072
3114
  const pass = filterRow(row);
3073
3115
  if (pass) {
3074
- if (row.subRows?.length && depth < maxDepth) {
3116
+ var _row$subRows2;
3117
+ if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
3075
3118
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3076
3119
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3077
3120
  row = newRow;
@@ -3092,7 +3135,7 @@
3092
3135
 
3093
3136
  function getFilteredRowModel() {
3094
3137
  return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3095
- if (!rowModel.rows.length || !columnFilters?.length && !globalFilter) {
3138
+ if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3096
3139
  for (let i = 0; i < rowModel.flatRows.length; i++) {
3097
3140
  rowModel.flatRows[i].columnFilters = {};
3098
3141
  rowModel.flatRows[i].columnFiltersMeta = {};
@@ -3105,9 +3148,7 @@
3105
3148
  var _filterFn$resolveFilt;
3106
3149
  const column = table.getColumn(d.id);
3107
3150
  if (!column) {
3108
- {
3109
- console.warn(`Table: Could not find a column to filter with columnId: ${d.id}`);
3110
- }
3151
+ return;
3111
3152
  }
3112
3153
  const filterFn = column.getFilterFn();
3113
3154
  if (!filterFn) {
@@ -3119,7 +3160,7 @@
3119
3160
  resolvedColumnFilters.push({
3120
3161
  id: d.id,
3121
3162
  filterFn,
3122
- resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue?.(d.value)) != null ? _filterFn$resolveFilt : d.value
3163
+ resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value
3123
3164
  });
3124
3165
  });
3125
3166
  const filterableIds = columnFilters.map(d => d.id);
@@ -3132,7 +3173,7 @@
3132
3173
  resolvedGlobalFilters.push({
3133
3174
  id: column.id,
3134
3175
  filterFn: globalFilterFn,
3135
- resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue?.(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
3176
+ resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
3136
3177
  });
3137
3178
  });
3138
3179
  }
@@ -3197,7 +3238,7 @@
3197
3238
 
3198
3239
  function getFacetedRowModel() {
3199
3240
  return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3200
- if (!preRowModel.rows.length || !columnFilters?.length && !globalFilter) {
3241
+ if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3201
3242
  return preRowModel;
3202
3243
  }
3203
3244
  const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean);
@@ -3222,7 +3263,11 @@
3222
3263
  }
3223
3264
 
3224
3265
  function getFacetedUniqueValues() {
3225
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3266
+ return (table, columnId) => memo(() => {
3267
+ var _table$getColumn;
3268
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3269
+ }, facetedRowModel => {
3270
+ if (!facetedRowModel) return new Map();
3226
3271
  let facetedUniqueValues = new Map();
3227
3272
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3228
3273
  const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
@@ -3248,8 +3293,13 @@
3248
3293
  }
3249
3294
 
3250
3295
  function getFacetedMinMaxValues() {
3251
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3252
- const firstValue = facetedRowModel.flatRows[0]?.getUniqueValues(columnId);
3296
+ return (table, columnId) => memo(() => {
3297
+ var _table$getColumn;
3298
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3299
+ }, facetedRowModel => {
3300
+ var _facetedRowModel$flat;
3301
+ if (!facetedRowModel) return undefined;
3302
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
3253
3303
  if (typeof firstValue === 'undefined') {
3254
3304
  return undefined;
3255
3305
  }
@@ -3278,17 +3328,21 @@
3278
3328
 
3279
3329
  function getSortedRowModel() {
3280
3330
  return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
3281
- if (!rowModel.rows.length || !sorting?.length) {
3331
+ if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3282
3332
  return rowModel;
3283
3333
  }
3284
3334
  const sortingState = table.getState().sorting;
3285
3335
  const sortedFlatRows = [];
3286
3336
 
3287
3337
  // Filter out sortings that correspond to non existing columns
3288
- const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3338
+ const availableSorting = sortingState.filter(sort => {
3339
+ var _table$getColumn;
3340
+ return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
3341
+ });
3289
3342
  const columnInfoById = {};
3290
3343
  availableSorting.forEach(sortEntry => {
3291
3344
  const column = table.getColumn(sortEntry.id);
3345
+ if (!column) return;
3292
3346
  columnInfoById[sortEntry.id] = {
3293
3347
  sortUndefined: column.columnDef.sortUndefined,
3294
3348
  invertSorting: column.columnDef.invertSorting,
@@ -3304,7 +3358,7 @@
3304
3358
  var _sortEntry$desc;
3305
3359
  const sortEntry = availableSorting[i];
3306
3360
  const columnInfo = columnInfoById[sortEntry.id];
3307
- const isDesc = (_sortEntry$desc = sortEntry?.desc) != null ? _sortEntry$desc : false;
3361
+ const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
3308
3362
  if (columnInfo.sortUndefined) {
3309
3363
  const aValue = rowA.getValue(sortEntry.id);
3310
3364
  const bValue = rowB.getValue(sortEntry.id);
@@ -3332,8 +3386,9 @@
3332
3386
 
3333
3387
  // If there are sub-rows, sort them
3334
3388
  sortedData.forEach(row => {
3389
+ var _row$subRows;
3335
3390
  sortedFlatRows.push(row);
3336
- if (row.subRows?.length) {
3391
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3337
3392
  row.subRows = sortData(row.subRows);
3338
3393
  }
3339
3394
  });
@@ -3429,7 +3484,7 @@
3429
3484
 
3430
3485
  // Aggregate the values
3431
3486
  const column = table.getColumn(columnId);
3432
- const aggregateFn = column.getAggregationFn();
3487
+ const aggregateFn = column == null ? void 0 : column.getAggregationFn();
3433
3488
  if (aggregateFn) {
3434
3489
  row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
3435
3490
  return row._groupingValuesCache[columnId];
@@ -3519,8 +3574,9 @@
3519
3574
  function expandRows(rowModel) {
3520
3575
  const expandedRows = [];
3521
3576
  const handleRow = row => {
3577
+ var _row$subRows;
3522
3578
  expandedRows.push(row);
3523
- if (row.subRows?.length && row.getIsExpanded()) {
3579
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
3524
3580
  row.subRows.forEach(handleRow);
3525
3581
  }
3526
3582
  };
@@ -3630,7 +3686,7 @@
3630
3686
  // state.
3631
3687
  onStateChange: updater => {
3632
3688
  setState(updater);
3633
- options.onStateChange?.(updater);
3689
+ options.onStateChange == null ? void 0 : options.onStateChange(updater);
3634
3690
  }
3635
3691
  }));
3636
3692
  return tableRef.current;