@odoo/o-spreadsheet 16.0.32 → 16.0.34

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.
@@ -5928,17 +5928,20 @@ rowMenuRegistry
5928
5928
  });
5929
5929
 
5930
5930
  function interactiveRenameSheet(env, sheetId, errorText) {
5931
+ if (env.model.getters.isReadonly()) {
5932
+ return;
5933
+ }
5931
5934
  const placeholder = env.model.getters.getSheetName(sheetId);
5932
5935
  const title = _lt("Rename Sheet");
5933
5936
  const callback = (name) => {
5934
5937
  if (name === null || name === placeholder) {
5935
5938
  return;
5936
5939
  }
5937
- if (name === "") {
5938
- interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5939
- }
5940
5940
  const result = env.model.dispatch("RENAME_SHEET", { sheetId, name });
5941
5941
  if (!result.isSuccessful) {
5942
+ if (result.reasons.includes(10 /* CommandResult.MissingSheetName */)) {
5943
+ interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5944
+ }
5942
5945
  if (result.reasons.includes(11 /* CommandResult.DuplicatedSheetName */)) {
5943
5946
  interactiveRenameSheet(env, sheetId, _lt("A sheet with the name %s already exists. Please select another name.", name));
5944
5947
  }
@@ -27821,9 +27824,9 @@ class CellPlugin extends CorePlugin {
27821
27824
  allowDispatch(cmd) {
27822
27825
  switch (cmd.type) {
27823
27826
  case "UPDATE_CELL":
27824
- return this.checkCellOutOfSheet(cmd);
27827
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
27825
27828
  case "CLEAR_CELL":
27826
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
27829
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
27827
27830
  default:
27828
27831
  return 0 /* CommandResult.Success */;
27829
27832
  }
@@ -28182,6 +28185,18 @@ class CellPlugin extends CorePlugin {
28182
28185
  }
28183
28186
  return 0 /* CommandResult.Success */;
28184
28187
  }
28188
+ checkUselessUpdateCell(cmd) {
28189
+ const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28190
+ const hasContent = "content" in cmd || "formula" in cmd;
28191
+ const hasStyle = "style" in cmd;
28192
+ const hasFormat = "format" in cmd;
28193
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
28194
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
28195
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
28196
+ return 88 /* CommandResult.NoChanges */;
28197
+ }
28198
+ return 0 /* CommandResult.Success */;
28199
+ }
28185
28200
  }
28186
28201
  CellPlugin.getters = [
28187
28202
  "zoneToXC",
@@ -43259,6 +43274,6 @@ exports.setTranslationMethod = setTranslationMethod;
43259
43274
  exports.tokenize = tokenize;
43260
43275
 
43261
43276
 
43262
- __info__.version = '16.0.32';
43263
- __info__.date = '2024-02-09T13:05:36.074Z';
43264
- __info__.hash = '452dce2';
43277
+ __info__.version = '16.0.34';
43278
+ __info__.date = '2024-03-12T07:54:05.304Z';
43279
+ __info__.hash = 'e923ddd';
@@ -3176,6 +3176,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3176
3176
  private updateCell;
3177
3177
  private checkCellOutOfSheet;
3178
3178
  private checkUselessClearCell;
3179
+ private checkUselessUpdateCell;
3179
3180
  }
3180
3181
 
3181
3182
  /**
@@ -5924,17 +5924,20 @@ rowMenuRegistry
5924
5924
  });
5925
5925
 
5926
5926
  function interactiveRenameSheet(env, sheetId, errorText) {
5927
+ if (env.model.getters.isReadonly()) {
5928
+ return;
5929
+ }
5927
5930
  const placeholder = env.model.getters.getSheetName(sheetId);
5928
5931
  const title = _lt("Rename Sheet");
5929
5932
  const callback = (name) => {
5930
5933
  if (name === null || name === placeholder) {
5931
5934
  return;
5932
5935
  }
5933
- if (name === "") {
5934
- interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5935
- }
5936
5936
  const result = env.model.dispatch("RENAME_SHEET", { sheetId, name });
5937
5937
  if (!result.isSuccessful) {
5938
+ if (result.reasons.includes(10 /* CommandResult.MissingSheetName */)) {
5939
+ interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5940
+ }
5938
5941
  if (result.reasons.includes(11 /* CommandResult.DuplicatedSheetName */)) {
5939
5942
  interactiveRenameSheet(env, sheetId, _lt("A sheet with the name %s already exists. Please select another name.", name));
5940
5943
  }
@@ -27817,9 +27820,9 @@ class CellPlugin extends CorePlugin {
27817
27820
  allowDispatch(cmd) {
27818
27821
  switch (cmd.type) {
27819
27822
  case "UPDATE_CELL":
27820
- return this.checkCellOutOfSheet(cmd);
27823
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
27821
27824
  case "CLEAR_CELL":
27822
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
27825
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
27823
27826
  default:
27824
27827
  return 0 /* CommandResult.Success */;
27825
27828
  }
@@ -28178,6 +28181,18 @@ class CellPlugin extends CorePlugin {
28178
28181
  }
28179
28182
  return 0 /* CommandResult.Success */;
28180
28183
  }
28184
+ checkUselessUpdateCell(cmd) {
28185
+ const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28186
+ const hasContent = "content" in cmd || "formula" in cmd;
28187
+ const hasStyle = "style" in cmd;
28188
+ const hasFormat = "format" in cmd;
28189
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
28190
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
28191
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
28192
+ return 88 /* CommandResult.NoChanges */;
28193
+ }
28194
+ return 0 /* CommandResult.Success */;
28195
+ }
28181
28196
  }
28182
28197
  CellPlugin.getters = [
28183
28198
  "zoneToXC",
@@ -43227,6 +43242,6 @@ function addFunction(functionName, functionDescription) {
43227
43242
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43228
43243
 
43229
43244
 
43230
- __info__.version = '16.0.32';
43231
- __info__.date = '2024-02-09T13:05:36.074Z';
43232
- __info__.hash = '452dce2';
43245
+ __info__.version = '16.0.34';
43246
+ __info__.date = '2024-03-12T07:54:05.304Z';
43247
+ __info__.hash = 'e923ddd';
@@ -5925,17 +5925,20 @@
5925
5925
  });
5926
5926
 
5927
5927
  function interactiveRenameSheet(env, sheetId, errorText) {
5928
+ if (env.model.getters.isReadonly()) {
5929
+ return;
5930
+ }
5928
5931
  const placeholder = env.model.getters.getSheetName(sheetId);
5929
5932
  const title = _lt("Rename Sheet");
5930
5933
  const callback = (name) => {
5931
5934
  if (name === null || name === placeholder) {
5932
5935
  return;
5933
5936
  }
5934
- if (name === "") {
5935
- interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5936
- }
5937
5937
  const result = env.model.dispatch("RENAME_SHEET", { sheetId, name });
5938
5938
  if (!result.isSuccessful) {
5939
+ if (result.reasons.includes(10 /* CommandResult.MissingSheetName */)) {
5940
+ interactiveRenameSheet(env, sheetId, _lt("The sheet name cannot be empty."));
5941
+ }
5939
5942
  if (result.reasons.includes(11 /* CommandResult.DuplicatedSheetName */)) {
5940
5943
  interactiveRenameSheet(env, sheetId, _lt("A sheet with the name %s already exists. Please select another name.", name));
5941
5944
  }
@@ -27818,9 +27821,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27818
27821
  allowDispatch(cmd) {
27819
27822
  switch (cmd.type) {
27820
27823
  case "UPDATE_CELL":
27821
- return this.checkCellOutOfSheet(cmd);
27824
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
27822
27825
  case "CLEAR_CELL":
27823
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
27826
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
27824
27827
  default:
27825
27828
  return 0 /* CommandResult.Success */;
27826
27829
  }
@@ -28179,6 +28182,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28179
28182
  }
28180
28183
  return 0 /* CommandResult.Success */;
28181
28184
  }
28185
+ checkUselessUpdateCell(cmd) {
28186
+ const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28187
+ const hasContent = "content" in cmd || "formula" in cmd;
28188
+ const hasStyle = "style" in cmd;
28189
+ const hasFormat = "format" in cmd;
28190
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
28191
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
28192
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
28193
+ return 88 /* CommandResult.NoChanges */;
28194
+ }
28195
+ return 0 /* CommandResult.Success */;
28196
+ }
28182
28197
  }
28183
28198
  CellPlugin.getters = [
28184
28199
  "zoneToXC",
@@ -43258,9 +43273,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43258
43273
  Object.defineProperty(exports, '__esModule', { value: true });
43259
43274
 
43260
43275
 
43261
- __info__.version = '16.0.32';
43262
- __info__.date = '2024-02-09T13:05:36.074Z';
43263
- __info__.hash = '452dce2';
43276
+ __info__.version = '16.0.34';
43277
+ __info__.date = '2024-03-12T07:54:05.304Z';
43278
+ __info__.hash = 'e923ddd';
43264
43279
 
43265
43280
 
43266
43281
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);