@odoo/o-spreadsheet 16.1.9 → 16.1.11

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.
@@ -3628,6 +3628,8 @@ exports.CommandResult = void 0;
3628
3628
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3629
3629
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3630
3630
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3631
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3632
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3631
3633
  })(exports.CommandResult || (exports.CommandResult = {}));
3632
3634
 
3633
3635
  var DIRECTION;
@@ -14115,7 +14117,11 @@ const LOOKUP = {
14115
14117
  : getNormalizedValueFromRowRange;
14116
14118
  const rangeLength = verticalSearch ? nbRow : nbCol;
14117
14119
  const index = dichotomicSearch(searchArray, _searchKey, "nextSmaller", "asc", rangeLength, getElement);
14118
- assertAvailable(searchArray[0][index], searchKey);
14120
+ if (index === -1)
14121
+ assertAvailable(undefined, searchKey);
14122
+ verticalSearch
14123
+ ? assertAvailable(searchArray[0][index], searchKey)
14124
+ : assertAvailable(searchArray[index][nbRow - 1], searchKey);
14119
14125
  if (resultRange === undefined) {
14120
14126
  return (verticalSearch ? searchArray[nbCol - 1][index] : searchArray[index][nbRow - 1]);
14121
14127
  }
@@ -14497,7 +14503,7 @@ const POW = {
14497
14503
  base (number) ${_lt("The number to raise to the exponent power.")}
14498
14504
  exponent (number) ${_lt("The exponent to raise base to.")}
14499
14505
  `),
14500
- returns: ["BOOLEAN"],
14506
+ returns: ["NUMBER"],
14501
14507
  compute: function (base, exponent) {
14502
14508
  return POWER.compute(base, exponent);
14503
14509
  },
@@ -19751,6 +19757,12 @@ css /* scss */ `
19751
19757
  height: 25px;
19752
19758
  }
19753
19759
  }
19760
+ /** Make the character a bit bigger
19761
+ compared to its neighbor INPUT box */
19762
+ .o-remove-selection {
19763
+ font-weight: bold;
19764
+ font-size: calc(100% + 4px);
19765
+ }
19754
19766
  }
19755
19767
  `;
19756
19768
  /**
@@ -19842,6 +19854,9 @@ class SelectionInput extends owl.Component {
19842
19854
  }
19843
19855
  }
19844
19856
  }
19857
+ extractRanges(value) {
19858
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
19859
+ }
19845
19860
  focus(rangeId) {
19846
19861
  this.state.isMissing = false;
19847
19862
  this.state.mode = "select-range";
@@ -19861,15 +19876,16 @@ class SelectionInput extends owl.Component {
19861
19876
  }
19862
19877
  onInputChanged(rangeId, ev) {
19863
19878
  const target = ev.target;
19879
+ const value = this.extractRanges(target.value);
19864
19880
  this.env.model.dispatch("CHANGE_RANGE", {
19865
19881
  id: this.id,
19866
19882
  rangeId,
19867
- value: target.value,
19883
+ value,
19868
19884
  });
19869
19885
  target.blur();
19870
19886
  this.triggerChange();
19871
19887
  }
19872
- disable() {
19888
+ confirm() {
19873
19889
  var _a, _b;
19874
19890
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
19875
19891
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -25191,7 +25207,7 @@ function extractStyle(cell, data) {
25191
25207
  if (cell.style) {
25192
25208
  style = data.styles[cell.style];
25193
25209
  }
25194
- const format = cell.format ? data.formats[cell.format] : undefined;
25210
+ const format = extractFormat(cell, data);
25195
25211
  const exportedBorder = {};
25196
25212
  if (cell.border) {
25197
25213
  const border = data.borders[cell.border];
@@ -25225,6 +25241,22 @@ function extractStyle(cell, data) {
25225
25241
  styles.font["italic"] = !!(style === null || style === void 0 ? void 0 : style.italic) || undefined;
25226
25242
  return styles;
25227
25243
  }
25244
+ function extractFormat(cell, data) {
25245
+ if (cell.format) {
25246
+ return data.formats[cell.format];
25247
+ }
25248
+ if (cell.isFormula) {
25249
+ const tokens = tokenize(cell.content || "");
25250
+ const functions = functionRegistry.content;
25251
+ const isExported = tokens
25252
+ .filter((tk) => tk.type === "FUNCTION")
25253
+ .every((tk) => functions[tk.value.toUpperCase()].isExported);
25254
+ if (!isExported) {
25255
+ return cell.computedFormat;
25256
+ }
25257
+ }
25258
+ return undefined;
25259
+ }
25228
25260
  function normalizeStyle(construct, styles) {
25229
25261
  const { id: fontId } = pushElement(styles["font"], construct.fonts);
25230
25262
  const { id: fillId } = pushElement(styles["fill"], construct.fills);
@@ -29975,9 +30007,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29975
30007
  const elements = cmd.dimension === "COL"
29976
30008
  ? this.getters.getNumberCols(cmd.sheetId)
29977
30009
  : this.getters.getNumberRows(cmd.sheetId);
29978
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29979
- ? 0 /* CommandResult.Success */
29980
- : 66 /* CommandResult.TooManyHiddenElements */;
30010
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
30011
+ if (hiddenElements.size >= elements) {
30012
+ return 66 /* CommandResult.TooManyHiddenElements */;
30013
+ }
30014
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30015
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30016
+ }
30017
+ else {
30018
+ return 0 /* CommandResult.Success */;
30019
+ }
29981
30020
  }
29982
30021
  case "REMOVE_COLUMNS_ROWS":
29983
30022
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -31141,6 +31180,28 @@ class SheetPlugin extends CorePlugin {
31141
31180
  return this.orderedSheetIds.length > 1
31142
31181
  ? 0 /* CommandResult.Success */
31143
31182
  : 9 /* CommandResult.NotEnoughSheets */;
31183
+ case "ADD_COLUMNS_ROWS":
31184
+ const elements = cmd.dimension === "COL"
31185
+ ? this.getNumberCols(cmd.sheetId)
31186
+ : this.getNumberRows(cmd.sheetId);
31187
+ if (cmd.base < 0 || cmd.base > elements) {
31188
+ return 86 /* CommandResult.InvalidHeaderIndex */;
31189
+ }
31190
+ else if (cmd.quantity <= 0) {
31191
+ return 87 /* CommandResult.InvalidQuantity */;
31192
+ }
31193
+ return 0 /* CommandResult.Success */;
31194
+ case "REMOVE_COLUMNS_ROWS": {
31195
+ const elements = cmd.dimension === "COL"
31196
+ ? this.getNumberCols(cmd.sheetId)
31197
+ : this.getNumberRows(cmd.sheetId);
31198
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31199
+ return 86 /* CommandResult.InvalidHeaderIndex */;
31200
+ }
31201
+ else {
31202
+ return 0 /* CommandResult.Success */;
31203
+ }
31204
+ }
31144
31205
  case "FREEZE_ROWS": {
31145
31206
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
31146
31207
  }
@@ -32306,7 +32367,7 @@ class EvaluationPlugin extends UIPlugin {
32306
32367
  // magic "empty" value
32307
32368
  // Returning {value: null} instead of undefined will ensure that we don't
32308
32369
  // fall back on the default value of the argument provided to the formula's compute function
32309
- return { value: null };
32370
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32310
32371
  }
32311
32372
  return getEvaluatedCell(cell);
32312
32373
  }
@@ -32389,8 +32450,12 @@ class EvaluationPlugin extends UIPlugin {
32389
32450
  const cell = this.getters.getCell(position);
32390
32451
  if (cell) {
32391
32452
  const exportedCellData = sheet.cells[xc];
32392
- exportedCellData.value = this.getEvaluatedCell(position).value;
32453
+ const evaluatedCell = this.getEvaluatedCell(position);
32454
+ exportedCellData.value = evaluatedCell.value;
32393
32455
  exportedCellData.isFormula = cell.isFormula && !this.isBadExpression(cell.content);
32456
+ if (cell.format !== evaluatedCell.format) {
32457
+ exportedCellData.computedFormat = evaluatedCell.format;
32458
+ }
32394
32459
  }
32395
32460
  }
32396
32461
  }
@@ -35853,6 +35918,9 @@ RendererPlugin.getters = ["getColDimensionsInViewport", "getRowDimensionsInViewp
35853
35918
  */
35854
35919
  class SelectionInputPlugin extends UIPlugin {
35855
35920
  constructor(config, initialRanges, inputHasSingleRange) {
35921
+ if (inputHasSingleRange && initialRanges.length > 1) {
35922
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
35923
+ }
35856
35924
  super(config);
35857
35925
  this.inputHasSingleRange = inputHasSingleRange;
35858
35926
  this.ranges = [];
@@ -35875,6 +35943,11 @@ class SelectionInputPlugin extends UIPlugin {
35875
35943
  return 30 /* CommandResult.MaximumRangesReached */;
35876
35944
  }
35877
35945
  break;
35946
+ case "CHANGE_RANGE":
35947
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35948
+ return 30 /* CommandResult.MaximumRangesReached */;
35949
+ }
35950
+ break;
35878
35951
  }
35879
35952
  return 0 /* CommandResult.Success */;
35880
35953
  }
@@ -36699,13 +36772,9 @@ class Session extends EventBus {
36699
36772
  }
36700
36773
  loadInitialMessages(messages) {
36701
36774
  this.isReplayingInitialRevisions = true;
36702
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
36703
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
36704
- });
36705
36775
  for (const message of messages) {
36706
36776
  this.onMessageReceived(message);
36707
36777
  }
36708
- this.off("unexpected-revision-id", this);
36709
36778
  this.isReplayingInitialRevisions = false;
36710
36779
  }
36711
36780
  /**
@@ -36777,6 +36846,10 @@ class Session extends EventBus {
36777
36846
  onMessageReceived(message) {
36778
36847
  if (this.isAlreadyProcessed(message))
36779
36848
  return;
36849
+ if (this.isWrongServerRevisionId(message)) {
36850
+ this.trigger("unexpected-revision-id");
36851
+ return;
36852
+ }
36780
36853
  switch (message.type) {
36781
36854
  case "CLIENT_MOVED":
36782
36855
  this.onClientMoved(message);
@@ -36803,10 +36876,6 @@ class Session extends EventBus {
36803
36876
  });
36804
36877
  break;
36805
36878
  case "REMOTE_REVISION":
36806
- if (message.serverRevisionId !== this.serverRevisionId) {
36807
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
36808
- return;
36809
- }
36810
36879
  const { clientId, commands } = message;
36811
36880
  const revision = new Revision(message.nextRevisionId, clientId, commands);
36812
36881
  if (revision.clientId !== this.clientId) {
@@ -36938,6 +37007,17 @@ class Session extends EventBus {
36938
37007
  return false;
36939
37008
  }
36940
37009
  }
37010
+ isWrongServerRevisionId(message) {
37011
+ switch (message.type) {
37012
+ case "REMOTE_REVISION":
37013
+ case "REVISION_REDONE":
37014
+ case "REVISION_UNDONE":
37015
+ case "SNAPSHOT_CREATED":
37016
+ return message.serverRevisionId !== this.serverRevisionId;
37017
+ default:
37018
+ return false;
37019
+ }
37020
+ }
36941
37021
  dropPendingHistoryMessages() {
36942
37022
  this.waitingUndoRedoAck = false;
36943
37023
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -39568,7 +39648,6 @@ css /* scss */ `
39568
39648
  color: dimgrey;
39569
39649
  }
39570
39650
  .o-sidePanelClose {
39571
- font-size: 1.5rem;
39572
39651
  padding: 5px 10px;
39573
39652
  cursor: pointer;
39574
39653
  &:hover {
@@ -42568,12 +42647,9 @@ function addFormula(cell) {
42568
42647
  else {
42569
42648
  // Shouldn't we always output the value then ?
42570
42649
  const value = cell.value;
42571
- // what if value = 0? Is this condition correct?
42572
- if (value) {
42573
- const type = getCellType(value);
42574
- attrs.push(["t", type]);
42575
- node = escapeXml /*xml*/ `<v>${value}</v>`;
42576
- }
42650
+ const type = getCellType(value);
42651
+ attrs.push(["t", type]);
42652
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
42577
42653
  return { attrs, node };
42578
42654
  }
42579
42655
  }
@@ -44183,6 +44259,6 @@ exports.setTranslationMethod = setTranslationMethod;
44183
44259
  exports.tokenize = tokenize;
44184
44260
 
44185
44261
 
44186
- __info__.version = '16.1.9';
44187
- __info__.date = '2023-04-21T07:29:41.080Z';
44188
- __info__.hash = '686bffa';
44262
+ __info__.version = '16.1.11';
44263
+ __info__.date = '2023-05-12T10:58:24.113Z';
44264
+ __info__.hash = 'd9a2cce';
@@ -800,6 +800,7 @@ interface ExcelWorkbookData extends WorkbookData {
800
800
  interface ExcelCellData extends CellData {
801
801
  value: CellValue;
802
802
  isFormula: Boolean;
803
+ computedFormat?: Format;
803
804
  }
804
805
  interface ExcelSheetData extends Omit<SheetData, "figureTables"> {
805
806
  cells: {
@@ -854,7 +855,6 @@ interface CollaborativeEventReceived {
854
855
  }
855
856
  interface UnexpectedRevisionIdEvent {
856
857
  type: "unexpected-revision-id";
857
- revisionId: UID;
858
858
  }
859
859
  interface NewLocalStateUpdateEvent {
860
860
  type: "new-local-state-update";
@@ -2254,7 +2254,9 @@ declare const enum CommandResult {
2254
2254
  DuplicatedFigureId = 82,
2255
2255
  InvalidSelectionStep = 83,
2256
2256
  DuplicatedChartId = 84,
2257
- ChartDoesNotExist = 85
2257
+ ChartDoesNotExist = 85,
2258
+ InvalidHeaderIndex = 86,
2259
+ InvalidQuantity = 87
2258
2260
  }
2259
2261
  interface CommandHandler<T> {
2260
2262
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2889,6 +2891,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
2889
2891
  private sendPendingMessage;
2890
2892
  private acknowledge;
2891
2893
  private isAlreadyProcessed;
2894
+ isWrongServerRevisionId(message: CollaborationMessage): boolean;
2892
2895
  private dropPendingHistoryMessages;
2893
2896
  }
2894
2897
 
@@ -3496,7 +3499,7 @@ declare class HeaderSizePlugin extends CorePlugin<HeaderSizeState> implements He
3496
3499
  declare class HeaderVisibilityPlugin extends CorePlugin {
3497
3500
  static getters: readonly ["canRemoveHeaders", "getHiddenColsGroups", "getHiddenRowsGroups", "isRowHiddenByUser", "isColHiddenByUser"];
3498
3501
  private readonly hiddenHeaders;
3499
- allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements;
3502
+ allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements | CommandResult.InvalidHeaderIndex;
3500
3503
  handle(cmd: Command): void;
3501
3504
  canRemoveHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
3502
3505
  isRowHiddenByUser(sheetId: UID, index: HeaderIndex): boolean;
@@ -5011,11 +5014,12 @@ declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
5011
5014
  getColor(range: SelectionRange): string;
5012
5015
  private triggerChange;
5013
5016
  onKeydown(ev: KeyboardEvent): void;
5017
+ private extractRanges;
5014
5018
  focus(rangeId: string): void;
5015
5019
  addEmptyInput(): void;
5016
5020
  removeInput(rangeId: string): void;
5017
5021
  onInputChanged(rangeId: string, ev: InputEvent): void;
5018
- disable(): void;
5022
+ confirm(): void;
5019
5023
  }
5020
5024
 
5021
5025
  interface Props$w {
@@ -3624,6 +3624,8 @@ var CommandResult;
3624
3624
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3625
3625
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3626
3626
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3627
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3628
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3627
3629
  })(CommandResult || (CommandResult = {}));
3628
3630
 
3629
3631
  var DIRECTION;
@@ -14111,7 +14113,11 @@ const LOOKUP = {
14111
14113
  : getNormalizedValueFromRowRange;
14112
14114
  const rangeLength = verticalSearch ? nbRow : nbCol;
14113
14115
  const index = dichotomicSearch(searchArray, _searchKey, "nextSmaller", "asc", rangeLength, getElement);
14114
- assertAvailable(searchArray[0][index], searchKey);
14116
+ if (index === -1)
14117
+ assertAvailable(undefined, searchKey);
14118
+ verticalSearch
14119
+ ? assertAvailable(searchArray[0][index], searchKey)
14120
+ : assertAvailable(searchArray[index][nbRow - 1], searchKey);
14115
14121
  if (resultRange === undefined) {
14116
14122
  return (verticalSearch ? searchArray[nbCol - 1][index] : searchArray[index][nbRow - 1]);
14117
14123
  }
@@ -14493,7 +14499,7 @@ const POW = {
14493
14499
  base (number) ${_lt("The number to raise to the exponent power.")}
14494
14500
  exponent (number) ${_lt("The exponent to raise base to.")}
14495
14501
  `),
14496
- returns: ["BOOLEAN"],
14502
+ returns: ["NUMBER"],
14497
14503
  compute: function (base, exponent) {
14498
14504
  return POWER.compute(base, exponent);
14499
14505
  },
@@ -19747,6 +19753,12 @@ css /* scss */ `
19747
19753
  height: 25px;
19748
19754
  }
19749
19755
  }
19756
+ /** Make the character a bit bigger
19757
+ compared to its neighbor INPUT box */
19758
+ .o-remove-selection {
19759
+ font-weight: bold;
19760
+ font-size: calc(100% + 4px);
19761
+ }
19750
19762
  }
19751
19763
  `;
19752
19764
  /**
@@ -19838,6 +19850,9 @@ class SelectionInput extends Component {
19838
19850
  }
19839
19851
  }
19840
19852
  }
19853
+ extractRanges(value) {
19854
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
19855
+ }
19841
19856
  focus(rangeId) {
19842
19857
  this.state.isMissing = false;
19843
19858
  this.state.mode = "select-range";
@@ -19857,15 +19872,16 @@ class SelectionInput extends Component {
19857
19872
  }
19858
19873
  onInputChanged(rangeId, ev) {
19859
19874
  const target = ev.target;
19875
+ const value = this.extractRanges(target.value);
19860
19876
  this.env.model.dispatch("CHANGE_RANGE", {
19861
19877
  id: this.id,
19862
19878
  rangeId,
19863
- value: target.value,
19879
+ value,
19864
19880
  });
19865
19881
  target.blur();
19866
19882
  this.triggerChange();
19867
19883
  }
19868
- disable() {
19884
+ confirm() {
19869
19885
  var _a, _b;
19870
19886
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
19871
19887
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -25187,7 +25203,7 @@ function extractStyle(cell, data) {
25187
25203
  if (cell.style) {
25188
25204
  style = data.styles[cell.style];
25189
25205
  }
25190
- const format = cell.format ? data.formats[cell.format] : undefined;
25206
+ const format = extractFormat(cell, data);
25191
25207
  const exportedBorder = {};
25192
25208
  if (cell.border) {
25193
25209
  const border = data.borders[cell.border];
@@ -25221,6 +25237,22 @@ function extractStyle(cell, data) {
25221
25237
  styles.font["italic"] = !!(style === null || style === void 0 ? void 0 : style.italic) || undefined;
25222
25238
  return styles;
25223
25239
  }
25240
+ function extractFormat(cell, data) {
25241
+ if (cell.format) {
25242
+ return data.formats[cell.format];
25243
+ }
25244
+ if (cell.isFormula) {
25245
+ const tokens = tokenize(cell.content || "");
25246
+ const functions = functionRegistry.content;
25247
+ const isExported = tokens
25248
+ .filter((tk) => tk.type === "FUNCTION")
25249
+ .every((tk) => functions[tk.value.toUpperCase()].isExported);
25250
+ if (!isExported) {
25251
+ return cell.computedFormat;
25252
+ }
25253
+ }
25254
+ return undefined;
25255
+ }
25224
25256
  function normalizeStyle(construct, styles) {
25225
25257
  const { id: fontId } = pushElement(styles["font"], construct.fonts);
25226
25258
  const { id: fillId } = pushElement(styles["fill"], construct.fills);
@@ -29971,9 +30003,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29971
30003
  const elements = cmd.dimension === "COL"
29972
30004
  ? this.getters.getNumberCols(cmd.sheetId)
29973
30005
  : this.getters.getNumberRows(cmd.sheetId);
29974
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29975
- ? 0 /* CommandResult.Success */
29976
- : 66 /* CommandResult.TooManyHiddenElements */;
30006
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
30007
+ if (hiddenElements.size >= elements) {
30008
+ return 66 /* CommandResult.TooManyHiddenElements */;
30009
+ }
30010
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30011
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30012
+ }
30013
+ else {
30014
+ return 0 /* CommandResult.Success */;
30015
+ }
29977
30016
  }
29978
30017
  case "REMOVE_COLUMNS_ROWS":
29979
30018
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -31137,6 +31176,28 @@ class SheetPlugin extends CorePlugin {
31137
31176
  return this.orderedSheetIds.length > 1
31138
31177
  ? 0 /* CommandResult.Success */
31139
31178
  : 9 /* CommandResult.NotEnoughSheets */;
31179
+ case "ADD_COLUMNS_ROWS":
31180
+ const elements = cmd.dimension === "COL"
31181
+ ? this.getNumberCols(cmd.sheetId)
31182
+ : this.getNumberRows(cmd.sheetId);
31183
+ if (cmd.base < 0 || cmd.base > elements) {
31184
+ return 86 /* CommandResult.InvalidHeaderIndex */;
31185
+ }
31186
+ else if (cmd.quantity <= 0) {
31187
+ return 87 /* CommandResult.InvalidQuantity */;
31188
+ }
31189
+ return 0 /* CommandResult.Success */;
31190
+ case "REMOVE_COLUMNS_ROWS": {
31191
+ const elements = cmd.dimension === "COL"
31192
+ ? this.getNumberCols(cmd.sheetId)
31193
+ : this.getNumberRows(cmd.sheetId);
31194
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31195
+ return 86 /* CommandResult.InvalidHeaderIndex */;
31196
+ }
31197
+ else {
31198
+ return 0 /* CommandResult.Success */;
31199
+ }
31200
+ }
31140
31201
  case "FREEZE_ROWS": {
31141
31202
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
31142
31203
  }
@@ -32302,7 +32363,7 @@ class EvaluationPlugin extends UIPlugin {
32302
32363
  // magic "empty" value
32303
32364
  // Returning {value: null} instead of undefined will ensure that we don't
32304
32365
  // fall back on the default value of the argument provided to the formula's compute function
32305
- return { value: null };
32366
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32306
32367
  }
32307
32368
  return getEvaluatedCell(cell);
32308
32369
  }
@@ -32385,8 +32446,12 @@ class EvaluationPlugin extends UIPlugin {
32385
32446
  const cell = this.getters.getCell(position);
32386
32447
  if (cell) {
32387
32448
  const exportedCellData = sheet.cells[xc];
32388
- exportedCellData.value = this.getEvaluatedCell(position).value;
32449
+ const evaluatedCell = this.getEvaluatedCell(position);
32450
+ exportedCellData.value = evaluatedCell.value;
32389
32451
  exportedCellData.isFormula = cell.isFormula && !this.isBadExpression(cell.content);
32452
+ if (cell.format !== evaluatedCell.format) {
32453
+ exportedCellData.computedFormat = evaluatedCell.format;
32454
+ }
32390
32455
  }
32391
32456
  }
32392
32457
  }
@@ -35849,6 +35914,9 @@ RendererPlugin.getters = ["getColDimensionsInViewport", "getRowDimensionsInViewp
35849
35914
  */
35850
35915
  class SelectionInputPlugin extends UIPlugin {
35851
35916
  constructor(config, initialRanges, inputHasSingleRange) {
35917
+ if (inputHasSingleRange && initialRanges.length > 1) {
35918
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
35919
+ }
35852
35920
  super(config);
35853
35921
  this.inputHasSingleRange = inputHasSingleRange;
35854
35922
  this.ranges = [];
@@ -35871,6 +35939,11 @@ class SelectionInputPlugin extends UIPlugin {
35871
35939
  return 30 /* CommandResult.MaximumRangesReached */;
35872
35940
  }
35873
35941
  break;
35942
+ case "CHANGE_RANGE":
35943
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35944
+ return 30 /* CommandResult.MaximumRangesReached */;
35945
+ }
35946
+ break;
35874
35947
  }
35875
35948
  return 0 /* CommandResult.Success */;
35876
35949
  }
@@ -36695,13 +36768,9 @@ class Session extends EventBus {
36695
36768
  }
36696
36769
  loadInitialMessages(messages) {
36697
36770
  this.isReplayingInitialRevisions = true;
36698
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
36699
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
36700
- });
36701
36771
  for (const message of messages) {
36702
36772
  this.onMessageReceived(message);
36703
36773
  }
36704
- this.off("unexpected-revision-id", this);
36705
36774
  this.isReplayingInitialRevisions = false;
36706
36775
  }
36707
36776
  /**
@@ -36773,6 +36842,10 @@ class Session extends EventBus {
36773
36842
  onMessageReceived(message) {
36774
36843
  if (this.isAlreadyProcessed(message))
36775
36844
  return;
36845
+ if (this.isWrongServerRevisionId(message)) {
36846
+ this.trigger("unexpected-revision-id");
36847
+ return;
36848
+ }
36776
36849
  switch (message.type) {
36777
36850
  case "CLIENT_MOVED":
36778
36851
  this.onClientMoved(message);
@@ -36799,10 +36872,6 @@ class Session extends EventBus {
36799
36872
  });
36800
36873
  break;
36801
36874
  case "REMOTE_REVISION":
36802
- if (message.serverRevisionId !== this.serverRevisionId) {
36803
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
36804
- return;
36805
- }
36806
36875
  const { clientId, commands } = message;
36807
36876
  const revision = new Revision(message.nextRevisionId, clientId, commands);
36808
36877
  if (revision.clientId !== this.clientId) {
@@ -36934,6 +37003,17 @@ class Session extends EventBus {
36934
37003
  return false;
36935
37004
  }
36936
37005
  }
37006
+ isWrongServerRevisionId(message) {
37007
+ switch (message.type) {
37008
+ case "REMOTE_REVISION":
37009
+ case "REVISION_REDONE":
37010
+ case "REVISION_UNDONE":
37011
+ case "SNAPSHOT_CREATED":
37012
+ return message.serverRevisionId !== this.serverRevisionId;
37013
+ default:
37014
+ return false;
37015
+ }
37016
+ }
36937
37017
  dropPendingHistoryMessages() {
36938
37018
  this.waitingUndoRedoAck = false;
36939
37019
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -39564,7 +39644,6 @@ css /* scss */ `
39564
39644
  color: dimgrey;
39565
39645
  }
39566
39646
  .o-sidePanelClose {
39567
- font-size: 1.5rem;
39568
39647
  padding: 5px 10px;
39569
39648
  cursor: pointer;
39570
39649
  &:hover {
@@ -42564,12 +42643,9 @@ function addFormula(cell) {
42564
42643
  else {
42565
42644
  // Shouldn't we always output the value then ?
42566
42645
  const value = cell.value;
42567
- // what if value = 0? Is this condition correct?
42568
- if (value) {
42569
- const type = getCellType(value);
42570
- attrs.push(["t", type]);
42571
- node = escapeXml /*xml*/ `<v>${value}</v>`;
42572
- }
42646
+ const type = getCellType(value);
42647
+ attrs.push(["t", type]);
42648
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
42573
42649
  return { attrs, node };
42574
42650
  }
42575
42651
  }
@@ -44151,6 +44227,6 @@ function addFunction(functionName, functionDescription) {
44151
44227
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
44152
44228
 
44153
44229
 
44154
- __info__.version = '16.1.9';
44155
- __info__.date = '2023-04-21T07:29:41.080Z';
44156
- __info__.hash = '686bffa';
44230
+ __info__.version = '16.1.11';
44231
+ __info__.date = '2023-05-12T10:58:24.113Z';
44232
+ __info__.hash = 'd9a2cce';