@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.
@@ -1607,6 +1607,9 @@ function parseFormat(formatString) {
1607
1607
  function formatValue(value, format) {
1608
1608
  switch (typeof value) {
1609
1609
  case "string":
1610
+ if (value.includes('\\"')) {
1611
+ return value.replace(/\\"/g, '"');
1612
+ }
1610
1613
  return value;
1611
1614
  case "boolean":
1612
1615
  return value ? "TRUE" : "FALSE";
@@ -1891,27 +1894,30 @@ function createDefaultFormat(value) {
1891
1894
  }
1892
1895
  function createLargeNumberFormat(format, magnitude, postFix) {
1893
1896
  const internalFormat = parseFormat(format || "#,##0");
1894
- const largeNumberFormat = internalFormat
1895
- .map((formatPart) => {
1896
- if (formatPart.type === "NUMBER") {
1897
- return [
1898
- {
1899
- ...formatPart,
1900
- format: {
1901
- ...formatPart.format,
1902
- magnitude,
1903
- decimalPart: undefined,
1904
- },
1905
- },
1906
- {
1907
- type: "STRING",
1908
- format: postFix,
1909
- },
1910
- ];
1897
+ const largeNumberFormat = [];
1898
+ for (let i = 0; i < internalFormat.length; i++) {
1899
+ const formatPart = internalFormat[i];
1900
+ if (formatPart.type !== "NUMBER") {
1901
+ largeNumberFormat.push(formatPart);
1902
+ continue;
1911
1903
  }
1912
- return formatPart;
1913
- })
1914
- .flat();
1904
+ largeNumberFormat.push({
1905
+ ...formatPart,
1906
+ format: {
1907
+ ...formatPart.format,
1908
+ magnitude,
1909
+ decimalPart: undefined,
1910
+ },
1911
+ });
1912
+ largeNumberFormat.push({
1913
+ type: "STRING",
1914
+ format: postFix,
1915
+ });
1916
+ const nextFormatPart = internalFormat[i + 1];
1917
+ if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
1918
+ i++;
1919
+ }
1920
+ }
1915
1921
  return convertInternalFormatToFormat(largeNumberFormat);
1916
1922
  }
1917
1923
  function changeDecimalPlaces(format, step) {
@@ -3350,64 +3356,65 @@ var CommandResult;
3350
3356
  CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
3351
3357
  CommandResult[CommandResult["InputAlreadyFocused"] = 28] = "InputAlreadyFocused";
3352
3358
  CommandResult[CommandResult["MaximumRangesReached"] = 29] = "MaximumRangesReached";
3353
- CommandResult[CommandResult["InvalidChartDefinition"] = 30] = "InvalidChartDefinition";
3354
- CommandResult[CommandResult["InvalidDataSet"] = 31] = "InvalidDataSet";
3355
- CommandResult[CommandResult["InvalidLabelRange"] = 32] = "InvalidLabelRange";
3356
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 33] = "InvalidScorecardKeyValue";
3357
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 34] = "InvalidScorecardBaseline";
3358
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 35] = "InvalidGaugeDataRange";
3359
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 36] = "EmptyGaugeRangeMin";
3360
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 37] = "GaugeRangeMinNaN";
3361
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 38] = "EmptyGaugeRangeMax";
3362
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 39] = "GaugeRangeMaxNaN";
3363
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 40] = "GaugeRangeMinBiggerThanRangeMax";
3364
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 41] = "GaugeLowerInflectionPointNaN";
3365
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 42] = "GaugeUpperInflectionPointNaN";
3366
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 43] = "GaugeLowerBiggerThanUpper";
3367
- CommandResult[CommandResult["InvalidAutofillSelection"] = 44] = "InvalidAutofillSelection";
3368
- CommandResult[CommandResult["WrongComposerSelection"] = 45] = "WrongComposerSelection";
3369
- CommandResult[CommandResult["MinBiggerThanMax"] = 46] = "MinBiggerThanMax";
3370
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 47] = "LowerBiggerThanUpper";
3371
- CommandResult[CommandResult["MidBiggerThanMax"] = 48] = "MidBiggerThanMax";
3372
- CommandResult[CommandResult["MinBiggerThanMid"] = 49] = "MinBiggerThanMid";
3373
- CommandResult[CommandResult["FirstArgMissing"] = 50] = "FirstArgMissing";
3374
- CommandResult[CommandResult["SecondArgMissing"] = 51] = "SecondArgMissing";
3375
- CommandResult[CommandResult["MinNaN"] = 52] = "MinNaN";
3376
- CommandResult[CommandResult["MidNaN"] = 53] = "MidNaN";
3377
- CommandResult[CommandResult["MaxNaN"] = 54] = "MaxNaN";
3378
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 55] = "ValueUpperInflectionNaN";
3379
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 56] = "ValueLowerInflectionNaN";
3380
- CommandResult[CommandResult["MinInvalidFormula"] = 57] = "MinInvalidFormula";
3381
- CommandResult[CommandResult["MidInvalidFormula"] = 58] = "MidInvalidFormula";
3382
- CommandResult[CommandResult["MaxInvalidFormula"] = 59] = "MaxInvalidFormula";
3383
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 60] = "ValueUpperInvalidFormula";
3384
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 61] = "ValueLowerInvalidFormula";
3385
- CommandResult[CommandResult["InvalidSortZone"] = 62] = "InvalidSortZone";
3386
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 63] = "WaitingSessionConfirmation";
3387
- CommandResult[CommandResult["MergeOverlap"] = 64] = "MergeOverlap";
3388
- CommandResult[CommandResult["TooManyHiddenElements"] = 65] = "TooManyHiddenElements";
3389
- CommandResult[CommandResult["Readonly"] = 66] = "Readonly";
3390
- CommandResult[CommandResult["InvalidViewportSize"] = 67] = "InvalidViewportSize";
3391
- CommandResult[CommandResult["InvalidScrollingDirection"] = 68] = "InvalidScrollingDirection";
3392
- CommandResult[CommandResult["FigureDoesNotExist"] = 69] = "FigureDoesNotExist";
3393
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 70] = "InvalidConditionalFormatId";
3394
- CommandResult[CommandResult["InvalidCellPopover"] = 71] = "InvalidCellPopover";
3395
- CommandResult[CommandResult["EmptyTarget"] = 72] = "EmptyTarget";
3396
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 73] = "InvalidFreezeQuantity";
3397
- CommandResult[CommandResult["FrozenPaneOverlap"] = 74] = "FrozenPaneOverlap";
3398
- CommandResult[CommandResult["ValuesNotChanged"] = 75] = "ValuesNotChanged";
3399
- CommandResult[CommandResult["InvalidFilterZone"] = 76] = "InvalidFilterZone";
3400
- CommandResult[CommandResult["FilterOverlap"] = 77] = "FilterOverlap";
3401
- CommandResult[CommandResult["FilterNotFound"] = 78] = "FilterNotFound";
3402
- CommandResult[CommandResult["MergeInFilter"] = 79] = "MergeInFilter";
3403
- CommandResult[CommandResult["NonContinuousTargets"] = 80] = "NonContinuousTargets";
3404
- CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
3405
- CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3406
- CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3407
- CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3408
- CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3409
- CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3410
- CommandResult[CommandResult["NoChanges"] = 87] = "NoChanges";
3359
+ CommandResult[CommandResult["InvalidInputId"] = 30] = "InvalidInputId";
3360
+ CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
3361
+ CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
3362
+ CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
3363
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
3364
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
3365
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
3366
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
3367
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
3368
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
3369
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
3370
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
3371
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
3372
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
3373
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
3374
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
3375
+ CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
3376
+ CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
3377
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
3378
+ CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
3379
+ CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
3380
+ CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
3381
+ CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
3382
+ CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
3383
+ CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
3384
+ CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
3385
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
3386
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
3387
+ CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
3388
+ CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
3389
+ CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
3390
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
3391
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
3392
+ CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
3393
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
3394
+ CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
3395
+ CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
3396
+ CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
3397
+ CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
3398
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
3399
+ CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
3400
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
3401
+ CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
3402
+ CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
3403
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
3404
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
3405
+ CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
3406
+ CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
3407
+ CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
3408
+ CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
3409
+ CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
3410
+ CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
3411
+ CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
3412
+ CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3413
+ CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3414
+ CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3415
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3416
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3417
+ CommandResult[CommandResult["NoChanges"] = 88] = "NoChanges";
3411
3418
  })(CommandResult || (CommandResult = {}));
3412
3419
 
3413
3420
  function isMatrix(x) {
@@ -4908,7 +4915,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
4908
4915
  });
4909
4916
  }
4910
4917
  }
4911
- if (result.isCancelledBecause(62 /* CommandResult.InvalidSortZone */)) {
4918
+ if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
4912
4919
  const { col, row } = anchor;
4913
4920
  env.model.selection.selectZone({ cell: { col, row }, zone });
4914
4921
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -4931,13 +4938,13 @@ const AddFilterInteractiveContent = {
4931
4938
  };
4932
4939
  function interactiveAddFilter(env, sheetId, target) {
4933
4940
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
4934
- if (result.isCancelledBecause(77 /* CommandResult.FilterOverlap */)) {
4941
+ if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
4935
4942
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
4936
4943
  }
4937
- else if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
4944
+ else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
4938
4945
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
4939
4946
  }
4940
- else if (result.isCancelledBecause(80 /* CommandResult.NonContinuousTargets */)) {
4947
+ else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
4941
4948
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
4942
4949
  }
4943
4950
  }
@@ -4959,7 +4966,7 @@ function handlePasteResult(env, result) {
4959
4966
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
4960
4967
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
4961
4968
  }
4962
- else if (result.reasons.includes(74 /* CommandResult.FrozenPaneOverlap */)) {
4969
+ else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
4963
4970
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
4964
4971
  }
4965
4972
  }
@@ -5575,6 +5582,12 @@ const INSERT_LINK = (env) => {
5575
5582
  let { col, row } = env.model.getters.getPosition();
5576
5583
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
5577
5584
  };
5585
+ const INSERT_LINK_NAME = (env) => {
5586
+ const sheetId = env.model.getters.getActiveSheetId();
5587
+ const { col, row } = env.model.getters.getPosition();
5588
+ const cell = env.model.getters.getCell(sheetId, col, row);
5589
+ return cell && cell.isLink() ? _lt("Edit link") : _lt("Insert link");
5590
+ };
5578
5591
  //------------------------------------------------------------------------------
5579
5592
  // Filters action
5580
5593
  //------------------------------------------------------------------------------
@@ -5712,7 +5725,7 @@ cellMenuRegistry
5712
5725
  action: DELETE_CELL_SHIFT_LEFT,
5713
5726
  })
5714
5727
  .add("insert_link", {
5715
- name: _lt("Insert link"),
5728
+ name: INSERT_LINK_NAME,
5716
5729
  separator: true,
5717
5730
  sequence: 150,
5718
5731
  action: INSERT_LINK,
@@ -6001,22 +6014,22 @@ sheetMenuRegistry
6001
6014
  const CfTerms = {
6002
6015
  Errors: {
6003
6016
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
6004
- [50 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6005
- [51 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6006
- [52 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6007
- [53 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6008
- [54 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6009
- [55 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6010
- [56 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6011
- [46 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6012
- [49 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6013
- [48 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6014
- [47 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6015
- [57 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6016
- [59 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6017
- [58 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6018
- [60 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6019
- [61 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6017
+ [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6018
+ [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6019
+ [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6020
+ [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6021
+ [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6022
+ [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6023
+ [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6024
+ [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6025
+ [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6026
+ [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6027
+ [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6028
+ [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6029
+ [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6030
+ [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6031
+ [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6032
+ [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6020
6033
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
6021
6034
  Unexpected: _lt("The rule is invalid for an unknown reason"),
6022
6035
  },
@@ -6044,20 +6057,20 @@ const ChartTerms = {
6044
6057
  Errors: {
6045
6058
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
6046
6059
  // BASIC CHART ERRORS (LINE | BAR | PIE)
6047
- [31 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6048
- [32 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6060
+ [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6061
+ [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6049
6062
  // SCORECARD CHART ERRORS
6050
- [33 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6051
- [34 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6063
+ [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6064
+ [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6052
6065
  // GAUGE CHART ERRORS
6053
- [35 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6054
- [36 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6055
- [37 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6056
- [38 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6057
- [39 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6058
- [40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6059
- [41 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6060
- [42 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6066
+ [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6067
+ [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6068
+ [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6069
+ [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6070
+ [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6071
+ [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6072
+ [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6073
+ [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6061
6074
  },
6062
6075
  };
6063
6076
  const NumberFormatTerms = {
@@ -6081,7 +6094,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
6081
6094
  const sheetId = env.model.getters.getActiveSheetId();
6082
6095
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
6083
6096
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
6084
- if (result.isCancelledBecause(64 /* CommandResult.MergeOverlap */)) {
6097
+ if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
6085
6098
  env.raiseError(MergeErrorMessage);
6086
6099
  }
6087
6100
  }
@@ -6727,11 +6740,11 @@ class LineBarPieConfigPanel extends Component {
6727
6740
  }
6728
6741
  get isDatasetInvalid() {
6729
6742
  var _a;
6730
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(31 /* CommandResult.InvalidDataSet */));
6743
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
6731
6744
  }
6732
6745
  get isLabelInvalid() {
6733
6746
  var _a;
6734
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
6747
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
6735
6748
  }
6736
6749
  onUpdateDataSetsHaveTitle(ev) {
6737
6750
  this.props.updateChart(this.props.figureId, {
@@ -6952,14 +6965,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
6952
6965
  : undefined));
6953
6966
  }
6954
6967
  }
6955
- else if (zone.left === zone.right && zone.top === zone.bottom) {
6956
- // A single cell. If it's only the title, the dataset is not added.
6957
- if (!dataSetsHaveTitle) {
6958
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
6959
- }
6960
- }
6961
6968
  else {
6962
- /* 1 row or 1 column */
6969
+ /* 1 cell, 1 row or 1 column */
6963
6970
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
6964
6971
  ? {
6965
6972
  top: zone.top,
@@ -7009,8 +7016,10 @@ function toExcelDataset(getters, ds) {
7009
7016
  }
7010
7017
  const dataRange = ds.dataRange.clone({ zone: dataZone });
7011
7018
  return {
7012
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
7013
- range: getters.getRangeString(dataRange, "forceSheetReference"),
7019
+ label: ds.labelCell
7020
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
7021
+ : undefined,
7022
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
7014
7023
  };
7015
7024
  }
7016
7025
  /**
@@ -7079,11 +7088,11 @@ function checkDataset(definition) {
7079
7088
  if (definition.dataSets) {
7080
7089
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
7081
7090
  if (invalidRanges) {
7082
- return 31 /* CommandResult.InvalidDataSet */;
7091
+ return 32 /* CommandResult.InvalidDataSet */;
7083
7092
  }
7084
7093
  const zones = definition.dataSets.map(toUnboundedZone);
7085
7094
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
7086
- return 31 /* CommandResult.InvalidDataSet */;
7095
+ return 32 /* CommandResult.InvalidDataSet */;
7087
7096
  }
7088
7097
  }
7089
7098
  return 0 /* CommandResult.Success */;
@@ -7092,7 +7101,7 @@ function checkLabelRange(definition) {
7092
7101
  if (definition.labelRange) {
7093
7102
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
7094
7103
  if (invalidLabels) {
7095
- return 32 /* CommandResult.InvalidLabelRange */;
7104
+ return 33 /* CommandResult.InvalidLabelRange */;
7096
7105
  }
7097
7106
  }
7098
7107
  return 0 /* CommandResult.Success */;
@@ -7393,6 +7402,9 @@ class BarChart extends AbstractChart {
7393
7402
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7394
7403
  return {
7395
7404
  ...this.getDefinition(),
7405
+ labelRange: this.labelRange
7406
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
7407
+ : undefined,
7396
7408
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7397
7409
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7398
7410
  dataSets,
@@ -7550,7 +7562,7 @@ chartRegistry.add("gauge", {
7550
7562
  });
7551
7563
  function isDataRangeValid(definition) {
7552
7564
  return definition.dataRange && !rangeReference.test(definition.dataRange)
7553
- ? 35 /* CommandResult.InvalidGaugeDataRange */
7565
+ ? 36 /* CommandResult.InvalidGaugeDataRange */
7554
7566
  : 0 /* CommandResult.Success */;
7555
7567
  }
7556
7568
  function checkRangeLimits(check, batchValidations) {
@@ -7582,7 +7594,7 @@ function checkInflectionPointsValue(check, batchValidations) {
7582
7594
  function checkRangeMinBiggerThanRangeMax(definition) {
7583
7595
  if (definition.sectionRule) {
7584
7596
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
7585
- return 40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7597
+ return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7586
7598
  }
7587
7599
  }
7588
7600
  return 0 /* CommandResult.Success */;
@@ -7591,9 +7603,9 @@ function checkEmpty(value, valueName) {
7591
7603
  if (value === "") {
7592
7604
  switch (valueName) {
7593
7605
  case "rangeMin":
7594
- return 36 /* CommandResult.EmptyGaugeRangeMin */;
7606
+ return 37 /* CommandResult.EmptyGaugeRangeMin */;
7595
7607
  case "rangeMax":
7596
- return 38 /* CommandResult.EmptyGaugeRangeMax */;
7608
+ return 39 /* CommandResult.EmptyGaugeRangeMax */;
7597
7609
  }
7598
7610
  }
7599
7611
  return 0 /* CommandResult.Success */;
@@ -7602,13 +7614,13 @@ function checkNaN(value, valueName) {
7602
7614
  if (isNaN(value)) {
7603
7615
  switch (valueName) {
7604
7616
  case "rangeMin":
7605
- return 37 /* CommandResult.GaugeRangeMinNaN */;
7617
+ return 38 /* CommandResult.GaugeRangeMinNaN */;
7606
7618
  case "rangeMax":
7607
- return 39 /* CommandResult.GaugeRangeMaxNaN */;
7619
+ return 40 /* CommandResult.GaugeRangeMaxNaN */;
7608
7620
  case "lowerInflectionPointValue":
7609
- return 41 /* CommandResult.GaugeLowerInflectionPointNaN */;
7621
+ return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
7610
7622
  case "upperInflectionPointValue":
7611
- return 42 /* CommandResult.GaugeUpperInflectionPointNaN */;
7623
+ return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
7612
7624
  }
7613
7625
  }
7614
7626
  return 0 /* CommandResult.Success */;
@@ -8021,6 +8033,9 @@ class LineChart extends AbstractChart {
8021
8033
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8022
8034
  return {
8023
8035
  ...this.getDefinition(),
8036
+ labelRange: this.labelRange
8037
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8038
+ : undefined,
8024
8039
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8025
8040
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8026
8041
  dataSets,
@@ -8281,6 +8296,9 @@ class PieChart extends AbstractChart {
8281
8296
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8282
8297
  return {
8283
8298
  ...this.getDefinition(),
8299
+ labelRange: this.labelRange
8300
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8301
+ : undefined,
8284
8302
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8285
8303
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8286
8304
  verticalAxisPosition: "left",
@@ -8361,12 +8379,12 @@ chartRegistry.add("scorecard", {
8361
8379
  });
8362
8380
  function checkKeyValue(definition) {
8363
8381
  return definition.keyValue && !rangeReference.test(definition.keyValue)
8364
- ? 33 /* CommandResult.InvalidScorecardKeyValue */
8382
+ ? 34 /* CommandResult.InvalidScorecardKeyValue */
8365
8383
  : 0 /* CommandResult.Success */;
8366
8384
  }
8367
8385
  function checkBaseline(definition) {
8368
8386
  return definition.baseline && !rangeReference.test(definition.baseline)
8369
- ? 34 /* CommandResult.InvalidScorecardBaseline */
8387
+ ? 35 /* CommandResult.InvalidScorecardBaseline */
8370
8388
  : 0 /* CommandResult.Success */;
8371
8389
  }
8372
8390
  class ScorecardChart$1 extends AbstractChart {
@@ -8795,7 +8813,7 @@ class GaugeChartConfigPanel extends Component {
8795
8813
  }
8796
8814
  get isDataRangeInvalid() {
8797
8815
  var _a;
8798
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidGaugeDataRange */));
8816
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
8799
8817
  }
8800
8818
  onDataRangeChanged(ranges) {
8801
8819
  this.dataRange = ranges[0];
@@ -8882,28 +8900,28 @@ class GaugeChartDesignPanel extends Component {
8882
8900
  }
8883
8901
  isRangeMinInvalid() {
8884
8902
  var _a, _b, _c;
8885
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.EmptyGaugeRangeMin */)) ||
8886
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(37 /* CommandResult.GaugeRangeMinNaN */)) ||
8887
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8903
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
8904
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
8905
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8888
8906
  }
8889
8907
  isRangeMaxInvalid() {
8890
8908
  var _a, _b, _c;
8891
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMax */)) ||
8892
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMaxNaN */)) ||
8893
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8909
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
8910
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
8911
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8894
8912
  }
8895
8913
  // ---------------------------------------------------------------------------
8896
8914
  // COLOR_SECTION_TEMPLATE
8897
8915
  // ---------------------------------------------------------------------------
8898
8916
  get isLowerInflectionPointInvalid() {
8899
8917
  var _a, _b;
8900
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(41 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8901
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8918
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8919
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8902
8920
  }
8903
8921
  get isUpperInflectionPointInvalid() {
8904
8922
  var _a, _b;
8905
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8906
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8923
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8924
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8907
8925
  }
8908
8926
  updateInflectionPointValue(attr, ev) {
8909
8927
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -9006,11 +9024,11 @@ class ScorecardChartConfigPanel extends Component {
9006
9024
  }
9007
9025
  get isKeyValueInvalid() {
9008
9026
  var _a;
9009
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidScorecardKeyValue */));
9027
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
9010
9028
  }
9011
9029
  get isBaselineInvalid() {
9012
9030
  var _a;
9013
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardBaseline */));
9031
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
9014
9032
  }
9015
9033
  onKeyValueRangeChanged(ranges) {
9016
9034
  this.keyValue = ranges[0];
@@ -9850,11 +9868,11 @@ class ConditionalFormattingPanel extends Component {
9850
9868
  ****************************************************************************/
9851
9869
  get isValue1Invalid() {
9852
9870
  var _a;
9853
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(50 /* CommandResult.FirstArgMissing */));
9871
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
9854
9872
  }
9855
9873
  get isValue2Invalid() {
9856
9874
  var _a;
9857
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.SecondArgMissing */));
9875
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
9858
9876
  }
9859
9877
  toggleStyle(tool) {
9860
9878
  const style = this.state.rules.cellIs.style;
@@ -9871,17 +9889,17 @@ class ConditionalFormattingPanel extends Component {
9871
9889
  isValueInvalid(threshold) {
9872
9890
  switch (threshold) {
9873
9891
  case "minimum":
9874
- return (this.state.errors.includes(57 /* CommandResult.MinInvalidFormula */) ||
9875
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMid */) ||
9876
- this.state.errors.includes(46 /* CommandResult.MinBiggerThanMax */) ||
9877
- this.state.errors.includes(52 /* CommandResult.MinNaN */));
9892
+ return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
9893
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
9894
+ this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
9895
+ this.state.errors.includes(53 /* CommandResult.MinNaN */));
9878
9896
  case "midpoint":
9879
- return (this.state.errors.includes(58 /* CommandResult.MidInvalidFormula */) ||
9880
- this.state.errors.includes(53 /* CommandResult.MidNaN */) ||
9881
- this.state.errors.includes(48 /* CommandResult.MidBiggerThanMax */));
9897
+ return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
9898
+ this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
9899
+ this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
9882
9900
  case "maximum":
9883
- return (this.state.errors.includes(59 /* CommandResult.MaxInvalidFormula */) ||
9884
- this.state.errors.includes(54 /* CommandResult.MaxNaN */));
9901
+ return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
9902
+ this.state.errors.includes(55 /* CommandResult.MaxNaN */));
9885
9903
  default:
9886
9904
  return false;
9887
9905
  }
@@ -9930,13 +9948,13 @@ class ConditionalFormattingPanel extends Component {
9930
9948
  isInflectionPointInvalid(inflectionPoint) {
9931
9949
  switch (inflectionPoint) {
9932
9950
  case "lowerInflectionPoint":
9933
- return (this.state.errors.includes(56 /* CommandResult.ValueLowerInflectionNaN */) ||
9934
- this.state.errors.includes(61 /* CommandResult.ValueLowerInvalidFormula */) ||
9935
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9951
+ return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
9952
+ this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
9953
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9936
9954
  case "upperInflectionPoint":
9937
- return (this.state.errors.includes(55 /* CommandResult.ValueUpperInflectionNaN */) ||
9938
- this.state.errors.includes(60 /* CommandResult.ValueUpperInvalidFormula */) ||
9939
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9955
+ return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
9956
+ this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
9957
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9940
9958
  default:
9941
9959
  return true;
9942
9960
  }
@@ -19581,7 +19599,7 @@ class EditionPlugin extends UIPlugin {
19581
19599
  validateSelection(length, start, end) {
19582
19600
  return start >= 0 && start <= length && end >= 0 && end <= length
19583
19601
  ? 0 /* CommandResult.Success */
19584
- : 45 /* CommandResult.WrongComposerSelection */;
19602
+ : 46 /* CommandResult.WrongComposerSelection */;
19585
19603
  }
19586
19604
  onColumnsRemoved(cmd) {
19587
19605
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -19865,9 +19883,10 @@ class EditionPlugin extends UIPlugin {
19865
19883
  */
19866
19884
  getReferencedRanges() {
19867
19885
  const editionSheetId = this.getters.getEditionSheet();
19868
- return this.currentTokens
19886
+ const referenceRanges = this.currentTokens
19869
19887
  .filter((token) => token.type === "REFERENCE")
19870
19888
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
19889
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
19871
19890
  }
19872
19891
  /**
19873
19892
  * Function used to determine when composer selection can start.
@@ -27638,7 +27657,7 @@ class BordersPlugin extends CorePlugin {
27638
27657
  const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
27639
27658
  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);
27640
27659
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
27641
- return 87 /* CommandResult.NoChanges */;
27660
+ return 88 /* CommandResult.NoChanges */;
27642
27661
  }
27643
27662
  return 0 /* CommandResult.Success */;
27644
27663
  }
@@ -27880,6 +27899,9 @@ class CellPlugin extends CorePlugin {
27880
27899
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27881
27900
  content: cell.content || undefined,
27882
27901
  };
27902
+ if (cell.isFormula()) {
27903
+ cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27904
+ }
27883
27905
  }
27884
27906
  _sheet.cells = cells;
27885
27907
  }
@@ -27927,13 +27949,13 @@ class CellPlugin extends CorePlugin {
27927
27949
  /*
27928
27950
  * Reconstructs the original formula string based on a normalized form and its dependencies
27929
27951
  */
27930
- buildFormulaContent(sheetId, cell, dependencies) {
27952
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
27931
27953
  const ranges = dependencies || cell.dependencies;
27932
27954
  let rangeIndex = 0;
27933
27955
  return concat(cell.compiledFormula.tokens.map((token) => {
27934
27956
  if (token.type === "REFERENCE") {
27935
27957
  const range = ranges[rangeIndex++];
27936
- return this.getters.getRangeString(range, sheetId);
27958
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
27937
27959
  }
27938
27960
  return token.value;
27939
27961
  }));
@@ -28098,9 +28120,9 @@ class CellPlugin extends CorePlugin {
28098
28120
  checkUselessClearCell(cmd) {
28099
28121
  const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28100
28122
  if (!cell)
28101
- return 87 /* CommandResult.NoChanges */;
28123
+ return 88 /* CommandResult.NoChanges */;
28102
28124
  if (!cell.content && !cell.style && !cell.format) {
28103
- return 87 /* CommandResult.NoChanges */;
28125
+ return 88 /* CommandResult.NoChanges */;
28104
28126
  }
28105
28127
  return 0 /* CommandResult.Success */;
28106
28128
  }
@@ -28309,13 +28331,13 @@ class ChartPlugin extends CorePlugin {
28309
28331
  }
28310
28332
  checkChartDuplicate(cmd) {
28311
28333
  return this.getters.getFigureSheetId(cmd.id)
28312
- ? 83 /* CommandResult.DuplicatedChartId */
28334
+ ? 84 /* CommandResult.DuplicatedChartId */
28313
28335
  : 0 /* CommandResult.Success */;
28314
28336
  }
28315
28337
  checkChartExists(cmd) {
28316
28338
  return this.getters.getFigureSheetId(cmd.id)
28317
28339
  ? 0 /* CommandResult.Success */
28318
- : 84 /* CommandResult.ChartDoesNotExist */;
28340
+ : 85 /* CommandResult.ChartDoesNotExist */;
28319
28341
  }
28320
28342
  }
28321
28343
  ChartPlugin.getters = [
@@ -28430,7 +28452,13 @@ class ConditionalFormatPlugin extends CorePlugin {
28430
28452
  }
28431
28453
  }
28432
28454
  exportForExcel(data) {
28433
- this.export(data);
28455
+ if (data.sheets) {
28456
+ for (let sheet of data.sheets) {
28457
+ if (this.cfRules[sheet.id]) {
28458
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
28459
+ }
28460
+ }
28461
+ }
28434
28462
  }
28435
28463
  // ---------------------------------------------------------------------------
28436
28464
  // Getters
@@ -28480,11 +28508,11 @@ class ConditionalFormatPlugin extends CorePlugin {
28480
28508
  // ---------------------------------------------------------------------------
28481
28509
  // Private
28482
28510
  // ---------------------------------------------------------------------------
28483
- mapToConditionalFormat(sheetId, cf) {
28511
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
28484
28512
  return {
28485
28513
  ...cf,
28486
28514
  ranges: cf.ranges.map((range) => {
28487
- return this.getters.getRangeString(range, sheetId);
28515
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
28488
28516
  }),
28489
28517
  };
28490
28518
  }
@@ -28517,10 +28545,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28517
28545
  return 27 /* CommandResult.InvalidSheetId */;
28518
28546
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
28519
28547
  if (ruleIndex === -1)
28520
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28548
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28521
28549
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
28522
28550
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
28523
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28551
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28524
28552
  }
28525
28553
  return 0 /* CommandResult.Success */;
28526
28554
  }
@@ -28561,10 +28589,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28561
28589
  const errors = [];
28562
28590
  const isEmpty = (value) => value === undefined || value === "";
28563
28591
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
28564
- errors.push(50 /* CommandResult.FirstArgMissing */);
28592
+ errors.push(51 /* CommandResult.FirstArgMissing */);
28565
28593
  }
28566
28594
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
28567
- errors.push(51 /* CommandResult.SecondArgMissing */);
28595
+ errors.push(52 /* CommandResult.SecondArgMissing */);
28568
28596
  }
28569
28597
  return errors.length ? errors : 0 /* CommandResult.Success */;
28570
28598
  }
@@ -28576,15 +28604,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28576
28604
  (threshold.value === "" || isNaN(threshold.value))) {
28577
28605
  switch (thresholdName) {
28578
28606
  case "min":
28579
- return 52 /* CommandResult.MinNaN */;
28607
+ return 53 /* CommandResult.MinNaN */;
28580
28608
  case "max":
28581
- return 54 /* CommandResult.MaxNaN */;
28609
+ return 55 /* CommandResult.MaxNaN */;
28582
28610
  case "mid":
28583
- return 53 /* CommandResult.MidNaN */;
28611
+ return 54 /* CommandResult.MidNaN */;
28584
28612
  case "upperInflectionPoint":
28585
- return 55 /* CommandResult.ValueUpperInflectionNaN */;
28613
+ return 56 /* CommandResult.ValueUpperInflectionNaN */;
28586
28614
  case "lowerInflectionPoint":
28587
- return 56 /* CommandResult.ValueLowerInflectionNaN */;
28615
+ return 57 /* CommandResult.ValueLowerInflectionNaN */;
28588
28616
  }
28589
28617
  }
28590
28618
  return 0 /* CommandResult.Success */;
@@ -28598,15 +28626,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28598
28626
  catch (error) {
28599
28627
  switch (thresholdName) {
28600
28628
  case "min":
28601
- return 57 /* CommandResult.MinInvalidFormula */;
28629
+ return 58 /* CommandResult.MinInvalidFormula */;
28602
28630
  case "max":
28603
- return 59 /* CommandResult.MaxInvalidFormula */;
28631
+ return 60 /* CommandResult.MaxInvalidFormula */;
28604
28632
  case "mid":
28605
- return 58 /* CommandResult.MidInvalidFormula */;
28633
+ return 59 /* CommandResult.MidInvalidFormula */;
28606
28634
  case "upperInflectionPoint":
28607
- return 60 /* CommandResult.ValueUpperInvalidFormula */;
28635
+ return 61 /* CommandResult.ValueUpperInvalidFormula */;
28608
28636
  case "lowerInflectionPoint":
28609
- return 61 /* CommandResult.ValueLowerInvalidFormula */;
28637
+ return 62 /* CommandResult.ValueLowerInvalidFormula */;
28610
28638
  }
28611
28639
  }
28612
28640
  return 0 /* CommandResult.Success */;
@@ -28623,7 +28651,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28623
28651
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
28624
28652
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
28625
28653
  Number(minValue) > Number(maxValue)) {
28626
- return 47 /* CommandResult.LowerBiggerThanUpper */;
28654
+ return 48 /* CommandResult.LowerBiggerThanUpper */;
28627
28655
  }
28628
28656
  return 0 /* CommandResult.Success */;
28629
28657
  }
@@ -28633,7 +28661,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28633
28661
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
28634
28662
  rule.minimum.type === rule.maximum.type &&
28635
28663
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
28636
- return 46 /* CommandResult.MinBiggerThanMax */;
28664
+ return 47 /* CommandResult.MinBiggerThanMax */;
28637
28665
  }
28638
28666
  return 0 /* CommandResult.Success */;
28639
28667
  }
@@ -28645,7 +28673,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28645
28673
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28646
28674
  rule.midpoint.type === rule.maximum.type &&
28647
28675
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
28648
- return 48 /* CommandResult.MidBiggerThanMax */;
28676
+ return 49 /* CommandResult.MidBiggerThanMax */;
28649
28677
  }
28650
28678
  return 0 /* CommandResult.Success */;
28651
28679
  }
@@ -28657,7 +28685,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28657
28685
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28658
28686
  rule.minimum.type === rule.midpoint.type &&
28659
28687
  stringToNumber(minValue) >= stringToNumber(midValue)) {
28660
- return 49 /* CommandResult.MinBiggerThanMid */;
28688
+ return 50 /* CommandResult.MinBiggerThanMid */;
28661
28689
  }
28662
28690
  return 0 /* CommandResult.Success */;
28663
28691
  }
@@ -28758,13 +28786,13 @@ class FigurePlugin extends CorePlugin {
28758
28786
  checkFigureExists(sheetId, figureId) {
28759
28787
  var _a;
28760
28788
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
28761
- return 69 /* CommandResult.FigureDoesNotExist */;
28789
+ return 70 /* CommandResult.FigureDoesNotExist */;
28762
28790
  }
28763
28791
  return 0 /* CommandResult.Success */;
28764
28792
  }
28765
28793
  checkFigureDuplicate(figureId) {
28766
28794
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
28767
- return 81 /* CommandResult.DuplicatedFigureId */;
28795
+ return 82 /* CommandResult.DuplicatedFigureId */;
28768
28796
  }
28769
28797
  return 0 /* CommandResult.Success */;
28770
28798
  }
@@ -28866,12 +28894,12 @@ class FiltersPlugin extends CorePlugin {
28866
28894
  switch (cmd.type) {
28867
28895
  case "CREATE_FILTER_TABLE":
28868
28896
  if (!areZonesContinuous(...cmd.target)) {
28869
- return 80 /* CommandResult.NonContinuousTargets */;
28897
+ return 81 /* CommandResult.NonContinuousTargets */;
28870
28898
  }
28871
28899
  const zone = union(...cmd.target);
28872
28900
  const checkFilterOverlap = () => {
28873
28901
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
28874
- return 77 /* CommandResult.FilterOverlap */;
28902
+ return 78 /* CommandResult.FilterOverlap */;
28875
28903
  }
28876
28904
  return 0 /* CommandResult.Success */;
28877
28905
  };
@@ -28879,7 +28907,7 @@ class FiltersPlugin extends CorePlugin {
28879
28907
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
28880
28908
  for (let merge of mergesInTarget) {
28881
28909
  if (overlap(zone, merge)) {
28882
- return 79 /* CommandResult.MergeInFilter */;
28910
+ return 80 /* CommandResult.MergeInFilter */;
28883
28911
  }
28884
28912
  }
28885
28913
  return 0 /* CommandResult.Success */;
@@ -28889,7 +28917,7 @@ class FiltersPlugin extends CorePlugin {
28889
28917
  for (let merge of cmd.target) {
28890
28918
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
28891
28919
  if (overlap(filterTable.zone, merge)) {
28892
- return 79 /* CommandResult.MergeInFilter */;
28920
+ return 80 /* CommandResult.MergeInFilter */;
28893
28921
  }
28894
28922
  }
28895
28923
  }
@@ -29389,10 +29417,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
29389
29417
  : this.getters.getNumberRows(cmd.sheetId);
29390
29418
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29391
29419
  if (hiddenElements.size >= elements) {
29392
- return 65 /* CommandResult.TooManyHiddenElements */;
29420
+ return 66 /* CommandResult.TooManyHiddenElements */;
29393
29421
  }
29394
29422
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29395
- return 85 /* CommandResult.InvalidHeaderIndex */;
29423
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29396
29424
  }
29397
29425
  else {
29398
29426
  return 0 /* CommandResult.Success */;
@@ -29795,7 +29823,7 @@ class MergePlugin extends CorePlugin {
29795
29823
  for (const zone of target) {
29796
29824
  for (const zone2 of target) {
29797
29825
  if (zone !== zone2 && overlap(zone, zone2)) {
29798
- return 64 /* CommandResult.MergeOverlap */;
29826
+ return 65 /* CommandResult.MergeOverlap */;
29799
29827
  }
29800
29828
  }
29801
29829
  }
@@ -29809,7 +29837,7 @@ class MergePlugin extends CorePlugin {
29809
29837
  for (const zone of target) {
29810
29838
  if ((zone.left < xSplit && zone.right >= xSplit) ||
29811
29839
  (zone.top < ySplit && zone.bottom >= ySplit)) {
29812
- return 74 /* CommandResult.FrozenPaneOverlap */;
29840
+ return 75 /* CommandResult.FrozenPaneOverlap */;
29813
29841
  }
29814
29842
  }
29815
29843
  return 0 /* CommandResult.Success */;
@@ -30056,10 +30084,10 @@ class SheetPlugin extends CorePlugin {
30056
30084
  ? this.getNumberCols(cmd.sheetId)
30057
30085
  : this.getNumberRows(cmd.sheetId);
30058
30086
  if (cmd.base < 0 || cmd.base >= elements) {
30059
- return 85 /* CommandResult.InvalidHeaderIndex */;
30087
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30060
30088
  }
30061
30089
  else if (cmd.quantity <= 0) {
30062
- return 86 /* CommandResult.InvalidQuantity */;
30090
+ return 87 /* CommandResult.InvalidQuantity */;
30063
30091
  }
30064
30092
  return 0 /* CommandResult.Success */;
30065
30093
  case "REMOVE_COLUMNS_ROWS": {
@@ -30067,7 +30095,7 @@ class SheetPlugin extends CorePlugin {
30067
30095
  ? this.getNumberCols(cmd.sheetId)
30068
30096
  : this.getNumberRows(cmd.sheetId);
30069
30097
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30070
- return 85 /* CommandResult.InvalidHeaderIndex */;
30098
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30071
30099
  }
30072
30100
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
30073
30101
  return 8 /* CommandResult.NotEnoughElements */;
@@ -30524,18 +30552,18 @@ class SheetPlugin extends CorePlugin {
30524
30552
  checkRowFreezeQuantity(cmd) {
30525
30553
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
30526
30554
  ? 0 /* CommandResult.Success */
30527
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30555
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30528
30556
  }
30529
30557
  checkColFreezeQuantity(cmd) {
30530
30558
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
30531
30559
  ? 0 /* CommandResult.Success */
30532
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30560
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30533
30561
  }
30534
30562
  checkRowFreezeOverlapMerge(cmd) {
30535
30563
  const merges = this.getters.getMerges(cmd.sheetId);
30536
30564
  for (let merge of merges) {
30537
30565
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
30538
- return 64 /* CommandResult.MergeOverlap */;
30566
+ return 65 /* CommandResult.MergeOverlap */;
30539
30567
  }
30540
30568
  }
30541
30569
  return 0 /* CommandResult.Success */;
@@ -30544,7 +30572,7 @@ class SheetPlugin extends CorePlugin {
30544
30572
  const merges = this.getters.getMerges(cmd.sheetId);
30545
30573
  for (let merge of merges) {
30546
30574
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
30547
- return 64 /* CommandResult.MergeOverlap */;
30575
+ return 65 /* CommandResult.MergeOverlap */;
30548
30576
  }
30549
30577
  }
30550
30578
  return 0 /* CommandResult.Success */;
@@ -30985,7 +31013,7 @@ class AutofillPlugin extends UIPlugin {
30985
31013
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
30986
31014
  return 0 /* CommandResult.Success */;
30987
31015
  }
30988
- return 44 /* CommandResult.InvalidAutofillSelection */;
31016
+ return 45 /* CommandResult.InvalidAutofillSelection */;
30989
31017
  case "AUTOFILL_AUTO":
30990
31018
  const zone = this.getters.getSelectedZone();
30991
31019
  return zone.top === zone.bottom
@@ -31585,7 +31613,7 @@ class CellPopoverPlugin extends UIPlugin {
31585
31613
  cellPopoverRegistry.get(cmd.popoverType);
31586
31614
  }
31587
31615
  catch (error) {
31588
- return 71 /* CommandResult.InvalidCellPopover */;
31616
+ return 72 /* CommandResult.InvalidCellPopover */;
31589
31617
  }
31590
31618
  return 0 /* CommandResult.Success */;
31591
31619
  default:
@@ -31809,7 +31837,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
31809
31837
  for (const zone of this.getPasteZones(target)) {
31810
31838
  if ((zone.left < xSplit && zone.right >= xSplit) ||
31811
31839
  (zone.top < ySplit && zone.bottom >= ySplit)) {
31812
- return 74 /* CommandResult.FrozenPaneOverlap */;
31840
+ return 75 /* CommandResult.FrozenPaneOverlap */;
31813
31841
  }
31814
31842
  }
31815
31843
  return 0 /* CommandResult.Success */;
@@ -32169,7 +32197,7 @@ class ClipboardFigureState {
32169
32197
  }
32170
32198
  isPasteAllowed(target, option) {
32171
32199
  if (target.length === 0) {
32172
- return 72 /* CommandResult.EmptyTarget */;
32200
+ return 73 /* CommandResult.EmptyTarget */;
32173
32201
  }
32174
32202
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
32175
32203
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -32813,10 +32841,8 @@ class EvaluationPlugin extends UIPlugin {
32813
32841
  * that are actually present in the grid.
32814
32842
  */
32815
32843
  function range(range) {
32844
+ assertRangeValid(range);
32816
32845
  const sheetId = range.sheetId;
32817
- if (!isZoneValid(range.zone)) {
32818
- throw new InvalidReferenceError();
32819
- }
32820
32846
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32821
32847
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32822
32848
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32851,23 +32877,26 @@ class EvaluationPlugin extends UIPlugin {
32851
32877
  * The `compute` of the formula's function must process it completely
32852
32878
  */
32853
32879
  function refFn(range, isMeta, functionName, paramNumber) {
32880
+ assertRangeValid(range);
32854
32881
  if (isMeta) {
32855
32882
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32856
32883
  return { value: zoneToXc(range.zone) };
32857
32884
  }
32858
- if (!isZoneValid(range.zone)) {
32859
- throw new InvalidReferenceError();
32860
- }
32861
32885
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32862
32886
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32863
32887
  throw new Error(paramNumber
32864
32888
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32865
32889
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32866
32890
  }
32891
+ return readCell(range);
32892
+ }
32893
+ function assertRangeValid(range) {
32894
+ if (!isZoneValid(range.zone)) {
32895
+ throw new InvalidReferenceError();
32896
+ }
32867
32897
  if (range.invalidSheetName) {
32868
32898
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32869
32899
  }
32870
- return readCell(range);
32871
32900
  }
32872
32901
  return [refFn, range, evalContext];
32873
32902
  }
@@ -33331,7 +33360,7 @@ class FilterEvaluationPlugin extends UIPlugin {
33331
33360
  switch (cmd.type) {
33332
33361
  case "UPDATE_FILTER":
33333
33362
  if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
33334
- return 78 /* CommandResult.FilterNotFound */;
33363
+ return 79 /* CommandResult.FilterNotFound */;
33335
33364
  }
33336
33365
  break;
33337
33366
  }
@@ -35151,7 +35180,7 @@ class GridSelectionPlugin extends UIPlugin {
35151
35180
  const headers = [cmd.base, ...cmd.elements];
35152
35181
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
35153
35182
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
35154
- return 85 /* CommandResult.InvalidHeaderIndex */;
35183
+ return 86 /* CommandResult.InvalidHeaderIndex */;
35155
35184
  }
35156
35185
  return 0 /* CommandResult.Success */;
35157
35186
  }
@@ -35282,21 +35311,6 @@ class SelectionInputPlugin extends UIPlugin {
35282
35311
  // ---------------------------------------------------------------------------
35283
35312
  // Command Handling
35284
35313
  // ---------------------------------------------------------------------------
35285
- allowDispatch(cmd) {
35286
- switch (cmd.type) {
35287
- case "ADD_EMPTY_RANGE":
35288
- if (this.inputHasSingleRange && this.ranges.length === 1) {
35289
- return 29 /* CommandResult.MaximumRangesReached */;
35290
- }
35291
- break;
35292
- case "CHANGE_RANGE":
35293
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35294
- return 29 /* CommandResult.MaximumRangesReached */;
35295
- }
35296
- break;
35297
- }
35298
- return 0 /* CommandResult.Success */;
35299
- }
35300
35314
  handleEvent(event) {
35301
35315
  const xc = zoneToXc(event.anchor.zone);
35302
35316
  const inputSheetId = this.activeSheet;
@@ -35506,6 +35520,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35506
35520
  // ---------------------------------------------------------------------------
35507
35521
  allowDispatch(cmd) {
35508
35522
  var _a, _b;
35523
+ switch (cmd.type) {
35524
+ case "FOCUS_RANGE":
35525
+ case "CHANGE_RANGE":
35526
+ case "ADD_EMPTY_RANGE":
35527
+ case "REMOVE_RANGE":
35528
+ if (!this.inputs[cmd.id]) {
35529
+ return 30 /* CommandResult.InvalidInputId */;
35530
+ }
35531
+ }
35509
35532
  switch (cmd.type) {
35510
35533
  case "FOCUS_RANGE":
35511
35534
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -35513,9 +35536,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35513
35536
  return 28 /* CommandResult.InputAlreadyFocused */;
35514
35537
  }
35515
35538
  break;
35516
- }
35517
- if (this.currentInput) {
35518
- return this.currentInput.allowDispatch(cmd);
35539
+ case "ADD_EMPTY_RANGE":
35540
+ const input = this.inputs[cmd.id];
35541
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
35542
+ return 29 /* CommandResult.MaximumRangesReached */;
35543
+ }
35544
+ break;
35545
+ case "CHANGE_RANGE": {
35546
+ const input = this.inputs[cmd.id];
35547
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
35548
+ return 29 /* CommandResult.MaximumRangesReached */;
35549
+ }
35550
+ break;
35551
+ }
35519
35552
  }
35520
35553
  return 0 /* CommandResult.Success */;
35521
35554
  }
@@ -37170,7 +37203,7 @@ class SheetViewPlugin extends UIPlugin {
37170
37203
  }
37171
37204
  checkPositiveDimension(cmd) {
37172
37205
  if (cmd.width < 0 || cmd.height < 0) {
37173
- return 67 /* CommandResult.InvalidViewportSize */;
37206
+ return 68 /* CommandResult.InvalidViewportSize */;
37174
37207
  }
37175
37208
  return 0 /* CommandResult.Success */;
37176
37209
  }
@@ -37180,7 +37213,7 @@ class SheetViewPlugin extends UIPlugin {
37180
37213
  cmd.gridOffsetY === this.gridOffsetY &&
37181
37214
  cmd.width === width &&
37182
37215
  cmd.height === height) {
37183
- return 75 /* CommandResult.ValuesNotChanged */;
37216
+ return 76 /* CommandResult.ValuesNotChanged */;
37184
37217
  }
37185
37218
  return 0 /* CommandResult.Success */;
37186
37219
  }
@@ -37188,7 +37221,7 @@ class SheetViewPlugin extends UIPlugin {
37188
37221
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
37189
37222
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
37190
37223
  (!pane.canScrollVertically && offsetY > 0)) {
37191
- return 68 /* CommandResult.InvalidScrollingDirection */;
37224
+ return 69 /* CommandResult.InvalidScrollingDirection */;
37192
37225
  }
37193
37226
  return 0 /* CommandResult.Success */;
37194
37227
  }
@@ -37390,7 +37423,7 @@ class SortPlugin extends UIPlugin {
37390
37423
  for (let row = zone.top; row <= zone.bottom; row++) {
37391
37424
  for (let col = zone.left; col <= zone.right; col++) {
37392
37425
  if (!this.getters.isInMerge(sheetId, col, row)) {
37393
- return 62 /* CommandResult.InvalidSortZone */;
37426
+ return 63 /* CommandResult.InvalidSortZone */;
37394
37427
  }
37395
37428
  }
37396
37429
  }
@@ -37411,7 +37444,7 @@ class SortPlugin extends UIPlugin {
37411
37444
  ];
37412
37445
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37413
37446
  })) {
37414
- return 62 /* CommandResult.InvalidSortZone */;
37447
+ return 63 /* CommandResult.InvalidSortZone */;
37415
37448
  }
37416
37449
  return 0 /* CommandResult.Success */;
37417
37450
  }
@@ -38555,7 +38588,7 @@ const AddMergeInteractiveContent = {
38555
38588
  };
38556
38589
  function interactiveAddMerge(env, sheetId, target) {
38557
38590
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
38558
- if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
38591
+ if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
38559
38592
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
38560
38593
  }
38561
38594
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40454,8 +40487,9 @@ class RangeAdapter {
40454
40487
  *
40455
40488
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
40456
40489
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
40490
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
40457
40491
  */
40458
- getRangeString(range, forSheetId) {
40492
+ getRangeString(range, forSheetId, useFixedZone = false) {
40459
40493
  if (!range) {
40460
40494
  return INCORRECT_RANGE_STRING;
40461
40495
  }
@@ -40482,7 +40516,7 @@ class RangeAdapter {
40482
40516
  if (prefixSheet && !sheetName) {
40483
40517
  return INCORRECT_RANGE_STRING;
40484
40518
  }
40485
- let rangeString = this.getRangePartString(rangeImpl, 0);
40519
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
40486
40520
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
40487
40521
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
40488
40522
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -40492,7 +40526,7 @@ class RangeAdapter {
40492
40526
  rangeImpl.parts[1].rowFixed ||
40493
40527
  rangeImpl.parts[1].colFixed) {
40494
40528
  rangeString += ":";
40495
- rangeString += this.getRangePartString(rangeImpl, 1);
40529
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
40496
40530
  }
40497
40531
  }
40498
40532
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -40522,14 +40556,14 @@ class RangeAdapter {
40522
40556
  /**
40523
40557
  * Get a Xc string that represent a part of a range
40524
40558
  */
40525
- getRangePartString(range, part) {
40559
+ getRangePartString(range, part, useFixedZone = false) {
40526
40560
  var _a, _b;
40527
40561
  const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40528
40562
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40529
40563
  const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40530
40564
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40531
40565
  let str = "";
40532
- if (range.isFullCol) {
40566
+ if (range.isFullCol && !useFixedZone) {
40533
40567
  if (part === 0 && range.unboundedZone.hasHeader) {
40534
40568
  str = colFixed + col + rowFixed + row;
40535
40569
  }
@@ -40537,7 +40571,7 @@ class RangeAdapter {
40537
40571
  str = colFixed + col;
40538
40572
  }
40539
40573
  }
40540
- else if (range.isFullRow) {
40574
+ else if (range.isFullRow && !useFixedZone) {
40541
40575
  if (part === 0 && range.unboundedZone.hasHeader) {
40542
40576
  str = colFixed + col + rowFixed + row;
40543
40577
  }
@@ -40738,7 +40772,7 @@ class SelectionStreamProcessor {
40738
40772
  */
40739
40773
  moveAnchorCell(direction, step = 1) {
40740
40774
  if (step !== "end" && step <= 0) {
40741
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40775
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40742
40776
  }
40743
40777
  const { col, row } = this.getNextAvailablePosition(direction, step);
40744
40778
  return this.selectCell(col, row);
@@ -40784,7 +40818,7 @@ class SelectionStreamProcessor {
40784
40818
  */
40785
40819
  resizeAnchorZone(direction, step = 1) {
40786
40820
  if (step !== "end" && step <= 0) {
40787
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40821
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40788
40822
  }
40789
40823
  const sheetId = this.getters.getActiveSheetId();
40790
40824
  const anchor = this.anchor;
@@ -41595,12 +41629,7 @@ function addFormula(cell) {
41595
41629
  attrs.push(["t", "str"]);
41596
41630
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41597
41631
  }
41598
- node = escapeXml /*xml*/ `
41599
- <f>
41600
- ${XlsxFormula}
41601
- </f>
41602
- ${cycle}
41603
- `;
41632
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41604
41633
  return { attrs, node };
41605
41634
  }
41606
41635
  else {
@@ -42341,11 +42370,10 @@ function addRows(construct, data, sheet) {
42341
42370
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
42342
42371
  }
42343
42372
  attributes.push(...additionalAttrs);
42344
- cellNodes.push(escapeXml /*xml*/ `
42345
- <c ${formatAttributes(attributes)}>
42346
- ${cellNode}
42347
- </c>
42348
- `);
42373
+ // prettier-ignore
42374
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
42375
+ ${cellNode}
42376
+ </c>`);
42349
42377
  }
42350
42378
  }
42351
42379
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -42724,10 +42752,10 @@ class Model extends EventBus {
42724
42752
  const command = { type, ...payload };
42725
42753
  let status = this.status;
42726
42754
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
42727
- return new DispatchResult(66 /* CommandResult.Readonly */);
42755
+ return new DispatchResult(67 /* CommandResult.Readonly */);
42728
42756
  }
42729
42757
  if (!this.session.canApplyOptimisticUpdate()) {
42730
- return new DispatchResult(63 /* CommandResult.WaitingSessionConfirmation */);
42758
+ return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
42731
42759
  }
42732
42760
  switch (status) {
42733
42761
  case 0 /* Status.Ready */:
@@ -43139,6 +43167,6 @@ function addFunction(functionName, functionDescription) {
43139
43167
  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 };
43140
43168
 
43141
43169
 
43142
- __info__.version = '16.0.29';
43143
- __info__.date = '2024-01-17T10:24:52.885Z';
43144
- __info__.hash = '3fda985';
43170
+ __info__.version = '16.0.31';
43171
+ __info__.date = '2024-02-02T13:44:18.740Z';
43172
+ __info__.hash = 'a2e40a9';