@odoo/o-spreadsheet 16.0.28 → 16.0.30

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.
@@ -1561,6 +1561,31 @@ const MAX_DECIMAL_PLACES = 20;
1561
1561
  //from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
1562
1562
  const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
1563
1563
  const zeroRegexp = /0/g;
1564
+ // TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
1565
+ // + possibly handle automatic translation of day/month
1566
+ const MONTHS = {
1567
+ 0: _lt("January"),
1568
+ 1: _lt("February"),
1569
+ 2: _lt("March"),
1570
+ 3: _lt("April"),
1571
+ 4: _lt("May"),
1572
+ 5: _lt("June"),
1573
+ 6: _lt("July"),
1574
+ 7: _lt("August"),
1575
+ 8: _lt("September"),
1576
+ 9: _lt("October"),
1577
+ 10: _lt("November"),
1578
+ 11: _lt("December"),
1579
+ };
1580
+ const DAYS$1 = {
1581
+ 0: _lt("Sunday"),
1582
+ 1: _lt("Monday"),
1583
+ 2: _lt("Tuesday"),
1584
+ 3: _lt("Wednesday"),
1585
+ 4: _lt("Thursday"),
1586
+ 5: _lt("Friday"),
1587
+ 6: _lt("Saturday"),
1588
+ };
1564
1589
  // -----------------------------------------------------------------------------
1565
1590
  // FORMAT REPRESENTATION CACHE
1566
1591
  // -----------------------------------------------------------------------------
@@ -1793,8 +1818,9 @@ function applyDateTimeFormat(value, format) {
1793
1818
  return strDate + (strDate && strTime ? " " : "") + strTime;
1794
1819
  }
1795
1820
  function formatJSDate(jsDate, format) {
1796
- const sep = format.match(/\/|-|\s/)[0];
1797
- const parts = format.split(sep);
1821
+ var _a;
1822
+ const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
1823
+ const parts = sep ? format.split(sep) : [format];
1798
1824
  return parts
1799
1825
  .map((p) => {
1800
1826
  switch (p) {
@@ -1802,10 +1828,23 @@ function formatJSDate(jsDate, format) {
1802
1828
  return jsDate.getDate();
1803
1829
  case "dd":
1804
1830
  return jsDate.getDate().toString().padStart(2, "0");
1831
+ case "ddd":
1832
+ return DAYS$1[jsDate.getDay()].slice(0, 3);
1833
+ case "dddd":
1834
+ return DAYS$1[jsDate.getDay()];
1805
1835
  case "m":
1806
1836
  return jsDate.getMonth() + 1;
1807
1837
  case "mm":
1808
1838
  return String(jsDate.getMonth() + 1).padStart(2, "0");
1839
+ case "mmm":
1840
+ return MONTHS[jsDate.getMonth()].slice(0, 3);
1841
+ case "mmmm":
1842
+ return MONTHS[jsDate.getMonth()];
1843
+ case "mmmmm":
1844
+ return MONTHS[jsDate.getMonth()].slice(0, 1);
1845
+ case "yy":
1846
+ const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
1847
+ return fullYear.slice(fullYear.length - 2);
1809
1848
  case "yyyy":
1810
1849
  return jsDate.getFullYear();
1811
1850
  default:
@@ -1852,27 +1891,30 @@ function createDefaultFormat(value) {
1852
1891
  }
1853
1892
  function createLargeNumberFormat(format, magnitude, postFix) {
1854
1893
  const internalFormat = parseFormat(format || "#,##0");
1855
- const largeNumberFormat = internalFormat
1856
- .map((formatPart) => {
1857
- if (formatPart.type === "NUMBER") {
1858
- return [
1859
- {
1860
- ...formatPart,
1861
- format: {
1862
- ...formatPart.format,
1863
- magnitude,
1864
- decimalPart: undefined,
1865
- },
1866
- },
1867
- {
1868
- type: "STRING",
1869
- format: postFix,
1870
- },
1871
- ];
1894
+ const largeNumberFormat = [];
1895
+ for (let i = 0; i < internalFormat.length; i++) {
1896
+ const formatPart = internalFormat[i];
1897
+ if (formatPart.type !== "NUMBER") {
1898
+ largeNumberFormat.push(formatPart);
1899
+ continue;
1872
1900
  }
1873
- return formatPart;
1874
- })
1875
- .flat();
1901
+ largeNumberFormat.push({
1902
+ ...formatPart,
1903
+ format: {
1904
+ ...formatPart.format,
1905
+ magnitude,
1906
+ decimalPart: undefined,
1907
+ },
1908
+ });
1909
+ largeNumberFormat.push({
1910
+ type: "STRING",
1911
+ format: postFix,
1912
+ });
1913
+ const nextFormatPart = internalFormat[i + 1];
1914
+ if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
1915
+ i++;
1916
+ }
1917
+ }
1876
1918
  return convertInternalFormatToFormat(largeNumberFormat);
1877
1919
  }
1878
1920
  function changeDecimalPlaces(format, step) {
@@ -3311,64 +3353,65 @@ var CommandResult;
3311
3353
  CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
3312
3354
  CommandResult[CommandResult["InputAlreadyFocused"] = 28] = "InputAlreadyFocused";
3313
3355
  CommandResult[CommandResult["MaximumRangesReached"] = 29] = "MaximumRangesReached";
3314
- CommandResult[CommandResult["InvalidChartDefinition"] = 30] = "InvalidChartDefinition";
3315
- CommandResult[CommandResult["InvalidDataSet"] = 31] = "InvalidDataSet";
3316
- CommandResult[CommandResult["InvalidLabelRange"] = 32] = "InvalidLabelRange";
3317
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 33] = "InvalidScorecardKeyValue";
3318
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 34] = "InvalidScorecardBaseline";
3319
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 35] = "InvalidGaugeDataRange";
3320
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 36] = "EmptyGaugeRangeMin";
3321
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 37] = "GaugeRangeMinNaN";
3322
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 38] = "EmptyGaugeRangeMax";
3323
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 39] = "GaugeRangeMaxNaN";
3324
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 40] = "GaugeRangeMinBiggerThanRangeMax";
3325
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 41] = "GaugeLowerInflectionPointNaN";
3326
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 42] = "GaugeUpperInflectionPointNaN";
3327
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 43] = "GaugeLowerBiggerThanUpper";
3328
- CommandResult[CommandResult["InvalidAutofillSelection"] = 44] = "InvalidAutofillSelection";
3329
- CommandResult[CommandResult["WrongComposerSelection"] = 45] = "WrongComposerSelection";
3330
- CommandResult[CommandResult["MinBiggerThanMax"] = 46] = "MinBiggerThanMax";
3331
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 47] = "LowerBiggerThanUpper";
3332
- CommandResult[CommandResult["MidBiggerThanMax"] = 48] = "MidBiggerThanMax";
3333
- CommandResult[CommandResult["MinBiggerThanMid"] = 49] = "MinBiggerThanMid";
3334
- CommandResult[CommandResult["FirstArgMissing"] = 50] = "FirstArgMissing";
3335
- CommandResult[CommandResult["SecondArgMissing"] = 51] = "SecondArgMissing";
3336
- CommandResult[CommandResult["MinNaN"] = 52] = "MinNaN";
3337
- CommandResult[CommandResult["MidNaN"] = 53] = "MidNaN";
3338
- CommandResult[CommandResult["MaxNaN"] = 54] = "MaxNaN";
3339
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 55] = "ValueUpperInflectionNaN";
3340
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 56] = "ValueLowerInflectionNaN";
3341
- CommandResult[CommandResult["MinInvalidFormula"] = 57] = "MinInvalidFormula";
3342
- CommandResult[CommandResult["MidInvalidFormula"] = 58] = "MidInvalidFormula";
3343
- CommandResult[CommandResult["MaxInvalidFormula"] = 59] = "MaxInvalidFormula";
3344
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 60] = "ValueUpperInvalidFormula";
3345
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 61] = "ValueLowerInvalidFormula";
3346
- CommandResult[CommandResult["InvalidSortZone"] = 62] = "InvalidSortZone";
3347
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 63] = "WaitingSessionConfirmation";
3348
- CommandResult[CommandResult["MergeOverlap"] = 64] = "MergeOverlap";
3349
- CommandResult[CommandResult["TooManyHiddenElements"] = 65] = "TooManyHiddenElements";
3350
- CommandResult[CommandResult["Readonly"] = 66] = "Readonly";
3351
- CommandResult[CommandResult["InvalidViewportSize"] = 67] = "InvalidViewportSize";
3352
- CommandResult[CommandResult["InvalidScrollingDirection"] = 68] = "InvalidScrollingDirection";
3353
- CommandResult[CommandResult["FigureDoesNotExist"] = 69] = "FigureDoesNotExist";
3354
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 70] = "InvalidConditionalFormatId";
3355
- CommandResult[CommandResult["InvalidCellPopover"] = 71] = "InvalidCellPopover";
3356
- CommandResult[CommandResult["EmptyTarget"] = 72] = "EmptyTarget";
3357
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 73] = "InvalidFreezeQuantity";
3358
- CommandResult[CommandResult["FrozenPaneOverlap"] = 74] = "FrozenPaneOverlap";
3359
- CommandResult[CommandResult["ValuesNotChanged"] = 75] = "ValuesNotChanged";
3360
- CommandResult[CommandResult["InvalidFilterZone"] = 76] = "InvalidFilterZone";
3361
- CommandResult[CommandResult["FilterOverlap"] = 77] = "FilterOverlap";
3362
- CommandResult[CommandResult["FilterNotFound"] = 78] = "FilterNotFound";
3363
- CommandResult[CommandResult["MergeInFilter"] = 79] = "MergeInFilter";
3364
- CommandResult[CommandResult["NonContinuousTargets"] = 80] = "NonContinuousTargets";
3365
- CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
3366
- CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3367
- CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3368
- CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3369
- CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3370
- CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3371
- CommandResult[CommandResult["NoChanges"] = 87] = "NoChanges";
3356
+ CommandResult[CommandResult["InvalidInputId"] = 30] = "InvalidInputId";
3357
+ CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
3358
+ CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
3359
+ CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
3360
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
3361
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
3362
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
3363
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
3364
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
3365
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
3366
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
3367
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
3368
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
3369
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
3370
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
3371
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
3372
+ CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
3373
+ CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
3374
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
3375
+ CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
3376
+ CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
3377
+ CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
3378
+ CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
3379
+ CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
3380
+ CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
3381
+ CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
3382
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
3383
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
3384
+ CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
3385
+ CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
3386
+ CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
3387
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
3388
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
3389
+ CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
3390
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
3391
+ CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
3392
+ CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
3393
+ CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
3394
+ CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
3395
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
3396
+ CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
3397
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
3398
+ CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
3399
+ CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
3400
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
3401
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
3402
+ CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
3403
+ CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
3404
+ CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
3405
+ CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
3406
+ CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
3407
+ CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
3408
+ CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
3409
+ CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3410
+ CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3411
+ CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3412
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3413
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3414
+ CommandResult[CommandResult["NoChanges"] = 88] = "NoChanges";
3372
3415
  })(CommandResult || (CommandResult = {}));
3373
3416
 
3374
3417
  function isMatrix(x) {
@@ -4869,7 +4912,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
4869
4912
  });
4870
4913
  }
4871
4914
  }
4872
- if (result.isCancelledBecause(62 /* CommandResult.InvalidSortZone */)) {
4915
+ if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
4873
4916
  const { col, row } = anchor;
4874
4917
  env.model.selection.selectZone({ cell: { col, row }, zone });
4875
4918
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -4892,13 +4935,13 @@ const AddFilterInteractiveContent = {
4892
4935
  };
4893
4936
  function interactiveAddFilter(env, sheetId, target) {
4894
4937
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
4895
- if (result.isCancelledBecause(77 /* CommandResult.FilterOverlap */)) {
4938
+ if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
4896
4939
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
4897
4940
  }
4898
- else if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
4941
+ else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
4899
4942
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
4900
4943
  }
4901
- else if (result.isCancelledBecause(80 /* CommandResult.NonContinuousTargets */)) {
4944
+ else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
4902
4945
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
4903
4946
  }
4904
4947
  }
@@ -4920,7 +4963,7 @@ function handlePasteResult(env, result) {
4920
4963
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
4921
4964
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
4922
4965
  }
4923
- else if (result.reasons.includes(74 /* CommandResult.FrozenPaneOverlap */)) {
4966
+ else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
4924
4967
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
4925
4968
  }
4926
4969
  }
@@ -5962,22 +6005,22 @@ sheetMenuRegistry
5962
6005
  const CfTerms = {
5963
6006
  Errors: {
5964
6007
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
5965
- [50 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
5966
- [51 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
5967
- [52 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
5968
- [53 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
5969
- [54 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
5970
- [55 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
5971
- [56 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
5972
- [46 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
5973
- [49 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
5974
- [48 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
5975
- [47 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
5976
- [57 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
5977
- [59 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
5978
- [58 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
5979
- [60 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
5980
- [61 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6008
+ [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6009
+ [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6010
+ [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6011
+ [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6012
+ [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6013
+ [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6014
+ [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6015
+ [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6016
+ [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6017
+ [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6018
+ [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6019
+ [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6020
+ [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6021
+ [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6022
+ [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6023
+ [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
5981
6024
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
5982
6025
  Unexpected: _lt("The rule is invalid for an unknown reason"),
5983
6026
  },
@@ -6005,20 +6048,20 @@ const ChartTerms = {
6005
6048
  Errors: {
6006
6049
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
6007
6050
  // BASIC CHART ERRORS (LINE | BAR | PIE)
6008
- [31 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6009
- [32 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6051
+ [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6052
+ [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6010
6053
  // SCORECARD CHART ERRORS
6011
- [33 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6012
- [34 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6054
+ [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6055
+ [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6013
6056
  // GAUGE CHART ERRORS
6014
- [35 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6015
- [36 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6016
- [37 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6017
- [38 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6018
- [39 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6019
- [40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6020
- [41 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6021
- [42 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6057
+ [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6058
+ [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6059
+ [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6060
+ [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6061
+ [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6062
+ [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6063
+ [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6064
+ [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6022
6065
  },
6023
6066
  };
6024
6067
  const NumberFormatTerms = {
@@ -6042,7 +6085,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
6042
6085
  const sheetId = env.model.getters.getActiveSheetId();
6043
6086
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
6044
6087
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
6045
- if (result.isCancelledBecause(64 /* CommandResult.MergeOverlap */)) {
6088
+ if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
6046
6089
  env.raiseError(MergeErrorMessage);
6047
6090
  }
6048
6091
  }
@@ -6688,11 +6731,11 @@ class LineBarPieConfigPanel extends Component {
6688
6731
  }
6689
6732
  get isDatasetInvalid() {
6690
6733
  var _a;
6691
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(31 /* CommandResult.InvalidDataSet */));
6734
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
6692
6735
  }
6693
6736
  get isLabelInvalid() {
6694
6737
  var _a;
6695
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
6738
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
6696
6739
  }
6697
6740
  onUpdateDataSetsHaveTitle(ev) {
6698
6741
  this.props.updateChart(this.props.figureId, {
@@ -6913,14 +6956,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
6913
6956
  : undefined));
6914
6957
  }
6915
6958
  }
6916
- else if (zone.left === zone.right && zone.top === zone.bottom) {
6917
- // A single cell. If it's only the title, the dataset is not added.
6918
- if (!dataSetsHaveTitle) {
6919
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
6920
- }
6921
- }
6922
6959
  else {
6923
- /* 1 row or 1 column */
6960
+ /* 1 cell, 1 row or 1 column */
6924
6961
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
6925
6962
  ? {
6926
6963
  top: zone.top,
@@ -6970,8 +7007,10 @@ function toExcelDataset(getters, ds) {
6970
7007
  }
6971
7008
  const dataRange = ds.dataRange.clone({ zone: dataZone });
6972
7009
  return {
6973
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
6974
- range: getters.getRangeString(dataRange, "forceSheetReference"),
7010
+ label: ds.labelCell
7011
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
7012
+ : undefined,
7013
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
6975
7014
  };
6976
7015
  }
6977
7016
  /**
@@ -7040,11 +7079,11 @@ function checkDataset(definition) {
7040
7079
  if (definition.dataSets) {
7041
7080
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
7042
7081
  if (invalidRanges) {
7043
- return 31 /* CommandResult.InvalidDataSet */;
7082
+ return 32 /* CommandResult.InvalidDataSet */;
7044
7083
  }
7045
7084
  const zones = definition.dataSets.map(toUnboundedZone);
7046
7085
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
7047
- return 31 /* CommandResult.InvalidDataSet */;
7086
+ return 32 /* CommandResult.InvalidDataSet */;
7048
7087
  }
7049
7088
  }
7050
7089
  return 0 /* CommandResult.Success */;
@@ -7053,7 +7092,7 @@ function checkLabelRange(definition) {
7053
7092
  if (definition.labelRange) {
7054
7093
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
7055
7094
  if (invalidLabels) {
7056
- return 32 /* CommandResult.InvalidLabelRange */;
7095
+ return 33 /* CommandResult.InvalidLabelRange */;
7057
7096
  }
7058
7097
  }
7059
7098
  return 0 /* CommandResult.Success */;
@@ -7354,6 +7393,9 @@ class BarChart extends AbstractChart {
7354
7393
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7355
7394
  return {
7356
7395
  ...this.getDefinition(),
7396
+ labelRange: this.labelRange
7397
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
7398
+ : undefined,
7357
7399
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7358
7400
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7359
7401
  dataSets,
@@ -7511,7 +7553,7 @@ chartRegistry.add("gauge", {
7511
7553
  });
7512
7554
  function isDataRangeValid(definition) {
7513
7555
  return definition.dataRange && !rangeReference.test(definition.dataRange)
7514
- ? 35 /* CommandResult.InvalidGaugeDataRange */
7556
+ ? 36 /* CommandResult.InvalidGaugeDataRange */
7515
7557
  : 0 /* CommandResult.Success */;
7516
7558
  }
7517
7559
  function checkRangeLimits(check, batchValidations) {
@@ -7543,7 +7585,7 @@ function checkInflectionPointsValue(check, batchValidations) {
7543
7585
  function checkRangeMinBiggerThanRangeMax(definition) {
7544
7586
  if (definition.sectionRule) {
7545
7587
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
7546
- return 40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7588
+ return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7547
7589
  }
7548
7590
  }
7549
7591
  return 0 /* CommandResult.Success */;
@@ -7552,9 +7594,9 @@ function checkEmpty(value, valueName) {
7552
7594
  if (value === "") {
7553
7595
  switch (valueName) {
7554
7596
  case "rangeMin":
7555
- return 36 /* CommandResult.EmptyGaugeRangeMin */;
7597
+ return 37 /* CommandResult.EmptyGaugeRangeMin */;
7556
7598
  case "rangeMax":
7557
- return 38 /* CommandResult.EmptyGaugeRangeMax */;
7599
+ return 39 /* CommandResult.EmptyGaugeRangeMax */;
7558
7600
  }
7559
7601
  }
7560
7602
  return 0 /* CommandResult.Success */;
@@ -7563,13 +7605,13 @@ function checkNaN(value, valueName) {
7563
7605
  if (isNaN(value)) {
7564
7606
  switch (valueName) {
7565
7607
  case "rangeMin":
7566
- return 37 /* CommandResult.GaugeRangeMinNaN */;
7608
+ return 38 /* CommandResult.GaugeRangeMinNaN */;
7567
7609
  case "rangeMax":
7568
- return 39 /* CommandResult.GaugeRangeMaxNaN */;
7610
+ return 40 /* CommandResult.GaugeRangeMaxNaN */;
7569
7611
  case "lowerInflectionPointValue":
7570
- return 41 /* CommandResult.GaugeLowerInflectionPointNaN */;
7612
+ return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
7571
7613
  case "upperInflectionPointValue":
7572
- return 42 /* CommandResult.GaugeUpperInflectionPointNaN */;
7614
+ return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
7573
7615
  }
7574
7616
  }
7575
7617
  return 0 /* CommandResult.Success */;
@@ -7982,6 +8024,9 @@ class LineChart extends AbstractChart {
7982
8024
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7983
8025
  return {
7984
8026
  ...this.getDefinition(),
8027
+ labelRange: this.labelRange
8028
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8029
+ : undefined,
7985
8030
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7986
8031
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7987
8032
  dataSets,
@@ -8242,6 +8287,9 @@ class PieChart extends AbstractChart {
8242
8287
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8243
8288
  return {
8244
8289
  ...this.getDefinition(),
8290
+ labelRange: this.labelRange
8291
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8292
+ : undefined,
8245
8293
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8246
8294
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8247
8295
  verticalAxisPosition: "left",
@@ -8322,12 +8370,12 @@ chartRegistry.add("scorecard", {
8322
8370
  });
8323
8371
  function checkKeyValue(definition) {
8324
8372
  return definition.keyValue && !rangeReference.test(definition.keyValue)
8325
- ? 33 /* CommandResult.InvalidScorecardKeyValue */
8373
+ ? 34 /* CommandResult.InvalidScorecardKeyValue */
8326
8374
  : 0 /* CommandResult.Success */;
8327
8375
  }
8328
8376
  function checkBaseline(definition) {
8329
8377
  return definition.baseline && !rangeReference.test(definition.baseline)
8330
- ? 34 /* CommandResult.InvalidScorecardBaseline */
8378
+ ? 35 /* CommandResult.InvalidScorecardBaseline */
8331
8379
  : 0 /* CommandResult.Success */;
8332
8380
  }
8333
8381
  class ScorecardChart$1 extends AbstractChart {
@@ -8756,7 +8804,7 @@ class GaugeChartConfigPanel extends Component {
8756
8804
  }
8757
8805
  get isDataRangeInvalid() {
8758
8806
  var _a;
8759
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidGaugeDataRange */));
8807
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
8760
8808
  }
8761
8809
  onDataRangeChanged(ranges) {
8762
8810
  this.dataRange = ranges[0];
@@ -8843,28 +8891,28 @@ class GaugeChartDesignPanel extends Component {
8843
8891
  }
8844
8892
  isRangeMinInvalid() {
8845
8893
  var _a, _b, _c;
8846
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.EmptyGaugeRangeMin */)) ||
8847
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(37 /* CommandResult.GaugeRangeMinNaN */)) ||
8848
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8894
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
8895
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
8896
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8849
8897
  }
8850
8898
  isRangeMaxInvalid() {
8851
8899
  var _a, _b, _c;
8852
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMax */)) ||
8853
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMaxNaN */)) ||
8854
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8900
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
8901
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
8902
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8855
8903
  }
8856
8904
  // ---------------------------------------------------------------------------
8857
8905
  // COLOR_SECTION_TEMPLATE
8858
8906
  // ---------------------------------------------------------------------------
8859
8907
  get isLowerInflectionPointInvalid() {
8860
8908
  var _a, _b;
8861
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(41 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8862
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8909
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8910
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8863
8911
  }
8864
8912
  get isUpperInflectionPointInvalid() {
8865
8913
  var _a, _b;
8866
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8867
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8914
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8915
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8868
8916
  }
8869
8917
  updateInflectionPointValue(attr, ev) {
8870
8918
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -8967,11 +9015,11 @@ class ScorecardChartConfigPanel extends Component {
8967
9015
  }
8968
9016
  get isKeyValueInvalid() {
8969
9017
  var _a;
8970
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidScorecardKeyValue */));
9018
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
8971
9019
  }
8972
9020
  get isBaselineInvalid() {
8973
9021
  var _a;
8974
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardBaseline */));
9022
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
8975
9023
  }
8976
9024
  onKeyValueRangeChanged(ranges) {
8977
9025
  this.keyValue = ranges[0];
@@ -9811,11 +9859,11 @@ class ConditionalFormattingPanel extends Component {
9811
9859
  ****************************************************************************/
9812
9860
  get isValue1Invalid() {
9813
9861
  var _a;
9814
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(50 /* CommandResult.FirstArgMissing */));
9862
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
9815
9863
  }
9816
9864
  get isValue2Invalid() {
9817
9865
  var _a;
9818
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.SecondArgMissing */));
9866
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
9819
9867
  }
9820
9868
  toggleStyle(tool) {
9821
9869
  const style = this.state.rules.cellIs.style;
@@ -9832,17 +9880,17 @@ class ConditionalFormattingPanel extends Component {
9832
9880
  isValueInvalid(threshold) {
9833
9881
  switch (threshold) {
9834
9882
  case "minimum":
9835
- return (this.state.errors.includes(57 /* CommandResult.MinInvalidFormula */) ||
9836
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMid */) ||
9837
- this.state.errors.includes(46 /* CommandResult.MinBiggerThanMax */) ||
9838
- this.state.errors.includes(52 /* CommandResult.MinNaN */));
9883
+ return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
9884
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
9885
+ this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
9886
+ this.state.errors.includes(53 /* CommandResult.MinNaN */));
9839
9887
  case "midpoint":
9840
- return (this.state.errors.includes(58 /* CommandResult.MidInvalidFormula */) ||
9841
- this.state.errors.includes(53 /* CommandResult.MidNaN */) ||
9842
- this.state.errors.includes(48 /* CommandResult.MidBiggerThanMax */));
9888
+ return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
9889
+ this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
9890
+ this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
9843
9891
  case "maximum":
9844
- return (this.state.errors.includes(59 /* CommandResult.MaxInvalidFormula */) ||
9845
- this.state.errors.includes(54 /* CommandResult.MaxNaN */));
9892
+ return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
9893
+ this.state.errors.includes(55 /* CommandResult.MaxNaN */));
9846
9894
  default:
9847
9895
  return false;
9848
9896
  }
@@ -9891,13 +9939,13 @@ class ConditionalFormattingPanel extends Component {
9891
9939
  isInflectionPointInvalid(inflectionPoint) {
9892
9940
  switch (inflectionPoint) {
9893
9941
  case "lowerInflectionPoint":
9894
- return (this.state.errors.includes(56 /* CommandResult.ValueLowerInflectionNaN */) ||
9895
- this.state.errors.includes(61 /* CommandResult.ValueLowerInvalidFormula */) ||
9896
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9942
+ return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
9943
+ this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
9944
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9897
9945
  case "upperInflectionPoint":
9898
- return (this.state.errors.includes(55 /* CommandResult.ValueUpperInflectionNaN */) ||
9899
- this.state.errors.includes(60 /* CommandResult.ValueUpperInvalidFormula */) ||
9900
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9946
+ return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
9947
+ this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
9948
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9901
9949
  default:
9902
9950
  return true;
9903
9951
  }
@@ -19542,7 +19590,7 @@ class EditionPlugin extends UIPlugin {
19542
19590
  validateSelection(length, start, end) {
19543
19591
  return start >= 0 && start <= length && end >= 0 && end <= length
19544
19592
  ? 0 /* CommandResult.Success */
19545
- : 45 /* CommandResult.WrongComposerSelection */;
19593
+ : 46 /* CommandResult.WrongComposerSelection */;
19546
19594
  }
19547
19595
  onColumnsRemoved(cmd) {
19548
19596
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -19826,9 +19874,10 @@ class EditionPlugin extends UIPlugin {
19826
19874
  */
19827
19875
  getReferencedRanges() {
19828
19876
  const editionSheetId = this.getters.getEditionSheet();
19829
- return this.currentTokens
19877
+ const referenceRanges = this.currentTokens
19830
19878
  .filter((token) => token.type === "REFERENCE")
19831
19879
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
19880
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
19832
19881
  }
19833
19882
  /**
19834
19883
  * Function used to determine when composer selection can start.
@@ -27599,7 +27648,7 @@ class BordersPlugin extends CorePlugin {
27599
27648
  const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
27600
27649
  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);
27601
27650
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
27602
- return 87 /* CommandResult.NoChanges */;
27651
+ return 88 /* CommandResult.NoChanges */;
27603
27652
  }
27604
27653
  return 0 /* CommandResult.Success */;
27605
27654
  }
@@ -27841,6 +27890,9 @@ class CellPlugin extends CorePlugin {
27841
27890
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27842
27891
  content: cell.content || undefined,
27843
27892
  };
27893
+ if (cell.isFormula()) {
27894
+ cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27895
+ }
27844
27896
  }
27845
27897
  _sheet.cells = cells;
27846
27898
  }
@@ -27888,13 +27940,13 @@ class CellPlugin extends CorePlugin {
27888
27940
  /*
27889
27941
  * Reconstructs the original formula string based on a normalized form and its dependencies
27890
27942
  */
27891
- buildFormulaContent(sheetId, cell, dependencies) {
27943
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
27892
27944
  const ranges = dependencies || cell.dependencies;
27893
27945
  let rangeIndex = 0;
27894
27946
  return concat(cell.compiledFormula.tokens.map((token) => {
27895
27947
  if (token.type === "REFERENCE") {
27896
27948
  const range = ranges[rangeIndex++];
27897
- return this.getters.getRangeString(range, sheetId);
27949
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
27898
27950
  }
27899
27951
  return token.value;
27900
27952
  }));
@@ -28059,9 +28111,9 @@ class CellPlugin extends CorePlugin {
28059
28111
  checkUselessClearCell(cmd) {
28060
28112
  const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28061
28113
  if (!cell)
28062
- return 87 /* CommandResult.NoChanges */;
28114
+ return 88 /* CommandResult.NoChanges */;
28063
28115
  if (!cell.content && !cell.style && !cell.format) {
28064
- return 87 /* CommandResult.NoChanges */;
28116
+ return 88 /* CommandResult.NoChanges */;
28065
28117
  }
28066
28118
  return 0 /* CommandResult.Success */;
28067
28119
  }
@@ -28270,13 +28322,13 @@ class ChartPlugin extends CorePlugin {
28270
28322
  }
28271
28323
  checkChartDuplicate(cmd) {
28272
28324
  return this.getters.getFigureSheetId(cmd.id)
28273
- ? 83 /* CommandResult.DuplicatedChartId */
28325
+ ? 84 /* CommandResult.DuplicatedChartId */
28274
28326
  : 0 /* CommandResult.Success */;
28275
28327
  }
28276
28328
  checkChartExists(cmd) {
28277
28329
  return this.getters.getFigureSheetId(cmd.id)
28278
28330
  ? 0 /* CommandResult.Success */
28279
- : 84 /* CommandResult.ChartDoesNotExist */;
28331
+ : 85 /* CommandResult.ChartDoesNotExist */;
28280
28332
  }
28281
28333
  }
28282
28334
  ChartPlugin.getters = [
@@ -28391,7 +28443,13 @@ class ConditionalFormatPlugin extends CorePlugin {
28391
28443
  }
28392
28444
  }
28393
28445
  exportForExcel(data) {
28394
- this.export(data);
28446
+ if (data.sheets) {
28447
+ for (let sheet of data.sheets) {
28448
+ if (this.cfRules[sheet.id]) {
28449
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
28450
+ }
28451
+ }
28452
+ }
28395
28453
  }
28396
28454
  // ---------------------------------------------------------------------------
28397
28455
  // Getters
@@ -28441,11 +28499,11 @@ class ConditionalFormatPlugin extends CorePlugin {
28441
28499
  // ---------------------------------------------------------------------------
28442
28500
  // Private
28443
28501
  // ---------------------------------------------------------------------------
28444
- mapToConditionalFormat(sheetId, cf) {
28502
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
28445
28503
  return {
28446
28504
  ...cf,
28447
28505
  ranges: cf.ranges.map((range) => {
28448
- return this.getters.getRangeString(range, sheetId);
28506
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
28449
28507
  }),
28450
28508
  };
28451
28509
  }
@@ -28478,10 +28536,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28478
28536
  return 27 /* CommandResult.InvalidSheetId */;
28479
28537
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
28480
28538
  if (ruleIndex === -1)
28481
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28539
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28482
28540
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
28483
28541
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
28484
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28542
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28485
28543
  }
28486
28544
  return 0 /* CommandResult.Success */;
28487
28545
  }
@@ -28522,10 +28580,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28522
28580
  const errors = [];
28523
28581
  const isEmpty = (value) => value === undefined || value === "";
28524
28582
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
28525
- errors.push(50 /* CommandResult.FirstArgMissing */);
28583
+ errors.push(51 /* CommandResult.FirstArgMissing */);
28526
28584
  }
28527
28585
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
28528
- errors.push(51 /* CommandResult.SecondArgMissing */);
28586
+ errors.push(52 /* CommandResult.SecondArgMissing */);
28529
28587
  }
28530
28588
  return errors.length ? errors : 0 /* CommandResult.Success */;
28531
28589
  }
@@ -28537,15 +28595,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28537
28595
  (threshold.value === "" || isNaN(threshold.value))) {
28538
28596
  switch (thresholdName) {
28539
28597
  case "min":
28540
- return 52 /* CommandResult.MinNaN */;
28598
+ return 53 /* CommandResult.MinNaN */;
28541
28599
  case "max":
28542
- return 54 /* CommandResult.MaxNaN */;
28600
+ return 55 /* CommandResult.MaxNaN */;
28543
28601
  case "mid":
28544
- return 53 /* CommandResult.MidNaN */;
28602
+ return 54 /* CommandResult.MidNaN */;
28545
28603
  case "upperInflectionPoint":
28546
- return 55 /* CommandResult.ValueUpperInflectionNaN */;
28604
+ return 56 /* CommandResult.ValueUpperInflectionNaN */;
28547
28605
  case "lowerInflectionPoint":
28548
- return 56 /* CommandResult.ValueLowerInflectionNaN */;
28606
+ return 57 /* CommandResult.ValueLowerInflectionNaN */;
28549
28607
  }
28550
28608
  }
28551
28609
  return 0 /* CommandResult.Success */;
@@ -28559,15 +28617,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28559
28617
  catch (error) {
28560
28618
  switch (thresholdName) {
28561
28619
  case "min":
28562
- return 57 /* CommandResult.MinInvalidFormula */;
28620
+ return 58 /* CommandResult.MinInvalidFormula */;
28563
28621
  case "max":
28564
- return 59 /* CommandResult.MaxInvalidFormula */;
28622
+ return 60 /* CommandResult.MaxInvalidFormula */;
28565
28623
  case "mid":
28566
- return 58 /* CommandResult.MidInvalidFormula */;
28624
+ return 59 /* CommandResult.MidInvalidFormula */;
28567
28625
  case "upperInflectionPoint":
28568
- return 60 /* CommandResult.ValueUpperInvalidFormula */;
28626
+ return 61 /* CommandResult.ValueUpperInvalidFormula */;
28569
28627
  case "lowerInflectionPoint":
28570
- return 61 /* CommandResult.ValueLowerInvalidFormula */;
28628
+ return 62 /* CommandResult.ValueLowerInvalidFormula */;
28571
28629
  }
28572
28630
  }
28573
28631
  return 0 /* CommandResult.Success */;
@@ -28584,7 +28642,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28584
28642
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
28585
28643
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
28586
28644
  Number(minValue) > Number(maxValue)) {
28587
- return 47 /* CommandResult.LowerBiggerThanUpper */;
28645
+ return 48 /* CommandResult.LowerBiggerThanUpper */;
28588
28646
  }
28589
28647
  return 0 /* CommandResult.Success */;
28590
28648
  }
@@ -28594,7 +28652,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28594
28652
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
28595
28653
  rule.minimum.type === rule.maximum.type &&
28596
28654
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
28597
- return 46 /* CommandResult.MinBiggerThanMax */;
28655
+ return 47 /* CommandResult.MinBiggerThanMax */;
28598
28656
  }
28599
28657
  return 0 /* CommandResult.Success */;
28600
28658
  }
@@ -28606,7 +28664,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28606
28664
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28607
28665
  rule.midpoint.type === rule.maximum.type &&
28608
28666
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
28609
- return 48 /* CommandResult.MidBiggerThanMax */;
28667
+ return 49 /* CommandResult.MidBiggerThanMax */;
28610
28668
  }
28611
28669
  return 0 /* CommandResult.Success */;
28612
28670
  }
@@ -28618,7 +28676,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28618
28676
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28619
28677
  rule.minimum.type === rule.midpoint.type &&
28620
28678
  stringToNumber(minValue) >= stringToNumber(midValue)) {
28621
- return 49 /* CommandResult.MinBiggerThanMid */;
28679
+ return 50 /* CommandResult.MinBiggerThanMid */;
28622
28680
  }
28623
28681
  return 0 /* CommandResult.Success */;
28624
28682
  }
@@ -28719,13 +28777,13 @@ class FigurePlugin extends CorePlugin {
28719
28777
  checkFigureExists(sheetId, figureId) {
28720
28778
  var _a;
28721
28779
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
28722
- return 69 /* CommandResult.FigureDoesNotExist */;
28780
+ return 70 /* CommandResult.FigureDoesNotExist */;
28723
28781
  }
28724
28782
  return 0 /* CommandResult.Success */;
28725
28783
  }
28726
28784
  checkFigureDuplicate(figureId) {
28727
28785
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
28728
- return 81 /* CommandResult.DuplicatedFigureId */;
28786
+ return 82 /* CommandResult.DuplicatedFigureId */;
28729
28787
  }
28730
28788
  return 0 /* CommandResult.Success */;
28731
28789
  }
@@ -28827,12 +28885,12 @@ class FiltersPlugin extends CorePlugin {
28827
28885
  switch (cmd.type) {
28828
28886
  case "CREATE_FILTER_TABLE":
28829
28887
  if (!areZonesContinuous(...cmd.target)) {
28830
- return 80 /* CommandResult.NonContinuousTargets */;
28888
+ return 81 /* CommandResult.NonContinuousTargets */;
28831
28889
  }
28832
28890
  const zone = union(...cmd.target);
28833
28891
  const checkFilterOverlap = () => {
28834
28892
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
28835
- return 77 /* CommandResult.FilterOverlap */;
28893
+ return 78 /* CommandResult.FilterOverlap */;
28836
28894
  }
28837
28895
  return 0 /* CommandResult.Success */;
28838
28896
  };
@@ -28840,7 +28898,7 @@ class FiltersPlugin extends CorePlugin {
28840
28898
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
28841
28899
  for (let merge of mergesInTarget) {
28842
28900
  if (overlap(zone, merge)) {
28843
- return 79 /* CommandResult.MergeInFilter */;
28901
+ return 80 /* CommandResult.MergeInFilter */;
28844
28902
  }
28845
28903
  }
28846
28904
  return 0 /* CommandResult.Success */;
@@ -28850,7 +28908,7 @@ class FiltersPlugin extends CorePlugin {
28850
28908
  for (let merge of cmd.target) {
28851
28909
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
28852
28910
  if (overlap(filterTable.zone, merge)) {
28853
- return 79 /* CommandResult.MergeInFilter */;
28911
+ return 80 /* CommandResult.MergeInFilter */;
28854
28912
  }
28855
28913
  }
28856
28914
  }
@@ -29350,10 +29408,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
29350
29408
  : this.getters.getNumberRows(cmd.sheetId);
29351
29409
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29352
29410
  if (hiddenElements.size >= elements) {
29353
- return 65 /* CommandResult.TooManyHiddenElements */;
29411
+ return 66 /* CommandResult.TooManyHiddenElements */;
29354
29412
  }
29355
29413
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29356
- return 85 /* CommandResult.InvalidHeaderIndex */;
29414
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29357
29415
  }
29358
29416
  else {
29359
29417
  return 0 /* CommandResult.Success */;
@@ -29756,7 +29814,7 @@ class MergePlugin extends CorePlugin {
29756
29814
  for (const zone of target) {
29757
29815
  for (const zone2 of target) {
29758
29816
  if (zone !== zone2 && overlap(zone, zone2)) {
29759
- return 64 /* CommandResult.MergeOverlap */;
29817
+ return 65 /* CommandResult.MergeOverlap */;
29760
29818
  }
29761
29819
  }
29762
29820
  }
@@ -29770,7 +29828,7 @@ class MergePlugin extends CorePlugin {
29770
29828
  for (const zone of target) {
29771
29829
  if ((zone.left < xSplit && zone.right >= xSplit) ||
29772
29830
  (zone.top < ySplit && zone.bottom >= ySplit)) {
29773
- return 74 /* CommandResult.FrozenPaneOverlap */;
29831
+ return 75 /* CommandResult.FrozenPaneOverlap */;
29774
29832
  }
29775
29833
  }
29776
29834
  return 0 /* CommandResult.Success */;
@@ -30017,10 +30075,10 @@ class SheetPlugin extends CorePlugin {
30017
30075
  ? this.getNumberCols(cmd.sheetId)
30018
30076
  : this.getNumberRows(cmd.sheetId);
30019
30077
  if (cmd.base < 0 || cmd.base >= elements) {
30020
- return 85 /* CommandResult.InvalidHeaderIndex */;
30078
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30021
30079
  }
30022
30080
  else if (cmd.quantity <= 0) {
30023
- return 86 /* CommandResult.InvalidQuantity */;
30081
+ return 87 /* CommandResult.InvalidQuantity */;
30024
30082
  }
30025
30083
  return 0 /* CommandResult.Success */;
30026
30084
  case "REMOVE_COLUMNS_ROWS": {
@@ -30028,7 +30086,7 @@ class SheetPlugin extends CorePlugin {
30028
30086
  ? this.getNumberCols(cmd.sheetId)
30029
30087
  : this.getNumberRows(cmd.sheetId);
30030
30088
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30031
- return 85 /* CommandResult.InvalidHeaderIndex */;
30089
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30032
30090
  }
30033
30091
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
30034
30092
  return 8 /* CommandResult.NotEnoughElements */;
@@ -30485,18 +30543,18 @@ class SheetPlugin extends CorePlugin {
30485
30543
  checkRowFreezeQuantity(cmd) {
30486
30544
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
30487
30545
  ? 0 /* CommandResult.Success */
30488
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30546
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30489
30547
  }
30490
30548
  checkColFreezeQuantity(cmd) {
30491
30549
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
30492
30550
  ? 0 /* CommandResult.Success */
30493
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30551
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30494
30552
  }
30495
30553
  checkRowFreezeOverlapMerge(cmd) {
30496
30554
  const merges = this.getters.getMerges(cmd.sheetId);
30497
30555
  for (let merge of merges) {
30498
30556
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
30499
- return 64 /* CommandResult.MergeOverlap */;
30557
+ return 65 /* CommandResult.MergeOverlap */;
30500
30558
  }
30501
30559
  }
30502
30560
  return 0 /* CommandResult.Success */;
@@ -30505,7 +30563,7 @@ class SheetPlugin extends CorePlugin {
30505
30563
  const merges = this.getters.getMerges(cmd.sheetId);
30506
30564
  for (let merge of merges) {
30507
30565
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
30508
- return 64 /* CommandResult.MergeOverlap */;
30566
+ return 65 /* CommandResult.MergeOverlap */;
30509
30567
  }
30510
30568
  }
30511
30569
  return 0 /* CommandResult.Success */;
@@ -30946,7 +31004,7 @@ class AutofillPlugin extends UIPlugin {
30946
31004
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
30947
31005
  return 0 /* CommandResult.Success */;
30948
31006
  }
30949
- return 44 /* CommandResult.InvalidAutofillSelection */;
31007
+ return 45 /* CommandResult.InvalidAutofillSelection */;
30950
31008
  case "AUTOFILL_AUTO":
30951
31009
  const zone = this.getters.getSelectedZone();
30952
31010
  return zone.top === zone.bottom
@@ -31546,7 +31604,7 @@ class CellPopoverPlugin extends UIPlugin {
31546
31604
  cellPopoverRegistry.get(cmd.popoverType);
31547
31605
  }
31548
31606
  catch (error) {
31549
- return 71 /* CommandResult.InvalidCellPopover */;
31607
+ return 72 /* CommandResult.InvalidCellPopover */;
31550
31608
  }
31551
31609
  return 0 /* CommandResult.Success */;
31552
31610
  default:
@@ -31770,7 +31828,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
31770
31828
  for (const zone of this.getPasteZones(target)) {
31771
31829
  if ((zone.left < xSplit && zone.right >= xSplit) ||
31772
31830
  (zone.top < ySplit && zone.bottom >= ySplit)) {
31773
- return 74 /* CommandResult.FrozenPaneOverlap */;
31831
+ return 75 /* CommandResult.FrozenPaneOverlap */;
31774
31832
  }
31775
31833
  }
31776
31834
  return 0 /* CommandResult.Success */;
@@ -32130,7 +32188,7 @@ class ClipboardFigureState {
32130
32188
  }
32131
32189
  isPasteAllowed(target, option) {
32132
32190
  if (target.length === 0) {
32133
- return 72 /* CommandResult.EmptyTarget */;
32191
+ return 73 /* CommandResult.EmptyTarget */;
32134
32192
  }
32135
32193
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
32136
32194
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -32774,10 +32832,8 @@ class EvaluationPlugin extends UIPlugin {
32774
32832
  * that are actually present in the grid.
32775
32833
  */
32776
32834
  function range(range) {
32835
+ assertRangeValid(range);
32777
32836
  const sheetId = range.sheetId;
32778
- if (!isZoneValid(range.zone)) {
32779
- throw new InvalidReferenceError();
32780
- }
32781
32837
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32782
32838
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32783
32839
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32812,23 +32868,26 @@ class EvaluationPlugin extends UIPlugin {
32812
32868
  * The `compute` of the formula's function must process it completely
32813
32869
  */
32814
32870
  function refFn(range, isMeta, functionName, paramNumber) {
32871
+ assertRangeValid(range);
32815
32872
  if (isMeta) {
32816
32873
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32817
32874
  return { value: zoneToXc(range.zone) };
32818
32875
  }
32819
- if (!isZoneValid(range.zone)) {
32820
- throw new InvalidReferenceError();
32821
- }
32822
32876
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32823
32877
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32824
32878
  throw new Error(paramNumber
32825
32879
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32826
32880
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32827
32881
  }
32882
+ return readCell(range);
32883
+ }
32884
+ function assertRangeValid(range) {
32885
+ if (!isZoneValid(range.zone)) {
32886
+ throw new InvalidReferenceError();
32887
+ }
32828
32888
  if (range.invalidSheetName) {
32829
32889
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32830
32890
  }
32831
- return readCell(range);
32832
32891
  }
32833
32892
  return [refFn, range, evalContext];
32834
32893
  }
@@ -33292,7 +33351,7 @@ class FilterEvaluationPlugin extends UIPlugin {
33292
33351
  switch (cmd.type) {
33293
33352
  case "UPDATE_FILTER":
33294
33353
  if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
33295
- return 78 /* CommandResult.FilterNotFound */;
33354
+ return 79 /* CommandResult.FilterNotFound */;
33296
33355
  }
33297
33356
  break;
33298
33357
  }
@@ -35112,7 +35171,7 @@ class GridSelectionPlugin extends UIPlugin {
35112
35171
  const headers = [cmd.base, ...cmd.elements];
35113
35172
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
35114
35173
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
35115
- return 85 /* CommandResult.InvalidHeaderIndex */;
35174
+ return 86 /* CommandResult.InvalidHeaderIndex */;
35116
35175
  }
35117
35176
  return 0 /* CommandResult.Success */;
35118
35177
  }
@@ -35243,21 +35302,6 @@ class SelectionInputPlugin extends UIPlugin {
35243
35302
  // ---------------------------------------------------------------------------
35244
35303
  // Command Handling
35245
35304
  // ---------------------------------------------------------------------------
35246
- allowDispatch(cmd) {
35247
- switch (cmd.type) {
35248
- case "ADD_EMPTY_RANGE":
35249
- if (this.inputHasSingleRange && this.ranges.length === 1) {
35250
- return 29 /* CommandResult.MaximumRangesReached */;
35251
- }
35252
- break;
35253
- case "CHANGE_RANGE":
35254
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35255
- return 29 /* CommandResult.MaximumRangesReached */;
35256
- }
35257
- break;
35258
- }
35259
- return 0 /* CommandResult.Success */;
35260
- }
35261
35305
  handleEvent(event) {
35262
35306
  const xc = zoneToXc(event.anchor.zone);
35263
35307
  const inputSheetId = this.activeSheet;
@@ -35467,6 +35511,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35467
35511
  // ---------------------------------------------------------------------------
35468
35512
  allowDispatch(cmd) {
35469
35513
  var _a, _b;
35514
+ switch (cmd.type) {
35515
+ case "FOCUS_RANGE":
35516
+ case "CHANGE_RANGE":
35517
+ case "ADD_EMPTY_RANGE":
35518
+ case "REMOVE_RANGE":
35519
+ if (!this.inputs[cmd.id]) {
35520
+ return 30 /* CommandResult.InvalidInputId */;
35521
+ }
35522
+ }
35470
35523
  switch (cmd.type) {
35471
35524
  case "FOCUS_RANGE":
35472
35525
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -35474,9 +35527,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35474
35527
  return 28 /* CommandResult.InputAlreadyFocused */;
35475
35528
  }
35476
35529
  break;
35477
- }
35478
- if (this.currentInput) {
35479
- return this.currentInput.allowDispatch(cmd);
35530
+ case "ADD_EMPTY_RANGE":
35531
+ const input = this.inputs[cmd.id];
35532
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
35533
+ return 29 /* CommandResult.MaximumRangesReached */;
35534
+ }
35535
+ break;
35536
+ case "CHANGE_RANGE": {
35537
+ const input = this.inputs[cmd.id];
35538
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
35539
+ return 29 /* CommandResult.MaximumRangesReached */;
35540
+ }
35541
+ break;
35542
+ }
35480
35543
  }
35481
35544
  return 0 /* CommandResult.Success */;
35482
35545
  }
@@ -37131,7 +37194,7 @@ class SheetViewPlugin extends UIPlugin {
37131
37194
  }
37132
37195
  checkPositiveDimension(cmd) {
37133
37196
  if (cmd.width < 0 || cmd.height < 0) {
37134
- return 67 /* CommandResult.InvalidViewportSize */;
37197
+ return 68 /* CommandResult.InvalidViewportSize */;
37135
37198
  }
37136
37199
  return 0 /* CommandResult.Success */;
37137
37200
  }
@@ -37141,7 +37204,7 @@ class SheetViewPlugin extends UIPlugin {
37141
37204
  cmd.gridOffsetY === this.gridOffsetY &&
37142
37205
  cmd.width === width &&
37143
37206
  cmd.height === height) {
37144
- return 75 /* CommandResult.ValuesNotChanged */;
37207
+ return 76 /* CommandResult.ValuesNotChanged */;
37145
37208
  }
37146
37209
  return 0 /* CommandResult.Success */;
37147
37210
  }
@@ -37149,7 +37212,7 @@ class SheetViewPlugin extends UIPlugin {
37149
37212
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
37150
37213
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
37151
37214
  (!pane.canScrollVertically && offsetY > 0)) {
37152
- return 68 /* CommandResult.InvalidScrollingDirection */;
37215
+ return 69 /* CommandResult.InvalidScrollingDirection */;
37153
37216
  }
37154
37217
  return 0 /* CommandResult.Success */;
37155
37218
  }
@@ -37351,7 +37414,7 @@ class SortPlugin extends UIPlugin {
37351
37414
  for (let row = zone.top; row <= zone.bottom; row++) {
37352
37415
  for (let col = zone.left; col <= zone.right; col++) {
37353
37416
  if (!this.getters.isInMerge(sheetId, col, row)) {
37354
- return 62 /* CommandResult.InvalidSortZone */;
37417
+ return 63 /* CommandResult.InvalidSortZone */;
37355
37418
  }
37356
37419
  }
37357
37420
  }
@@ -37372,7 +37435,7 @@ class SortPlugin extends UIPlugin {
37372
37435
  ];
37373
37436
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37374
37437
  })) {
37375
- return 62 /* CommandResult.InvalidSortZone */;
37438
+ return 63 /* CommandResult.InvalidSortZone */;
37376
37439
  }
37377
37440
  return 0 /* CommandResult.Success */;
37378
37441
  }
@@ -38516,7 +38579,7 @@ const AddMergeInteractiveContent = {
38516
38579
  };
38517
38580
  function interactiveAddMerge(env, sheetId, target) {
38518
38581
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
38519
- if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
38582
+ if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
38520
38583
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
38521
38584
  }
38522
38585
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40415,8 +40478,9 @@ class RangeAdapter {
40415
40478
  *
40416
40479
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
40417
40480
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
40481
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
40418
40482
  */
40419
- getRangeString(range, forSheetId) {
40483
+ getRangeString(range, forSheetId, useFixedZone = false) {
40420
40484
  if (!range) {
40421
40485
  return INCORRECT_RANGE_STRING;
40422
40486
  }
@@ -40443,7 +40507,7 @@ class RangeAdapter {
40443
40507
  if (prefixSheet && !sheetName) {
40444
40508
  return INCORRECT_RANGE_STRING;
40445
40509
  }
40446
- let rangeString = this.getRangePartString(rangeImpl, 0);
40510
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
40447
40511
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
40448
40512
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
40449
40513
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -40453,7 +40517,7 @@ class RangeAdapter {
40453
40517
  rangeImpl.parts[1].rowFixed ||
40454
40518
  rangeImpl.parts[1].colFixed) {
40455
40519
  rangeString += ":";
40456
- rangeString += this.getRangePartString(rangeImpl, 1);
40520
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
40457
40521
  }
40458
40522
  }
40459
40523
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -40483,13 +40547,14 @@ class RangeAdapter {
40483
40547
  /**
40484
40548
  * Get a Xc string that represent a part of a range
40485
40549
  */
40486
- getRangePartString(range, part) {
40487
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
40550
+ getRangePartString(range, part, useFixedZone = false) {
40551
+ var _a, _b;
40552
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40488
40553
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40489
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
40554
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40490
40555
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40491
40556
  let str = "";
40492
- if (range.isFullCol) {
40557
+ if (range.isFullCol && !useFixedZone) {
40493
40558
  if (part === 0 && range.unboundedZone.hasHeader) {
40494
40559
  str = colFixed + col + rowFixed + row;
40495
40560
  }
@@ -40497,7 +40562,7 @@ class RangeAdapter {
40497
40562
  str = colFixed + col;
40498
40563
  }
40499
40564
  }
40500
- else if (range.isFullRow) {
40565
+ else if (range.isFullRow && !useFixedZone) {
40501
40566
  if (part === 0 && range.unboundedZone.hasHeader) {
40502
40567
  str = colFixed + col + rowFixed + row;
40503
40568
  }
@@ -40698,7 +40763,7 @@ class SelectionStreamProcessor {
40698
40763
  */
40699
40764
  moveAnchorCell(direction, step = 1) {
40700
40765
  if (step !== "end" && step <= 0) {
40701
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40766
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40702
40767
  }
40703
40768
  const { col, row } = this.getNextAvailablePosition(direction, step);
40704
40769
  return this.selectCell(col, row);
@@ -40744,7 +40809,7 @@ class SelectionStreamProcessor {
40744
40809
  */
40745
40810
  resizeAnchorZone(direction, step = 1) {
40746
40811
  if (step !== "end" && step <= 0) {
40747
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40812
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40748
40813
  }
40749
40814
  const sheetId = this.getters.getActiveSheetId();
40750
40815
  const anchor = this.anchor;
@@ -41555,12 +41620,7 @@ function addFormula(cell) {
41555
41620
  attrs.push(["t", "str"]);
41556
41621
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41557
41622
  }
41558
- node = escapeXml /*xml*/ `
41559
- <f>
41560
- ${XlsxFormula}
41561
- </f>
41562
- ${cycle}
41563
- `;
41623
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41564
41624
  return { attrs, node };
41565
41625
  }
41566
41626
  else {
@@ -42301,11 +42361,10 @@ function addRows(construct, data, sheet) {
42301
42361
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
42302
42362
  }
42303
42363
  attributes.push(...additionalAttrs);
42304
- cellNodes.push(escapeXml /*xml*/ `
42305
- <c ${formatAttributes(attributes)}>
42306
- ${cellNode}
42307
- </c>
42308
- `);
42364
+ // prettier-ignore
42365
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
42366
+ ${cellNode}
42367
+ </c>`);
42309
42368
  }
42310
42369
  }
42311
42370
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -42684,10 +42743,10 @@ class Model extends EventBus {
42684
42743
  const command = { type, ...payload };
42685
42744
  let status = this.status;
42686
42745
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
42687
- return new DispatchResult(66 /* CommandResult.Readonly */);
42746
+ return new DispatchResult(67 /* CommandResult.Readonly */);
42688
42747
  }
42689
42748
  if (!this.session.canApplyOptimisticUpdate()) {
42690
- return new DispatchResult(63 /* CommandResult.WaitingSessionConfirmation */);
42749
+ return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
42691
42750
  }
42692
42751
  switch (status) {
42693
42752
  case 0 /* Status.Ready */:
@@ -43099,6 +43158,6 @@ function addFunction(functionName, functionDescription) {
43099
43158
  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 };
43100
43159
 
43101
43160
 
43102
- __info__.version = '16.0.28';
43103
- __info__.date = '2024-01-12T13:42:04.756Z';
43104
- __info__.hash = '7251a47';
43161
+ __info__.version = '16.0.30';
43162
+ __info__.date = '2024-01-29T13:49:32.243Z';
43163
+ __info__.hash = '49966d6';