@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.js CHANGED
@@ -55206,10 +55206,11 @@ function reducer(state, action) {
55206
55206
  action.rowId,
55207
55207
  moveReasons ?? state.changes.moveReasons[action.rowId],
55208
55208
  Object
55209
- )
55209
+ ),
55210
+ // status can be undefined, so don't use ??
55211
+ status: setWith(state.changes.status, action.rowId, void 0, Object)
55210
55212
  },
55211
- indexes: setWith(state.indexes, action.rowId, index2, Object),
55212
- statuses: omit$1(state.statuses, action.rowId)
55213
+ indexes: setWith(state.indexes, action.rowId, index2, Object)
55213
55214
  };
55214
55215
  }
55215
55216
  case "removeRow": {
@@ -55222,6 +55223,7 @@ function reducer(state, action) {
55222
55223
  errors: omit$1(state.changes.errors, action.rowId),
55223
55224
  moveReasons: omit$1(state.changes.moveReasons, action.rowId),
55224
55225
  originals: omit$1(state.changes.originals, action.rowId),
55226
+ status: omit$1(state.changes.status, action.rowId),
55225
55227
  dirty: omit$1(state.changes.dirty, action.rowId)
55226
55228
  },
55227
55229
  indexes: omit$1(state.indexes, action.rowId),
@@ -55251,15 +55253,12 @@ function reducer(state, action) {
55251
55253
  }
55252
55254
  case "setRowStatus": {
55253
55255
  const { status } = payload;
55254
- if (status) {
55255
- return {
55256
- ...state,
55257
- statuses: setWith(state.statuses, action.rowId, status, Object)
55258
- };
55259
- }
55260
55256
  return {
55261
55257
  ...state,
55262
- statuses: omit$1(state.statuses, action.rowId)
55258
+ changes: {
55259
+ ...state.changes,
55260
+ status: status ? setWith(state.changes.status, action.rowId, status, Object) : omit$1(state.changes.status, action.rowId)
55261
+ }
55263
55262
  };
55264
55263
  }
55265
55264
  case "setRowErrors": {
@@ -55299,10 +55298,9 @@ function reducer(state, action) {
55299
55298
  function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
55300
55299
  const localization = useLocalization();
55301
55300
  const [state, dispatch] = React__default.useReducer(reducer, {
55302
- changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, dirty: {} },
55301
+ changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, status: {}, dirty: {} },
55303
55302
  indexes: {},
55304
- temporaryRows: [],
55305
- statuses: {}
55303
+ temporaryRows: []
55306
55304
  });
55307
55305
  function getRowValue(rowId) {
55308
55306
  var _a;
@@ -55330,7 +55328,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55330
55328
  return !!((_b = state.changes.errors[rowId]) == null ? void 0 : _b.row) || !!Object.keys(((_c = state.changes.errors[rowId]) == null ? void 0 : _c.cells) ?? {}).length;
55331
55329
  }
55332
55330
  function getRowStatus(rowId) {
55333
- return state.statuses[rowId];
55331
+ return state.changes.status[rowId];
55334
55332
  }
55335
55333
  function setRowStatus(rowId, status) {
55336
55334
  dispatch({
@@ -55341,12 +55339,6 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55341
55339
  }
55342
55340
  });
55343
55341
  }
55344
- function showSavedStatus(rowId) {
55345
- setRowStatus(rowId, "saved");
55346
- setTimeout(() => {
55347
- setRowStatus(rowId, void 0);
55348
- }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
55349
- }
55350
55342
  function insertTemporaryRow(data, rowIndex) {
55351
55343
  const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${nanoid()}`;
55352
55344
  const value = {
@@ -55473,7 +55465,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55473
55465
  newState.changes.originals[row.id] = row.original;
55474
55466
  newState.changes.moveReasons[row.id] = { ...newState.changes.moveReasons[row.id] };
55475
55467
  newState.changes.rows[row.id] = { ...newState.changes.rows[row.id] };
55476
- newState.statuses[row.id] = "errored";
55468
+ newState.changes.status[row.id] = "errored";
55477
55469
  newState.indexes[row.id] = index2;
55478
55470
  newState.changes.errors[row.id] = {
55479
55471
  cells: cellErrors,
@@ -55514,7 +55506,7 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55514
55506
  }));
55515
55507
  }
55516
55508
  function hasSaved() {
55517
- return !!Object.values(state.statuses).filter((status) => status === "saved").length;
55509
+ return !!Object.values(state.changes.status).filter((value) => value === "saved").length;
55518
55510
  }
55519
55511
  function hasChanges(rowId) {
55520
55512
  return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
@@ -55553,7 +55545,10 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
55553
55545
  }
55554
55546
  await handleSave(changeSet);
55555
55547
  complete(rowId2, table, rowChanges);
55556
- showSavedStatus(rowId2);
55548
+ setRowStatus(rowId2, "saved");
55549
+ setTimeout(() => {
55550
+ setRowStatus(rowId2, void 0);
55551
+ }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
55557
55552
  } catch (error) {
55558
55553
  if (error instanceof ReferenceError || error instanceof TypeError || ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) >= 500) {
55559
55554
  console.error(error);