@odoo/o-spreadsheet 16.0.29 → 16.0.31

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.
@@ -1611,6 +1611,9 @@ function parseFormat(formatString) {
1611
1611
  function formatValue(value, format) {
1612
1612
  switch (typeof value) {
1613
1613
  case "string":
1614
+ if (value.includes('\\"')) {
1615
+ return value.replace(/\\"/g, '"');
1616
+ }
1614
1617
  return value;
1615
1618
  case "boolean":
1616
1619
  return value ? "TRUE" : "FALSE";
@@ -1895,27 +1898,30 @@ function createDefaultFormat(value) {
1895
1898
  }
1896
1899
  function createLargeNumberFormat(format, magnitude, postFix) {
1897
1900
  const internalFormat = parseFormat(format || "#,##0");
1898
- const largeNumberFormat = internalFormat
1899
- .map((formatPart) => {
1900
- if (formatPart.type === "NUMBER") {
1901
- return [
1902
- {
1903
- ...formatPart,
1904
- format: {
1905
- ...formatPart.format,
1906
- magnitude,
1907
- decimalPart: undefined,
1908
- },
1909
- },
1910
- {
1911
- type: "STRING",
1912
- format: postFix,
1913
- },
1914
- ];
1901
+ const largeNumberFormat = [];
1902
+ for (let i = 0; i < internalFormat.length; i++) {
1903
+ const formatPart = internalFormat[i];
1904
+ if (formatPart.type !== "NUMBER") {
1905
+ largeNumberFormat.push(formatPart);
1906
+ continue;
1915
1907
  }
1916
- return formatPart;
1917
- })
1918
- .flat();
1908
+ largeNumberFormat.push({
1909
+ ...formatPart,
1910
+ format: {
1911
+ ...formatPart.format,
1912
+ magnitude,
1913
+ decimalPart: undefined,
1914
+ },
1915
+ });
1916
+ largeNumberFormat.push({
1917
+ type: "STRING",
1918
+ format: postFix,
1919
+ });
1920
+ const nextFormatPart = internalFormat[i + 1];
1921
+ if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
1922
+ i++;
1923
+ }
1924
+ }
1919
1925
  return convertInternalFormatToFormat(largeNumberFormat);
1920
1926
  }
1921
1927
  function changeDecimalPlaces(format, step) {
@@ -3354,64 +3360,65 @@ exports.CommandResult = void 0;
3354
3360
  CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
3355
3361
  CommandResult[CommandResult["InputAlreadyFocused"] = 28] = "InputAlreadyFocused";
3356
3362
  CommandResult[CommandResult["MaximumRangesReached"] = 29] = "MaximumRangesReached";
3357
- CommandResult[CommandResult["InvalidChartDefinition"] = 30] = "InvalidChartDefinition";
3358
- CommandResult[CommandResult["InvalidDataSet"] = 31] = "InvalidDataSet";
3359
- CommandResult[CommandResult["InvalidLabelRange"] = 32] = "InvalidLabelRange";
3360
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 33] = "InvalidScorecardKeyValue";
3361
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 34] = "InvalidScorecardBaseline";
3362
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 35] = "InvalidGaugeDataRange";
3363
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 36] = "EmptyGaugeRangeMin";
3364
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 37] = "GaugeRangeMinNaN";
3365
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 38] = "EmptyGaugeRangeMax";
3366
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 39] = "GaugeRangeMaxNaN";
3367
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 40] = "GaugeRangeMinBiggerThanRangeMax";
3368
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 41] = "GaugeLowerInflectionPointNaN";
3369
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 42] = "GaugeUpperInflectionPointNaN";
3370
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 43] = "GaugeLowerBiggerThanUpper";
3371
- CommandResult[CommandResult["InvalidAutofillSelection"] = 44] = "InvalidAutofillSelection";
3372
- CommandResult[CommandResult["WrongComposerSelection"] = 45] = "WrongComposerSelection";
3373
- CommandResult[CommandResult["MinBiggerThanMax"] = 46] = "MinBiggerThanMax";
3374
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 47] = "LowerBiggerThanUpper";
3375
- CommandResult[CommandResult["MidBiggerThanMax"] = 48] = "MidBiggerThanMax";
3376
- CommandResult[CommandResult["MinBiggerThanMid"] = 49] = "MinBiggerThanMid";
3377
- CommandResult[CommandResult["FirstArgMissing"] = 50] = "FirstArgMissing";
3378
- CommandResult[CommandResult["SecondArgMissing"] = 51] = "SecondArgMissing";
3379
- CommandResult[CommandResult["MinNaN"] = 52] = "MinNaN";
3380
- CommandResult[CommandResult["MidNaN"] = 53] = "MidNaN";
3381
- CommandResult[CommandResult["MaxNaN"] = 54] = "MaxNaN";
3382
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 55] = "ValueUpperInflectionNaN";
3383
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 56] = "ValueLowerInflectionNaN";
3384
- CommandResult[CommandResult["MinInvalidFormula"] = 57] = "MinInvalidFormula";
3385
- CommandResult[CommandResult["MidInvalidFormula"] = 58] = "MidInvalidFormula";
3386
- CommandResult[CommandResult["MaxInvalidFormula"] = 59] = "MaxInvalidFormula";
3387
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 60] = "ValueUpperInvalidFormula";
3388
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 61] = "ValueLowerInvalidFormula";
3389
- CommandResult[CommandResult["InvalidSortZone"] = 62] = "InvalidSortZone";
3390
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 63] = "WaitingSessionConfirmation";
3391
- CommandResult[CommandResult["MergeOverlap"] = 64] = "MergeOverlap";
3392
- CommandResult[CommandResult["TooManyHiddenElements"] = 65] = "TooManyHiddenElements";
3393
- CommandResult[CommandResult["Readonly"] = 66] = "Readonly";
3394
- CommandResult[CommandResult["InvalidViewportSize"] = 67] = "InvalidViewportSize";
3395
- CommandResult[CommandResult["InvalidScrollingDirection"] = 68] = "InvalidScrollingDirection";
3396
- CommandResult[CommandResult["FigureDoesNotExist"] = 69] = "FigureDoesNotExist";
3397
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 70] = "InvalidConditionalFormatId";
3398
- CommandResult[CommandResult["InvalidCellPopover"] = 71] = "InvalidCellPopover";
3399
- CommandResult[CommandResult["EmptyTarget"] = 72] = "EmptyTarget";
3400
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 73] = "InvalidFreezeQuantity";
3401
- CommandResult[CommandResult["FrozenPaneOverlap"] = 74] = "FrozenPaneOverlap";
3402
- CommandResult[CommandResult["ValuesNotChanged"] = 75] = "ValuesNotChanged";
3403
- CommandResult[CommandResult["InvalidFilterZone"] = 76] = "InvalidFilterZone";
3404
- CommandResult[CommandResult["FilterOverlap"] = 77] = "FilterOverlap";
3405
- CommandResult[CommandResult["FilterNotFound"] = 78] = "FilterNotFound";
3406
- CommandResult[CommandResult["MergeInFilter"] = 79] = "MergeInFilter";
3407
- CommandResult[CommandResult["NonContinuousTargets"] = 80] = "NonContinuousTargets";
3408
- CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
3409
- CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3410
- CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3411
- CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3412
- CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3413
- CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3414
- CommandResult[CommandResult["NoChanges"] = 87] = "NoChanges";
3363
+ CommandResult[CommandResult["InvalidInputId"] = 30] = "InvalidInputId";
3364
+ CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
3365
+ CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
3366
+ CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
3367
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
3368
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
3369
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
3370
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
3371
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
3372
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
3373
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
3374
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
3375
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
3376
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
3377
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
3378
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
3379
+ CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
3380
+ CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
3381
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
3382
+ CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
3383
+ CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
3384
+ CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
3385
+ CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
3386
+ CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
3387
+ CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
3388
+ CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
3389
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
3390
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
3391
+ CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
3392
+ CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
3393
+ CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
3394
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
3395
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
3396
+ CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
3397
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
3398
+ CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
3399
+ CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
3400
+ CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
3401
+ CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
3402
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
3403
+ CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
3404
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
3405
+ CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
3406
+ CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
3407
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
3408
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
3409
+ CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
3410
+ CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
3411
+ CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
3412
+ CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
3413
+ CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
3414
+ CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
3415
+ CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
3416
+ CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3417
+ CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3418
+ CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3419
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3420
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3421
+ CommandResult[CommandResult["NoChanges"] = 88] = "NoChanges";
3415
3422
  })(exports.CommandResult || (exports.CommandResult = {}));
3416
3423
 
3417
3424
  function isMatrix(x) {
@@ -4912,7 +4919,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
4912
4919
  });
4913
4920
  }
4914
4921
  }
4915
- if (result.isCancelledBecause(62 /* CommandResult.InvalidSortZone */)) {
4922
+ if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
4916
4923
  const { col, row } = anchor;
4917
4924
  env.model.selection.selectZone({ cell: { col, row }, zone });
4918
4925
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -4935,13 +4942,13 @@ const AddFilterInteractiveContent = {
4935
4942
  };
4936
4943
  function interactiveAddFilter(env, sheetId, target) {
4937
4944
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
4938
- if (result.isCancelledBecause(77 /* CommandResult.FilterOverlap */)) {
4945
+ if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
4939
4946
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
4940
4947
  }
4941
- else if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
4948
+ else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
4942
4949
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
4943
4950
  }
4944
- else if (result.isCancelledBecause(80 /* CommandResult.NonContinuousTargets */)) {
4951
+ else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
4945
4952
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
4946
4953
  }
4947
4954
  }
@@ -4963,7 +4970,7 @@ function handlePasteResult(env, result) {
4963
4970
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
4964
4971
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
4965
4972
  }
4966
- else if (result.reasons.includes(74 /* CommandResult.FrozenPaneOverlap */)) {
4973
+ else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
4967
4974
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
4968
4975
  }
4969
4976
  }
@@ -5579,6 +5586,12 @@ const INSERT_LINK = (env) => {
5579
5586
  let { col, row } = env.model.getters.getPosition();
5580
5587
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
5581
5588
  };
5589
+ const INSERT_LINK_NAME = (env) => {
5590
+ const sheetId = env.model.getters.getActiveSheetId();
5591
+ const { col, row } = env.model.getters.getPosition();
5592
+ const cell = env.model.getters.getCell(sheetId, col, row);
5593
+ return cell && cell.isLink() ? _lt("Edit link") : _lt("Insert link");
5594
+ };
5582
5595
  //------------------------------------------------------------------------------
5583
5596
  // Filters action
5584
5597
  //------------------------------------------------------------------------------
@@ -5716,7 +5729,7 @@ cellMenuRegistry
5716
5729
  action: DELETE_CELL_SHIFT_LEFT,
5717
5730
  })
5718
5731
  .add("insert_link", {
5719
- name: _lt("Insert link"),
5732
+ name: INSERT_LINK_NAME,
5720
5733
  separator: true,
5721
5734
  sequence: 150,
5722
5735
  action: INSERT_LINK,
@@ -6005,22 +6018,22 @@ sheetMenuRegistry
6005
6018
  const CfTerms = {
6006
6019
  Errors: {
6007
6020
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
6008
- [50 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6009
- [51 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6010
- [52 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6011
- [53 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6012
- [54 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6013
- [55 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6014
- [56 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6015
- [46 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6016
- [49 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6017
- [48 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6018
- [47 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6019
- [57 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6020
- [59 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6021
- [58 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6022
- [60 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6023
- [61 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6021
+ [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6022
+ [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6023
+ [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6024
+ [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6025
+ [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6026
+ [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6027
+ [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6028
+ [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6029
+ [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6030
+ [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6031
+ [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6032
+ [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6033
+ [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6034
+ [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6035
+ [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6036
+ [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6024
6037
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
6025
6038
  Unexpected: _lt("The rule is invalid for an unknown reason"),
6026
6039
  },
@@ -6048,20 +6061,20 @@ const ChartTerms = {
6048
6061
  Errors: {
6049
6062
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
6050
6063
  // BASIC CHART ERRORS (LINE | BAR | PIE)
6051
- [31 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6052
- [32 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6064
+ [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6065
+ [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6053
6066
  // SCORECARD CHART ERRORS
6054
- [33 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6055
- [34 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6067
+ [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6068
+ [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6056
6069
  // GAUGE CHART ERRORS
6057
- [35 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6058
- [36 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6059
- [37 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6060
- [38 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6061
- [39 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6062
- [40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6063
- [41 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6064
- [42 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6070
+ [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6071
+ [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6072
+ [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6073
+ [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6074
+ [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6075
+ [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6076
+ [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6077
+ [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6065
6078
  },
6066
6079
  };
6067
6080
  const NumberFormatTerms = {
@@ -6085,7 +6098,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
6085
6098
  const sheetId = env.model.getters.getActiveSheetId();
6086
6099
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
6087
6100
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
6088
- if (result.isCancelledBecause(64 /* CommandResult.MergeOverlap */)) {
6101
+ if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
6089
6102
  env.raiseError(MergeErrorMessage);
6090
6103
  }
6091
6104
  }
@@ -6731,11 +6744,11 @@ class LineBarPieConfigPanel extends owl.Component {
6731
6744
  }
6732
6745
  get isDatasetInvalid() {
6733
6746
  var _a;
6734
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(31 /* CommandResult.InvalidDataSet */));
6747
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
6735
6748
  }
6736
6749
  get isLabelInvalid() {
6737
6750
  var _a;
6738
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
6751
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
6739
6752
  }
6740
6753
  onUpdateDataSetsHaveTitle(ev) {
6741
6754
  this.props.updateChart(this.props.figureId, {
@@ -6956,14 +6969,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
6956
6969
  : undefined));
6957
6970
  }
6958
6971
  }
6959
- else if (zone.left === zone.right && zone.top === zone.bottom) {
6960
- // A single cell. If it's only the title, the dataset is not added.
6961
- if (!dataSetsHaveTitle) {
6962
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
6963
- }
6964
- }
6965
6972
  else {
6966
- /* 1 row or 1 column */
6973
+ /* 1 cell, 1 row or 1 column */
6967
6974
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
6968
6975
  ? {
6969
6976
  top: zone.top,
@@ -7013,8 +7020,10 @@ function toExcelDataset(getters, ds) {
7013
7020
  }
7014
7021
  const dataRange = ds.dataRange.clone({ zone: dataZone });
7015
7022
  return {
7016
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
7017
- range: getters.getRangeString(dataRange, "forceSheetReference"),
7023
+ label: ds.labelCell
7024
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
7025
+ : undefined,
7026
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
7018
7027
  };
7019
7028
  }
7020
7029
  /**
@@ -7083,11 +7092,11 @@ function checkDataset(definition) {
7083
7092
  if (definition.dataSets) {
7084
7093
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
7085
7094
  if (invalidRanges) {
7086
- return 31 /* CommandResult.InvalidDataSet */;
7095
+ return 32 /* CommandResult.InvalidDataSet */;
7087
7096
  }
7088
7097
  const zones = definition.dataSets.map(toUnboundedZone);
7089
7098
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
7090
- return 31 /* CommandResult.InvalidDataSet */;
7099
+ return 32 /* CommandResult.InvalidDataSet */;
7091
7100
  }
7092
7101
  }
7093
7102
  return 0 /* CommandResult.Success */;
@@ -7096,7 +7105,7 @@ function checkLabelRange(definition) {
7096
7105
  if (definition.labelRange) {
7097
7106
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
7098
7107
  if (invalidLabels) {
7099
- return 32 /* CommandResult.InvalidLabelRange */;
7108
+ return 33 /* CommandResult.InvalidLabelRange */;
7100
7109
  }
7101
7110
  }
7102
7111
  return 0 /* CommandResult.Success */;
@@ -7397,6 +7406,9 @@ class BarChart extends AbstractChart {
7397
7406
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7398
7407
  return {
7399
7408
  ...this.getDefinition(),
7409
+ labelRange: this.labelRange
7410
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
7411
+ : undefined,
7400
7412
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7401
7413
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7402
7414
  dataSets,
@@ -7554,7 +7566,7 @@ chartRegistry.add("gauge", {
7554
7566
  });
7555
7567
  function isDataRangeValid(definition) {
7556
7568
  return definition.dataRange && !rangeReference.test(definition.dataRange)
7557
- ? 35 /* CommandResult.InvalidGaugeDataRange */
7569
+ ? 36 /* CommandResult.InvalidGaugeDataRange */
7558
7570
  : 0 /* CommandResult.Success */;
7559
7571
  }
7560
7572
  function checkRangeLimits(check, batchValidations) {
@@ -7586,7 +7598,7 @@ function checkInflectionPointsValue(check, batchValidations) {
7586
7598
  function checkRangeMinBiggerThanRangeMax(definition) {
7587
7599
  if (definition.sectionRule) {
7588
7600
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
7589
- return 40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7601
+ return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7590
7602
  }
7591
7603
  }
7592
7604
  return 0 /* CommandResult.Success */;
@@ -7595,9 +7607,9 @@ function checkEmpty(value, valueName) {
7595
7607
  if (value === "") {
7596
7608
  switch (valueName) {
7597
7609
  case "rangeMin":
7598
- return 36 /* CommandResult.EmptyGaugeRangeMin */;
7610
+ return 37 /* CommandResult.EmptyGaugeRangeMin */;
7599
7611
  case "rangeMax":
7600
- return 38 /* CommandResult.EmptyGaugeRangeMax */;
7612
+ return 39 /* CommandResult.EmptyGaugeRangeMax */;
7601
7613
  }
7602
7614
  }
7603
7615
  return 0 /* CommandResult.Success */;
@@ -7606,13 +7618,13 @@ function checkNaN(value, valueName) {
7606
7618
  if (isNaN(value)) {
7607
7619
  switch (valueName) {
7608
7620
  case "rangeMin":
7609
- return 37 /* CommandResult.GaugeRangeMinNaN */;
7621
+ return 38 /* CommandResult.GaugeRangeMinNaN */;
7610
7622
  case "rangeMax":
7611
- return 39 /* CommandResult.GaugeRangeMaxNaN */;
7623
+ return 40 /* CommandResult.GaugeRangeMaxNaN */;
7612
7624
  case "lowerInflectionPointValue":
7613
- return 41 /* CommandResult.GaugeLowerInflectionPointNaN */;
7625
+ return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
7614
7626
  case "upperInflectionPointValue":
7615
- return 42 /* CommandResult.GaugeUpperInflectionPointNaN */;
7627
+ return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
7616
7628
  }
7617
7629
  }
7618
7630
  return 0 /* CommandResult.Success */;
@@ -8025,6 +8037,9 @@ class LineChart extends AbstractChart {
8025
8037
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8026
8038
  return {
8027
8039
  ...this.getDefinition(),
8040
+ labelRange: this.labelRange
8041
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8042
+ : undefined,
8028
8043
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8029
8044
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8030
8045
  dataSets,
@@ -8285,6 +8300,9 @@ class PieChart extends AbstractChart {
8285
8300
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8286
8301
  return {
8287
8302
  ...this.getDefinition(),
8303
+ labelRange: this.labelRange
8304
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8305
+ : undefined,
8288
8306
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8289
8307
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8290
8308
  verticalAxisPosition: "left",
@@ -8365,12 +8383,12 @@ chartRegistry.add("scorecard", {
8365
8383
  });
8366
8384
  function checkKeyValue(definition) {
8367
8385
  return definition.keyValue && !rangeReference.test(definition.keyValue)
8368
- ? 33 /* CommandResult.InvalidScorecardKeyValue */
8386
+ ? 34 /* CommandResult.InvalidScorecardKeyValue */
8369
8387
  : 0 /* CommandResult.Success */;
8370
8388
  }
8371
8389
  function checkBaseline(definition) {
8372
8390
  return definition.baseline && !rangeReference.test(definition.baseline)
8373
- ? 34 /* CommandResult.InvalidScorecardBaseline */
8391
+ ? 35 /* CommandResult.InvalidScorecardBaseline */
8374
8392
  : 0 /* CommandResult.Success */;
8375
8393
  }
8376
8394
  class ScorecardChart$1 extends AbstractChart {
@@ -8799,7 +8817,7 @@ class GaugeChartConfigPanel extends owl.Component {
8799
8817
  }
8800
8818
  get isDataRangeInvalid() {
8801
8819
  var _a;
8802
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidGaugeDataRange */));
8820
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
8803
8821
  }
8804
8822
  onDataRangeChanged(ranges) {
8805
8823
  this.dataRange = ranges[0];
@@ -8886,28 +8904,28 @@ class GaugeChartDesignPanel extends owl.Component {
8886
8904
  }
8887
8905
  isRangeMinInvalid() {
8888
8906
  var _a, _b, _c;
8889
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.EmptyGaugeRangeMin */)) ||
8890
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(37 /* CommandResult.GaugeRangeMinNaN */)) ||
8891
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8907
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
8908
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
8909
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8892
8910
  }
8893
8911
  isRangeMaxInvalid() {
8894
8912
  var _a, _b, _c;
8895
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMax */)) ||
8896
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMaxNaN */)) ||
8897
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8913
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
8914
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
8915
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8898
8916
  }
8899
8917
  // ---------------------------------------------------------------------------
8900
8918
  // COLOR_SECTION_TEMPLATE
8901
8919
  // ---------------------------------------------------------------------------
8902
8920
  get isLowerInflectionPointInvalid() {
8903
8921
  var _a, _b;
8904
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(41 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8905
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8922
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8923
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8906
8924
  }
8907
8925
  get isUpperInflectionPointInvalid() {
8908
8926
  var _a, _b;
8909
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8910
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8927
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8928
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8911
8929
  }
8912
8930
  updateInflectionPointValue(attr, ev) {
8913
8931
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -9010,11 +9028,11 @@ class ScorecardChartConfigPanel extends owl.Component {
9010
9028
  }
9011
9029
  get isKeyValueInvalid() {
9012
9030
  var _a;
9013
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidScorecardKeyValue */));
9031
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
9014
9032
  }
9015
9033
  get isBaselineInvalid() {
9016
9034
  var _a;
9017
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardBaseline */));
9035
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
9018
9036
  }
9019
9037
  onKeyValueRangeChanged(ranges) {
9020
9038
  this.keyValue = ranges[0];
@@ -9854,11 +9872,11 @@ class ConditionalFormattingPanel extends owl.Component {
9854
9872
  ****************************************************************************/
9855
9873
  get isValue1Invalid() {
9856
9874
  var _a;
9857
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(50 /* CommandResult.FirstArgMissing */));
9875
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
9858
9876
  }
9859
9877
  get isValue2Invalid() {
9860
9878
  var _a;
9861
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.SecondArgMissing */));
9879
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
9862
9880
  }
9863
9881
  toggleStyle(tool) {
9864
9882
  const style = this.state.rules.cellIs.style;
@@ -9875,17 +9893,17 @@ class ConditionalFormattingPanel extends owl.Component {
9875
9893
  isValueInvalid(threshold) {
9876
9894
  switch (threshold) {
9877
9895
  case "minimum":
9878
- return (this.state.errors.includes(57 /* CommandResult.MinInvalidFormula */) ||
9879
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMid */) ||
9880
- this.state.errors.includes(46 /* CommandResult.MinBiggerThanMax */) ||
9881
- this.state.errors.includes(52 /* CommandResult.MinNaN */));
9896
+ return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
9897
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
9898
+ this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
9899
+ this.state.errors.includes(53 /* CommandResult.MinNaN */));
9882
9900
  case "midpoint":
9883
- return (this.state.errors.includes(58 /* CommandResult.MidInvalidFormula */) ||
9884
- this.state.errors.includes(53 /* CommandResult.MidNaN */) ||
9885
- this.state.errors.includes(48 /* CommandResult.MidBiggerThanMax */));
9901
+ return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
9902
+ this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
9903
+ this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
9886
9904
  case "maximum":
9887
- return (this.state.errors.includes(59 /* CommandResult.MaxInvalidFormula */) ||
9888
- this.state.errors.includes(54 /* CommandResult.MaxNaN */));
9905
+ return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
9906
+ this.state.errors.includes(55 /* CommandResult.MaxNaN */));
9889
9907
  default:
9890
9908
  return false;
9891
9909
  }
@@ -9934,13 +9952,13 @@ class ConditionalFormattingPanel extends owl.Component {
9934
9952
  isInflectionPointInvalid(inflectionPoint) {
9935
9953
  switch (inflectionPoint) {
9936
9954
  case "lowerInflectionPoint":
9937
- return (this.state.errors.includes(56 /* CommandResult.ValueLowerInflectionNaN */) ||
9938
- this.state.errors.includes(61 /* CommandResult.ValueLowerInvalidFormula */) ||
9939
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9955
+ return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
9956
+ this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
9957
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9940
9958
  case "upperInflectionPoint":
9941
- return (this.state.errors.includes(55 /* CommandResult.ValueUpperInflectionNaN */) ||
9942
- this.state.errors.includes(60 /* CommandResult.ValueUpperInvalidFormula */) ||
9943
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9959
+ return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
9960
+ this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
9961
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9944
9962
  default:
9945
9963
  return true;
9946
9964
  }
@@ -19585,7 +19603,7 @@ class EditionPlugin extends UIPlugin {
19585
19603
  validateSelection(length, start, end) {
19586
19604
  return start >= 0 && start <= length && end >= 0 && end <= length
19587
19605
  ? 0 /* CommandResult.Success */
19588
- : 45 /* CommandResult.WrongComposerSelection */;
19606
+ : 46 /* CommandResult.WrongComposerSelection */;
19589
19607
  }
19590
19608
  onColumnsRemoved(cmd) {
19591
19609
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -19869,9 +19887,10 @@ class EditionPlugin extends UIPlugin {
19869
19887
  */
19870
19888
  getReferencedRanges() {
19871
19889
  const editionSheetId = this.getters.getEditionSheet();
19872
- return this.currentTokens
19890
+ const referenceRanges = this.currentTokens
19873
19891
  .filter((token) => token.type === "REFERENCE")
19874
19892
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
19893
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
19875
19894
  }
19876
19895
  /**
19877
19896
  * Function used to determine when composer selection can start.
@@ -27642,7 +27661,7 @@ class BordersPlugin extends CorePlugin {
27642
27661
  const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
27643
27662
  const areAllNewBordersUndefined = !((_a = cmd.border) === null || _a === void 0 ? void 0 : _a.bottom) && !((_b = cmd.border) === null || _b === void 0 ? void 0 : _b.left) && !((_c = cmd.border) === null || _c === void 0 ? void 0 : _c.right) && !((_d = cmd.border) === null || _d === void 0 ? void 0 : _d.top);
27644
27663
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
27645
- return 87 /* CommandResult.NoChanges */;
27664
+ return 88 /* CommandResult.NoChanges */;
27646
27665
  }
27647
27666
  return 0 /* CommandResult.Success */;
27648
27667
  }
@@ -27884,6 +27903,9 @@ class CellPlugin extends CorePlugin {
27884
27903
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27885
27904
  content: cell.content || undefined,
27886
27905
  };
27906
+ if (cell.isFormula()) {
27907
+ cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27908
+ }
27887
27909
  }
27888
27910
  _sheet.cells = cells;
27889
27911
  }
@@ -27931,13 +27953,13 @@ class CellPlugin extends CorePlugin {
27931
27953
  /*
27932
27954
  * Reconstructs the original formula string based on a normalized form and its dependencies
27933
27955
  */
27934
- buildFormulaContent(sheetId, cell, dependencies) {
27956
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
27935
27957
  const ranges = dependencies || cell.dependencies;
27936
27958
  let rangeIndex = 0;
27937
27959
  return concat(cell.compiledFormula.tokens.map((token) => {
27938
27960
  if (token.type === "REFERENCE") {
27939
27961
  const range = ranges[rangeIndex++];
27940
- return this.getters.getRangeString(range, sheetId);
27962
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
27941
27963
  }
27942
27964
  return token.value;
27943
27965
  }));
@@ -28102,9 +28124,9 @@ class CellPlugin extends CorePlugin {
28102
28124
  checkUselessClearCell(cmd) {
28103
28125
  const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28104
28126
  if (!cell)
28105
- return 87 /* CommandResult.NoChanges */;
28127
+ return 88 /* CommandResult.NoChanges */;
28106
28128
  if (!cell.content && !cell.style && !cell.format) {
28107
- return 87 /* CommandResult.NoChanges */;
28129
+ return 88 /* CommandResult.NoChanges */;
28108
28130
  }
28109
28131
  return 0 /* CommandResult.Success */;
28110
28132
  }
@@ -28313,13 +28335,13 @@ class ChartPlugin extends CorePlugin {
28313
28335
  }
28314
28336
  checkChartDuplicate(cmd) {
28315
28337
  return this.getters.getFigureSheetId(cmd.id)
28316
- ? 83 /* CommandResult.DuplicatedChartId */
28338
+ ? 84 /* CommandResult.DuplicatedChartId */
28317
28339
  : 0 /* CommandResult.Success */;
28318
28340
  }
28319
28341
  checkChartExists(cmd) {
28320
28342
  return this.getters.getFigureSheetId(cmd.id)
28321
28343
  ? 0 /* CommandResult.Success */
28322
- : 84 /* CommandResult.ChartDoesNotExist */;
28344
+ : 85 /* CommandResult.ChartDoesNotExist */;
28323
28345
  }
28324
28346
  }
28325
28347
  ChartPlugin.getters = [
@@ -28434,7 +28456,13 @@ class ConditionalFormatPlugin extends CorePlugin {
28434
28456
  }
28435
28457
  }
28436
28458
  exportForExcel(data) {
28437
- this.export(data);
28459
+ if (data.sheets) {
28460
+ for (let sheet of data.sheets) {
28461
+ if (this.cfRules[sheet.id]) {
28462
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
28463
+ }
28464
+ }
28465
+ }
28438
28466
  }
28439
28467
  // ---------------------------------------------------------------------------
28440
28468
  // Getters
@@ -28484,11 +28512,11 @@ class ConditionalFormatPlugin extends CorePlugin {
28484
28512
  // ---------------------------------------------------------------------------
28485
28513
  // Private
28486
28514
  // ---------------------------------------------------------------------------
28487
- mapToConditionalFormat(sheetId, cf) {
28515
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
28488
28516
  return {
28489
28517
  ...cf,
28490
28518
  ranges: cf.ranges.map((range) => {
28491
- return this.getters.getRangeString(range, sheetId);
28519
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
28492
28520
  }),
28493
28521
  };
28494
28522
  }
@@ -28521,10 +28549,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28521
28549
  return 27 /* CommandResult.InvalidSheetId */;
28522
28550
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
28523
28551
  if (ruleIndex === -1)
28524
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28552
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28525
28553
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
28526
28554
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
28527
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28555
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28528
28556
  }
28529
28557
  return 0 /* CommandResult.Success */;
28530
28558
  }
@@ -28565,10 +28593,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28565
28593
  const errors = [];
28566
28594
  const isEmpty = (value) => value === undefined || value === "";
28567
28595
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
28568
- errors.push(50 /* CommandResult.FirstArgMissing */);
28596
+ errors.push(51 /* CommandResult.FirstArgMissing */);
28569
28597
  }
28570
28598
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
28571
- errors.push(51 /* CommandResult.SecondArgMissing */);
28599
+ errors.push(52 /* CommandResult.SecondArgMissing */);
28572
28600
  }
28573
28601
  return errors.length ? errors : 0 /* CommandResult.Success */;
28574
28602
  }
@@ -28580,15 +28608,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28580
28608
  (threshold.value === "" || isNaN(threshold.value))) {
28581
28609
  switch (thresholdName) {
28582
28610
  case "min":
28583
- return 52 /* CommandResult.MinNaN */;
28611
+ return 53 /* CommandResult.MinNaN */;
28584
28612
  case "max":
28585
- return 54 /* CommandResult.MaxNaN */;
28613
+ return 55 /* CommandResult.MaxNaN */;
28586
28614
  case "mid":
28587
- return 53 /* CommandResult.MidNaN */;
28615
+ return 54 /* CommandResult.MidNaN */;
28588
28616
  case "upperInflectionPoint":
28589
- return 55 /* CommandResult.ValueUpperInflectionNaN */;
28617
+ return 56 /* CommandResult.ValueUpperInflectionNaN */;
28590
28618
  case "lowerInflectionPoint":
28591
- return 56 /* CommandResult.ValueLowerInflectionNaN */;
28619
+ return 57 /* CommandResult.ValueLowerInflectionNaN */;
28592
28620
  }
28593
28621
  }
28594
28622
  return 0 /* CommandResult.Success */;
@@ -28602,15 +28630,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28602
28630
  catch (error) {
28603
28631
  switch (thresholdName) {
28604
28632
  case "min":
28605
- return 57 /* CommandResult.MinInvalidFormula */;
28633
+ return 58 /* CommandResult.MinInvalidFormula */;
28606
28634
  case "max":
28607
- return 59 /* CommandResult.MaxInvalidFormula */;
28635
+ return 60 /* CommandResult.MaxInvalidFormula */;
28608
28636
  case "mid":
28609
- return 58 /* CommandResult.MidInvalidFormula */;
28637
+ return 59 /* CommandResult.MidInvalidFormula */;
28610
28638
  case "upperInflectionPoint":
28611
- return 60 /* CommandResult.ValueUpperInvalidFormula */;
28639
+ return 61 /* CommandResult.ValueUpperInvalidFormula */;
28612
28640
  case "lowerInflectionPoint":
28613
- return 61 /* CommandResult.ValueLowerInvalidFormula */;
28641
+ return 62 /* CommandResult.ValueLowerInvalidFormula */;
28614
28642
  }
28615
28643
  }
28616
28644
  return 0 /* CommandResult.Success */;
@@ -28627,7 +28655,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28627
28655
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
28628
28656
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
28629
28657
  Number(minValue) > Number(maxValue)) {
28630
- return 47 /* CommandResult.LowerBiggerThanUpper */;
28658
+ return 48 /* CommandResult.LowerBiggerThanUpper */;
28631
28659
  }
28632
28660
  return 0 /* CommandResult.Success */;
28633
28661
  }
@@ -28637,7 +28665,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28637
28665
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
28638
28666
  rule.minimum.type === rule.maximum.type &&
28639
28667
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
28640
- return 46 /* CommandResult.MinBiggerThanMax */;
28668
+ return 47 /* CommandResult.MinBiggerThanMax */;
28641
28669
  }
28642
28670
  return 0 /* CommandResult.Success */;
28643
28671
  }
@@ -28649,7 +28677,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28649
28677
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28650
28678
  rule.midpoint.type === rule.maximum.type &&
28651
28679
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
28652
- return 48 /* CommandResult.MidBiggerThanMax */;
28680
+ return 49 /* CommandResult.MidBiggerThanMax */;
28653
28681
  }
28654
28682
  return 0 /* CommandResult.Success */;
28655
28683
  }
@@ -28661,7 +28689,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28661
28689
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28662
28690
  rule.minimum.type === rule.midpoint.type &&
28663
28691
  stringToNumber(minValue) >= stringToNumber(midValue)) {
28664
- return 49 /* CommandResult.MinBiggerThanMid */;
28692
+ return 50 /* CommandResult.MinBiggerThanMid */;
28665
28693
  }
28666
28694
  return 0 /* CommandResult.Success */;
28667
28695
  }
@@ -28762,13 +28790,13 @@ class FigurePlugin extends CorePlugin {
28762
28790
  checkFigureExists(sheetId, figureId) {
28763
28791
  var _a;
28764
28792
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
28765
- return 69 /* CommandResult.FigureDoesNotExist */;
28793
+ return 70 /* CommandResult.FigureDoesNotExist */;
28766
28794
  }
28767
28795
  return 0 /* CommandResult.Success */;
28768
28796
  }
28769
28797
  checkFigureDuplicate(figureId) {
28770
28798
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
28771
- return 81 /* CommandResult.DuplicatedFigureId */;
28799
+ return 82 /* CommandResult.DuplicatedFigureId */;
28772
28800
  }
28773
28801
  return 0 /* CommandResult.Success */;
28774
28802
  }
@@ -28870,12 +28898,12 @@ class FiltersPlugin extends CorePlugin {
28870
28898
  switch (cmd.type) {
28871
28899
  case "CREATE_FILTER_TABLE":
28872
28900
  if (!areZonesContinuous(...cmd.target)) {
28873
- return 80 /* CommandResult.NonContinuousTargets */;
28901
+ return 81 /* CommandResult.NonContinuousTargets */;
28874
28902
  }
28875
28903
  const zone = union(...cmd.target);
28876
28904
  const checkFilterOverlap = () => {
28877
28905
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
28878
- return 77 /* CommandResult.FilterOverlap */;
28906
+ return 78 /* CommandResult.FilterOverlap */;
28879
28907
  }
28880
28908
  return 0 /* CommandResult.Success */;
28881
28909
  };
@@ -28883,7 +28911,7 @@ class FiltersPlugin extends CorePlugin {
28883
28911
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
28884
28912
  for (let merge of mergesInTarget) {
28885
28913
  if (overlap(zone, merge)) {
28886
- return 79 /* CommandResult.MergeInFilter */;
28914
+ return 80 /* CommandResult.MergeInFilter */;
28887
28915
  }
28888
28916
  }
28889
28917
  return 0 /* CommandResult.Success */;
@@ -28893,7 +28921,7 @@ class FiltersPlugin extends CorePlugin {
28893
28921
  for (let merge of cmd.target) {
28894
28922
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
28895
28923
  if (overlap(filterTable.zone, merge)) {
28896
- return 79 /* CommandResult.MergeInFilter */;
28924
+ return 80 /* CommandResult.MergeInFilter */;
28897
28925
  }
28898
28926
  }
28899
28927
  }
@@ -29393,10 +29421,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
29393
29421
  : this.getters.getNumberRows(cmd.sheetId);
29394
29422
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29395
29423
  if (hiddenElements.size >= elements) {
29396
- return 65 /* CommandResult.TooManyHiddenElements */;
29424
+ return 66 /* CommandResult.TooManyHiddenElements */;
29397
29425
  }
29398
29426
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29399
- return 85 /* CommandResult.InvalidHeaderIndex */;
29427
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29400
29428
  }
29401
29429
  else {
29402
29430
  return 0 /* CommandResult.Success */;
@@ -29799,7 +29827,7 @@ class MergePlugin extends CorePlugin {
29799
29827
  for (const zone of target) {
29800
29828
  for (const zone2 of target) {
29801
29829
  if (zone !== zone2 && overlap(zone, zone2)) {
29802
- return 64 /* CommandResult.MergeOverlap */;
29830
+ return 65 /* CommandResult.MergeOverlap */;
29803
29831
  }
29804
29832
  }
29805
29833
  }
@@ -29813,7 +29841,7 @@ class MergePlugin extends CorePlugin {
29813
29841
  for (const zone of target) {
29814
29842
  if ((zone.left < xSplit && zone.right >= xSplit) ||
29815
29843
  (zone.top < ySplit && zone.bottom >= ySplit)) {
29816
- return 74 /* CommandResult.FrozenPaneOverlap */;
29844
+ return 75 /* CommandResult.FrozenPaneOverlap */;
29817
29845
  }
29818
29846
  }
29819
29847
  return 0 /* CommandResult.Success */;
@@ -30060,10 +30088,10 @@ class SheetPlugin extends CorePlugin {
30060
30088
  ? this.getNumberCols(cmd.sheetId)
30061
30089
  : this.getNumberRows(cmd.sheetId);
30062
30090
  if (cmd.base < 0 || cmd.base >= elements) {
30063
- return 85 /* CommandResult.InvalidHeaderIndex */;
30091
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30064
30092
  }
30065
30093
  else if (cmd.quantity <= 0) {
30066
- return 86 /* CommandResult.InvalidQuantity */;
30094
+ return 87 /* CommandResult.InvalidQuantity */;
30067
30095
  }
30068
30096
  return 0 /* CommandResult.Success */;
30069
30097
  case "REMOVE_COLUMNS_ROWS": {
@@ -30071,7 +30099,7 @@ class SheetPlugin extends CorePlugin {
30071
30099
  ? this.getNumberCols(cmd.sheetId)
30072
30100
  : this.getNumberRows(cmd.sheetId);
30073
30101
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30074
- return 85 /* CommandResult.InvalidHeaderIndex */;
30102
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30075
30103
  }
30076
30104
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
30077
30105
  return 8 /* CommandResult.NotEnoughElements */;
@@ -30528,18 +30556,18 @@ class SheetPlugin extends CorePlugin {
30528
30556
  checkRowFreezeQuantity(cmd) {
30529
30557
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
30530
30558
  ? 0 /* CommandResult.Success */
30531
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30559
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30532
30560
  }
30533
30561
  checkColFreezeQuantity(cmd) {
30534
30562
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
30535
30563
  ? 0 /* CommandResult.Success */
30536
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30564
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30537
30565
  }
30538
30566
  checkRowFreezeOverlapMerge(cmd) {
30539
30567
  const merges = this.getters.getMerges(cmd.sheetId);
30540
30568
  for (let merge of merges) {
30541
30569
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
30542
- return 64 /* CommandResult.MergeOverlap */;
30570
+ return 65 /* CommandResult.MergeOverlap */;
30543
30571
  }
30544
30572
  }
30545
30573
  return 0 /* CommandResult.Success */;
@@ -30548,7 +30576,7 @@ class SheetPlugin extends CorePlugin {
30548
30576
  const merges = this.getters.getMerges(cmd.sheetId);
30549
30577
  for (let merge of merges) {
30550
30578
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
30551
- return 64 /* CommandResult.MergeOverlap */;
30579
+ return 65 /* CommandResult.MergeOverlap */;
30552
30580
  }
30553
30581
  }
30554
30582
  return 0 /* CommandResult.Success */;
@@ -30989,7 +31017,7 @@ class AutofillPlugin extends UIPlugin {
30989
31017
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
30990
31018
  return 0 /* CommandResult.Success */;
30991
31019
  }
30992
- return 44 /* CommandResult.InvalidAutofillSelection */;
31020
+ return 45 /* CommandResult.InvalidAutofillSelection */;
30993
31021
  case "AUTOFILL_AUTO":
30994
31022
  const zone = this.getters.getSelectedZone();
30995
31023
  return zone.top === zone.bottom
@@ -31589,7 +31617,7 @@ class CellPopoverPlugin extends UIPlugin {
31589
31617
  cellPopoverRegistry.get(cmd.popoverType);
31590
31618
  }
31591
31619
  catch (error) {
31592
- return 71 /* CommandResult.InvalidCellPopover */;
31620
+ return 72 /* CommandResult.InvalidCellPopover */;
31593
31621
  }
31594
31622
  return 0 /* CommandResult.Success */;
31595
31623
  default:
@@ -31813,7 +31841,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
31813
31841
  for (const zone of this.getPasteZones(target)) {
31814
31842
  if ((zone.left < xSplit && zone.right >= xSplit) ||
31815
31843
  (zone.top < ySplit && zone.bottom >= ySplit)) {
31816
- return 74 /* CommandResult.FrozenPaneOverlap */;
31844
+ return 75 /* CommandResult.FrozenPaneOverlap */;
31817
31845
  }
31818
31846
  }
31819
31847
  return 0 /* CommandResult.Success */;
@@ -32173,7 +32201,7 @@ class ClipboardFigureState {
32173
32201
  }
32174
32202
  isPasteAllowed(target, option) {
32175
32203
  if (target.length === 0) {
32176
- return 72 /* CommandResult.EmptyTarget */;
32204
+ return 73 /* CommandResult.EmptyTarget */;
32177
32205
  }
32178
32206
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
32179
32207
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -32817,10 +32845,8 @@ class EvaluationPlugin extends UIPlugin {
32817
32845
  * that are actually present in the grid.
32818
32846
  */
32819
32847
  function range(range) {
32848
+ assertRangeValid(range);
32820
32849
  const sheetId = range.sheetId;
32821
- if (!isZoneValid(range.zone)) {
32822
- throw new InvalidReferenceError();
32823
- }
32824
32850
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32825
32851
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32826
32852
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32855,23 +32881,26 @@ class EvaluationPlugin extends UIPlugin {
32855
32881
  * The `compute` of the formula's function must process it completely
32856
32882
  */
32857
32883
  function refFn(range, isMeta, functionName, paramNumber) {
32884
+ assertRangeValid(range);
32858
32885
  if (isMeta) {
32859
32886
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32860
32887
  return { value: zoneToXc(range.zone) };
32861
32888
  }
32862
- if (!isZoneValid(range.zone)) {
32863
- throw new InvalidReferenceError();
32864
- }
32865
32889
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32866
32890
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32867
32891
  throw new Error(paramNumber
32868
32892
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32869
32893
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32870
32894
  }
32895
+ return readCell(range);
32896
+ }
32897
+ function assertRangeValid(range) {
32898
+ if (!isZoneValid(range.zone)) {
32899
+ throw new InvalidReferenceError();
32900
+ }
32871
32901
  if (range.invalidSheetName) {
32872
32902
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32873
32903
  }
32874
- return readCell(range);
32875
32904
  }
32876
32905
  return [refFn, range, evalContext];
32877
32906
  }
@@ -33335,7 +33364,7 @@ class FilterEvaluationPlugin extends UIPlugin {
33335
33364
  switch (cmd.type) {
33336
33365
  case "UPDATE_FILTER":
33337
33366
  if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
33338
- return 78 /* CommandResult.FilterNotFound */;
33367
+ return 79 /* CommandResult.FilterNotFound */;
33339
33368
  }
33340
33369
  break;
33341
33370
  }
@@ -35155,7 +35184,7 @@ class GridSelectionPlugin extends UIPlugin {
35155
35184
  const headers = [cmd.base, ...cmd.elements];
35156
35185
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
35157
35186
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
35158
- return 85 /* CommandResult.InvalidHeaderIndex */;
35187
+ return 86 /* CommandResult.InvalidHeaderIndex */;
35159
35188
  }
35160
35189
  return 0 /* CommandResult.Success */;
35161
35190
  }
@@ -35286,21 +35315,6 @@ class SelectionInputPlugin extends UIPlugin {
35286
35315
  // ---------------------------------------------------------------------------
35287
35316
  // Command Handling
35288
35317
  // ---------------------------------------------------------------------------
35289
- allowDispatch(cmd) {
35290
- switch (cmd.type) {
35291
- case "ADD_EMPTY_RANGE":
35292
- if (this.inputHasSingleRange && this.ranges.length === 1) {
35293
- return 29 /* CommandResult.MaximumRangesReached */;
35294
- }
35295
- break;
35296
- case "CHANGE_RANGE":
35297
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35298
- return 29 /* CommandResult.MaximumRangesReached */;
35299
- }
35300
- break;
35301
- }
35302
- return 0 /* CommandResult.Success */;
35303
- }
35304
35318
  handleEvent(event) {
35305
35319
  const xc = zoneToXc(event.anchor.zone);
35306
35320
  const inputSheetId = this.activeSheet;
@@ -35510,6 +35524,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35510
35524
  // ---------------------------------------------------------------------------
35511
35525
  allowDispatch(cmd) {
35512
35526
  var _a, _b;
35527
+ switch (cmd.type) {
35528
+ case "FOCUS_RANGE":
35529
+ case "CHANGE_RANGE":
35530
+ case "ADD_EMPTY_RANGE":
35531
+ case "REMOVE_RANGE":
35532
+ if (!this.inputs[cmd.id]) {
35533
+ return 30 /* CommandResult.InvalidInputId */;
35534
+ }
35535
+ }
35513
35536
  switch (cmd.type) {
35514
35537
  case "FOCUS_RANGE":
35515
35538
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -35517,9 +35540,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35517
35540
  return 28 /* CommandResult.InputAlreadyFocused */;
35518
35541
  }
35519
35542
  break;
35520
- }
35521
- if (this.currentInput) {
35522
- return this.currentInput.allowDispatch(cmd);
35543
+ case "ADD_EMPTY_RANGE":
35544
+ const input = this.inputs[cmd.id];
35545
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
35546
+ return 29 /* CommandResult.MaximumRangesReached */;
35547
+ }
35548
+ break;
35549
+ case "CHANGE_RANGE": {
35550
+ const input = this.inputs[cmd.id];
35551
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
35552
+ return 29 /* CommandResult.MaximumRangesReached */;
35553
+ }
35554
+ break;
35555
+ }
35523
35556
  }
35524
35557
  return 0 /* CommandResult.Success */;
35525
35558
  }
@@ -37174,7 +37207,7 @@ class SheetViewPlugin extends UIPlugin {
37174
37207
  }
37175
37208
  checkPositiveDimension(cmd) {
37176
37209
  if (cmd.width < 0 || cmd.height < 0) {
37177
- return 67 /* CommandResult.InvalidViewportSize */;
37210
+ return 68 /* CommandResult.InvalidViewportSize */;
37178
37211
  }
37179
37212
  return 0 /* CommandResult.Success */;
37180
37213
  }
@@ -37184,7 +37217,7 @@ class SheetViewPlugin extends UIPlugin {
37184
37217
  cmd.gridOffsetY === this.gridOffsetY &&
37185
37218
  cmd.width === width &&
37186
37219
  cmd.height === height) {
37187
- return 75 /* CommandResult.ValuesNotChanged */;
37220
+ return 76 /* CommandResult.ValuesNotChanged */;
37188
37221
  }
37189
37222
  return 0 /* CommandResult.Success */;
37190
37223
  }
@@ -37192,7 +37225,7 @@ class SheetViewPlugin extends UIPlugin {
37192
37225
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
37193
37226
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
37194
37227
  (!pane.canScrollVertically && offsetY > 0)) {
37195
- return 68 /* CommandResult.InvalidScrollingDirection */;
37228
+ return 69 /* CommandResult.InvalidScrollingDirection */;
37196
37229
  }
37197
37230
  return 0 /* CommandResult.Success */;
37198
37231
  }
@@ -37394,7 +37427,7 @@ class SortPlugin extends UIPlugin {
37394
37427
  for (let row = zone.top; row <= zone.bottom; row++) {
37395
37428
  for (let col = zone.left; col <= zone.right; col++) {
37396
37429
  if (!this.getters.isInMerge(sheetId, col, row)) {
37397
- return 62 /* CommandResult.InvalidSortZone */;
37430
+ return 63 /* CommandResult.InvalidSortZone */;
37398
37431
  }
37399
37432
  }
37400
37433
  }
@@ -37415,7 +37448,7 @@ class SortPlugin extends UIPlugin {
37415
37448
  ];
37416
37449
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37417
37450
  })) {
37418
- return 62 /* CommandResult.InvalidSortZone */;
37451
+ return 63 /* CommandResult.InvalidSortZone */;
37419
37452
  }
37420
37453
  return 0 /* CommandResult.Success */;
37421
37454
  }
@@ -38559,7 +38592,7 @@ const AddMergeInteractiveContent = {
38559
38592
  };
38560
38593
  function interactiveAddMerge(env, sheetId, target) {
38561
38594
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
38562
- if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
38595
+ if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
38563
38596
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
38564
38597
  }
38565
38598
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40458,8 +40491,9 @@ class RangeAdapter {
40458
40491
  *
40459
40492
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
40460
40493
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
40494
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
40461
40495
  */
40462
- getRangeString(range, forSheetId) {
40496
+ getRangeString(range, forSheetId, useFixedZone = false) {
40463
40497
  if (!range) {
40464
40498
  return INCORRECT_RANGE_STRING;
40465
40499
  }
@@ -40486,7 +40520,7 @@ class RangeAdapter {
40486
40520
  if (prefixSheet && !sheetName) {
40487
40521
  return INCORRECT_RANGE_STRING;
40488
40522
  }
40489
- let rangeString = this.getRangePartString(rangeImpl, 0);
40523
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
40490
40524
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
40491
40525
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
40492
40526
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -40496,7 +40530,7 @@ class RangeAdapter {
40496
40530
  rangeImpl.parts[1].rowFixed ||
40497
40531
  rangeImpl.parts[1].colFixed) {
40498
40532
  rangeString += ":";
40499
- rangeString += this.getRangePartString(rangeImpl, 1);
40533
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
40500
40534
  }
40501
40535
  }
40502
40536
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -40526,14 +40560,14 @@ class RangeAdapter {
40526
40560
  /**
40527
40561
  * Get a Xc string that represent a part of a range
40528
40562
  */
40529
- getRangePartString(range, part) {
40563
+ getRangePartString(range, part, useFixedZone = false) {
40530
40564
  var _a, _b;
40531
40565
  const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40532
40566
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40533
40567
  const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40534
40568
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40535
40569
  let str = "";
40536
- if (range.isFullCol) {
40570
+ if (range.isFullCol && !useFixedZone) {
40537
40571
  if (part === 0 && range.unboundedZone.hasHeader) {
40538
40572
  str = colFixed + col + rowFixed + row;
40539
40573
  }
@@ -40541,7 +40575,7 @@ class RangeAdapter {
40541
40575
  str = colFixed + col;
40542
40576
  }
40543
40577
  }
40544
- else if (range.isFullRow) {
40578
+ else if (range.isFullRow && !useFixedZone) {
40545
40579
  if (part === 0 && range.unboundedZone.hasHeader) {
40546
40580
  str = colFixed + col + rowFixed + row;
40547
40581
  }
@@ -40742,7 +40776,7 @@ class SelectionStreamProcessor {
40742
40776
  */
40743
40777
  moveAnchorCell(direction, step = 1) {
40744
40778
  if (step !== "end" && step <= 0) {
40745
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40779
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40746
40780
  }
40747
40781
  const { col, row } = this.getNextAvailablePosition(direction, step);
40748
40782
  return this.selectCell(col, row);
@@ -40788,7 +40822,7 @@ class SelectionStreamProcessor {
40788
40822
  */
40789
40823
  resizeAnchorZone(direction, step = 1) {
40790
40824
  if (step !== "end" && step <= 0) {
40791
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40825
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40792
40826
  }
40793
40827
  const sheetId = this.getters.getActiveSheetId();
40794
40828
  const anchor = this.anchor;
@@ -41599,12 +41633,7 @@ function addFormula(cell) {
41599
41633
  attrs.push(["t", "str"]);
41600
41634
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41601
41635
  }
41602
- node = escapeXml /*xml*/ `
41603
- <f>
41604
- ${XlsxFormula}
41605
- </f>
41606
- ${cycle}
41607
- `;
41636
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41608
41637
  return { attrs, node };
41609
41638
  }
41610
41639
  else {
@@ -42345,11 +42374,10 @@ function addRows(construct, data, sheet) {
42345
42374
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
42346
42375
  }
42347
42376
  attributes.push(...additionalAttrs);
42348
- cellNodes.push(escapeXml /*xml*/ `
42349
- <c ${formatAttributes(attributes)}>
42350
- ${cellNode}
42351
- </c>
42352
- `);
42377
+ // prettier-ignore
42378
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
42379
+ ${cellNode}
42380
+ </c>`);
42353
42381
  }
42354
42382
  }
42355
42383
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -42728,10 +42756,10 @@ class Model extends EventBus {
42728
42756
  const command = { type, ...payload };
42729
42757
  let status = this.status;
42730
42758
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
42731
- return new DispatchResult(66 /* CommandResult.Readonly */);
42759
+ return new DispatchResult(67 /* CommandResult.Readonly */);
42732
42760
  }
42733
42761
  if (!this.session.canApplyOptimisticUpdate()) {
42734
- return new DispatchResult(63 /* CommandResult.WaitingSessionConfirmation */);
42762
+ return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
42735
42763
  }
42736
42764
  switch (status) {
42737
42765
  case 0 /* Status.Ready */:
@@ -43171,6 +43199,6 @@ exports.setTranslationMethod = setTranslationMethod;
43171
43199
  exports.tokenize = tokenize;
43172
43200
 
43173
43201
 
43174
- __info__.version = '16.0.29';
43175
- __info__.date = '2024-01-17T10:24:52.885Z';
43176
- __info__.hash = '3fda985';
43202
+ __info__.version = '16.0.31';
43203
+ __info__.date = '2024-02-02T13:44:18.740Z';
43204
+ __info__.hash = 'a2e40a9';