@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.
@@ -1565,6 +1565,31 @@ const MAX_DECIMAL_PLACES = 20;
1565
1565
  //from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
1566
1566
  const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
1567
1567
  const zeroRegexp = /0/g;
1568
+ // TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
1569
+ // + possibly handle automatic translation of day/month
1570
+ const MONTHS = {
1571
+ 0: _lt("January"),
1572
+ 1: _lt("February"),
1573
+ 2: _lt("March"),
1574
+ 3: _lt("April"),
1575
+ 4: _lt("May"),
1576
+ 5: _lt("June"),
1577
+ 6: _lt("July"),
1578
+ 7: _lt("August"),
1579
+ 8: _lt("September"),
1580
+ 9: _lt("October"),
1581
+ 10: _lt("November"),
1582
+ 11: _lt("December"),
1583
+ };
1584
+ const DAYS$1 = {
1585
+ 0: _lt("Sunday"),
1586
+ 1: _lt("Monday"),
1587
+ 2: _lt("Tuesday"),
1588
+ 3: _lt("Wednesday"),
1589
+ 4: _lt("Thursday"),
1590
+ 5: _lt("Friday"),
1591
+ 6: _lt("Saturday"),
1592
+ };
1568
1593
  // -----------------------------------------------------------------------------
1569
1594
  // FORMAT REPRESENTATION CACHE
1570
1595
  // -----------------------------------------------------------------------------
@@ -1797,8 +1822,9 @@ function applyDateTimeFormat(value, format) {
1797
1822
  return strDate + (strDate && strTime ? " " : "") + strTime;
1798
1823
  }
1799
1824
  function formatJSDate(jsDate, format) {
1800
- const sep = format.match(/\/|-|\s/)[0];
1801
- const parts = format.split(sep);
1825
+ var _a;
1826
+ const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
1827
+ const parts = sep ? format.split(sep) : [format];
1802
1828
  return parts
1803
1829
  .map((p) => {
1804
1830
  switch (p) {
@@ -1806,10 +1832,23 @@ function formatJSDate(jsDate, format) {
1806
1832
  return jsDate.getDate();
1807
1833
  case "dd":
1808
1834
  return jsDate.getDate().toString().padStart(2, "0");
1835
+ case "ddd":
1836
+ return DAYS$1[jsDate.getDay()].slice(0, 3);
1837
+ case "dddd":
1838
+ return DAYS$1[jsDate.getDay()];
1809
1839
  case "m":
1810
1840
  return jsDate.getMonth() + 1;
1811
1841
  case "mm":
1812
1842
  return String(jsDate.getMonth() + 1).padStart(2, "0");
1843
+ case "mmm":
1844
+ return MONTHS[jsDate.getMonth()].slice(0, 3);
1845
+ case "mmmm":
1846
+ return MONTHS[jsDate.getMonth()];
1847
+ case "mmmmm":
1848
+ return MONTHS[jsDate.getMonth()].slice(0, 1);
1849
+ case "yy":
1850
+ const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
1851
+ return fullYear.slice(fullYear.length - 2);
1813
1852
  case "yyyy":
1814
1853
  return jsDate.getFullYear();
1815
1854
  default:
@@ -1856,27 +1895,30 @@ function createDefaultFormat(value) {
1856
1895
  }
1857
1896
  function createLargeNumberFormat(format, magnitude, postFix) {
1858
1897
  const internalFormat = parseFormat(format || "#,##0");
1859
- const largeNumberFormat = internalFormat
1860
- .map((formatPart) => {
1861
- if (formatPart.type === "NUMBER") {
1862
- return [
1863
- {
1864
- ...formatPart,
1865
- format: {
1866
- ...formatPart.format,
1867
- magnitude,
1868
- decimalPart: undefined,
1869
- },
1870
- },
1871
- {
1872
- type: "STRING",
1873
- format: postFix,
1874
- },
1875
- ];
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;
1876
1904
  }
1877
- return formatPart;
1878
- })
1879
- .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
+ }
1880
1922
  return convertInternalFormatToFormat(largeNumberFormat);
1881
1923
  }
1882
1924
  function changeDecimalPlaces(format, step) {
@@ -3315,64 +3357,65 @@ exports.CommandResult = void 0;
3315
3357
  CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
3316
3358
  CommandResult[CommandResult["InputAlreadyFocused"] = 28] = "InputAlreadyFocused";
3317
3359
  CommandResult[CommandResult["MaximumRangesReached"] = 29] = "MaximumRangesReached";
3318
- CommandResult[CommandResult["InvalidChartDefinition"] = 30] = "InvalidChartDefinition";
3319
- CommandResult[CommandResult["InvalidDataSet"] = 31] = "InvalidDataSet";
3320
- CommandResult[CommandResult["InvalidLabelRange"] = 32] = "InvalidLabelRange";
3321
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 33] = "InvalidScorecardKeyValue";
3322
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 34] = "InvalidScorecardBaseline";
3323
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 35] = "InvalidGaugeDataRange";
3324
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 36] = "EmptyGaugeRangeMin";
3325
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 37] = "GaugeRangeMinNaN";
3326
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 38] = "EmptyGaugeRangeMax";
3327
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 39] = "GaugeRangeMaxNaN";
3328
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 40] = "GaugeRangeMinBiggerThanRangeMax";
3329
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 41] = "GaugeLowerInflectionPointNaN";
3330
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 42] = "GaugeUpperInflectionPointNaN";
3331
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 43] = "GaugeLowerBiggerThanUpper";
3332
- CommandResult[CommandResult["InvalidAutofillSelection"] = 44] = "InvalidAutofillSelection";
3333
- CommandResult[CommandResult["WrongComposerSelection"] = 45] = "WrongComposerSelection";
3334
- CommandResult[CommandResult["MinBiggerThanMax"] = 46] = "MinBiggerThanMax";
3335
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 47] = "LowerBiggerThanUpper";
3336
- CommandResult[CommandResult["MidBiggerThanMax"] = 48] = "MidBiggerThanMax";
3337
- CommandResult[CommandResult["MinBiggerThanMid"] = 49] = "MinBiggerThanMid";
3338
- CommandResult[CommandResult["FirstArgMissing"] = 50] = "FirstArgMissing";
3339
- CommandResult[CommandResult["SecondArgMissing"] = 51] = "SecondArgMissing";
3340
- CommandResult[CommandResult["MinNaN"] = 52] = "MinNaN";
3341
- CommandResult[CommandResult["MidNaN"] = 53] = "MidNaN";
3342
- CommandResult[CommandResult["MaxNaN"] = 54] = "MaxNaN";
3343
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 55] = "ValueUpperInflectionNaN";
3344
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 56] = "ValueLowerInflectionNaN";
3345
- CommandResult[CommandResult["MinInvalidFormula"] = 57] = "MinInvalidFormula";
3346
- CommandResult[CommandResult["MidInvalidFormula"] = 58] = "MidInvalidFormula";
3347
- CommandResult[CommandResult["MaxInvalidFormula"] = 59] = "MaxInvalidFormula";
3348
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 60] = "ValueUpperInvalidFormula";
3349
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 61] = "ValueLowerInvalidFormula";
3350
- CommandResult[CommandResult["InvalidSortZone"] = 62] = "InvalidSortZone";
3351
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 63] = "WaitingSessionConfirmation";
3352
- CommandResult[CommandResult["MergeOverlap"] = 64] = "MergeOverlap";
3353
- CommandResult[CommandResult["TooManyHiddenElements"] = 65] = "TooManyHiddenElements";
3354
- CommandResult[CommandResult["Readonly"] = 66] = "Readonly";
3355
- CommandResult[CommandResult["InvalidViewportSize"] = 67] = "InvalidViewportSize";
3356
- CommandResult[CommandResult["InvalidScrollingDirection"] = 68] = "InvalidScrollingDirection";
3357
- CommandResult[CommandResult["FigureDoesNotExist"] = 69] = "FigureDoesNotExist";
3358
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 70] = "InvalidConditionalFormatId";
3359
- CommandResult[CommandResult["InvalidCellPopover"] = 71] = "InvalidCellPopover";
3360
- CommandResult[CommandResult["EmptyTarget"] = 72] = "EmptyTarget";
3361
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 73] = "InvalidFreezeQuantity";
3362
- CommandResult[CommandResult["FrozenPaneOverlap"] = 74] = "FrozenPaneOverlap";
3363
- CommandResult[CommandResult["ValuesNotChanged"] = 75] = "ValuesNotChanged";
3364
- CommandResult[CommandResult["InvalidFilterZone"] = 76] = "InvalidFilterZone";
3365
- CommandResult[CommandResult["FilterOverlap"] = 77] = "FilterOverlap";
3366
- CommandResult[CommandResult["FilterNotFound"] = 78] = "FilterNotFound";
3367
- CommandResult[CommandResult["MergeInFilter"] = 79] = "MergeInFilter";
3368
- CommandResult[CommandResult["NonContinuousTargets"] = 80] = "NonContinuousTargets";
3369
- CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
3370
- CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
3371
- CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
3372
- CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
3373
- CommandResult[CommandResult["InvalidHeaderIndex"] = 85] = "InvalidHeaderIndex";
3374
- CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
3375
- 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";
3376
3419
  })(exports.CommandResult || (exports.CommandResult = {}));
3377
3420
 
3378
3421
  function isMatrix(x) {
@@ -4873,7 +4916,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
4873
4916
  });
4874
4917
  }
4875
4918
  }
4876
- if (result.isCancelledBecause(62 /* CommandResult.InvalidSortZone */)) {
4919
+ if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
4877
4920
  const { col, row } = anchor;
4878
4921
  env.model.selection.selectZone({ cell: { col, row }, zone });
4879
4922
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -4896,13 +4939,13 @@ const AddFilterInteractiveContent = {
4896
4939
  };
4897
4940
  function interactiveAddFilter(env, sheetId, target) {
4898
4941
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
4899
- if (result.isCancelledBecause(77 /* CommandResult.FilterOverlap */)) {
4942
+ if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
4900
4943
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
4901
4944
  }
4902
- else if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
4945
+ else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
4903
4946
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
4904
4947
  }
4905
- else if (result.isCancelledBecause(80 /* CommandResult.NonContinuousTargets */)) {
4948
+ else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
4906
4949
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
4907
4950
  }
4908
4951
  }
@@ -4924,7 +4967,7 @@ function handlePasteResult(env, result) {
4924
4967
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
4925
4968
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
4926
4969
  }
4927
- else if (result.reasons.includes(74 /* CommandResult.FrozenPaneOverlap */)) {
4970
+ else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
4928
4971
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
4929
4972
  }
4930
4973
  }
@@ -5966,22 +6009,22 @@ sheetMenuRegistry
5966
6009
  const CfTerms = {
5967
6010
  Errors: {
5968
6011
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
5969
- [50 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
5970
- [51 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
5971
- [52 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
5972
- [53 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
5973
- [54 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
5974
- [55 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
5975
- [56 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
5976
- [46 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
5977
- [49 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
5978
- [48 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
5979
- [47 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
5980
- [57 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
5981
- [59 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
5982
- [58 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
5983
- [60 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
5984
- [61 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6012
+ [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6013
+ [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6014
+ [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6015
+ [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6016
+ [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6017
+ [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6018
+ [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6019
+ [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6020
+ [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6021
+ [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6022
+ [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6023
+ [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6024
+ [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6025
+ [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6026
+ [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6027
+ [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
5985
6028
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
5986
6029
  Unexpected: _lt("The rule is invalid for an unknown reason"),
5987
6030
  },
@@ -6009,20 +6052,20 @@ const ChartTerms = {
6009
6052
  Errors: {
6010
6053
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
6011
6054
  // BASIC CHART ERRORS (LINE | BAR | PIE)
6012
- [31 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6013
- [32 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6055
+ [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6056
+ [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6014
6057
  // SCORECARD CHART ERRORS
6015
- [33 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6016
- [34 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6058
+ [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6059
+ [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6017
6060
  // GAUGE CHART ERRORS
6018
- [35 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6019
- [36 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6020
- [37 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6021
- [38 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6022
- [39 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6023
- [40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6024
- [41 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6025
- [42 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6061
+ [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6062
+ [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6063
+ [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6064
+ [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6065
+ [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6066
+ [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6067
+ [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6068
+ [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6026
6069
  },
6027
6070
  };
6028
6071
  const NumberFormatTerms = {
@@ -6046,7 +6089,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
6046
6089
  const sheetId = env.model.getters.getActiveSheetId();
6047
6090
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
6048
6091
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
6049
- if (result.isCancelledBecause(64 /* CommandResult.MergeOverlap */)) {
6092
+ if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
6050
6093
  env.raiseError(MergeErrorMessage);
6051
6094
  }
6052
6095
  }
@@ -6692,11 +6735,11 @@ class LineBarPieConfigPanel extends owl.Component {
6692
6735
  }
6693
6736
  get isDatasetInvalid() {
6694
6737
  var _a;
6695
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(31 /* CommandResult.InvalidDataSet */));
6738
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
6696
6739
  }
6697
6740
  get isLabelInvalid() {
6698
6741
  var _a;
6699
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
6742
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
6700
6743
  }
6701
6744
  onUpdateDataSetsHaveTitle(ev) {
6702
6745
  this.props.updateChart(this.props.figureId, {
@@ -6917,14 +6960,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
6917
6960
  : undefined));
6918
6961
  }
6919
6962
  }
6920
- else if (zone.left === zone.right && zone.top === zone.bottom) {
6921
- // A single cell. If it's only the title, the dataset is not added.
6922
- if (!dataSetsHaveTitle) {
6923
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
6924
- }
6925
- }
6926
6963
  else {
6927
- /* 1 row or 1 column */
6964
+ /* 1 cell, 1 row or 1 column */
6928
6965
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
6929
6966
  ? {
6930
6967
  top: zone.top,
@@ -6974,8 +7011,10 @@ function toExcelDataset(getters, ds) {
6974
7011
  }
6975
7012
  const dataRange = ds.dataRange.clone({ zone: dataZone });
6976
7013
  return {
6977
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
6978
- range: getters.getRangeString(dataRange, "forceSheetReference"),
7014
+ label: ds.labelCell
7015
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
7016
+ : undefined,
7017
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
6979
7018
  };
6980
7019
  }
6981
7020
  /**
@@ -7044,11 +7083,11 @@ function checkDataset(definition) {
7044
7083
  if (definition.dataSets) {
7045
7084
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
7046
7085
  if (invalidRanges) {
7047
- return 31 /* CommandResult.InvalidDataSet */;
7086
+ return 32 /* CommandResult.InvalidDataSet */;
7048
7087
  }
7049
7088
  const zones = definition.dataSets.map(toUnboundedZone);
7050
7089
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
7051
- return 31 /* CommandResult.InvalidDataSet */;
7090
+ return 32 /* CommandResult.InvalidDataSet */;
7052
7091
  }
7053
7092
  }
7054
7093
  return 0 /* CommandResult.Success */;
@@ -7057,7 +7096,7 @@ function checkLabelRange(definition) {
7057
7096
  if (definition.labelRange) {
7058
7097
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
7059
7098
  if (invalidLabels) {
7060
- return 32 /* CommandResult.InvalidLabelRange */;
7099
+ return 33 /* CommandResult.InvalidLabelRange */;
7061
7100
  }
7062
7101
  }
7063
7102
  return 0 /* CommandResult.Success */;
@@ -7358,6 +7397,9 @@ class BarChart extends AbstractChart {
7358
7397
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7359
7398
  return {
7360
7399
  ...this.getDefinition(),
7400
+ labelRange: this.labelRange
7401
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
7402
+ : undefined,
7361
7403
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7362
7404
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7363
7405
  dataSets,
@@ -7515,7 +7557,7 @@ chartRegistry.add("gauge", {
7515
7557
  });
7516
7558
  function isDataRangeValid(definition) {
7517
7559
  return definition.dataRange && !rangeReference.test(definition.dataRange)
7518
- ? 35 /* CommandResult.InvalidGaugeDataRange */
7560
+ ? 36 /* CommandResult.InvalidGaugeDataRange */
7519
7561
  : 0 /* CommandResult.Success */;
7520
7562
  }
7521
7563
  function checkRangeLimits(check, batchValidations) {
@@ -7547,7 +7589,7 @@ function checkInflectionPointsValue(check, batchValidations) {
7547
7589
  function checkRangeMinBiggerThanRangeMax(definition) {
7548
7590
  if (definition.sectionRule) {
7549
7591
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
7550
- return 40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7592
+ return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7551
7593
  }
7552
7594
  }
7553
7595
  return 0 /* CommandResult.Success */;
@@ -7556,9 +7598,9 @@ function checkEmpty(value, valueName) {
7556
7598
  if (value === "") {
7557
7599
  switch (valueName) {
7558
7600
  case "rangeMin":
7559
- return 36 /* CommandResult.EmptyGaugeRangeMin */;
7601
+ return 37 /* CommandResult.EmptyGaugeRangeMin */;
7560
7602
  case "rangeMax":
7561
- return 38 /* CommandResult.EmptyGaugeRangeMax */;
7603
+ return 39 /* CommandResult.EmptyGaugeRangeMax */;
7562
7604
  }
7563
7605
  }
7564
7606
  return 0 /* CommandResult.Success */;
@@ -7567,13 +7609,13 @@ function checkNaN(value, valueName) {
7567
7609
  if (isNaN(value)) {
7568
7610
  switch (valueName) {
7569
7611
  case "rangeMin":
7570
- return 37 /* CommandResult.GaugeRangeMinNaN */;
7612
+ return 38 /* CommandResult.GaugeRangeMinNaN */;
7571
7613
  case "rangeMax":
7572
- return 39 /* CommandResult.GaugeRangeMaxNaN */;
7614
+ return 40 /* CommandResult.GaugeRangeMaxNaN */;
7573
7615
  case "lowerInflectionPointValue":
7574
- return 41 /* CommandResult.GaugeLowerInflectionPointNaN */;
7616
+ return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
7575
7617
  case "upperInflectionPointValue":
7576
- return 42 /* CommandResult.GaugeUpperInflectionPointNaN */;
7618
+ return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
7577
7619
  }
7578
7620
  }
7579
7621
  return 0 /* CommandResult.Success */;
@@ -7986,6 +8028,9 @@ class LineChart extends AbstractChart {
7986
8028
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7987
8029
  return {
7988
8030
  ...this.getDefinition(),
8031
+ labelRange: this.labelRange
8032
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8033
+ : undefined,
7989
8034
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
7990
8035
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
7991
8036
  dataSets,
@@ -8246,6 +8291,9 @@ class PieChart extends AbstractChart {
8246
8291
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8247
8292
  return {
8248
8293
  ...this.getDefinition(),
8294
+ labelRange: this.labelRange
8295
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
8296
+ : undefined,
8249
8297
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
8250
8298
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
8251
8299
  verticalAxisPosition: "left",
@@ -8326,12 +8374,12 @@ chartRegistry.add("scorecard", {
8326
8374
  });
8327
8375
  function checkKeyValue(definition) {
8328
8376
  return definition.keyValue && !rangeReference.test(definition.keyValue)
8329
- ? 33 /* CommandResult.InvalidScorecardKeyValue */
8377
+ ? 34 /* CommandResult.InvalidScorecardKeyValue */
8330
8378
  : 0 /* CommandResult.Success */;
8331
8379
  }
8332
8380
  function checkBaseline(definition) {
8333
8381
  return definition.baseline && !rangeReference.test(definition.baseline)
8334
- ? 34 /* CommandResult.InvalidScorecardBaseline */
8382
+ ? 35 /* CommandResult.InvalidScorecardBaseline */
8335
8383
  : 0 /* CommandResult.Success */;
8336
8384
  }
8337
8385
  class ScorecardChart$1 extends AbstractChart {
@@ -8760,7 +8808,7 @@ class GaugeChartConfigPanel extends owl.Component {
8760
8808
  }
8761
8809
  get isDataRangeInvalid() {
8762
8810
  var _a;
8763
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidGaugeDataRange */));
8811
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
8764
8812
  }
8765
8813
  onDataRangeChanged(ranges) {
8766
8814
  this.dataRange = ranges[0];
@@ -8847,28 +8895,28 @@ class GaugeChartDesignPanel extends owl.Component {
8847
8895
  }
8848
8896
  isRangeMinInvalid() {
8849
8897
  var _a, _b, _c;
8850
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.EmptyGaugeRangeMin */)) ||
8851
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(37 /* CommandResult.GaugeRangeMinNaN */)) ||
8852
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(40 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8898
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
8899
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
8900
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8853
8901
  }
8854
8902
  isRangeMaxInvalid() {
8855
8903
  var _a, _b, _c;
8856
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMax */)) ||
8857
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMaxNaN */)) ||
8858
- ((_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(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
8905
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
8906
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
8859
8907
  }
8860
8908
  // ---------------------------------------------------------------------------
8861
8909
  // COLOR_SECTION_TEMPLATE
8862
8910
  // ---------------------------------------------------------------------------
8863
8911
  get isLowerInflectionPointInvalid() {
8864
8912
  var _a, _b;
8865
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(41 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8866
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8913
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
8914
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8867
8915
  }
8868
8916
  get isUpperInflectionPointInvalid() {
8869
8917
  var _a, _b;
8870
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8871
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(43 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8918
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
8919
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
8872
8920
  }
8873
8921
  updateInflectionPointValue(attr, ev) {
8874
8922
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -8971,11 +9019,11 @@ class ScorecardChartConfigPanel extends owl.Component {
8971
9019
  }
8972
9020
  get isKeyValueInvalid() {
8973
9021
  var _a;
8974
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidScorecardKeyValue */));
9022
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
8975
9023
  }
8976
9024
  get isBaselineInvalid() {
8977
9025
  var _a;
8978
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardBaseline */));
9026
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
8979
9027
  }
8980
9028
  onKeyValueRangeChanged(ranges) {
8981
9029
  this.keyValue = ranges[0];
@@ -9815,11 +9863,11 @@ class ConditionalFormattingPanel extends owl.Component {
9815
9863
  ****************************************************************************/
9816
9864
  get isValue1Invalid() {
9817
9865
  var _a;
9818
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(50 /* CommandResult.FirstArgMissing */));
9866
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
9819
9867
  }
9820
9868
  get isValue2Invalid() {
9821
9869
  var _a;
9822
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.SecondArgMissing */));
9870
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
9823
9871
  }
9824
9872
  toggleStyle(tool) {
9825
9873
  const style = this.state.rules.cellIs.style;
@@ -9836,17 +9884,17 @@ class ConditionalFormattingPanel extends owl.Component {
9836
9884
  isValueInvalid(threshold) {
9837
9885
  switch (threshold) {
9838
9886
  case "minimum":
9839
- return (this.state.errors.includes(57 /* CommandResult.MinInvalidFormula */) ||
9840
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMid */) ||
9841
- this.state.errors.includes(46 /* CommandResult.MinBiggerThanMax */) ||
9842
- this.state.errors.includes(52 /* CommandResult.MinNaN */));
9887
+ return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
9888
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
9889
+ this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
9890
+ this.state.errors.includes(53 /* CommandResult.MinNaN */));
9843
9891
  case "midpoint":
9844
- return (this.state.errors.includes(58 /* CommandResult.MidInvalidFormula */) ||
9845
- this.state.errors.includes(53 /* CommandResult.MidNaN */) ||
9846
- this.state.errors.includes(48 /* CommandResult.MidBiggerThanMax */));
9892
+ return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
9893
+ this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
9894
+ this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
9847
9895
  case "maximum":
9848
- return (this.state.errors.includes(59 /* CommandResult.MaxInvalidFormula */) ||
9849
- this.state.errors.includes(54 /* CommandResult.MaxNaN */));
9896
+ return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
9897
+ this.state.errors.includes(55 /* CommandResult.MaxNaN */));
9850
9898
  default:
9851
9899
  return false;
9852
9900
  }
@@ -9895,13 +9943,13 @@ class ConditionalFormattingPanel extends owl.Component {
9895
9943
  isInflectionPointInvalid(inflectionPoint) {
9896
9944
  switch (inflectionPoint) {
9897
9945
  case "lowerInflectionPoint":
9898
- return (this.state.errors.includes(56 /* CommandResult.ValueLowerInflectionNaN */) ||
9899
- this.state.errors.includes(61 /* CommandResult.ValueLowerInvalidFormula */) ||
9900
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9946
+ return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
9947
+ this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
9948
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9901
9949
  case "upperInflectionPoint":
9902
- return (this.state.errors.includes(55 /* CommandResult.ValueUpperInflectionNaN */) ||
9903
- this.state.errors.includes(60 /* CommandResult.ValueUpperInvalidFormula */) ||
9904
- this.state.errors.includes(47 /* CommandResult.LowerBiggerThanUpper */));
9950
+ return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
9951
+ this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
9952
+ this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
9905
9953
  default:
9906
9954
  return true;
9907
9955
  }
@@ -19546,7 +19594,7 @@ class EditionPlugin extends UIPlugin {
19546
19594
  validateSelection(length, start, end) {
19547
19595
  return start >= 0 && start <= length && end >= 0 && end <= length
19548
19596
  ? 0 /* CommandResult.Success */
19549
- : 45 /* CommandResult.WrongComposerSelection */;
19597
+ : 46 /* CommandResult.WrongComposerSelection */;
19550
19598
  }
19551
19599
  onColumnsRemoved(cmd) {
19552
19600
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -19830,9 +19878,10 @@ class EditionPlugin extends UIPlugin {
19830
19878
  */
19831
19879
  getReferencedRanges() {
19832
19880
  const editionSheetId = this.getters.getEditionSheet();
19833
- return this.currentTokens
19881
+ const referenceRanges = this.currentTokens
19834
19882
  .filter((token) => token.type === "REFERENCE")
19835
19883
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
19884
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
19836
19885
  }
19837
19886
  /**
19838
19887
  * Function used to determine when composer selection can start.
@@ -27603,7 +27652,7 @@ class BordersPlugin extends CorePlugin {
27603
27652
  const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
27604
27653
  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);
27605
27654
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
27606
- return 87 /* CommandResult.NoChanges */;
27655
+ return 88 /* CommandResult.NoChanges */;
27607
27656
  }
27608
27657
  return 0 /* CommandResult.Success */;
27609
27658
  }
@@ -27845,6 +27894,9 @@ class CellPlugin extends CorePlugin {
27845
27894
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27846
27895
  content: cell.content || undefined,
27847
27896
  };
27897
+ if (cell.isFormula()) {
27898
+ cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27899
+ }
27848
27900
  }
27849
27901
  _sheet.cells = cells;
27850
27902
  }
@@ -27892,13 +27944,13 @@ class CellPlugin extends CorePlugin {
27892
27944
  /*
27893
27945
  * Reconstructs the original formula string based on a normalized form and its dependencies
27894
27946
  */
27895
- buildFormulaContent(sheetId, cell, dependencies) {
27947
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
27896
27948
  const ranges = dependencies || cell.dependencies;
27897
27949
  let rangeIndex = 0;
27898
27950
  return concat(cell.compiledFormula.tokens.map((token) => {
27899
27951
  if (token.type === "REFERENCE") {
27900
27952
  const range = ranges[rangeIndex++];
27901
- return this.getters.getRangeString(range, sheetId);
27953
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
27902
27954
  }
27903
27955
  return token.value;
27904
27956
  }));
@@ -28063,9 +28115,9 @@ class CellPlugin extends CorePlugin {
28063
28115
  checkUselessClearCell(cmd) {
28064
28116
  const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
28065
28117
  if (!cell)
28066
- return 87 /* CommandResult.NoChanges */;
28118
+ return 88 /* CommandResult.NoChanges */;
28067
28119
  if (!cell.content && !cell.style && !cell.format) {
28068
- return 87 /* CommandResult.NoChanges */;
28120
+ return 88 /* CommandResult.NoChanges */;
28069
28121
  }
28070
28122
  return 0 /* CommandResult.Success */;
28071
28123
  }
@@ -28274,13 +28326,13 @@ class ChartPlugin extends CorePlugin {
28274
28326
  }
28275
28327
  checkChartDuplicate(cmd) {
28276
28328
  return this.getters.getFigureSheetId(cmd.id)
28277
- ? 83 /* CommandResult.DuplicatedChartId */
28329
+ ? 84 /* CommandResult.DuplicatedChartId */
28278
28330
  : 0 /* CommandResult.Success */;
28279
28331
  }
28280
28332
  checkChartExists(cmd) {
28281
28333
  return this.getters.getFigureSheetId(cmd.id)
28282
28334
  ? 0 /* CommandResult.Success */
28283
- : 84 /* CommandResult.ChartDoesNotExist */;
28335
+ : 85 /* CommandResult.ChartDoesNotExist */;
28284
28336
  }
28285
28337
  }
28286
28338
  ChartPlugin.getters = [
@@ -28395,7 +28447,13 @@ class ConditionalFormatPlugin extends CorePlugin {
28395
28447
  }
28396
28448
  }
28397
28449
  exportForExcel(data) {
28398
- this.export(data);
28450
+ if (data.sheets) {
28451
+ for (let sheet of data.sheets) {
28452
+ if (this.cfRules[sheet.id]) {
28453
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
28454
+ }
28455
+ }
28456
+ }
28399
28457
  }
28400
28458
  // ---------------------------------------------------------------------------
28401
28459
  // Getters
@@ -28445,11 +28503,11 @@ class ConditionalFormatPlugin extends CorePlugin {
28445
28503
  // ---------------------------------------------------------------------------
28446
28504
  // Private
28447
28505
  // ---------------------------------------------------------------------------
28448
- mapToConditionalFormat(sheetId, cf) {
28506
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
28449
28507
  return {
28450
28508
  ...cf,
28451
28509
  ranges: cf.ranges.map((range) => {
28452
- return this.getters.getRangeString(range, sheetId);
28510
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
28453
28511
  }),
28454
28512
  };
28455
28513
  }
@@ -28482,10 +28540,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28482
28540
  return 27 /* CommandResult.InvalidSheetId */;
28483
28541
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
28484
28542
  if (ruleIndex === -1)
28485
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28543
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28486
28544
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
28487
28545
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
28488
- return 70 /* CommandResult.InvalidConditionalFormatId */;
28546
+ return 71 /* CommandResult.InvalidConditionalFormatId */;
28489
28547
  }
28490
28548
  return 0 /* CommandResult.Success */;
28491
28549
  }
@@ -28526,10 +28584,10 @@ class ConditionalFormatPlugin extends CorePlugin {
28526
28584
  const errors = [];
28527
28585
  const isEmpty = (value) => value === undefined || value === "";
28528
28586
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
28529
- errors.push(50 /* CommandResult.FirstArgMissing */);
28587
+ errors.push(51 /* CommandResult.FirstArgMissing */);
28530
28588
  }
28531
28589
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
28532
- errors.push(51 /* CommandResult.SecondArgMissing */);
28590
+ errors.push(52 /* CommandResult.SecondArgMissing */);
28533
28591
  }
28534
28592
  return errors.length ? errors : 0 /* CommandResult.Success */;
28535
28593
  }
@@ -28541,15 +28599,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28541
28599
  (threshold.value === "" || isNaN(threshold.value))) {
28542
28600
  switch (thresholdName) {
28543
28601
  case "min":
28544
- return 52 /* CommandResult.MinNaN */;
28602
+ return 53 /* CommandResult.MinNaN */;
28545
28603
  case "max":
28546
- return 54 /* CommandResult.MaxNaN */;
28604
+ return 55 /* CommandResult.MaxNaN */;
28547
28605
  case "mid":
28548
- return 53 /* CommandResult.MidNaN */;
28606
+ return 54 /* CommandResult.MidNaN */;
28549
28607
  case "upperInflectionPoint":
28550
- return 55 /* CommandResult.ValueUpperInflectionNaN */;
28608
+ return 56 /* CommandResult.ValueUpperInflectionNaN */;
28551
28609
  case "lowerInflectionPoint":
28552
- return 56 /* CommandResult.ValueLowerInflectionNaN */;
28610
+ return 57 /* CommandResult.ValueLowerInflectionNaN */;
28553
28611
  }
28554
28612
  }
28555
28613
  return 0 /* CommandResult.Success */;
@@ -28563,15 +28621,15 @@ class ConditionalFormatPlugin extends CorePlugin {
28563
28621
  catch (error) {
28564
28622
  switch (thresholdName) {
28565
28623
  case "min":
28566
- return 57 /* CommandResult.MinInvalidFormula */;
28624
+ return 58 /* CommandResult.MinInvalidFormula */;
28567
28625
  case "max":
28568
- return 59 /* CommandResult.MaxInvalidFormula */;
28626
+ return 60 /* CommandResult.MaxInvalidFormula */;
28569
28627
  case "mid":
28570
- return 58 /* CommandResult.MidInvalidFormula */;
28628
+ return 59 /* CommandResult.MidInvalidFormula */;
28571
28629
  case "upperInflectionPoint":
28572
- return 60 /* CommandResult.ValueUpperInvalidFormula */;
28630
+ return 61 /* CommandResult.ValueUpperInvalidFormula */;
28573
28631
  case "lowerInflectionPoint":
28574
- return 61 /* CommandResult.ValueLowerInvalidFormula */;
28632
+ return 62 /* CommandResult.ValueLowerInvalidFormula */;
28575
28633
  }
28576
28634
  }
28577
28635
  return 0 /* CommandResult.Success */;
@@ -28588,7 +28646,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28588
28646
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
28589
28647
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
28590
28648
  Number(minValue) > Number(maxValue)) {
28591
- return 47 /* CommandResult.LowerBiggerThanUpper */;
28649
+ return 48 /* CommandResult.LowerBiggerThanUpper */;
28592
28650
  }
28593
28651
  return 0 /* CommandResult.Success */;
28594
28652
  }
@@ -28598,7 +28656,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28598
28656
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
28599
28657
  rule.minimum.type === rule.maximum.type &&
28600
28658
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
28601
- return 46 /* CommandResult.MinBiggerThanMax */;
28659
+ return 47 /* CommandResult.MinBiggerThanMax */;
28602
28660
  }
28603
28661
  return 0 /* CommandResult.Success */;
28604
28662
  }
@@ -28610,7 +28668,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28610
28668
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28611
28669
  rule.midpoint.type === rule.maximum.type &&
28612
28670
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
28613
- return 48 /* CommandResult.MidBiggerThanMax */;
28671
+ return 49 /* CommandResult.MidBiggerThanMax */;
28614
28672
  }
28615
28673
  return 0 /* CommandResult.Success */;
28616
28674
  }
@@ -28622,7 +28680,7 @@ class ConditionalFormatPlugin extends CorePlugin {
28622
28680
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
28623
28681
  rule.minimum.type === rule.midpoint.type &&
28624
28682
  stringToNumber(minValue) >= stringToNumber(midValue)) {
28625
- return 49 /* CommandResult.MinBiggerThanMid */;
28683
+ return 50 /* CommandResult.MinBiggerThanMid */;
28626
28684
  }
28627
28685
  return 0 /* CommandResult.Success */;
28628
28686
  }
@@ -28723,13 +28781,13 @@ class FigurePlugin extends CorePlugin {
28723
28781
  checkFigureExists(sheetId, figureId) {
28724
28782
  var _a;
28725
28783
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
28726
- return 69 /* CommandResult.FigureDoesNotExist */;
28784
+ return 70 /* CommandResult.FigureDoesNotExist */;
28727
28785
  }
28728
28786
  return 0 /* CommandResult.Success */;
28729
28787
  }
28730
28788
  checkFigureDuplicate(figureId) {
28731
28789
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
28732
- return 81 /* CommandResult.DuplicatedFigureId */;
28790
+ return 82 /* CommandResult.DuplicatedFigureId */;
28733
28791
  }
28734
28792
  return 0 /* CommandResult.Success */;
28735
28793
  }
@@ -28831,12 +28889,12 @@ class FiltersPlugin extends CorePlugin {
28831
28889
  switch (cmd.type) {
28832
28890
  case "CREATE_FILTER_TABLE":
28833
28891
  if (!areZonesContinuous(...cmd.target)) {
28834
- return 80 /* CommandResult.NonContinuousTargets */;
28892
+ return 81 /* CommandResult.NonContinuousTargets */;
28835
28893
  }
28836
28894
  const zone = union(...cmd.target);
28837
28895
  const checkFilterOverlap = () => {
28838
28896
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
28839
- return 77 /* CommandResult.FilterOverlap */;
28897
+ return 78 /* CommandResult.FilterOverlap */;
28840
28898
  }
28841
28899
  return 0 /* CommandResult.Success */;
28842
28900
  };
@@ -28844,7 +28902,7 @@ class FiltersPlugin extends CorePlugin {
28844
28902
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
28845
28903
  for (let merge of mergesInTarget) {
28846
28904
  if (overlap(zone, merge)) {
28847
- return 79 /* CommandResult.MergeInFilter */;
28905
+ return 80 /* CommandResult.MergeInFilter */;
28848
28906
  }
28849
28907
  }
28850
28908
  return 0 /* CommandResult.Success */;
@@ -28854,7 +28912,7 @@ class FiltersPlugin extends CorePlugin {
28854
28912
  for (let merge of cmd.target) {
28855
28913
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
28856
28914
  if (overlap(filterTable.zone, merge)) {
28857
- return 79 /* CommandResult.MergeInFilter */;
28915
+ return 80 /* CommandResult.MergeInFilter */;
28858
28916
  }
28859
28917
  }
28860
28918
  }
@@ -29354,10 +29412,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
29354
29412
  : this.getters.getNumberRows(cmd.sheetId);
29355
29413
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29356
29414
  if (hiddenElements.size >= elements) {
29357
- return 65 /* CommandResult.TooManyHiddenElements */;
29415
+ return 66 /* CommandResult.TooManyHiddenElements */;
29358
29416
  }
29359
29417
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29360
- return 85 /* CommandResult.InvalidHeaderIndex */;
29418
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29361
29419
  }
29362
29420
  else {
29363
29421
  return 0 /* CommandResult.Success */;
@@ -29760,7 +29818,7 @@ class MergePlugin extends CorePlugin {
29760
29818
  for (const zone of target) {
29761
29819
  for (const zone2 of target) {
29762
29820
  if (zone !== zone2 && overlap(zone, zone2)) {
29763
- return 64 /* CommandResult.MergeOverlap */;
29821
+ return 65 /* CommandResult.MergeOverlap */;
29764
29822
  }
29765
29823
  }
29766
29824
  }
@@ -29774,7 +29832,7 @@ class MergePlugin extends CorePlugin {
29774
29832
  for (const zone of target) {
29775
29833
  if ((zone.left < xSplit && zone.right >= xSplit) ||
29776
29834
  (zone.top < ySplit && zone.bottom >= ySplit)) {
29777
- return 74 /* CommandResult.FrozenPaneOverlap */;
29835
+ return 75 /* CommandResult.FrozenPaneOverlap */;
29778
29836
  }
29779
29837
  }
29780
29838
  return 0 /* CommandResult.Success */;
@@ -30021,10 +30079,10 @@ class SheetPlugin extends CorePlugin {
30021
30079
  ? this.getNumberCols(cmd.sheetId)
30022
30080
  : this.getNumberRows(cmd.sheetId);
30023
30081
  if (cmd.base < 0 || cmd.base >= elements) {
30024
- return 85 /* CommandResult.InvalidHeaderIndex */;
30082
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30025
30083
  }
30026
30084
  else if (cmd.quantity <= 0) {
30027
- return 86 /* CommandResult.InvalidQuantity */;
30085
+ return 87 /* CommandResult.InvalidQuantity */;
30028
30086
  }
30029
30087
  return 0 /* CommandResult.Success */;
30030
30088
  case "REMOVE_COLUMNS_ROWS": {
@@ -30032,7 +30090,7 @@ class SheetPlugin extends CorePlugin {
30032
30090
  ? this.getNumberCols(cmd.sheetId)
30033
30091
  : this.getNumberRows(cmd.sheetId);
30034
30092
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30035
- return 85 /* CommandResult.InvalidHeaderIndex */;
30093
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30036
30094
  }
30037
30095
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
30038
30096
  return 8 /* CommandResult.NotEnoughElements */;
@@ -30489,18 +30547,18 @@ class SheetPlugin extends CorePlugin {
30489
30547
  checkRowFreezeQuantity(cmd) {
30490
30548
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
30491
30549
  ? 0 /* CommandResult.Success */
30492
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30550
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30493
30551
  }
30494
30552
  checkColFreezeQuantity(cmd) {
30495
30553
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
30496
30554
  ? 0 /* CommandResult.Success */
30497
- : 73 /* CommandResult.InvalidFreezeQuantity */;
30555
+ : 74 /* CommandResult.InvalidFreezeQuantity */;
30498
30556
  }
30499
30557
  checkRowFreezeOverlapMerge(cmd) {
30500
30558
  const merges = this.getters.getMerges(cmd.sheetId);
30501
30559
  for (let merge of merges) {
30502
30560
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
30503
- return 64 /* CommandResult.MergeOverlap */;
30561
+ return 65 /* CommandResult.MergeOverlap */;
30504
30562
  }
30505
30563
  }
30506
30564
  return 0 /* CommandResult.Success */;
@@ -30509,7 +30567,7 @@ class SheetPlugin extends CorePlugin {
30509
30567
  const merges = this.getters.getMerges(cmd.sheetId);
30510
30568
  for (let merge of merges) {
30511
30569
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
30512
- return 64 /* CommandResult.MergeOverlap */;
30570
+ return 65 /* CommandResult.MergeOverlap */;
30513
30571
  }
30514
30572
  }
30515
30573
  return 0 /* CommandResult.Success */;
@@ -30950,7 +31008,7 @@ class AutofillPlugin extends UIPlugin {
30950
31008
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
30951
31009
  return 0 /* CommandResult.Success */;
30952
31010
  }
30953
- return 44 /* CommandResult.InvalidAutofillSelection */;
31011
+ return 45 /* CommandResult.InvalidAutofillSelection */;
30954
31012
  case "AUTOFILL_AUTO":
30955
31013
  const zone = this.getters.getSelectedZone();
30956
31014
  return zone.top === zone.bottom
@@ -31550,7 +31608,7 @@ class CellPopoverPlugin extends UIPlugin {
31550
31608
  cellPopoverRegistry.get(cmd.popoverType);
31551
31609
  }
31552
31610
  catch (error) {
31553
- return 71 /* CommandResult.InvalidCellPopover */;
31611
+ return 72 /* CommandResult.InvalidCellPopover */;
31554
31612
  }
31555
31613
  return 0 /* CommandResult.Success */;
31556
31614
  default:
@@ -31774,7 +31832,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
31774
31832
  for (const zone of this.getPasteZones(target)) {
31775
31833
  if ((zone.left < xSplit && zone.right >= xSplit) ||
31776
31834
  (zone.top < ySplit && zone.bottom >= ySplit)) {
31777
- return 74 /* CommandResult.FrozenPaneOverlap */;
31835
+ return 75 /* CommandResult.FrozenPaneOverlap */;
31778
31836
  }
31779
31837
  }
31780
31838
  return 0 /* CommandResult.Success */;
@@ -32134,7 +32192,7 @@ class ClipboardFigureState {
32134
32192
  }
32135
32193
  isPasteAllowed(target, option) {
32136
32194
  if (target.length === 0) {
32137
- return 72 /* CommandResult.EmptyTarget */;
32195
+ return 73 /* CommandResult.EmptyTarget */;
32138
32196
  }
32139
32197
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
32140
32198
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -32778,10 +32836,8 @@ class EvaluationPlugin extends UIPlugin {
32778
32836
  * that are actually present in the grid.
32779
32837
  */
32780
32838
  function range(range) {
32839
+ assertRangeValid(range);
32781
32840
  const sheetId = range.sheetId;
32782
- if (!isZoneValid(range.zone)) {
32783
- throw new InvalidReferenceError();
32784
- }
32785
32841
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32786
32842
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32787
32843
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32816,23 +32872,26 @@ class EvaluationPlugin extends UIPlugin {
32816
32872
  * The `compute` of the formula's function must process it completely
32817
32873
  */
32818
32874
  function refFn(range, isMeta, functionName, paramNumber) {
32875
+ assertRangeValid(range);
32819
32876
  if (isMeta) {
32820
32877
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32821
32878
  return { value: zoneToXc(range.zone) };
32822
32879
  }
32823
- if (!isZoneValid(range.zone)) {
32824
- throw new InvalidReferenceError();
32825
- }
32826
32880
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32827
32881
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32828
32882
  throw new Error(paramNumber
32829
32883
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32830
32884
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32831
32885
  }
32886
+ return readCell(range);
32887
+ }
32888
+ function assertRangeValid(range) {
32889
+ if (!isZoneValid(range.zone)) {
32890
+ throw new InvalidReferenceError();
32891
+ }
32832
32892
  if (range.invalidSheetName) {
32833
32893
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32834
32894
  }
32835
- return readCell(range);
32836
32895
  }
32837
32896
  return [refFn, range, evalContext];
32838
32897
  }
@@ -33296,7 +33355,7 @@ class FilterEvaluationPlugin extends UIPlugin {
33296
33355
  switch (cmd.type) {
33297
33356
  case "UPDATE_FILTER":
33298
33357
  if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
33299
- return 78 /* CommandResult.FilterNotFound */;
33358
+ return 79 /* CommandResult.FilterNotFound */;
33300
33359
  }
33301
33360
  break;
33302
33361
  }
@@ -35116,7 +35175,7 @@ class GridSelectionPlugin extends UIPlugin {
35116
35175
  const headers = [cmd.base, ...cmd.elements];
35117
35176
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
35118
35177
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
35119
- return 85 /* CommandResult.InvalidHeaderIndex */;
35178
+ return 86 /* CommandResult.InvalidHeaderIndex */;
35120
35179
  }
35121
35180
  return 0 /* CommandResult.Success */;
35122
35181
  }
@@ -35247,21 +35306,6 @@ class SelectionInputPlugin extends UIPlugin {
35247
35306
  // ---------------------------------------------------------------------------
35248
35307
  // Command Handling
35249
35308
  // ---------------------------------------------------------------------------
35250
- allowDispatch(cmd) {
35251
- switch (cmd.type) {
35252
- case "ADD_EMPTY_RANGE":
35253
- if (this.inputHasSingleRange && this.ranges.length === 1) {
35254
- return 29 /* CommandResult.MaximumRangesReached */;
35255
- }
35256
- break;
35257
- case "CHANGE_RANGE":
35258
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
35259
- return 29 /* CommandResult.MaximumRangesReached */;
35260
- }
35261
- break;
35262
- }
35263
- return 0 /* CommandResult.Success */;
35264
- }
35265
35309
  handleEvent(event) {
35266
35310
  const xc = zoneToXc(event.anchor.zone);
35267
35311
  const inputSheetId = this.activeSheet;
@@ -35471,6 +35515,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35471
35515
  // ---------------------------------------------------------------------------
35472
35516
  allowDispatch(cmd) {
35473
35517
  var _a, _b;
35518
+ switch (cmd.type) {
35519
+ case "FOCUS_RANGE":
35520
+ case "CHANGE_RANGE":
35521
+ case "ADD_EMPTY_RANGE":
35522
+ case "REMOVE_RANGE":
35523
+ if (!this.inputs[cmd.id]) {
35524
+ return 30 /* CommandResult.InvalidInputId */;
35525
+ }
35526
+ }
35474
35527
  switch (cmd.type) {
35475
35528
  case "FOCUS_RANGE":
35476
35529
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -35478,9 +35531,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35478
35531
  return 28 /* CommandResult.InputAlreadyFocused */;
35479
35532
  }
35480
35533
  break;
35481
- }
35482
- if (this.currentInput) {
35483
- return this.currentInput.allowDispatch(cmd);
35534
+ case "ADD_EMPTY_RANGE":
35535
+ const input = this.inputs[cmd.id];
35536
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
35537
+ return 29 /* CommandResult.MaximumRangesReached */;
35538
+ }
35539
+ break;
35540
+ case "CHANGE_RANGE": {
35541
+ const input = this.inputs[cmd.id];
35542
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
35543
+ return 29 /* CommandResult.MaximumRangesReached */;
35544
+ }
35545
+ break;
35546
+ }
35484
35547
  }
35485
35548
  return 0 /* CommandResult.Success */;
35486
35549
  }
@@ -37135,7 +37198,7 @@ class SheetViewPlugin extends UIPlugin {
37135
37198
  }
37136
37199
  checkPositiveDimension(cmd) {
37137
37200
  if (cmd.width < 0 || cmd.height < 0) {
37138
- return 67 /* CommandResult.InvalidViewportSize */;
37201
+ return 68 /* CommandResult.InvalidViewportSize */;
37139
37202
  }
37140
37203
  return 0 /* CommandResult.Success */;
37141
37204
  }
@@ -37145,7 +37208,7 @@ class SheetViewPlugin extends UIPlugin {
37145
37208
  cmd.gridOffsetY === this.gridOffsetY &&
37146
37209
  cmd.width === width &&
37147
37210
  cmd.height === height) {
37148
- return 75 /* CommandResult.ValuesNotChanged */;
37211
+ return 76 /* CommandResult.ValuesNotChanged */;
37149
37212
  }
37150
37213
  return 0 /* CommandResult.Success */;
37151
37214
  }
@@ -37153,7 +37216,7 @@ class SheetViewPlugin extends UIPlugin {
37153
37216
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
37154
37217
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
37155
37218
  (!pane.canScrollVertically && offsetY > 0)) {
37156
- return 68 /* CommandResult.InvalidScrollingDirection */;
37219
+ return 69 /* CommandResult.InvalidScrollingDirection */;
37157
37220
  }
37158
37221
  return 0 /* CommandResult.Success */;
37159
37222
  }
@@ -37355,7 +37418,7 @@ class SortPlugin extends UIPlugin {
37355
37418
  for (let row = zone.top; row <= zone.bottom; row++) {
37356
37419
  for (let col = zone.left; col <= zone.right; col++) {
37357
37420
  if (!this.getters.isInMerge(sheetId, col, row)) {
37358
- return 62 /* CommandResult.InvalidSortZone */;
37421
+ return 63 /* CommandResult.InvalidSortZone */;
37359
37422
  }
37360
37423
  }
37361
37424
  }
@@ -37376,7 +37439,7 @@ class SortPlugin extends UIPlugin {
37376
37439
  ];
37377
37440
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37378
37441
  })) {
37379
- return 62 /* CommandResult.InvalidSortZone */;
37442
+ return 63 /* CommandResult.InvalidSortZone */;
37380
37443
  }
37381
37444
  return 0 /* CommandResult.Success */;
37382
37445
  }
@@ -38520,7 +38583,7 @@ const AddMergeInteractiveContent = {
38520
38583
  };
38521
38584
  function interactiveAddMerge(env, sheetId, target) {
38522
38585
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
38523
- if (result.isCancelledBecause(79 /* CommandResult.MergeInFilter */)) {
38586
+ if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
38524
38587
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
38525
38588
  }
38526
38589
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40419,8 +40482,9 @@ class RangeAdapter {
40419
40482
  *
40420
40483
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
40421
40484
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
40485
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
40422
40486
  */
40423
- getRangeString(range, forSheetId) {
40487
+ getRangeString(range, forSheetId, useFixedZone = false) {
40424
40488
  if (!range) {
40425
40489
  return INCORRECT_RANGE_STRING;
40426
40490
  }
@@ -40447,7 +40511,7 @@ class RangeAdapter {
40447
40511
  if (prefixSheet && !sheetName) {
40448
40512
  return INCORRECT_RANGE_STRING;
40449
40513
  }
40450
- let rangeString = this.getRangePartString(rangeImpl, 0);
40514
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
40451
40515
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
40452
40516
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
40453
40517
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -40457,7 +40521,7 @@ class RangeAdapter {
40457
40521
  rangeImpl.parts[1].rowFixed ||
40458
40522
  rangeImpl.parts[1].colFixed) {
40459
40523
  rangeString += ":";
40460
- rangeString += this.getRangePartString(rangeImpl, 1);
40524
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
40461
40525
  }
40462
40526
  }
40463
40527
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -40487,13 +40551,14 @@ class RangeAdapter {
40487
40551
  /**
40488
40552
  * Get a Xc string that represent a part of a range
40489
40553
  */
40490
- getRangePartString(range, part) {
40491
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
40554
+ getRangePartString(range, part, useFixedZone = false) {
40555
+ var _a, _b;
40556
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40492
40557
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40493
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
40558
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40494
40559
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40495
40560
  let str = "";
40496
- if (range.isFullCol) {
40561
+ if (range.isFullCol && !useFixedZone) {
40497
40562
  if (part === 0 && range.unboundedZone.hasHeader) {
40498
40563
  str = colFixed + col + rowFixed + row;
40499
40564
  }
@@ -40501,7 +40566,7 @@ class RangeAdapter {
40501
40566
  str = colFixed + col;
40502
40567
  }
40503
40568
  }
40504
- else if (range.isFullRow) {
40569
+ else if (range.isFullRow && !useFixedZone) {
40505
40570
  if (part === 0 && range.unboundedZone.hasHeader) {
40506
40571
  str = colFixed + col + rowFixed + row;
40507
40572
  }
@@ -40702,7 +40767,7 @@ class SelectionStreamProcessor {
40702
40767
  */
40703
40768
  moveAnchorCell(direction, step = 1) {
40704
40769
  if (step !== "end" && step <= 0) {
40705
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40770
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40706
40771
  }
40707
40772
  const { col, row } = this.getNextAvailablePosition(direction, step);
40708
40773
  return this.selectCell(col, row);
@@ -40748,7 +40813,7 @@ class SelectionStreamProcessor {
40748
40813
  */
40749
40814
  resizeAnchorZone(direction, step = 1) {
40750
40815
  if (step !== "end" && step <= 0) {
40751
- return new DispatchResult(82 /* CommandResult.InvalidSelectionStep */);
40816
+ return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
40752
40817
  }
40753
40818
  const sheetId = this.getters.getActiveSheetId();
40754
40819
  const anchor = this.anchor;
@@ -41559,12 +41624,7 @@ function addFormula(cell) {
41559
41624
  attrs.push(["t", "str"]);
41560
41625
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41561
41626
  }
41562
- node = escapeXml /*xml*/ `
41563
- <f>
41564
- ${XlsxFormula}
41565
- </f>
41566
- ${cycle}
41567
- `;
41627
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
41568
41628
  return { attrs, node };
41569
41629
  }
41570
41630
  else {
@@ -42305,11 +42365,10 @@ function addRows(construct, data, sheet) {
42305
42365
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
42306
42366
  }
42307
42367
  attributes.push(...additionalAttrs);
42308
- cellNodes.push(escapeXml /*xml*/ `
42309
- <c ${formatAttributes(attributes)}>
42310
- ${cellNode}
42311
- </c>
42312
- `);
42368
+ // prettier-ignore
42369
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
42370
+ ${cellNode}
42371
+ </c>`);
42313
42372
  }
42314
42373
  }
42315
42374
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -42688,10 +42747,10 @@ class Model extends EventBus {
42688
42747
  const command = { type, ...payload };
42689
42748
  let status = this.status;
42690
42749
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
42691
- return new DispatchResult(66 /* CommandResult.Readonly */);
42750
+ return new DispatchResult(67 /* CommandResult.Readonly */);
42692
42751
  }
42693
42752
  if (!this.session.canApplyOptimisticUpdate()) {
42694
- return new DispatchResult(63 /* CommandResult.WaitingSessionConfirmation */);
42753
+ return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
42695
42754
  }
42696
42755
  switch (status) {
42697
42756
  case 0 /* Status.Ready */:
@@ -43131,6 +43190,6 @@ exports.setTranslationMethod = setTranslationMethod;
43131
43190
  exports.tokenize = tokenize;
43132
43191
 
43133
43192
 
43134
- __info__.version = '16.0.28';
43135
- __info__.date = '2024-01-12T13:42:04.756Z';
43136
- __info__.hash = '7251a47';
43193
+ __info__.version = '16.0.30';
43194
+ __info__.date = '2024-01-29T13:49:32.243Z';
43195
+ __info__.hash = '49966d6';