@economic/taco 2.70.2-release-reverts.0 → 2.70.2-release-reverts.1

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
@@ -55224,10 +55224,11 @@ function reducer(state, action) {
55224
55224
  action.rowId,
55225
55225
  moveReasons ?? state.changes.moveReasons[action.rowId],
55226
55226
  Object
55227
- )
55227
+ ),
55228
+ // status can be undefined, so don't use ??
55229
+ status: setWith(state.changes.status, action.rowId, void 0, Object)
55228
55230
  },
55229
- indexes: setWith(state.indexes, action.rowId, index2, Object),
55230
- statuses: omit$1(state.statuses, action.rowId)
55231
+ indexes: setWith(state.indexes, action.rowId, index2, Object)
55231
55232
  };
55232
55233
  }
55233
55234
  case "removeRow": {
@@ -55240,6 +55241,7 @@ function reducer(state, action) {
55240
55241
  errors: omit$1(state.changes.errors, action.rowId),
55241
55242
  moveReasons: omit$1(state.changes.moveReasons, action.rowId),
55242
55243
  originals: omit$1(state.changes.originals, action.rowId),
55244
+ status: omit$1(state.changes.status, action.rowId),
55243
55245
  dirty: omit$1(state.changes.dirty, action.rowId)
55244
55246
  },
55245
55247
  indexes: omit$1(state.indexes, action.rowId),
@@ -55269,15 +55271,12 @@ function reducer(state, action) {
55269
55271
  }
55270
55272
  case "setRowStatus": {
55271
55273
  const { status } = payload;
55272
- if (status) {
55273
- return {
55274
- ...state,
55275
- statuses: setWith(state.statuses, action.rowId, status, Object)
55276
- };
55277
- }
55278
55274
  return {
55279
55275
  ...state,
55280
- statuses: omit$1(state.statuses, action.rowId)
55276
+ changes: {
55277
+ ...state.changes,
55278
+ status: status ? setWith(state.changes.status, action.rowId, status, Object) : omit$1(state.changes.status, action.rowId)
55279
+ }
55281
55280
  };
55282
55281
  }
55283
55282
  case "setRowErrors": {
@@ -55317,10 +55316,9 @@ function reducer(state, action) {
55317
55316
  function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
55318
55317
  const localization = useLocalization();
55319
55318
  const [state, dispatch] = React.useReducer(reducer, {
55320
- changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, dirty: {} },
55319
+ changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, status: {}, dirty: {} },
55321
55320
  indexes: {},
55322
- temporaryRows: [],
55323
- statuses: {}
55321
+ temporaryRows: []
55324
55322
  });
55325
55323
  function getRowValue(rowId) {
55326
55324
  var _a;
@@ -55348,7 +55346,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55348
55346
  return !!((_b = state.changes.errors[rowId]) == null ? void 0 : _b.row) || !!Object.keys(((_c = state.changes.errors[rowId]) == null ? void 0 : _c.cells) ?? {}).length;
55349
55347
  }
55350
55348
  function getRowStatus(rowId) {
55351
- return state.statuses[rowId];
55349
+ return state.changes.status[rowId];
55352
55350
  }
55353
55351
  function setRowStatus(rowId, status) {
55354
55352
  dispatch({
@@ -55359,12 +55357,6 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55359
55357
  }
55360
55358
  });
55361
55359
  }
55362
- function showSavedStatus(rowId) {
55363
- setRowStatus(rowId, "saved");
55364
- setTimeout(() => {
55365
- setRowStatus(rowId, void 0);
55366
- }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
55367
- }
55368
55360
  function insertTemporaryRow(data, rowIndex) {
55369
55361
  const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${nanoid()}`;
55370
55362
  const value = {
@@ -55491,7 +55483,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55491
55483
  newState.changes.originals[row.id] = row.original;
55492
55484
  newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
55493
55485
  newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
55494
- newState.statuses[row.id] = "errored";
55486
+ newState.changes.status[row.id] = "errored";
55495
55487
  newState.indexes[row.id] = index2;
55496
55488
  newState.changes.errors[row.id] = {
55497
55489
  cells: cellErrors,
@@ -55532,7 +55524,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55532
55524
  }));
55533
55525
  }
55534
55526
  function hasSaved() {
55535
- return !!Object.values(state.statuses).filter((status) => status === "saved").length;
55527
+ return !!Object.values(state.changes.status).filter((value) => value === "saved").length;
55536
55528
  }
55537
55529
  function hasChanges(rowId) {
55538
55530
  return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
@@ -55571,7 +55563,10 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55571
55563
  }
55572
55564
  await handleSave(changeSet);
55573
55565
  complete(rowId2, table, rowChanges);
55574
- showSavedStatus(rowId2);
55566
+ setRowStatus(rowId2, "saved");
55567
+ setTimeout(() => {
55568
+ setRowStatus(rowId2, void 0);
55569
+ }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
55575
55570
  } catch (error) {
55576
55571
  if (error instanceof ReferenceError || error instanceof TypeError || ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) >= 500) {
55577
55572
  console.error(error);