@tanstack/table-core 8.9.3 → 8.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/lib/core/row.js +1 -1
  2. package/build/lib/core/row.js.map +1 -1
  3. package/build/lib/core/table.js +2 -2
  4. package/build/lib/core/table.js.map +1 -1
  5. package/build/lib/features/ColumnSizing.js +1 -1
  6. package/build/lib/features/ColumnSizing.js.map +1 -1
  7. package/build/lib/features/Expanding.js +1 -1
  8. package/build/lib/features/Expanding.js.map +1 -1
  9. package/build/lib/features/Filters.js +8 -8
  10. package/build/lib/features/Filters.js.map +1 -1
  11. package/build/lib/features/Grouping.js +1 -1
  12. package/build/lib/features/Grouping.js.map +1 -1
  13. package/build/lib/features/Pagination.js +4 -4
  14. package/build/lib/features/Pagination.js.map +1 -1
  15. package/build/lib/features/Pinning.js +2 -2
  16. package/build/lib/features/Pinning.js.map +1 -1
  17. package/build/lib/features/Sorting.js +2 -2
  18. package/build/lib/features/Sorting.js.map +1 -1
  19. package/build/lib/features/Visibility.js +1 -1
  20. package/build/lib/features/Visibility.js.map +1 -1
  21. package/build/lib/filterFns.js +6 -6
  22. package/build/lib/filterFns.js.map +1 -1
  23. package/build/lib/index.esm.js +33 -33
  24. package/build/lib/index.esm.js.map +1 -1
  25. package/build/lib/index.mjs +33 -33
  26. package/build/lib/index.mjs.map +1 -1
  27. package/build/lib/utils/filterRowsUtils.js +3 -3
  28. package/build/lib/utils/filterRowsUtils.js.map +1 -1
  29. package/build/lib/utils.js +1 -1
  30. package/build/lib/utils.js.map +1 -1
  31. package/build/umd/index.development.js +33 -33
  32. package/build/umd/index.development.js.map +1 -1
  33. package/build/umd/index.production.js +1 -1
  34. package/build/umd/index.production.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/utils/filterRowsUtils.ts +3 -3
@@ -65,7 +65,7 @@ function memo(getDeps, fn, opts) {
65
65
  let resultTime;
66
66
  if (opts.key && opts.debug) resultTime = Date.now();
67
67
  result = fn(...newDeps);
68
- opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
68
+ opts == null || opts.onChange == null || opts.onChange(result);
69
69
  if (opts.key && opts.debug) {
70
70
  if (opts != null && opts.debug()) {
71
71
  const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
@@ -609,7 +609,7 @@ const ColumnSizing = {
609
609
  if (!column || !canResize) {
610
610
  return;
611
611
  }
612
- e.persist == null ? void 0 : e.persist();
612
+ e.persist == null || e.persist();
613
613
  if (isTouchStartEvent(e)) {
614
614
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
615
615
  if (e.touches && e.touches.length > 1) {
@@ -825,7 +825,7 @@ const Expanding = {
825
825
  },
826
826
  getToggleAllRowsExpandedHandler: () => {
827
827
  return e => {
828
- e.persist == null ? void 0 : e.persist();
828
+ e.persist == null || e.persist();
829
829
  table.toggleAllRowsExpanded();
830
830
  };
831
831
  },
@@ -925,19 +925,19 @@ const Expanding = {
925
925
  };
926
926
 
927
927
  const includesString = (row, columnId, filterValue) => {
928
- var _row$getValue, _row$getValue$toStrin, _row$getValue$toStrin2;
928
+ var _row$getValue;
929
929
  const search = filterValue.toLowerCase();
930
- return Boolean((_row$getValue = row.getValue(columnId)) == null ? void 0 : (_row$getValue$toStrin = _row$getValue.toString()) == null ? void 0 : (_row$getValue$toStrin2 = _row$getValue$toStrin.toLowerCase()) == null ? void 0 : _row$getValue$toStrin2.includes(search));
930
+ return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
931
931
  };
932
932
  includesString.autoRemove = val => testFalsey(val);
933
933
  const includesStringSensitive = (row, columnId, filterValue) => {
934
- var _row$getValue2, _row$getValue2$toStri;
935
- return Boolean((_row$getValue2 = row.getValue(columnId)) == null ? void 0 : (_row$getValue2$toStri = _row$getValue2.toString()) == null ? void 0 : _row$getValue2$toStri.includes(filterValue));
934
+ var _row$getValue2;
935
+ return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));
936
936
  };
937
937
  includesStringSensitive.autoRemove = val => testFalsey(val);
938
938
  const equalsString = (row, columnId, filterValue) => {
939
- var _row$getValue3, _row$getValue3$toStri;
940
- return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : (_row$getValue3$toStri = _row$getValue3.toString()) == null ? void 0 : _row$getValue3$toStri.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());
939
+ var _row$getValue3;
940
+ return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());
941
941
  };
942
942
  equalsString.autoRemove = val => testFalsey(val);
943
943
  const arrIncludes = (row, columnId, filterValue) => {
@@ -1031,8 +1031,8 @@ const Filters = {
1031
1031
  maxLeafRowFilterDepth: 100,
1032
1032
  globalFilterFn: 'auto',
1033
1033
  getColumnCanGlobalFilter: column => {
1034
- var _table$getCoreRowMode, _table$getCoreRowMode2;
1035
- const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
1034
+ var _table$getCoreRowMode;
1035
+ const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
1036
1036
  return typeof value === 'string' || typeof value === 'number';
1037
1037
  }
1038
1038
  };
@@ -1075,12 +1075,12 @@ const Filters = {
1075
1075
  },
1076
1076
  getIsFiltered: () => column.getFilterIndex() > -1,
1077
1077
  getFilterValue: () => {
1078
- var _table$getState$colum, _table$getState$colum2;
1079
- 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;
1078
+ var _table$getState$colum;
1079
+ return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
1080
1080
  },
1081
1081
  getFilterIndex: () => {
1082
- var _table$getState$colum3, _table$getState$colum4;
1083
- 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;
1082
+ var _table$getState$colum2, _table$getState$colum3;
1083
+ return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
1084
1084
  },
1085
1085
  setFilterValue: value => {
1086
1086
  table.setColumnFilters(old => {
@@ -1173,10 +1173,10 @@ const Filters = {
1173
1173
  return true;
1174
1174
  });
1175
1175
  };
1176
- table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
1176
+ table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
1177
1177
  },
1178
1178
  setGlobalFilter: updater => {
1179
- table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
1179
+ table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
1180
1180
  },
1181
1181
  resetGlobalFilter: defaultState => {
1182
1182
  table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
@@ -1322,7 +1322,7 @@ const Grouping = {
1322
1322
  return {
1323
1323
  aggregatedCell: props => {
1324
1324
  var _toString, _props$getValue;
1325
- return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1325
+ return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
1326
1326
  },
1327
1327
  aggregationFn: 'auto'
1328
1328
  };
@@ -1572,12 +1572,12 @@ const Pagination = {
1572
1572
  });
1573
1573
  },
1574
1574
  resetPageIndex: defaultState => {
1575
- var _table$initialState$p2, _table$initialState, _table$initialState$p3;
1576
- 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);
1575
+ var _table$initialState$p2, _table$initialState;
1576
+ table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
1577
1577
  },
1578
1578
  resetPageSize: defaultState => {
1579
- var _table$initialState$p4, _table$initialState2, _table$initialState2$;
1580
- 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);
1579
+ var _table$initialState$p3, _table$initialState2;
1580
+ table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
1581
1581
  },
1582
1582
  setPageSize: updater => {
1583
1583
  table.setPagination(old => {
@@ -1717,9 +1717,9 @@ const Pinning = {
1717
1717
  return isLeft ? 'left' : isRight ? 'right' : false;
1718
1718
  },
1719
1719
  getPinnedIndex: () => {
1720
- var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
1720
+ var _table$getState$colum, _table$getState$colum2;
1721
1721
  const position = column.getIsPinned();
1722
- 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;
1722
+ return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
1723
1723
  }
1724
1724
  };
1725
1725
  },
@@ -2480,8 +2480,8 @@ const Sorting = {
2480
2480
  const canSort = column.getCanSort();
2481
2481
  return e => {
2482
2482
  if (!canSort) return;
2483
- e.persist == null ? void 0 : e.persist();
2484
- column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2483
+ e.persist == null || e.persist();
2484
+ column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
2485
2485
  };
2486
2486
  }
2487
2487
  };
@@ -2541,7 +2541,7 @@ const Visibility = {
2541
2541
  },
2542
2542
  getToggleVisibilityHandler: () => {
2543
2543
  return e => {
2544
- column.toggleVisibility == null ? void 0 : column.toggleVisibility(e.target.checked);
2544
+ column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
2545
2545
  };
2546
2546
  }
2547
2547
  };
@@ -2679,7 +2679,7 @@ function createTable(options) {
2679
2679
  return table.options.state;
2680
2680
  },
2681
2681
  setState: updater => {
2682
- table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
2682
+ table.options.onStateChange == null || table.options.onStateChange(updater);
2683
2683
  },
2684
2684
  _getRowId: (row, index, parent) => {
2685
2685
  var _table$options$getRow;
@@ -2724,7 +2724,7 @@ function createTable(options) {
2724
2724
  // footer: props => props.header.column.id,
2725
2725
  cell: props => {
2726
2726
  var _props$renderValue$to, _props$renderValue;
2727
- 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;
2727
+ return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;
2728
2728
  },
2729
2729
  ...table._features.reduce((obj, feature) => {
2730
2730
  return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
@@ -2915,7 +2915,7 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
2915
2915
  };
2916
2916
  for (let i = 0; i < table._features.length; i++) {
2917
2917
  const feature = table._features[i];
2918
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
2918
+ Object.assign(row, feature == null || feature.createRow == null ? void 0 : feature.createRow(row, table));
2919
2919
  }
2920
2920
  return row;
2921
2921
  };
@@ -3062,13 +3062,13 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3062
3062
  if (filterRow(row) && !newRow.subRows.length) {
3063
3063
  rows.push(row);
3064
3064
  newFilteredRowsById[row.id] = row;
3065
- newFilteredRowsById[i] = row;
3065
+ newFilteredFlatRows.push(row);
3066
3066
  continue;
3067
3067
  }
3068
3068
  if (filterRow(row) || newRow.subRows.length) {
3069
3069
  rows.push(row);
3070
3070
  newFilteredRowsById[row.id] = row;
3071
- newFilteredRowsById[i] = row;
3071
+ newFilteredFlatRows.push(row);
3072
3072
  continue;
3073
3073
  }
3074
3074
  } else {
@@ -3076,7 +3076,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3076
3076
  if (filterRow(row)) {
3077
3077
  rows.push(row);
3078
3078
  newFilteredRowsById[row.id] = row;
3079
- newFilteredRowsById[i] = row;
3079
+ newFilteredFlatRows.push(row);
3080
3080
  }
3081
3081
  }
3082
3082
  }