@tanstack/svelte-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.
@@ -55,7 +55,7 @@
55
55
  subArr.forEach(item => {
56
56
  flat.push(item);
57
57
  const children = getChildren(item);
58
- if (children?.length) {
58
+ if (children != null && children.length) {
59
59
  recurse(children);
60
60
  }
61
61
  });
@@ -78,9 +78,9 @@
78
78
  let resultTime;
79
79
  if (opts.key && opts.debug) resultTime = Date.now();
80
80
  result = fn(...newDeps);
81
- opts?.onChange?.(result);
81
+ opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
82
82
  if (opts.key && opts.debug) {
83
- if (opts?.debug()) {
83
+ if (opts != null && opts.debug()) {
84
84
  const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
85
85
  const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
86
86
  const resultFpsPercentage = resultEndTime / 16;
@@ -94,7 +94,7 @@
94
94
  console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
95
95
  font-size: .6rem;
96
96
  font-weight: bold;
97
- color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts?.key);
97
+ color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
98
98
  }
99
99
  }
100
100
  return result;
@@ -119,9 +119,10 @@
119
119
  accessorFn = originalRow => {
120
120
  let result = originalRow;
121
121
  for (const key of accessorKey.split('.')) {
122
- result = result[key];
122
+ var _result;
123
+ result = (_result = result) == null ? void 0 : _result[key];
123
124
  if (result === undefined) {
124
- throw new Error(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
125
+ console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
125
126
  }
126
127
  }
127
128
  return result;
@@ -143,7 +144,8 @@
143
144
  columnDef: resolvedColumnDef,
144
145
  columns: [],
145
146
  getFlatColumns: memo(() => [true], () => {
146
- return [column, ...column.columns?.flatMap(d => d.getFlatColumns())];
147
+ var _column$columns;
148
+ return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
147
149
  }, {
148
150
  key: "development" === 'production' ,
149
151
  debug: () => {
@@ -152,7 +154,8 @@
152
154
  }
153
155
  }),
154
156
  getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
155
- if (column.columns?.length) {
157
+ var _column$columns2;
158
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
156
159
  let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
157
160
  return orderColumns(leafColumns);
158
161
  }
@@ -166,7 +169,7 @@
166
169
  })
167
170
  };
168
171
  column = table._features.reduce((obj, feature) => {
169
- return Object.assign(obj, feature.createColumn?.(column, table));
172
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
170
173
  }, column);
171
174
 
172
175
  // Yes, we have to convert table to uknown, because we know more than the compiler here.
@@ -207,7 +210,7 @@
207
210
  })
208
211
  };
209
212
  table._features.forEach(feature => {
210
- Object.assign(header, feature.createHeader?.(header, table));
213
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
211
214
  });
212
215
  return header;
213
216
  }
@@ -218,9 +221,9 @@
218
221
 
219
222
  getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
220
223
  var _left$map$filter, _right$map$filter;
221
- const leftColumns = (_left$map$filter = left?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
222
- const rightColumns = (_right$map$filter = right?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
223
- const centerColumns = leafColumns.filter(column => !left?.includes(column.id) && !right?.includes(column.id));
224
+ const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
225
+ const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
226
+ const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
224
227
  const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
225
228
  return headerGroups;
226
229
  }, {
@@ -231,7 +234,7 @@
231
234
  }
232
235
  }),
233
236
  getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
234
- leafColumns = leafColumns.filter(column => !left?.includes(column.id) && !right?.includes(column.id));
237
+ leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
235
238
  return buildHeaderGroups(allColumns, leafColumns, table, 'center');
236
239
  }, {
237
240
  key: 'getCenterHeaderGroups',
@@ -242,7 +245,7 @@
242
245
  }),
243
246
  getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
244
247
  var _left$map$filter2;
245
- const orderedLeafColumns = (_left$map$filter2 = left?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
248
+ const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
246
249
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
247
250
  }, {
248
251
  key: 'getLeftHeaderGroups',
@@ -253,7 +256,7 @@
253
256
  }),
254
257
  getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
255
258
  var _right$map$filter2;
256
- const orderedLeafColumns = (_right$map$filter2 = right?.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
259
+ const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
257
260
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
258
261
  }, {
259
262
  key: 'getRightHeaderGroups',
@@ -349,7 +352,10 @@
349
352
  // Leaf Headers
350
353
 
351
354
  getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
352
- return flatHeaders.filter(header => !header.subHeaders?.length);
355
+ return flatHeaders.filter(header => {
356
+ var _header$subHeaders;
357
+ return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
358
+ });
353
359
  }, {
354
360
  key: 'getCenterLeafHeaders',
355
361
  debug: () => {
@@ -358,7 +364,10 @@
358
364
  }
359
365
  }),
360
366
  getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
361
- return flatHeaders.filter(header => !header.subHeaders?.length);
367
+ return flatHeaders.filter(header => {
368
+ var _header$subHeaders2;
369
+ return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
370
+ });
362
371
  }, {
363
372
  key: 'getLeftLeafHeaders',
364
373
  debug: () => {
@@ -367,7 +376,10 @@
367
376
  }
368
377
  }),
369
378
  getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
370
- return flatHeaders.filter(header => !header.subHeaders?.length);
379
+ return flatHeaders.filter(header => {
380
+ var _header$subHeaders3;
381
+ return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
382
+ });
371
383
  }, {
372
384
  key: 'getRightLeafHeaders',
373
385
  debug: () => {
@@ -376,8 +388,8 @@
376
388
  }
377
389
  }),
378
390
  getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
379
- var _left$0$headers, _center$0$headers, _right$0$headers;
380
- 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 => {
391
+ var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
392
+ 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 => {
381
393
  return header.getLeafHeaders();
382
394
  }).flat();
383
395
  }, {
@@ -391,7 +403,7 @@
391
403
  }
392
404
  };
393
405
  function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
394
- var _headerGroups$0$heade;
406
+ var _headerGroups$0$heade, _headerGroups$;
395
407
  // Find the max depth of the columns:
396
408
  // build the leaf column row
397
409
  // build each buffer row going up
@@ -405,7 +417,8 @@
405
417
  }
406
418
  maxDepth = Math.max(maxDepth, depth);
407
419
  columns.filter(column => column.getIsVisible()).forEach(column => {
408
- if (column.columns?.length) {
420
+ var _column$columns;
421
+ if ((_column$columns = column.columns) != null && _column$columns.length) {
409
422
  findMaxDepth(column.columns, depth + 1);
410
423
  }
411
424
  }, 0);
@@ -439,13 +452,13 @@
439
452
  column = headerToGroup.column;
440
453
  isPlaceholder = true;
441
454
  }
442
- if (latestPendingParentHeader && latestPendingParentHeader?.column === column) {
455
+ if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
443
456
  // This column is repeated. Add it as a sub header to the next batch
444
457
  latestPendingParentHeader.subHeaders.push(headerToGroup);
445
458
  } else {
446
459
  // This is a new header. Let's create it
447
460
  const header = createHeader(table, column, {
448
- id: [headerFamily, depth, column.id, headerToGroup?.id].filter(Boolean).join('_'),
461
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
449
462
  isPlaceholder,
450
463
  placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,
451
464
  depth,
@@ -506,7 +519,7 @@
506
519
  };
507
520
  });
508
521
  };
509
- recurseHeadersForSpans((_headerGroups$0$heade = headerGroups[0]?.headers) != null ? _headerGroups$0$heade : []);
522
+ recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
510
523
  return headerGroups;
511
524
  }
512
525
 
@@ -601,12 +614,12 @@
601
614
  },
602
615
  getResizeHandler: () => {
603
616
  const column = table.getColumn(header.column.id);
604
- const canResize = column.getCanResize();
617
+ const canResize = column == null ? void 0 : column.getCanResize();
605
618
  return e => {
606
- if (!canResize) {
619
+ if (!column || !canResize) {
607
620
  return;
608
621
  }
609
- e.persist?.();
622
+ e.persist == null ? void 0 : e.persist();
610
623
  if (isTouchStartEvent(e)) {
611
624
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
612
625
  if (e.touches && e.touches.length > 1) {
@@ -623,8 +636,8 @@
623
636
  }
624
637
  table.setColumnSizingInfo(old => {
625
638
  var _old$startOffset, _old$startSize;
626
- const deltaOffset = clientXPos - ((_old$startOffset = old?.startOffset) != null ? _old$startOffset : 0);
627
- const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old?.startSize) != null ? _old$startSize : 0), -0.999999);
639
+ const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
640
+ const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
628
641
  old.columnSizingStart.forEach(_ref3 => {
629
642
  let [columnId, headerSize] = _ref3;
630
643
  newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
@@ -673,13 +686,14 @@
673
686
  return false;
674
687
  },
675
688
  upHandler: e => {
689
+ var _e$touches$;
676
690
  document.removeEventListener('touchmove', touchEvents.moveHandler);
677
691
  document.removeEventListener('touchend', touchEvents.upHandler);
678
692
  if (e.cancelable) {
679
693
  e.preventDefault();
680
694
  e.stopPropagation();
681
695
  }
682
- onEnd(e.touches[0]?.clientX);
696
+ onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
683
697
  }
684
698
  };
685
699
  const passiveIfSupported = passiveEventSupported() ? {
@@ -707,8 +721,8 @@
707
721
  },
708
722
  createTable: table => {
709
723
  return {
710
- setColumnSizing: updater => table.options.onColumnSizingChange?.(updater),
711
- setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange?.(updater),
724
+ setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
725
+ setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
712
726
  resetColumnSizing: defaultState => {
713
727
  var _table$initialState$c;
714
728
  table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
@@ -718,26 +732,26 @@
718
732
  table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
719
733
  },
720
734
  getTotalSize: () => {
721
- var _table$getHeaderGroup;
722
- return (_table$getHeaderGroup = table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {
735
+ var _table$getHeaderGroup, _table$getHeaderGroup2;
736
+ return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
723
737
  return sum + header.getSize();
724
738
  }, 0)) != null ? _table$getHeaderGroup : 0;
725
739
  },
726
740
  getLeftTotalSize: () => {
727
- var _table$getLeftHeaderG;
728
- return (_table$getLeftHeaderG = table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {
741
+ var _table$getLeftHeaderG, _table$getLeftHeaderG2;
742
+ return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
729
743
  return sum + header.getSize();
730
744
  }, 0)) != null ? _table$getLeftHeaderG : 0;
731
745
  },
732
746
  getCenterTotalSize: () => {
733
- var _table$getCenterHeade;
734
- return (_table$getCenterHeade = table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {
747
+ var _table$getCenterHeade, _table$getCenterHeade2;
748
+ return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
735
749
  return sum + header.getSize();
736
750
  }, 0)) != null ? _table$getCenterHeade : 0;
737
751
  },
738
752
  getRightTotalSize: () => {
739
- var _table$getRightHeader;
740
- return (_table$getRightHeader = table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {
753
+ var _table$getRightHeader, _table$getRightHeader2;
754
+ return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
741
755
  return sum + header.getSize();
742
756
  }, 0)) != null ? _table$getRightHeader : 0;
743
757
  }
@@ -804,7 +818,7 @@
804
818
  });
805
819
  }
806
820
  },
807
- setExpanded: updater => table.options.onExpandedChange?.(updater),
821
+ setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
808
822
  toggleAllRowsExpanded: expanded => {
809
823
  if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
810
824
  table.setExpanded(true);
@@ -813,15 +827,15 @@
813
827
  }
814
828
  },
815
829
  resetExpanded: defaultState => {
816
- var _table$initialState$e;
817
- table.setExpanded(defaultState ? {} : (_table$initialState$e = table.initialState?.expanded) != null ? _table$initialState$e : {});
830
+ var _table$initialState$e, _table$initialState;
831
+ table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
818
832
  },
819
833
  getCanSomeRowsExpand: () => {
820
834
  return table.getRowModel().flatRows.some(row => row.getCanExpand());
821
835
  },
822
836
  getToggleAllRowsExpandedHandler: () => {
823
837
  return e => {
824
- e.persist?.();
838
+ e.persist == null ? void 0 : e.persist();
825
839
  table.toggleAllRowsExpanded();
826
840
  };
827
841
  },
@@ -874,7 +888,7 @@
874
888
  toggleExpanded: expanded => {
875
889
  table.setExpanded(old => {
876
890
  var _expanded;
877
- const exists = old === true ? true : !!old?.[row.id];
891
+ const exists = old === true ? true : !!(old != null && old[row.id]);
878
892
  let oldExpanded = {};
879
893
  if (old === true) {
880
894
  Object.keys(table.getRowModel().rowsById).forEach(rowId => {
@@ -903,11 +917,11 @@
903
917
  getIsExpanded: () => {
904
918
  var _table$options$getIsR;
905
919
  const expanded = table.getState().expanded;
906
- return !!((_table$options$getIsR = table.options.getIsRowExpanded?.(row)) != null ? _table$options$getIsR : expanded === true || expanded?.[row.id]);
920
+ 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]));
907
921
  },
908
922
  getCanExpand: () => {
909
- var _table$options$getRow, _table$options$enable;
910
- 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;
923
+ var _table$options$getRow, _table$options$enable, _row$subRows;
924
+ 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);
911
925
  },
912
926
  getToggleExpandedHandler: () => {
913
927
  const canExpand = row.getCanExpand();
@@ -921,30 +935,40 @@
921
935
  };
922
936
 
923
937
  const includesString = (row, columnId, filterValue) => {
938
+ var _row$getValue;
924
939
  const search = filterValue.toLowerCase();
925
- return Boolean(row.getValue(columnId)?.toLowerCase().includes(search));
940
+ return Boolean((_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search));
926
941
  };
927
942
  includesString.autoRemove = val => testFalsey(val);
928
943
  const includesStringSensitive = (row, columnId, filterValue) => {
929
- return Boolean(row.getValue(columnId)?.includes(filterValue));
944
+ var _row$getValue2;
945
+ return Boolean((_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue));
930
946
  };
931
947
  includesStringSensitive.autoRemove = val => testFalsey(val);
932
948
  const equalsString = (row, columnId, filterValue) => {
933
- return row.getValue(columnId)?.toLowerCase() === filterValue.toLowerCase();
949
+ var _row$getValue3;
950
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
934
951
  };
935
952
  equalsString.autoRemove = val => testFalsey(val);
936
953
  const arrIncludes = (row, columnId, filterValue) => {
937
- return row.getValue(columnId)?.includes(filterValue);
954
+ var _row$getValue4;
955
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
938
956
  };
939
- arrIncludes.autoRemove = val => testFalsey(val) || !val?.length;
957
+ arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
940
958
  const arrIncludesAll = (row, columnId, filterValue) => {
941
- return !filterValue.some(val => !row.getValue(columnId)?.includes(val));
959
+ return !filterValue.some(val => {
960
+ var _row$getValue5;
961
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
962
+ });
942
963
  };
943
- arrIncludesAll.autoRemove = val => testFalsey(val) || !val?.length;
964
+ arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
944
965
  const arrIncludesSome = (row, columnId, filterValue) => {
945
- return filterValue.some(val => row.getValue(columnId)?.includes(val));
966
+ return filterValue.some(val => {
967
+ var _row$getValue6;
968
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
969
+ });
946
970
  };
947
- arrIncludesSome.autoRemove = val => testFalsey(val) || !val?.length;
971
+ arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
948
972
  const equals = (row, columnId, filterValue) => {
949
973
  return row.getValue(columnId) === filterValue;
950
974
  };
@@ -1017,7 +1041,8 @@
1017
1041
  maxLeafRowFilterDepth: 100,
1018
1042
  globalFilterFn: 'auto',
1019
1043
  getColumnCanGlobalFilter: column => {
1020
- const value = table.getCoreRowModel().flatRows[0]?._getAllCellsByColumnId()[column.id]?.getValue();
1044
+ var _table$getCoreRowMode, _table$getCoreRowMode2;
1045
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1021
1046
  return typeof value === 'string' || typeof value === 'number';
1022
1047
  }
1023
1048
  };
@@ -1026,7 +1051,7 @@
1026
1051
  return {
1027
1052
  getAutoFilterFn: () => {
1028
1053
  const firstRow = table.getCoreRowModel().flatRows[0];
1029
- const value = firstRow?.getValue(column.id);
1054
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1030
1055
  if (typeof value === 'string') {
1031
1056
  return filterFns.includesString;
1032
1057
  }
@@ -1045,10 +1070,10 @@
1045
1070
  return filterFns.weakEquals;
1046
1071
  },
1047
1072
  getFilterFn: () => {
1048
- var _table$options$filter;
1073
+ var _table$options$filter, _table$options$filter2;
1049
1074
  return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn()
1050
1075
  // @ts-ignore
1051
- : (_table$options$filter = table.options.filterFns?.[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
1076
+ : (_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];
1052
1077
  },
1053
1078
  getCanFilter: () => {
1054
1079
  var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
@@ -1056,24 +1081,27 @@
1056
1081
  },
1057
1082
  getCanGlobalFilter: () => {
1058
1083
  var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
1059
- 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;
1084
+ 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;
1060
1085
  },
1061
1086
  getIsFiltered: () => column.getFilterIndex() > -1,
1062
- getFilterValue: () => table.getState().columnFilters?.find(d => d.id === column.id)?.value,
1087
+ getFilterValue: () => {
1088
+ var _table$getState$colum, _table$getState$colum2;
1089
+ 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;
1090
+ },
1063
1091
  getFilterIndex: () => {
1064
- var _table$getState$colum;
1065
- return (_table$getState$colum = table.getState().columnFilters?.findIndex(d => d.id === column.id)) != null ? _table$getState$colum : -1;
1092
+ var _table$getState$colum3, _table$getState$colum4;
1093
+ 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;
1066
1094
  },
1067
1095
  setFilterValue: value => {
1068
1096
  table.setColumnFilters(old => {
1069
1097
  const filterFn = column.getFilterFn();
1070
- const previousfilter = old?.find(d => d.id === column.id);
1098
+ const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
1071
1099
  const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
1072
1100
 
1073
1101
  //
1074
1102
  if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
1075
1103
  var _old$filter;
1076
- return (_old$filter = old?.filter(d => d.id !== column.id)) != null ? _old$filter : [];
1104
+ return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
1077
1105
  }
1078
1106
  const newFilterObj = {
1079
1107
  id: column.id,
@@ -1081,14 +1109,14 @@
1081
1109
  };
1082
1110
  if (previousfilter) {
1083
1111
  var _old$map;
1084
- return (_old$map = old?.map(d => {
1112
+ return (_old$map = old == null ? void 0 : old.map(d => {
1085
1113
  if (d.id === column.id) {
1086
1114
  return newFilterObj;
1087
1115
  }
1088
1116
  return d;
1089
1117
  })) != null ? _old$map : [];
1090
1118
  }
1091
- if (old?.length) {
1119
+ if (old != null && old.length) {
1092
1120
  return [...old, newFilterObj];
1093
1121
  }
1094
1122
  return [newFilterObj];
@@ -1132,18 +1160,19 @@
1132
1160
  return filterFns.includesString;
1133
1161
  },
1134
1162
  getGlobalFilterFn: () => {
1135
- var _table$options$filter2;
1163
+ var _table$options$filter3, _table$options$filter4;
1136
1164
  const {
1137
1165
  globalFilterFn: globalFilterFn
1138
1166
  } = table.options;
1139
1167
  return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn()
1140
1168
  // @ts-ignore
1141
- : (_table$options$filter2 = table.options.filterFns?.[globalFilterFn]) != null ? _table$options$filter2 : filterFns[globalFilterFn];
1169
+ : (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn];
1142
1170
  },
1143
1171
  setColumnFilters: updater => {
1144
1172
  const leafColumns = table.getAllLeafColumns();
1145
1173
  const updateFn = old => {
1146
- return functionalUpdate(updater, old)?.filter(filter => {
1174
+ var _functionalUpdate;
1175
+ return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
1147
1176
  const column = leafColumns.find(d => d.id === filter.id);
1148
1177
  if (column) {
1149
1178
  const filterFn = column.getFilterFn();
@@ -1154,17 +1183,17 @@
1154
1183
  return true;
1155
1184
  });
1156
1185
  };
1157
- table.options.onColumnFiltersChange?.(updateFn);
1186
+ table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1158
1187
  },
1159
1188
  setGlobalFilter: updater => {
1160
- table.options.onGlobalFilterChange?.(updater);
1189
+ table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1161
1190
  },
1162
1191
  resetGlobalFilter: defaultState => {
1163
1192
  table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
1164
1193
  },
1165
1194
  resetColumnFilters: defaultState => {
1166
- var _table$initialState$c;
1167
- table.setColumnFilters(defaultState ? [] : (_table$initialState$c = table.initialState?.columnFilters) != null ? _table$initialState$c : []);
1195
+ var _table$initialState$c, _table$initialState;
1196
+ table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
1168
1197
  },
1169
1198
  getPreFilteredRowModel: () => table.getCoreRowModel(),
1170
1199
  getFilteredRowModel: () => {
@@ -1302,8 +1331,8 @@
1302
1331
  getDefaultColumnDef: () => {
1303
1332
  return {
1304
1333
  aggregatedCell: props => {
1305
- var _toString;
1306
- return (_toString = props.getValue()?.toString?.()) != null ? _toString : null;
1334
+ var _toString, _props$getValue;
1335
+ return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1307
1336
  },
1308
1337
  aggregationFn: 'auto'
1309
1338
  };
@@ -1325,7 +1354,7 @@
1325
1354
  toggleGrouping: () => {
1326
1355
  table.setGrouping(old => {
1327
1356
  // Find any existing grouping for this column
1328
- if (old?.includes(column.id)) {
1357
+ if (old != null && old.includes(column.id)) {
1329
1358
  return old.filter(d => d !== column.id);
1330
1359
  }
1331
1360
  return [...(old != null ? old : []), column.id];
@@ -1336,9 +1365,13 @@
1336
1365
  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;
1337
1366
  },
1338
1367
  getIsGrouped: () => {
1339
- return table.getState().grouping?.includes(column.id);
1368
+ var _table$getState$group;
1369
+ return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
1370
+ },
1371
+ getGroupedIndex: () => {
1372
+ var _table$getState$group2;
1373
+ return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
1340
1374
  },
1341
- getGroupedIndex: () => table.getState().grouping?.indexOf(column.id),
1342
1375
  getToggleGroupingHandler: () => {
1343
1376
  const canGroup = column.getCanGroup();
1344
1377
  return () => {
@@ -1348,7 +1381,7 @@
1348
1381
  },
1349
1382
  getAutoAggregationFn: () => {
1350
1383
  const firstRow = table.getCoreRowModel().flatRows[0];
1351
- const value = firstRow?.getValue(column.id);
1384
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
1352
1385
  if (typeof value === 'number') {
1353
1386
  return aggregationFns.sum;
1354
1387
  }
@@ -1357,20 +1390,20 @@
1357
1390
  }
1358
1391
  },
1359
1392
  getAggregationFn: () => {
1360
- var _table$options$aggreg;
1393
+ var _table$options$aggreg, _table$options$aggreg2;
1361
1394
  if (!column) {
1362
1395
  throw new Error();
1363
1396
  }
1364
- 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];
1397
+ 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];
1365
1398
  }
1366
1399
  };
1367
1400
  },
1368
1401
  createTable: table => {
1369
1402
  return {
1370
- setGrouping: updater => table.options.onGroupingChange?.(updater),
1403
+ setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
1371
1404
  resetGrouping: defaultState => {
1372
- var _table$initialState$g;
1373
- table.setGrouping(defaultState ? [] : (_table$initialState$g = table.initialState?.grouping) != null ? _table$initialState$g : []);
1405
+ var _table$initialState$g, _table$initialState;
1406
+ table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
1374
1407
  },
1375
1408
  getPreGroupedRowModel: () => table.getFilteredRowModel(),
1376
1409
  getGroupedRowModel: () => {
@@ -1394,12 +1427,15 @@
1394
1427
  return {
1395
1428
  getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
1396
1429
  getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
1397
- getIsAggregated: () => !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length
1430
+ getIsAggregated: () => {
1431
+ var _row$subRows;
1432
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1433
+ }
1398
1434
  };
1399
1435
  }
1400
1436
  };
1401
1437
  function orderColumns(leafColumns, grouping, groupedColumnMode) {
1402
- if (!grouping?.length || !groupedColumnMode) {
1438
+ if (!(grouping != null && grouping.length) || !groupedColumnMode) {
1403
1439
  return leafColumns;
1404
1440
  }
1405
1441
  const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
@@ -1426,7 +1462,7 @@
1426
1462
  },
1427
1463
  createTable: table => {
1428
1464
  return {
1429
- setColumnOrder: updater => table.options.onColumnOrderChange?.(updater),
1465
+ setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
1430
1466
  resetColumnOrder: defaultState => {
1431
1467
  var _table$initialState$c;
1432
1468
  table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
@@ -1437,7 +1473,7 @@
1437
1473
  let orderedColumns = [];
1438
1474
 
1439
1475
  // If there is no order, return the normal columns
1440
- if (!columnOrder?.length) {
1476
+ if (!(columnOrder != null && columnOrder.length)) {
1441
1477
  orderedColumns = columns;
1442
1478
  } else {
1443
1479
  const columnOrderCopy = [...columnOrder];
@@ -1482,7 +1518,7 @@
1482
1518
  ...state,
1483
1519
  pagination: {
1484
1520
  ...getDefaultPaginationState(),
1485
- ...state?.pagination
1521
+ ...(state == null ? void 0 : state.pagination)
1486
1522
  }
1487
1523
  };
1488
1524
  },
@@ -1517,7 +1553,7 @@
1517
1553
  let newState = functionalUpdate(updater, old);
1518
1554
  return newState;
1519
1555
  };
1520
- return table.options.onPaginationChange?.(safeUpdater);
1556
+ return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
1521
1557
  },
1522
1558
  resetPagination: defaultState => {
1523
1559
  var _table$initialState$p;
@@ -1535,12 +1571,12 @@
1535
1571
  });
1536
1572
  },
1537
1573
  resetPageIndex: defaultState => {
1538
- var _table$initialState$p2;
1539
- table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = table.initialState?.pagination?.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
1574
+ var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1575
+ 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);
1540
1576
  },
1541
1577
  resetPageSize: defaultState => {
1542
- var _table$initialState$p3;
1543
- table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = table.initialState?.pagination?.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
1578
+ var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1579
+ 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);
1544
1580
  },
1545
1581
  setPageSize: updater => {
1546
1582
  table.setPagination(old => {
@@ -1645,20 +1681,20 @@
1645
1681
  if (position === 'right') {
1646
1682
  var _old$left, _old$right;
1647
1683
  return {
1648
- left: ((_old$left = old?.left) != null ? _old$left : []).filter(d => !columnIds?.includes(d)),
1649
- right: [...((_old$right = old?.right) != null ? _old$right : []).filter(d => !columnIds?.includes(d)), ...columnIds]
1684
+ left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1685
+ right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
1650
1686
  };
1651
1687
  }
1652
1688
  if (position === 'left') {
1653
1689
  var _old$left2, _old$right2;
1654
1690
  return {
1655
- left: [...((_old$left2 = old?.left) != null ? _old$left2 : []).filter(d => !columnIds?.includes(d)), ...columnIds],
1656
- right: ((_old$right2 = old?.right) != null ? _old$right2 : []).filter(d => !columnIds?.includes(d))
1691
+ left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
1692
+ right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1657
1693
  };
1658
1694
  }
1659
1695
  return {
1660
- left: ((_old$left3 = old?.left) != null ? _old$left3 : []).filter(d => !columnIds?.includes(d)),
1661
- right: ((_old$right3 = old?.right) != null ? _old$right3 : []).filter(d => !columnIds?.includes(d))
1696
+ left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
1697
+ right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
1662
1698
  };
1663
1699
  });
1664
1700
  },
@@ -1675,14 +1711,14 @@
1675
1711
  left,
1676
1712
  right
1677
1713
  } = table.getState().columnPinning;
1678
- const isLeft = leafColumnIds.some(d => left?.includes(d));
1679
- const isRight = leafColumnIds.some(d => right?.includes(d));
1714
+ const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
1715
+ const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
1680
1716
  return isLeft ? 'left' : isRight ? 'right' : false;
1681
1717
  },
1682
1718
  getPinnedIndex: () => {
1683
- var _table$getState$colum;
1719
+ var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1684
1720
  const position = column.getIsPinned();
1685
- return position ? (_table$getState$colum = table.getState().columnPinning?.[position]?.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
1721
+ 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;
1686
1722
  }
1687
1723
  };
1688
1724
  },
@@ -1728,17 +1764,19 @@
1728
1764
  },
1729
1765
  createTable: table => {
1730
1766
  return {
1731
- setColumnPinning: updater => table.options.onColumnPinningChange?.(updater),
1767
+ setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
1732
1768
  resetColumnPinning: defaultState => {
1733
- var _table$initialState$c;
1734
- return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = table.initialState?.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1769
+ var _table$initialState$c, _table$initialState;
1770
+ return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
1735
1771
  },
1736
1772
  getIsSomeColumnsPinned: position => {
1773
+ var _pinningState$positio;
1737
1774
  const pinningState = table.getState().columnPinning;
1738
1775
  if (!position) {
1739
- return Boolean(pinningState.left?.length || pinningState.right?.length);
1776
+ var _pinningState$left, _pinningState$right;
1777
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1740
1778
  }
1741
- return Boolean(pinningState[position]?.length);
1779
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1742
1780
  },
1743
1781
  getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
1744
1782
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
@@ -1795,7 +1833,7 @@
1795
1833
 
1796
1834
  createTable: table => {
1797
1835
  return {
1798
- setRowSelection: updater => table.options.onRowSelectionChange?.(updater),
1836
+ setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
1799
1837
  resetRowSelection: defaultState => {
1800
1838
  var _table$initialState$r;
1801
1839
  return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
@@ -2061,14 +2099,16 @@
2061
2099
  getToggleSelectedHandler: () => {
2062
2100
  const canSelect = row.getCanSelect();
2063
2101
  return e => {
2102
+ var _target;
2064
2103
  if (!canSelect) return;
2065
- row.toggleSelected(e.target?.checked);
2104
+ row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
2066
2105
  };
2067
2106
  }
2068
2107
  };
2069
2108
  }
2070
2109
  };
2071
2110
  const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
2111
+ var _row$subRows;
2072
2112
  const row = table.getRow(id);
2073
2113
 
2074
2114
  // const isGrouped = row.getIsGrouped()
@@ -2089,7 +2129,7 @@
2089
2129
  }
2090
2130
  // }
2091
2131
 
2092
- if (row.subRows?.length && row.getCanSelectSubRows()) {
2132
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
2093
2133
  row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
2094
2134
  }
2095
2135
  };
@@ -2101,12 +2141,13 @@
2101
2141
  // Filters top level and nested rows
2102
2142
  const recurseRows = function (rows, depth) {
2103
2143
  return rows.map(row => {
2144
+ var _row$subRows2;
2104
2145
  const isSelected = isRowSelected(row, rowSelection);
2105
2146
  if (isSelected) {
2106
2147
  newSelectedFlatRows.push(row);
2107
2148
  newSelectedRowsById[row.id] = row;
2108
2149
  }
2109
- if (row.subRows?.length) {
2150
+ if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
2110
2151
  row = {
2111
2152
  ...row,
2112
2153
  subRows: recurseRows(row.subRows)
@@ -2280,7 +2321,7 @@
2280
2321
  const firstRows = table.getFilteredRowModel().flatRows.slice(10);
2281
2322
  let isString = false;
2282
2323
  for (const row of firstRows) {
2283
- const value = row?.getValue(column.id);
2324
+ const value = row == null ? void 0 : row.getValue(column.id);
2284
2325
  if (Object.prototype.toString.call(value) === '[object Date]') {
2285
2326
  return sortingFns.datetime;
2286
2327
  }
@@ -2298,18 +2339,18 @@
2298
2339
  },
2299
2340
  getAutoSortDir: () => {
2300
2341
  const firstRow = table.getFilteredRowModel().flatRows[0];
2301
- const value = firstRow?.getValue(column.id);
2342
+ const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
2302
2343
  if (typeof value === 'string') {
2303
2344
  return 'asc';
2304
2345
  }
2305
2346
  return 'desc';
2306
2347
  },
2307
2348
  getSortingFn: () => {
2308
- var _table$options$sortin;
2349
+ var _table$options$sortin, _table$options$sortin2;
2309
2350
  if (!column) {
2310
2351
  throw new Error();
2311
2352
  }
2312
- 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];
2353
+ 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];
2313
2354
  },
2314
2355
  toggleSorting: (desc, multi) => {
2315
2356
  // if (column.columns.length) {
@@ -2326,8 +2367,8 @@
2326
2367
  const hasManualValue = typeof desc !== 'undefined' && desc !== null;
2327
2368
  table.setSorting(old => {
2328
2369
  // Find any existing sorting for this column
2329
- const existingSorting = old?.find(d => d.id === column.id);
2330
- const existingIndex = old?.findIndex(d => d.id === column.id);
2370
+ const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
2371
+ const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
2331
2372
  let newSorting = [];
2332
2373
 
2333
2374
  // What should we do with this sort action?
@@ -2335,7 +2376,7 @@
2335
2376
  let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
2336
2377
 
2337
2378
  // Multi-mode
2338
- if (old?.length && column.getCanMultiSort() && multi) {
2379
+ if (old != null && old.length && column.getCanMultiSort() && multi) {
2339
2380
  if (existingSorting) {
2340
2381
  sortAction = 'toggle';
2341
2382
  } else {
@@ -2343,7 +2384,7 @@
2343
2384
  }
2344
2385
  } else {
2345
2386
  // Normal mode
2346
- if (old?.length && existingIndex !== old.length - 1) {
2387
+ if (old != null && old.length && existingIndex !== old.length - 1) {
2347
2388
  sortAction = 'replace';
2348
2389
  } else if (existingSorting) {
2349
2390
  sortAction = 'toggle';
@@ -2421,33 +2462,34 @@
2421
2462
  return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
2422
2463
  },
2423
2464
  getIsSorted: () => {
2424
- const columnSort = table.getState().sorting?.find(d => d.id === column.id);
2465
+ var _table$getState$sorti;
2466
+ const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
2425
2467
  return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
2426
2468
  },
2427
2469
  getSortIndex: () => {
2428
- var _table$getState$sorti;
2429
- return (_table$getState$sorti = table.getState().sorting?.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti : -1;
2470
+ var _table$getState$sorti2, _table$getState$sorti3;
2471
+ 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;
2430
2472
  },
2431
2473
  clearSorting: () => {
2432
2474
  //clear sorting for just 1 column
2433
- table.setSorting(old => old?.length ? old.filter(d => d.id !== column.id) : []);
2475
+ table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
2434
2476
  },
2435
2477
  getToggleSortingHandler: () => {
2436
2478
  const canSort = column.getCanSort();
2437
2479
  return e => {
2438
2480
  if (!canSort) return;
2439
- e.persist?.();
2440
- column.toggleSorting?.(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false);
2481
+ e.persist == null ? void 0 : e.persist();
2482
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2441
2483
  };
2442
2484
  }
2443
2485
  };
2444
2486
  },
2445
2487
  createTable: table => {
2446
2488
  return {
2447
- setSorting: updater => table.options.onSortingChange?.(updater),
2489
+ setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
2448
2490
  resetSorting: defaultState => {
2449
- var _table$initialState$s;
2450
- table.setSorting(defaultState ? [] : (_table$initialState$s = table.initialState?.sorting) != null ? _table$initialState$s : []);
2491
+ var _table$initialState$s, _table$initialState;
2492
+ table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
2451
2493
  },
2452
2494
  getPreSortedRowModel: () => table.getGroupedRowModel(),
2453
2495
  getSortedRowModel: () => {
@@ -2488,8 +2530,8 @@
2488
2530
  }
2489
2531
  },
2490
2532
  getIsVisible: () => {
2491
- var _table$getState$colum;
2492
- return (_table$getState$colum = table.getState().columnVisibility?.[column.id]) != null ? _table$getState$colum : true;
2533
+ var _table$getState$colum, _table$getState$colum2;
2534
+ return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
2493
2535
  },
2494
2536
  getCanHide: () => {
2495
2537
  var _column$columnDef$ena, _table$options$enable;
@@ -2497,7 +2539,7 @@
2497
2539
  },
2498
2540
  getToggleVisibilityHandler: () => {
2499
2541
  return e => {
2500
- column.toggleVisibility?.(e.target.checked);
2542
+ column.toggleVisibility == null ? void 0 : column.toggleVisibility(e.target.checked);
2501
2543
  };
2502
2544
  }
2503
2545
  };
@@ -2525,7 +2567,7 @@
2525
2567
  createTable: table => {
2526
2568
  const makeVisibleColumnsMethod = (key, getColumns) => {
2527
2569
  return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2528
- return columns.filter(d => d.getIsVisible?.());
2570
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2529
2571
  }, {
2530
2572
  key,
2531
2573
  debug: () => {
@@ -2540,7 +2582,7 @@
2540
2582
  getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
2541
2583
  getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
2542
2584
  getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
2543
- setColumnVisibility: updater => table.options.onColumnVisibilityChange?.(updater),
2585
+ setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
2544
2586
  resetColumnVisibility: defaultState => {
2545
2587
  var _table$initialState$c;
2546
2588
  table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
@@ -2550,14 +2592,15 @@
2550
2592
  value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
2551
2593
  table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
2552
2594
  ...obj,
2553
- [column.id]: !value ? !column.getCanHide?.() : value
2595
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2554
2596
  }), {}));
2555
2597
  },
2556
- getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !column.getIsVisible?.()),
2557
- getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible?.()),
2598
+ getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2599
+ getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2558
2600
  getToggleAllColumnsVisibilityHandler: () => {
2559
2601
  return e => {
2560
- table.toggleAllColumnsVisible(e.target?.checked);
2602
+ var _target;
2603
+ table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2561
2604
  };
2562
2605
  }
2563
2606
  };
@@ -2577,7 +2620,7 @@
2577
2620
  _features: features
2578
2621
  };
2579
2622
  const defaultOptions = table._features.reduce((obj, feature) => {
2580
- return Object.assign(obj, feature.getDefaultOptions?.(table));
2623
+ return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
2581
2624
  }, {});
2582
2625
  const mergeOptions = options => {
2583
2626
  if (table.options.mergeOptions) {
@@ -2595,7 +2638,7 @@
2595
2638
  };
2596
2639
  table._features.forEach(feature => {
2597
2640
  var _feature$getInitialSt;
2598
- initialState = (_feature$getInitialSt = feature.getInitialState?.(initialState)) != null ? _feature$getInitialSt : initialState;
2641
+ initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
2599
2642
  });
2600
2643
  const queued = [];
2601
2644
  let queuedTimeout = false;
@@ -2634,11 +2677,11 @@
2634
2677
  return table.options.state;
2635
2678
  },
2636
2679
  setState: updater => {
2637
- table.options.onStateChange?.(updater);
2680
+ table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2638
2681
  },
2639
2682
  _getRowId: (row, index, parent) => {
2640
2683
  var _table$options$getRow;
2641
- return (_table$options$getRow = table.options.getRowId?.(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`;
2684
+ 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}`;
2642
2685
  },
2643
2686
  getCoreRowModel: () => {
2644
2687
  if (!table._getCoreRowModel) {
@@ -2677,11 +2720,11 @@
2677
2720
  },
2678
2721
  // footer: props => props.header.column.id,
2679
2722
  cell: props => {
2680
- var _props$renderValue$to;
2681
- return (_props$renderValue$to = props.renderValue()?.toString?.()) != null ? _props$renderValue$to : null;
2723
+ var _props$renderValue$to, _props$renderValue;
2724
+ 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;
2682
2725
  },
2683
2726
  ...table._features.reduce((obj, feature) => {
2684
- return Object.assign(obj, feature.getDefaultColumnDef?.());
2727
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2685
2728
  }, {}),
2686
2729
  ...defaultColumn
2687
2730
  };
@@ -2749,17 +2792,14 @@
2749
2792
  getColumn: columnId => {
2750
2793
  const column = table._getAllFlatColumnsById()[columnId];
2751
2794
  if (!column) {
2752
- {
2753
- console.warn(`[Table] Column with id ${columnId} does not exist.`);
2754
- }
2755
- throw new Error();
2795
+ console.error(`[Table] Column with id '${columnId}' does not exist.`);
2756
2796
  }
2757
2797
  return column;
2758
2798
  }
2759
2799
  };
2760
2800
  Object.assign(table, coreInstance);
2761
2801
  table._features.forEach(feature => {
2762
- return Object.assign(table, feature.createTable?.(table));
2802
+ return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
2763
2803
  });
2764
2804
  return table;
2765
2805
  }
@@ -2788,7 +2828,7 @@
2788
2828
  })
2789
2829
  };
2790
2830
  table._features.forEach(feature => {
2791
- Object.assign(cell, feature.createCell?.(cell, column, row, table));
2831
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
2792
2832
  }, {});
2793
2833
  return cell;
2794
2834
  }
@@ -2806,7 +2846,7 @@
2806
2846
  return row._valuesCache[columnId];
2807
2847
  }
2808
2848
  const column = table.getColumn(columnId);
2809
- if (!column.accessorFn) {
2849
+ if (!(column != null && column.accessorFn)) {
2810
2850
  return undefined;
2811
2851
  }
2812
2852
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -2817,7 +2857,7 @@
2817
2857
  return row._uniqueValuesCache[columnId];
2818
2858
  }
2819
2859
  const column = table.getColumn(columnId);
2820
- if (!column.accessorFn) {
2860
+ if (!(column != null && column.accessorFn)) {
2821
2861
  return undefined;
2822
2862
  }
2823
2863
  if (!column.columnDef.getUniqueValues) {
@@ -2859,7 +2899,7 @@
2859
2899
  };
2860
2900
  for (let i = 0; i < table._features.length; i++) {
2861
2901
  const feature = table._features[i];
2862
- Object.assign(row, feature?.createRow?.(row, table));
2902
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
2863
2903
  }
2864
2904
  return row;
2865
2905
  };
@@ -2953,10 +2993,11 @@
2953
2993
 
2954
2994
  // Get the original subrows
2955
2995
  if (table.options.getSubRows) {
2996
+ var _row$originalSubRows;
2956
2997
  row.originalSubRows = table.options.getSubRows(originalRows[i], i);
2957
2998
 
2958
2999
  // Then recursively access them
2959
- if (row.originalSubRows?.length) {
3000
+ if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
2960
3001
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
2961
3002
  }
2962
3003
  }
@@ -2996,10 +3037,11 @@
2996
3037
 
2997
3038
  // Filter from children up first
2998
3039
  for (let i = 0; i < rowsToFilter.length; i++) {
3040
+ var _row$subRows;
2999
3041
  let row = rowsToFilter[i];
3000
3042
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3001
3043
  newRow.columnFilters = row.columnFilters;
3002
- if (row.subRows?.length && depth < maxDepth) {
3044
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
3003
3045
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3004
3046
  row = newRow;
3005
3047
  if (filterRow(row) && !newRow.subRows.length) {
@@ -3051,7 +3093,8 @@
3051
3093
  let row = rowsToFilter[i];
3052
3094
  const pass = filterRow(row);
3053
3095
  if (pass) {
3054
- if (row.subRows?.length && depth < maxDepth) {
3096
+ var _row$subRows2;
3097
+ if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
3055
3098
  const newRow = createRow(table, row.id, row.original, row.index, row.depth);
3056
3099
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3057
3100
  row = newRow;
@@ -3072,7 +3115,7 @@
3072
3115
 
3073
3116
  function getFilteredRowModel() {
3074
3117
  return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3075
- if (!rowModel.rows.length || !columnFilters?.length && !globalFilter) {
3118
+ if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3076
3119
  for (let i = 0; i < rowModel.flatRows.length; i++) {
3077
3120
  rowModel.flatRows[i].columnFilters = {};
3078
3121
  rowModel.flatRows[i].columnFiltersMeta = {};
@@ -3085,9 +3128,7 @@
3085
3128
  var _filterFn$resolveFilt;
3086
3129
  const column = table.getColumn(d.id);
3087
3130
  if (!column) {
3088
- {
3089
- console.warn(`Table: Could not find a column to filter with columnId: ${d.id}`);
3090
- }
3131
+ return;
3091
3132
  }
3092
3133
  const filterFn = column.getFilterFn();
3093
3134
  if (!filterFn) {
@@ -3099,7 +3140,7 @@
3099
3140
  resolvedColumnFilters.push({
3100
3141
  id: d.id,
3101
3142
  filterFn,
3102
- resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue?.(d.value)) != null ? _filterFn$resolveFilt : d.value
3143
+ resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value
3103
3144
  });
3104
3145
  });
3105
3146
  const filterableIds = columnFilters.map(d => d.id);
@@ -3112,7 +3153,7 @@
3112
3153
  resolvedGlobalFilters.push({
3113
3154
  id: column.id,
3114
3155
  filterFn: globalFilterFn,
3115
- resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue?.(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
3156
+ resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter
3116
3157
  });
3117
3158
  });
3118
3159
  }
@@ -3177,7 +3218,7 @@
3177
3218
 
3178
3219
  function getFacetedRowModel() {
3179
3220
  return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
3180
- if (!preRowModel.rows.length || !columnFilters?.length && !globalFilter) {
3221
+ if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3181
3222
  return preRowModel;
3182
3223
  }
3183
3224
  const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean);
@@ -3202,7 +3243,11 @@
3202
3243
  }
3203
3244
 
3204
3245
  function getFacetedUniqueValues() {
3205
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3246
+ return (table, columnId) => memo(() => {
3247
+ var _table$getColumn;
3248
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3249
+ }, facetedRowModel => {
3250
+ if (!facetedRowModel) return new Map();
3206
3251
  let facetedUniqueValues = new Map();
3207
3252
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3208
3253
  const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
@@ -3228,8 +3273,13 @@
3228
3273
  }
3229
3274
 
3230
3275
  function getFacetedMinMaxValues() {
3231
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3232
- const firstValue = facetedRowModel.flatRows[0]?.getUniqueValues(columnId);
3276
+ return (table, columnId) => memo(() => {
3277
+ var _table$getColumn;
3278
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3279
+ }, facetedRowModel => {
3280
+ var _facetedRowModel$flat;
3281
+ if (!facetedRowModel) return undefined;
3282
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
3233
3283
  if (typeof firstValue === 'undefined') {
3234
3284
  return undefined;
3235
3285
  }
@@ -3258,17 +3308,21 @@
3258
3308
 
3259
3309
  function getSortedRowModel() {
3260
3310
  return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
3261
- if (!rowModel.rows.length || !sorting?.length) {
3311
+ if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
3262
3312
  return rowModel;
3263
3313
  }
3264
3314
  const sortingState = table.getState().sorting;
3265
3315
  const sortedFlatRows = [];
3266
3316
 
3267
3317
  // Filter out sortings that correspond to non existing columns
3268
- const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3318
+ const availableSorting = sortingState.filter(sort => {
3319
+ var _table$getColumn;
3320
+ return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
3321
+ });
3269
3322
  const columnInfoById = {};
3270
3323
  availableSorting.forEach(sortEntry => {
3271
3324
  const column = table.getColumn(sortEntry.id);
3325
+ if (!column) return;
3272
3326
  columnInfoById[sortEntry.id] = {
3273
3327
  sortUndefined: column.columnDef.sortUndefined,
3274
3328
  invertSorting: column.columnDef.invertSorting,
@@ -3284,7 +3338,7 @@
3284
3338
  var _sortEntry$desc;
3285
3339
  const sortEntry = availableSorting[i];
3286
3340
  const columnInfo = columnInfoById[sortEntry.id];
3287
- const isDesc = (_sortEntry$desc = sortEntry?.desc) != null ? _sortEntry$desc : false;
3341
+ const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
3288
3342
  if (columnInfo.sortUndefined) {
3289
3343
  const aValue = rowA.getValue(sortEntry.id);
3290
3344
  const bValue = rowB.getValue(sortEntry.id);
@@ -3312,8 +3366,9 @@
3312
3366
 
3313
3367
  // If there are sub-rows, sort them
3314
3368
  sortedData.forEach(row => {
3369
+ var _row$subRows;
3315
3370
  sortedFlatRows.push(row);
3316
- if (row.subRows?.length) {
3371
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3317
3372
  row.subRows = sortData(row.subRows);
3318
3373
  }
3319
3374
  });
@@ -3409,7 +3464,7 @@
3409
3464
 
3410
3465
  // Aggregate the values
3411
3466
  const column = table.getColumn(columnId);
3412
- const aggregateFn = column.getAggregationFn();
3467
+ const aggregateFn = column == null ? void 0 : column.getAggregationFn();
3413
3468
  if (aggregateFn) {
3414
3469
  row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
3415
3470
  return row._groupingValuesCache[columnId];
@@ -3499,8 +3554,9 @@
3499
3554
  function expandRows(rowModel) {
3500
3555
  const expandedRows = [];
3501
3556
  const handleRow = row => {
3557
+ var _row$subRows;
3502
3558
  expandedRows.push(row);
3503
- if (row.subRows?.length && row.getIsExpanded()) {
3559
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
3504
3560
  row.subRows.forEach(handleRow);
3505
3561
  }
3506
3562
  };
@@ -3561,7 +3617,7 @@
3561
3617
  });
3562
3618
  }
3563
3619
 
3564
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.0 */
3620
+ /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.1 */
3565
3621
 
3566
3622
  function create_fragment$1(ctx) {
3567
3623
  let t;
@@ -3660,8 +3716,9 @@
3660
3716
  return typeof component === 'object' && typeof component.$$render === 'function' && typeof component.render === 'function';
3661
3717
  }
3662
3718
  function isSvelteClientComponent(component) {
3719
+ var _component$name, _component$name2;
3663
3720
  let isHMR = ('__SVELTE_HMR' in window);
3664
- return component.prototype instanceof internal.SvelteComponent || isHMR && component.name?.startsWith('Proxy<') && component.name?.endsWith('>');
3721
+ return component.prototype instanceof internal.SvelteComponent || isHMR && ((_component$name = component.name) == null ? void 0 : _component$name.startsWith('Proxy<')) && ((_component$name2 = component.name) == null ? void 0 : _component$name2.endsWith('>'));
3665
3722
  }
3666
3723
  function isSvelteComponent(component) {
3667
3724
  if (typeof document === 'undefined') {
@@ -3727,7 +3784,7 @@
3727
3784
  } else {
3728
3785
  stateStore.set(updater);
3729
3786
  }
3730
- resolvedOptions.onStateChange?.(updater);
3787
+ resolvedOptions.onStateChange == null ? void 0 : resolvedOptions.onStateChange(updater);
3731
3788
  }
3732
3789
  };
3733
3790
  });