@odoo/o-spreadsheet 16.0.8 → 16.0.10

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.
@@ -3273,6 +3273,8 @@ exports.CommandResult = void 0;
3273
3273
  CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3274
3274
  CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3275
3275
  CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3276
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3277
+ CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3276
3278
  })(exports.CommandResult || (exports.CommandResult = {}));
3277
3279
 
3278
3280
  var DIRECTION;
@@ -6415,6 +6417,12 @@ css /* scss */ `
6415
6417
  height: 25px;
6416
6418
  }
6417
6419
  }
6420
+ /** Make the character a bit bigger
6421
+ compared to its neighbor INPUT box */
6422
+ .o-remove-selection {
6423
+ font-weight: bold;
6424
+ font-size: calc(100% + 4px);
6425
+ }
6418
6426
  }
6419
6427
  `;
6420
6428
  /**
@@ -6491,6 +6499,9 @@ class SelectionInput extends owl.Component {
6491
6499
  (_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
6492
6500
  this.previousRanges = ranges;
6493
6501
  }
6502
+ extractRanges(value) {
6503
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
6504
+ }
6494
6505
  focus(rangeId) {
6495
6506
  this.state.isMissing = false;
6496
6507
  this.env.model.dispatch("FOCUS_RANGE", {
@@ -6509,15 +6520,16 @@ class SelectionInput extends owl.Component {
6509
6520
  }
6510
6521
  onInputChanged(rangeId, ev) {
6511
6522
  const target = ev.target;
6523
+ const value = this.extractRanges(target.value);
6512
6524
  this.env.model.dispatch("CHANGE_RANGE", {
6513
6525
  id: this.id,
6514
6526
  rangeId,
6515
- value: target.value,
6527
+ value,
6516
6528
  });
6517
6529
  target.blur();
6518
6530
  this.triggerChange();
6519
6531
  }
6520
- disable() {
6532
+ confirm() {
6521
6533
  var _a, _b;
6522
6534
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
6523
6535
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -17411,7 +17423,7 @@ const POW = {
17411
17423
  base (number) ${_lt("The number to raise to the exponent power.")}
17412
17424
  exponent (number) ${_lt("The exponent to raise base to.")}
17413
17425
  `),
17414
- returns: ["BOOLEAN"],
17426
+ returns: ["NUMBER"],
17415
17427
  compute: function (base, exponent) {
17416
17428
  return POWER.compute(base, exponent);
17417
17429
  },
@@ -24355,7 +24367,7 @@ function extractStyle(cell, data) {
24355
24367
  if (cell.style) {
24356
24368
  style = data.styles[cell.style];
24357
24369
  }
24358
- const format = cell.format ? data.formats[cell.format] : undefined;
24370
+ const format = extractFormat(cell, data);
24359
24371
  const exportedBorder = {};
24360
24372
  if (cell.border) {
24361
24373
  const border = data.borders[cell.border];
@@ -24389,6 +24401,22 @@ function extractStyle(cell, data) {
24389
24401
  styles.font["italic"] = !!(style === null || style === void 0 ? void 0 : style.italic) || undefined;
24390
24402
  return styles;
24391
24403
  }
24404
+ function extractFormat(cell, data) {
24405
+ if (cell.format) {
24406
+ return data.formats[cell.format];
24407
+ }
24408
+ if (cell.isFormula) {
24409
+ const tokens = tokenize(cell.content || "");
24410
+ const functions = functionRegistry.content;
24411
+ const isExported = tokens
24412
+ .filter((tk) => tk.type === "FUNCTION")
24413
+ .every((tk) => functions[tk.value.toUpperCase()].isExported);
24414
+ if (!isExported) {
24415
+ return cell.computedFormat;
24416
+ }
24417
+ }
24418
+ return undefined;
24419
+ }
24392
24420
  function normalizeStyle(construct, styles) {
24393
24421
  const { id: fontId } = pushElement(styles["font"], construct.fonts);
24394
24422
  const { id: fillId } = pushElement(styles["fill"], construct.fills);
@@ -27611,6 +27639,9 @@ class CellPlugin extends CorePlugin {
27611
27639
  const exportedCellData = sheet.cells[xc];
27612
27640
  exportedCellData.value = cell.evaluated.value;
27613
27641
  exportedCellData.isFormula = cell.isFormula();
27642
+ if (cell.format !== cell.evaluated.format) {
27643
+ exportedCellData.computedFormat = cell.evaluated.format;
27644
+ }
27614
27645
  }
27615
27646
  }
27616
27647
  }
@@ -29063,9 +29094,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29063
29094
  const elements = cmd.dimension === "COL"
29064
29095
  ? this.getters.getNumberCols(cmd.sheetId)
29065
29096
  : this.getters.getNumberRows(cmd.sheetId);
29066
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29067
- ? 0 /* CommandResult.Success */
29068
- : 65 /* CommandResult.TooManyHiddenElements */;
29097
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29098
+ if (hiddenElements.size >= elements) {
29099
+ return 65 /* CommandResult.TooManyHiddenElements */;
29100
+ }
29101
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29102
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29103
+ }
29104
+ else {
29105
+ return 0 /* CommandResult.Success */;
29106
+ }
29069
29107
  }
29070
29108
  case "REMOVE_COLUMNS_ROWS":
29071
29109
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -29720,6 +29758,28 @@ class SheetPlugin extends CorePlugin {
29720
29758
  return this.orderedSheetIds.length > 1
29721
29759
  ? 0 /* CommandResult.Success */
29722
29760
  : 9 /* CommandResult.NotEnoughSheets */;
29761
+ case "ADD_COLUMNS_ROWS":
29762
+ const elements = cmd.dimension === "COL"
29763
+ ? this.getNumberCols(cmd.sheetId)
29764
+ : this.getNumberRows(cmd.sheetId);
29765
+ if (cmd.base < 0 || cmd.base > elements) {
29766
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29767
+ }
29768
+ else if (cmd.quantity <= 0) {
29769
+ return 86 /* CommandResult.InvalidQuantity */;
29770
+ }
29771
+ return 0 /* CommandResult.Success */;
29772
+ case "REMOVE_COLUMNS_ROWS": {
29773
+ const elements = cmd.dimension === "COL"
29774
+ ? this.getNumberCols(cmd.sheetId)
29775
+ : this.getNumberRows(cmd.sheetId);
29776
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29777
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29778
+ }
29779
+ else {
29780
+ return 0 /* CommandResult.Success */;
29781
+ }
29782
+ }
29723
29783
  case "FREEZE_ROWS": {
29724
29784
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
29725
29785
  }
@@ -32431,7 +32491,7 @@ class EvaluationPlugin extends UIPlugin {
32431
32491
  // magic "empty" value
32432
32492
  // Returning {value: null} instead of undefined will ensure that we don't
32433
32493
  // fall back on the default value of the argument provided to the formula's compute function
32434
- return { value: null };
32494
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32435
32495
  }
32436
32496
  return getEvaluatedCell(cell);
32437
32497
  }
@@ -34846,6 +34906,9 @@ const uuidGenerator = new UuidGenerator();
34846
34906
  */
34847
34907
  class SelectionInputPlugin extends UIPlugin {
34848
34908
  constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
34909
+ if (inputHasSingleRange && initialRanges.length > 1) {
34910
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
34911
+ }
34849
34912
  super(getters, state, dispatch, config, selection);
34850
34913
  this.inputHasSingleRange = inputHasSingleRange;
34851
34914
  this.ranges = [];
@@ -34868,6 +34931,11 @@ class SelectionInputPlugin extends UIPlugin {
34868
34931
  return 29 /* CommandResult.MaximumRangesReached */;
34869
34932
  }
34870
34933
  break;
34934
+ case "CHANGE_RANGE":
34935
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34936
+ return 29 /* CommandResult.MaximumRangesReached */;
34937
+ }
34938
+ break;
34871
34939
  }
34872
34940
  return 0 /* CommandResult.Success */;
34873
34941
  }
@@ -35681,13 +35749,9 @@ class Session extends EventBus {
35681
35749
  }
35682
35750
  loadInitialMessages(messages) {
35683
35751
  this.isReplayingInitialRevisions = true;
35684
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
35685
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
35686
- });
35687
35752
  for (const message of messages) {
35688
35753
  this.onMessageReceived(message);
35689
35754
  }
35690
- this.off("unexpected-revision-id", this);
35691
35755
  this.isReplayingInitialRevisions = false;
35692
35756
  }
35693
35757
  /**
@@ -35759,6 +35823,10 @@ class Session extends EventBus {
35759
35823
  onMessageReceived(message) {
35760
35824
  if (this.isAlreadyProcessed(message))
35761
35825
  return;
35826
+ if (this.isWrongServerRevisionId(message)) {
35827
+ this.trigger("unexpected-revision-id");
35828
+ return;
35829
+ }
35762
35830
  switch (message.type) {
35763
35831
  case "CLIENT_MOVED":
35764
35832
  this.onClientMoved(message);
@@ -35785,10 +35853,6 @@ class Session extends EventBus {
35785
35853
  });
35786
35854
  break;
35787
35855
  case "REMOTE_REVISION":
35788
- if (message.serverRevisionId !== this.serverRevisionId) {
35789
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35790
- return;
35791
- }
35792
35856
  const { clientId, commands } = message;
35793
35857
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35794
35858
  if (revision.clientId !== this.clientId) {
@@ -35920,6 +35984,17 @@ class Session extends EventBus {
35920
35984
  return false;
35921
35985
  }
35922
35986
  }
35987
+ isWrongServerRevisionId(message) {
35988
+ switch (message.type) {
35989
+ case "REMOTE_REVISION":
35990
+ case "REVISION_REDONE":
35991
+ case "REVISION_UNDONE":
35992
+ case "SNAPSHOT_CREATED":
35993
+ return message.serverRevisionId !== this.serverRevisionId;
35994
+ default:
35995
+ return false;
35996
+ }
35997
+ }
35923
35998
  dropPendingHistoryMessages() {
35924
35999
  this.waitingUndoRedoAck = false;
35925
36000
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37883,7 +37958,6 @@ css /* scss */ `
37883
37958
  color: dimgrey;
37884
37959
  }
37885
37960
  .o-sidePanelClose {
37886
- font-size: 1.5rem;
37887
37961
  padding: 5px 10px;
37888
37962
  cursor: pointer;
37889
37963
  &:hover {
@@ -41167,12 +41241,9 @@ function addFormula(cell) {
41167
41241
  else {
41168
41242
  // Shouldn't we always output the value then ?
41169
41243
  const value = cell.value;
41170
- // what if value = 0? Is this condition correct?
41171
- if (value) {
41172
- const type = getCellType(value);
41173
- attrs.push(["t", type]);
41174
- node = escapeXml /*xml*/ `<v>${value}</v>`;
41175
- }
41244
+ const type = getCellType(value);
41245
+ attrs.push(["t", type]);
41246
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
41176
41247
  return { attrs, node };
41177
41248
  }
41178
41249
  }
@@ -42732,6 +42803,6 @@ exports.setTranslationMethod = setTranslationMethod;
42732
42803
  exports.tokenize = tokenize;
42733
42804
 
42734
42805
 
42735
- __info__.version = '16.0.8';
42736
- __info__.date = '2023-04-21T07:29:33.894Z';
42737
- __info__.hash = 'dbd7aa4';
42806
+ __info__.version = '16.0.10';
42807
+ __info__.date = '2023-05-12T10:59:27.820Z';
42808
+ __info__.hash = '115eda7';
@@ -818,6 +818,7 @@ interface ExcelWorkbookData extends WorkbookData {
818
818
  interface ExcelCellData extends CellData {
819
819
  value: CellValue;
820
820
  isFormula: Boolean;
821
+ computedFormat?: Format;
821
822
  }
822
823
  interface ExcelSheetData extends Omit<SheetData, "figureTables"> {
823
824
  cells: {
@@ -872,7 +873,6 @@ interface CollaborativeEventReceived {
872
873
  }
873
874
  interface UnexpectedRevisionIdEvent {
874
875
  type: "unexpected-revision-id";
875
- revisionId: UID;
876
876
  }
877
877
  interface NewLocalStateUpdateEvent {
878
878
  type: "new-local-state-update";
@@ -2178,7 +2178,9 @@ declare const enum CommandResult {
2178
2178
  DuplicatedFigureId = 81,
2179
2179
  InvalidSelectionStep = 82,
2180
2180
  DuplicatedChartId = 83,
2181
- ChartDoesNotExist = 84
2181
+ ChartDoesNotExist = 84,
2182
+ InvalidHeaderIndex = 85,
2183
+ InvalidQuantity = 86
2182
2184
  }
2183
2185
  interface CommandHandler<T> {
2184
2186
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2806,6 +2808,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
2806
2808
  private sendPendingMessage;
2807
2809
  private acknowledge;
2808
2810
  private isAlreadyProcessed;
2811
+ isWrongServerRevisionId(message: CollaborationMessage): boolean;
2809
2812
  private dropPendingHistoryMessages;
2810
2813
  }
2811
2814
 
@@ -3389,7 +3392,7 @@ declare class HeaderSizePlugin extends CorePlugin<HeaderSizeState> implements He
3389
3392
  declare class HeaderVisibilityPlugin extends CorePlugin {
3390
3393
  static getters: readonly ["canRemoveHeaders", "getHiddenColsGroups", "getHiddenRowsGroups", "isRowHiddenByUser", "isColHiddenByUser"];
3391
3394
  private readonly hiddenHeaders;
3392
- allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements;
3395
+ allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements | CommandResult.InvalidHeaderIndex;
3393
3396
  handle(cmd: Command): void;
3394
3397
  canRemoveHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
3395
3398
  isRowHiddenByUser(sheetId: UID, index: HeaderIndex): boolean;
@@ -4859,11 +4862,12 @@ declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4859
4862
  checkChange(): void;
4860
4863
  getColor(range: SelectionRange): string;
4861
4864
  private triggerChange;
4865
+ private extractRanges;
4862
4866
  focus(rangeId: string): void;
4863
4867
  addEmptyInput(): void;
4864
4868
  removeInput(rangeId: string): void;
4865
4869
  onInputChanged(rangeId: string, ev: InputEvent): void;
4866
- disable(): void;
4870
+ confirm(): void;
4867
4871
  }
4868
4872
 
4869
4873
  interface Props$x {
@@ -3269,6 +3269,8 @@ var CommandResult;
3269
3269
  CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3270
3270
  CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3271
3271
  CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3272
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3273
+ CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3272
3274
  })(CommandResult || (CommandResult = {}));
3273
3275
 
3274
3276
  var DIRECTION;
@@ -6411,6 +6413,12 @@ css /* scss */ `
6411
6413
  height: 25px;
6412
6414
  }
6413
6415
  }
6416
+ /** Make the character a bit bigger
6417
+ compared to its neighbor INPUT box */
6418
+ .o-remove-selection {
6419
+ font-weight: bold;
6420
+ font-size: calc(100% + 4px);
6421
+ }
6414
6422
  }
6415
6423
  `;
6416
6424
  /**
@@ -6487,6 +6495,9 @@ class SelectionInput extends Component {
6487
6495
  (_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
6488
6496
  this.previousRanges = ranges;
6489
6497
  }
6498
+ extractRanges(value) {
6499
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
6500
+ }
6490
6501
  focus(rangeId) {
6491
6502
  this.state.isMissing = false;
6492
6503
  this.env.model.dispatch("FOCUS_RANGE", {
@@ -6505,15 +6516,16 @@ class SelectionInput extends Component {
6505
6516
  }
6506
6517
  onInputChanged(rangeId, ev) {
6507
6518
  const target = ev.target;
6519
+ const value = this.extractRanges(target.value);
6508
6520
  this.env.model.dispatch("CHANGE_RANGE", {
6509
6521
  id: this.id,
6510
6522
  rangeId,
6511
- value: target.value,
6523
+ value,
6512
6524
  });
6513
6525
  target.blur();
6514
6526
  this.triggerChange();
6515
6527
  }
6516
- disable() {
6528
+ confirm() {
6517
6529
  var _a, _b;
6518
6530
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
6519
6531
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -17407,7 +17419,7 @@ const POW = {
17407
17419
  base (number) ${_lt("The number to raise to the exponent power.")}
17408
17420
  exponent (number) ${_lt("The exponent to raise base to.")}
17409
17421
  `),
17410
- returns: ["BOOLEAN"],
17422
+ returns: ["NUMBER"],
17411
17423
  compute: function (base, exponent) {
17412
17424
  return POWER.compute(base, exponent);
17413
17425
  },
@@ -24351,7 +24363,7 @@ function extractStyle(cell, data) {
24351
24363
  if (cell.style) {
24352
24364
  style = data.styles[cell.style];
24353
24365
  }
24354
- const format = cell.format ? data.formats[cell.format] : undefined;
24366
+ const format = extractFormat(cell, data);
24355
24367
  const exportedBorder = {};
24356
24368
  if (cell.border) {
24357
24369
  const border = data.borders[cell.border];
@@ -24385,6 +24397,22 @@ function extractStyle(cell, data) {
24385
24397
  styles.font["italic"] = !!(style === null || style === void 0 ? void 0 : style.italic) || undefined;
24386
24398
  return styles;
24387
24399
  }
24400
+ function extractFormat(cell, data) {
24401
+ if (cell.format) {
24402
+ return data.formats[cell.format];
24403
+ }
24404
+ if (cell.isFormula) {
24405
+ const tokens = tokenize(cell.content || "");
24406
+ const functions = functionRegistry.content;
24407
+ const isExported = tokens
24408
+ .filter((tk) => tk.type === "FUNCTION")
24409
+ .every((tk) => functions[tk.value.toUpperCase()].isExported);
24410
+ if (!isExported) {
24411
+ return cell.computedFormat;
24412
+ }
24413
+ }
24414
+ return undefined;
24415
+ }
24388
24416
  function normalizeStyle(construct, styles) {
24389
24417
  const { id: fontId } = pushElement(styles["font"], construct.fonts);
24390
24418
  const { id: fillId } = pushElement(styles["fill"], construct.fills);
@@ -27607,6 +27635,9 @@ class CellPlugin extends CorePlugin {
27607
27635
  const exportedCellData = sheet.cells[xc];
27608
27636
  exportedCellData.value = cell.evaluated.value;
27609
27637
  exportedCellData.isFormula = cell.isFormula();
27638
+ if (cell.format !== cell.evaluated.format) {
27639
+ exportedCellData.computedFormat = cell.evaluated.format;
27640
+ }
27610
27641
  }
27611
27642
  }
27612
27643
  }
@@ -29059,9 +29090,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29059
29090
  const elements = cmd.dimension === "COL"
29060
29091
  ? this.getters.getNumberCols(cmd.sheetId)
29061
29092
  : this.getters.getNumberRows(cmd.sheetId);
29062
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29063
- ? 0 /* CommandResult.Success */
29064
- : 65 /* CommandResult.TooManyHiddenElements */;
29093
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29094
+ if (hiddenElements.size >= elements) {
29095
+ return 65 /* CommandResult.TooManyHiddenElements */;
29096
+ }
29097
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29098
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29099
+ }
29100
+ else {
29101
+ return 0 /* CommandResult.Success */;
29102
+ }
29065
29103
  }
29066
29104
  case "REMOVE_COLUMNS_ROWS":
29067
29105
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -29716,6 +29754,28 @@ class SheetPlugin extends CorePlugin {
29716
29754
  return this.orderedSheetIds.length > 1
29717
29755
  ? 0 /* CommandResult.Success */
29718
29756
  : 9 /* CommandResult.NotEnoughSheets */;
29757
+ case "ADD_COLUMNS_ROWS":
29758
+ const elements = cmd.dimension === "COL"
29759
+ ? this.getNumberCols(cmd.sheetId)
29760
+ : this.getNumberRows(cmd.sheetId);
29761
+ if (cmd.base < 0 || cmd.base > elements) {
29762
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29763
+ }
29764
+ else if (cmd.quantity <= 0) {
29765
+ return 86 /* CommandResult.InvalidQuantity */;
29766
+ }
29767
+ return 0 /* CommandResult.Success */;
29768
+ case "REMOVE_COLUMNS_ROWS": {
29769
+ const elements = cmd.dimension === "COL"
29770
+ ? this.getNumberCols(cmd.sheetId)
29771
+ : this.getNumberRows(cmd.sheetId);
29772
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29773
+ return 85 /* CommandResult.InvalidHeaderIndex */;
29774
+ }
29775
+ else {
29776
+ return 0 /* CommandResult.Success */;
29777
+ }
29778
+ }
29719
29779
  case "FREEZE_ROWS": {
29720
29780
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
29721
29781
  }
@@ -32427,7 +32487,7 @@ class EvaluationPlugin extends UIPlugin {
32427
32487
  // magic "empty" value
32428
32488
  // Returning {value: null} instead of undefined will ensure that we don't
32429
32489
  // fall back on the default value of the argument provided to the formula's compute function
32430
- return { value: null };
32490
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32431
32491
  }
32432
32492
  return getEvaluatedCell(cell);
32433
32493
  }
@@ -34842,6 +34902,9 @@ const uuidGenerator = new UuidGenerator();
34842
34902
  */
34843
34903
  class SelectionInputPlugin extends UIPlugin {
34844
34904
  constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
34905
+ if (inputHasSingleRange && initialRanges.length > 1) {
34906
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
34907
+ }
34845
34908
  super(getters, state, dispatch, config, selection);
34846
34909
  this.inputHasSingleRange = inputHasSingleRange;
34847
34910
  this.ranges = [];
@@ -34864,6 +34927,11 @@ class SelectionInputPlugin extends UIPlugin {
34864
34927
  return 29 /* CommandResult.MaximumRangesReached */;
34865
34928
  }
34866
34929
  break;
34930
+ case "CHANGE_RANGE":
34931
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34932
+ return 29 /* CommandResult.MaximumRangesReached */;
34933
+ }
34934
+ break;
34867
34935
  }
34868
34936
  return 0 /* CommandResult.Success */;
34869
34937
  }
@@ -35677,13 +35745,9 @@ class Session extends EventBus {
35677
35745
  }
35678
35746
  loadInitialMessages(messages) {
35679
35747
  this.isReplayingInitialRevisions = true;
35680
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
35681
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
35682
- });
35683
35748
  for (const message of messages) {
35684
35749
  this.onMessageReceived(message);
35685
35750
  }
35686
- this.off("unexpected-revision-id", this);
35687
35751
  this.isReplayingInitialRevisions = false;
35688
35752
  }
35689
35753
  /**
@@ -35755,6 +35819,10 @@ class Session extends EventBus {
35755
35819
  onMessageReceived(message) {
35756
35820
  if (this.isAlreadyProcessed(message))
35757
35821
  return;
35822
+ if (this.isWrongServerRevisionId(message)) {
35823
+ this.trigger("unexpected-revision-id");
35824
+ return;
35825
+ }
35758
35826
  switch (message.type) {
35759
35827
  case "CLIENT_MOVED":
35760
35828
  this.onClientMoved(message);
@@ -35781,10 +35849,6 @@ class Session extends EventBus {
35781
35849
  });
35782
35850
  break;
35783
35851
  case "REMOTE_REVISION":
35784
- if (message.serverRevisionId !== this.serverRevisionId) {
35785
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35786
- return;
35787
- }
35788
35852
  const { clientId, commands } = message;
35789
35853
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35790
35854
  if (revision.clientId !== this.clientId) {
@@ -35916,6 +35980,17 @@ class Session extends EventBus {
35916
35980
  return false;
35917
35981
  }
35918
35982
  }
35983
+ isWrongServerRevisionId(message) {
35984
+ switch (message.type) {
35985
+ case "REMOTE_REVISION":
35986
+ case "REVISION_REDONE":
35987
+ case "REVISION_UNDONE":
35988
+ case "SNAPSHOT_CREATED":
35989
+ return message.serverRevisionId !== this.serverRevisionId;
35990
+ default:
35991
+ return false;
35992
+ }
35993
+ }
35919
35994
  dropPendingHistoryMessages() {
35920
35995
  this.waitingUndoRedoAck = false;
35921
35996
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37879,7 +37954,6 @@ css /* scss */ `
37879
37954
  color: dimgrey;
37880
37955
  }
37881
37956
  .o-sidePanelClose {
37882
- font-size: 1.5rem;
37883
37957
  padding: 5px 10px;
37884
37958
  cursor: pointer;
37885
37959
  &:hover {
@@ -41163,12 +41237,9 @@ function addFormula(cell) {
41163
41237
  else {
41164
41238
  // Shouldn't we always output the value then ?
41165
41239
  const value = cell.value;
41166
- // what if value = 0? Is this condition correct?
41167
- if (value) {
41168
- const type = getCellType(value);
41169
- attrs.push(["t", type]);
41170
- node = escapeXml /*xml*/ `<v>${value}</v>`;
41171
- }
41240
+ const type = getCellType(value);
41241
+ attrs.push(["t", type]);
41242
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
41172
41243
  return { attrs, node };
41173
41244
  }
41174
41245
  }
@@ -42700,6 +42771,6 @@ function addFunction(functionName, functionDescription) {
42700
42771
  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 };
42701
42772
 
42702
42773
 
42703
- __info__.version = '16.0.8';
42704
- __info__.date = '2023-04-21T07:29:33.894Z';
42705
- __info__.hash = 'dbd7aa4';
42774
+ __info__.version = '16.0.10';
42775
+ __info__.date = '2023-05-12T10:59:27.820Z';
42776
+ __info__.hash = '115eda7';