@economic/taco 2.64.1-alpha.0 → 2.64.1-stale-validator.0

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.
package/dist/taco.cjs CHANGED
@@ -37836,9 +37836,6 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37836
37836
  virtualiser.measure();
37837
37837
  }
37838
37838
  }, [expandedState]);
37839
- React.useEffect(() => {
37840
- virtualiser.measure();
37841
- }, [tableMeta.fontSize.size, tableMeta.rowHeight.height, JSON.stringify(table.getState().sorting), rows.length]);
37842
37839
  const totalSize = virtualiser.getTotalSize();
37843
37840
  const virtualItems = virtualiser.getVirtualItems();
37844
37841
  const scrollToIndex = React.useCallback(
@@ -53941,14 +53938,6 @@ function isTableScrolled(ref) {
53941
53938
  function useTableEditingListener(table, tableRef, scrollToIndex) {
53942
53939
  const tableMeta = table.options.meta;
53943
53940
  const localization = useLocalization();
53944
- useLazyEffect(() => {
53945
- return () => {
53946
- var _a;
53947
- if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== void 0) {
53948
- tableMeta.editing.saveChanges(table, (_a = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.id);
53949
- }
53950
- };
53951
- }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.isEditing]);
53952
53941
  const hasChanges = tableMeta.editing.hasChanges();
53953
53942
  React.useEffect(() => {
53954
53943
  function showUnsavedChangesWarning(event) {
@@ -55293,7 +55282,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55293
55282
  var _a, _b, _c;
55294
55283
  return (_c = (_b = (_a = state.changes.errors) == null ? void 0 : _a[cell.row.id]) == null ? void 0 : _b.cells) == null ? void 0 : _c[cell.column.id];
55295
55284
  }
55296
- async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
55285
+ async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true, shouldRunValidation = true) {
55297
55286
  var _a;
55298
55287
  const tableMeta = cell.getContext().table.options.meta;
55299
55288
  const state2 = tableMeta.editing.getState();
@@ -55323,7 +55312,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55323
55312
  const nextMoveReasons = { ...state2.changes.moveReasons[cell.row.id] };
55324
55313
  const nextCellErrors = { ...(_a = state2.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
55325
55314
  let validationErrors = {};
55326
- if (validator && Object.keys(nextChanges).length && original) {
55315
+ if (validator && Object.keys(nextChanges).length && original && shouldRunValidation) {
55327
55316
  const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
55328
55317
  validationErrors = await validator(nextRowValue) ?? {};
55329
55318
  }
@@ -55805,7 +55794,7 @@ function EditingControlCell(props) {
55805
55794
  if (hasChanged) {
55806
55795
  tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
55807
55796
  if (hasNonTextControl) {
55808
- requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
55797
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
55809
55798
  }
55810
55799
  }
55811
55800
  },
@@ -55818,7 +55807,7 @@ function EditingControlCell(props) {
55818
55807
  }
55819
55808
  requestAnimationFrame(() => {
55820
55809
  tableMeta.editing.toggleDetailedMode(false);
55821
- tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
55810
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl, true);
55822
55811
  });
55823
55812
  },
55824
55813
  [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
@@ -56114,6 +56103,11 @@ function Row(props) {
56114
56103
  }
56115
56104
  }
56116
56105
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
56106
+ useLazyEffect(() => {
56107
+ if (tableMeta.editing.isEditing && !isActiveRow) {
56108
+ tableMeta.editing.saveChanges(table, row.id);
56109
+ }
56110
+ }, [isActiveRow]);
56117
56111
  const handleFocus = React.useCallback(
56118
56112
  (event) => {
56119
56113
  var _a;