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