@odoo/o-spreadsheet 16.3.22 → 16.3.25

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.
@@ -1743,6 +1743,9 @@
1743
1743
  function formatValue(value, format) {
1744
1744
  switch (typeof value) {
1745
1745
  case "string":
1746
+ if (value.includes('\\"')) {
1747
+ return value.replace(/\\"/g, '"');
1748
+ }
1746
1749
  return value;
1747
1750
  case "boolean":
1748
1751
  return value ? "TRUE" : "FALSE";
@@ -2074,27 +2077,30 @@
2074
2077
  }
2075
2078
  function createLargeNumberFormat(format, magnitude, postFix) {
2076
2079
  const internalFormat = parseFormat(format || "#,##0");
2077
- const largeNumberFormat = internalFormat
2078
- .map((formatPart) => {
2079
- if (formatPart.type === "NUMBER") {
2080
- return [
2081
- {
2082
- ...formatPart,
2083
- format: {
2084
- ...formatPart.format,
2085
- magnitude,
2086
- decimalPart: undefined,
2087
- },
2088
- },
2089
- {
2090
- type: "STRING",
2091
- format: postFix,
2092
- },
2093
- ];
2080
+ const largeNumberFormat = [];
2081
+ for (let i = 0; i < internalFormat.length; i++) {
2082
+ const formatPart = internalFormat[i];
2083
+ if (formatPart.type !== "NUMBER") {
2084
+ largeNumberFormat.push(formatPart);
2085
+ continue;
2094
2086
  }
2095
- return formatPart;
2096
- })
2097
- .flat();
2087
+ largeNumberFormat.push({
2088
+ ...formatPart,
2089
+ format: {
2090
+ ...formatPart.format,
2091
+ magnitude,
2092
+ decimalPart: undefined,
2093
+ },
2094
+ });
2095
+ largeNumberFormat.push({
2096
+ type: "STRING",
2097
+ format: postFix,
2098
+ });
2099
+ const nextFormatPart = internalFormat[i + 1];
2100
+ if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2101
+ i++;
2102
+ }
2103
+ }
2098
2104
  return convertInternalFormatToFormat(largeNumberFormat);
2099
2105
  }
2100
2106
  function changeDecimalPlaces(format, step) {
@@ -4436,69 +4442,70 @@
4436
4442
  CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
4437
4443
  CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
4438
4444
  CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
4439
- CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
4440
- CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
4441
- CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
4442
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
4443
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
4444
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
4445
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
4446
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
4447
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
4448
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
4449
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
4450
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
4451
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
4452
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
4453
- CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
4454
- CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
4455
- CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
4456
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
4457
- CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
4458
- CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
4459
- CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
4460
- CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
4461
- CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
4462
- CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
4463
- CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
4464
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
4465
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
4466
- CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
4467
- CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
4468
- CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
4469
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
4470
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
4471
- CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
4472
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
4473
- CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
4474
- CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
4475
- CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
4476
- CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
4477
- CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
4478
- CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
4479
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
4480
- CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
4481
- CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
4482
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
4483
- CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
4484
- CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
4485
- CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
4486
- CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
4487
- CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
4488
- CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
4489
- CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
4490
- CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
4491
- CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
4492
- CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
4493
- CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
4494
- CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
4495
- CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4496
- CommandResult[CommandResult["MoreThanOneColumnSelected"] = 88] = "MoreThanOneColumnSelected";
4497
- CommandResult[CommandResult["EmptySplitSeparator"] = 89] = "EmptySplitSeparator";
4498
- CommandResult[CommandResult["SplitWillOverwriteContent"] = 90] = "SplitWillOverwriteContent";
4499
- CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 91] = "NoSplitSeparatorInSelection";
4500
- CommandResult[CommandResult["NoActiveSheet"] = 92] = "NoActiveSheet";
4501
- CommandResult[CommandResult["NoChanges"] = 93] = "NoChanges";
4445
+ CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
4446
+ CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
4447
+ CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
4448
+ CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
4449
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
4450
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
4451
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
4452
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
4453
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
4454
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
4455
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
4456
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
4457
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
4458
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
4459
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
4460
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
4461
+ CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
4462
+ CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
4463
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
4464
+ CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
4465
+ CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
4466
+ CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
4467
+ CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
4468
+ CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
4469
+ CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
4470
+ CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
4471
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
4472
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
4473
+ CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
4474
+ CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
4475
+ CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
4476
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
4477
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
4478
+ CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
4479
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
4480
+ CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
4481
+ CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
4482
+ CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
4483
+ CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
4484
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
4485
+ CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
4486
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
4487
+ CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
4488
+ CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
4489
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
4490
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
4491
+ CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
4492
+ CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
4493
+ CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
4494
+ CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
4495
+ CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
4496
+ CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
4497
+ CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
4498
+ CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
4499
+ CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
4500
+ CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
4501
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
4502
+ CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
4503
+ CommandResult[CommandResult["MoreThanOneColumnSelected"] = 89] = "MoreThanOneColumnSelected";
4504
+ CommandResult[CommandResult["EmptySplitSeparator"] = 90] = "EmptySplitSeparator";
4505
+ CommandResult[CommandResult["SplitWillOverwriteContent"] = 91] = "SplitWillOverwriteContent";
4506
+ CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 92] = "NoSplitSeparatorInSelection";
4507
+ CommandResult[CommandResult["NoActiveSheet"] = 93] = "NoActiveSheet";
4508
+ CommandResult[CommandResult["NoChanges"] = 94] = "NoChanges";
4502
4509
  })(exports.CommandResult || (exports.CommandResult = {}));
4503
4510
 
4504
4511
  const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
@@ -6458,14 +6465,8 @@
6458
6465
  : undefined));
6459
6466
  }
6460
6467
  }
6461
- else if (zone.left === zone.right && zone.top === zone.bottom) {
6462
- // A single cell. If it's only the title, the dataset is not added.
6463
- if (!dataSetsHaveTitle) {
6464
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
6465
- }
6466
- }
6467
6468
  else {
6468
- /* 1 row or 1 column */
6469
+ /* 1 cell, 1 row or 1 column */
6469
6470
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
6470
6471
  ? {
6471
6472
  top: zone.top,
@@ -6514,8 +6515,10 @@
6514
6515
  }
6515
6516
  const dataRange = ds.dataRange.clone({ zone: dataZone });
6516
6517
  return {
6517
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
6518
- range: getters.getRangeString(dataRange, "forceSheetReference"),
6518
+ label: ds.labelCell
6519
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
6520
+ : undefined,
6521
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
6519
6522
  };
6520
6523
  }
6521
6524
  function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
@@ -6528,7 +6531,7 @@
6528
6531
  zone.top = zone.top + 1;
6529
6532
  }
6530
6533
  const range = labelRange.clone({ zone });
6531
- return getters.getRangeString(range, "forceSheetReference");
6534
+ return getters.getRangeString(range, "forceSheetReference", true);
6532
6535
  }
6533
6536
  /**
6534
6537
  * Transform a chart definition which supports dataSets (dataSets and LabelRange)
@@ -6594,11 +6597,11 @@
6594
6597
  if (definition.dataSets) {
6595
6598
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
6596
6599
  if (invalidRanges) {
6597
- return 32 /* CommandResult.InvalidDataSet */;
6600
+ return 33 /* CommandResult.InvalidDataSet */;
6598
6601
  }
6599
6602
  const zones = definition.dataSets.map(toUnboundedZone);
6600
6603
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
6601
- return 32 /* CommandResult.InvalidDataSet */;
6604
+ return 33 /* CommandResult.InvalidDataSet */;
6602
6605
  }
6603
6606
  }
6604
6607
  return 0 /* CommandResult.Success */;
@@ -6607,7 +6610,7 @@
6607
6610
  if (definition.labelRange) {
6608
6611
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
6609
6612
  if (invalidLabels) {
6610
- return 33 /* CommandResult.InvalidLabelRange */;
6613
+ return 34 /* CommandResult.InvalidLabelRange */;
6611
6614
  }
6612
6615
  }
6613
6616
  return 0 /* CommandResult.Success */;
@@ -6694,22 +6697,22 @@
6694
6697
  const CfTerms = {
6695
6698
  Errors: {
6696
6699
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
6697
- [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6698
- [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6699
- [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6700
- [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6701
- [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6702
- [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6703
- [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6704
- [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6705
- [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6706
- [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6707
- [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6708
- [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6709
- [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6710
- [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6711
- [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6712
- [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6700
+ [52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
6701
+ [53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
6702
+ [54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
6703
+ [55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
6704
+ [56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
6705
+ [57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
6706
+ [58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
6707
+ [48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
6708
+ [51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
6709
+ [50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
6710
+ [49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
6711
+ [59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
6712
+ [61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
6713
+ [60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
6714
+ [62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
6715
+ [63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
6713
6716
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
6714
6717
  Unexpected: _lt("The rule is invalid for an unknown reason"),
6715
6718
  },
@@ -6737,20 +6740,20 @@
6737
6740
  Errors: {
6738
6741
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
6739
6742
  // BASIC CHART ERRORS (LINE | BAR | PIE)
6740
- [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6741
- [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6743
+ [33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
6744
+ [34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
6742
6745
  // SCORECARD CHART ERRORS
6743
- [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6744
- [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6746
+ [35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
6747
+ [36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
6745
6748
  // GAUGE CHART ERRORS
6746
- [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6747
- [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6748
- [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6749
- [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6750
- [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6751
- [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6752
- [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6753
- [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6749
+ [37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
6750
+ [38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
6751
+ [39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
6752
+ [40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
6753
+ [41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
6754
+ [42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
6755
+ [43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
6756
+ [44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
6754
6757
  },
6755
6758
  };
6756
6759
  const CustomCurrencyTerms = {
@@ -6760,9 +6763,9 @@
6760
6763
  const SplitToColumnsTerms = {
6761
6764
  Errors: {
6762
6765
  Unexpected: _lt("Cannot split the selection for an unknown reason"),
6763
- [91 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
6764
- [88 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
6765
- [90 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
6766
+ [92 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
6767
+ [89 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
6768
+ [91 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
6766
6769
  },
6767
6770
  };
6768
6771
 
@@ -7065,7 +7068,7 @@
7065
7068
  return undefined;
7066
7069
  const dataSets = this.dataSets
7067
7070
  .map((ds) => toExcelDataset(this.getters, ds))
7068
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7071
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
7069
7072
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
7070
7073
  return {
7071
7074
  ...this.getDefinition(),
@@ -7166,7 +7169,7 @@
7166
7169
 
7167
7170
  function isDataRangeValid(definition) {
7168
7171
  return definition.dataRange && !rangeReference.test(definition.dataRange)
7169
- ? 36 /* CommandResult.InvalidGaugeDataRange */
7172
+ ? 37 /* CommandResult.InvalidGaugeDataRange */
7170
7173
  : 0 /* CommandResult.Success */;
7171
7174
  }
7172
7175
  function checkRangeLimits(check, batchValidations) {
@@ -7198,7 +7201,7 @@
7198
7201
  function checkRangeMinBiggerThanRangeMax(definition) {
7199
7202
  if (definition.sectionRule) {
7200
7203
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
7201
- return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7204
+ return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
7202
7205
  }
7203
7206
  }
7204
7207
  return 0 /* CommandResult.Success */;
@@ -7207,9 +7210,9 @@
7207
7210
  if (value === "") {
7208
7211
  switch (valueName) {
7209
7212
  case "rangeMin":
7210
- return 37 /* CommandResult.EmptyGaugeRangeMin */;
7213
+ return 38 /* CommandResult.EmptyGaugeRangeMin */;
7211
7214
  case "rangeMax":
7212
- return 39 /* CommandResult.EmptyGaugeRangeMax */;
7215
+ return 40 /* CommandResult.EmptyGaugeRangeMax */;
7213
7216
  }
7214
7217
  }
7215
7218
  return 0 /* CommandResult.Success */;
@@ -7218,13 +7221,13 @@
7218
7221
  if (isNaN(value)) {
7219
7222
  switch (valueName) {
7220
7223
  case "rangeMin":
7221
- return 38 /* CommandResult.GaugeRangeMinNaN */;
7224
+ return 39 /* CommandResult.GaugeRangeMinNaN */;
7222
7225
  case "rangeMax":
7223
- return 40 /* CommandResult.GaugeRangeMaxNaN */;
7226
+ return 41 /* CommandResult.GaugeRangeMaxNaN */;
7224
7227
  case "lowerInflectionPointValue":
7225
- return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
7228
+ return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
7226
7229
  case "upperInflectionPointValue":
7227
- return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
7230
+ return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
7228
7231
  }
7229
7232
  }
7230
7233
  return 0 /* CommandResult.Success */;
@@ -7649,7 +7652,7 @@
7649
7652
  return undefined;
7650
7653
  const dataSets = this.dataSets
7651
7654
  .map((ds) => toExcelDataset(this.getters, ds))
7652
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7655
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
7653
7656
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
7654
7657
  return {
7655
7658
  ...this.getDefinition(),
@@ -7934,7 +7937,7 @@
7934
7937
  return undefined;
7935
7938
  const dataSets = this.dataSets
7936
7939
  .map((ds) => toExcelDataset(this.getters, ds))
7937
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
7940
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
7938
7941
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
7939
7942
  return {
7940
7943
  ...this.getDefinition(),
@@ -8014,12 +8017,12 @@
8014
8017
 
8015
8018
  function checkKeyValue(definition) {
8016
8019
  return definition.keyValue && !rangeReference.test(definition.keyValue)
8017
- ? 34 /* CommandResult.InvalidScorecardKeyValue */
8020
+ ? 35 /* CommandResult.InvalidScorecardKeyValue */
8018
8021
  : 0 /* CommandResult.Success */;
8019
8022
  }
8020
8023
  function checkBaseline(definition) {
8021
8024
  return definition.baseline && !rangeReference.test(definition.baseline)
8022
- ? 35 /* CommandResult.InvalidScorecardBaseline */
8025
+ ? 36 /* CommandResult.InvalidScorecardBaseline */
8023
8026
  : 0 /* CommandResult.Success */;
8024
8027
  }
8025
8028
  class ScorecardChart extends AbstractChart {
@@ -8525,7 +8528,7 @@
8525
8528
  };
8526
8529
  function interactiveAddMerge(env, sheetId, target) {
8527
8530
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
8528
- if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
8531
+ if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
8529
8532
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
8530
8533
  }
8531
8534
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -8775,7 +8778,7 @@
8775
8778
  });
8776
8779
  }
8777
8780
  }
8778
- if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
8781
+ if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
8779
8782
  const { col, row } = anchor;
8780
8783
  env.model.selection.selectZone({ cell: { col, row }, zone });
8781
8784
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -8798,13 +8801,13 @@
8798
8801
  };
8799
8802
  function interactiveAddFilter(env, sheetId, target) {
8800
8803
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
8801
- if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
8804
+ if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
8802
8805
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
8803
8806
  }
8804
- else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
8807
+ else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
8805
8808
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
8806
8809
  }
8807
- else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
8810
+ else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
8808
8811
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
8809
8812
  }
8810
8813
  }
@@ -8826,7 +8829,7 @@
8826
8829
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
8827
8830
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
8828
8831
  }
8829
- else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
8832
+ else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
8830
8833
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
8831
8834
  }
8832
8835
  }
@@ -16984,7 +16987,7 @@
16984
16987
  const sheetId = env.model.getters.getActiveSheetId();
16985
16988
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
16986
16989
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
16987
- if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
16990
+ if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
16988
16991
  env.raiseError(MergeErrorMessage);
16989
16992
  }
16990
16993
  }
@@ -18007,10 +18010,10 @@
18007
18010
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
18008
18011
  }
18009
18012
  get isDatasetInvalid() {
18010
- return !!this.state.datasetDispatchResult?.isCancelledBecause(32 /* CommandResult.InvalidDataSet */);
18013
+ return !!this.state.datasetDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidDataSet */);
18011
18014
  }
18012
18015
  get isLabelInvalid() {
18013
- return !!this.state.labelsDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */);
18016
+ return !!this.state.labelsDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */);
18014
18017
  }
18015
18018
  onUpdateDataSetsHaveTitle(ev) {
18016
18019
  this.props.updateChart(this.props.figureId, {
@@ -18452,7 +18455,7 @@
18452
18455
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
18453
18456
  }
18454
18457
  get isDataRangeInvalid() {
18455
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */);
18458
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */);
18456
18459
  }
18457
18460
  onDataRangeChanged(ranges) {
18458
18461
  this.dataRange = ranges[0];
@@ -18526,25 +18529,25 @@
18526
18529
  });
18527
18530
  }
18528
18531
  isRangeMinInvalid() {
18529
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */) ||
18530
- this.state.sectionRuleDispatchResult?.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */) ||
18531
- this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
18532
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */) ||
18533
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */) ||
18534
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
18532
18535
  }
18533
18536
  isRangeMaxInvalid() {
18534
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */) ||
18535
- this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */) ||
18536
- this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
18537
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */) ||
18538
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */) ||
18539
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
18537
18540
  }
18538
18541
  // ---------------------------------------------------------------------------
18539
18542
  // COLOR_SECTION_TEMPLATE
18540
18543
  // ---------------------------------------------------------------------------
18541
18544
  get isLowerInflectionPointInvalid() {
18542
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
18543
- this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */));
18545
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
18546
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
18544
18547
  }
18545
18548
  get isUpperInflectionPointInvalid() {
18546
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
18547
- this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */));
18549
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
18550
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
18548
18551
  }
18549
18552
  updateInflectionPointValue(attr, ev) {
18550
18553
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -18652,10 +18655,10 @@
18652
18655
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
18653
18656
  }
18654
18657
  get isKeyValueInvalid() {
18655
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */);
18658
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */);
18656
18659
  }
18657
18660
  get isBaselineInvalid() {
18658
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */);
18661
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */);
18659
18662
  }
18660
18663
  onKeyValueRangeChanged(ranges) {
18661
18664
  this.keyValue = ranges[0];
@@ -19515,10 +19518,10 @@
19515
19518
  * Cell Is Rule
19516
19519
  ****************************************************************************/
19517
19520
  get isValue1Invalid() {
19518
- return !!this.state.errors?.includes(51 /* CommandResult.FirstArgMissing */);
19521
+ return !!this.state.errors?.includes(52 /* CommandResult.FirstArgMissing */);
19519
19522
  }
19520
19523
  get isValue2Invalid() {
19521
- return !!this.state.errors?.includes(52 /* CommandResult.SecondArgMissing */);
19524
+ return !!this.state.errors?.includes(53 /* CommandResult.SecondArgMissing */);
19522
19525
  }
19523
19526
  toggleStyle(tool) {
19524
19527
  const style = this.state.rules.cellIs.style;
@@ -19535,17 +19538,17 @@
19535
19538
  isValueInvalid(threshold) {
19536
19539
  switch (threshold) {
19537
19540
  case "minimum":
19538
- return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
19539
- this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
19540
- this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
19541
- this.state.errors.includes(53 /* CommandResult.MinNaN */));
19541
+ return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
19542
+ this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
19543
+ this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
19544
+ this.state.errors.includes(54 /* CommandResult.MinNaN */));
19542
19545
  case "midpoint":
19543
- return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
19544
- this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
19545
- this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
19546
+ return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
19547
+ this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
19548
+ this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
19546
19549
  case "maximum":
19547
- return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
19548
- this.state.errors.includes(55 /* CommandResult.MaxNaN */));
19550
+ return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
19551
+ this.state.errors.includes(56 /* CommandResult.MaxNaN */));
19549
19552
  default:
19550
19553
  return false;
19551
19554
  }
@@ -19593,13 +19596,13 @@
19593
19596
  isInflectionPointInvalid(inflectionPoint) {
19594
19597
  switch (inflectionPoint) {
19595
19598
  case "lowerInflectionPoint":
19596
- return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
19597
- this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
19598
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
19599
+ return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
19600
+ this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
19601
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
19599
19602
  case "upperInflectionPoint":
19600
- return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
19601
- this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
19602
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
19603
+ return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
19604
+ this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
19605
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
19603
19606
  default:
19604
19607
  return true;
19605
19608
  }
@@ -19910,7 +19913,7 @@
19910
19913
  };
19911
19914
  function interactiveSplitToColumns(env, separator, addNewColumns) {
19912
19915
  let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
19913
- if (result.isCancelledBecause(90 /* CommandResult.SplitWillOverwriteContent */)) {
19916
+ if (result.isCancelledBecause(91 /* CommandResult.SplitWillOverwriteContent */)) {
19914
19917
  env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
19915
19918
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
19916
19919
  separator,
@@ -19973,8 +19976,8 @@
19973
19976
  const errors = new Set();
19974
19977
  for (const reason of cancelledReasons) {
19975
19978
  switch (reason) {
19976
- case 90 /* CommandResult.SplitWillOverwriteContent */:
19977
- case 89 /* CommandResult.EmptySplitSeparator */:
19979
+ case 91 /* CommandResult.SplitWillOverwriteContent */:
19980
+ case 90 /* CommandResult.EmptySplitSeparator */:
19978
19981
  break;
19979
19982
  default:
19980
19983
  errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
@@ -19989,8 +19992,8 @@
19989
19992
  addNewColumns: this.state.addNewColumns,
19990
19993
  force: false,
19991
19994
  }).reasons;
19992
- if (cancelledReasons.includes(90 /* CommandResult.SplitWillOverwriteContent */)) {
19993
- warnings.push(SplitToColumnsTerms.Errors[90 /* CommandResult.SplitWillOverwriteContent */]);
19995
+ if (cancelledReasons.includes(91 /* CommandResult.SplitWillOverwriteContent */)) {
19996
+ warnings.push(SplitToColumnsTerms.Errors[91 /* CommandResult.SplitWillOverwriteContent */]);
19994
19997
  }
19995
19998
  return warnings;
19996
19999
  }
@@ -20981,6 +20984,7 @@
20981
20984
  static components = { TextValueProvider, FunctionDescriptionProvider };
20982
20985
  static defaultProps = {
20983
20986
  inputStyle: "",
20987
+ isDefaultFocus: false,
20984
20988
  };
20985
20989
  composerRef = owl.useRef("o_composer");
20986
20990
  contentHelper = new ContentEditableHelper(this.composerRef.el);
@@ -21038,13 +21042,13 @@
21038
21042
  setup() {
21039
21043
  owl.onMounted(() => {
21040
21044
  const el = this.composerRef.el;
21045
+ if (this.props.isDefaultFocus) {
21046
+ this.env.focusableElement.setFocusableElement(el);
21047
+ }
21041
21048
  this.contentHelper.updateEl(el);
21042
21049
  this.processContent();
21043
21050
  this.contentHelper.scrollSelectionIntoView();
21044
21051
  });
21045
- owl.onWillUnmount(() => {
21046
- this.props.onComposerUnmounted?.();
21047
- });
21048
21052
  owl.onPatched(() => {
21049
21053
  if (!this.isKeyStillDown) {
21050
21054
  this.processContent();
@@ -21055,7 +21059,8 @@
21055
21059
  // Handlers
21056
21060
  // ---------------------------------------------------------------------------
21057
21061
  processArrowKeys(ev) {
21058
- if (this.env.model.getters.isSelectingForComposer()) {
21062
+ if (this.env.model.getters.isSelectingForComposer() ||
21063
+ this.env.model.getters.getEditionMode() === "inactive") {
21059
21064
  this.functionDescriptionState.showDescription = false;
21060
21065
  // Prevent the default content editable behavior which moves the cursor
21061
21066
  ev.preventDefault();
@@ -21095,21 +21100,23 @@
21095
21100
  processTabKey(ev) {
21096
21101
  ev.preventDefault();
21097
21102
  ev.stopPropagation();
21098
- if (this.autoCompleteState.showProvider) {
21099
- const autoCompleteValue = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;
21100
- if (autoCompleteValue) {
21101
- this.autoComplete(autoCompleteValue);
21102
- return;
21103
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
21104
+ if (this.autoCompleteState.showProvider) {
21105
+ const autoCompleteValue = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;
21106
+ if (autoCompleteValue) {
21107
+ this.autoComplete(autoCompleteValue);
21108
+ return;
21109
+ }
21103
21110
  }
21104
- }
21105
- else {
21106
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
21107
- // we can't let the model think that it is for a ref selection.
21108
- // todo: check if this can be removed someday
21109
- this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
21111
+ else {
21112
+ // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
21113
+ // we can't let the model think that it is for a ref selection.
21114
+ // todo: check if this can be removed someday
21115
+ this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
21116
+ }
21117
+ this.env.model.dispatch("STOP_EDITION");
21110
21118
  }
21111
21119
  const direction = ev.shiftKey ? "left" : "right";
21112
- this.env.model.dispatch("STOP_EDITION");
21113
21120
  this.env.model.selection.moveAnchorCell(direction, 1);
21114
21121
  }
21115
21122
  processEnterKey(ev) {
@@ -21153,6 +21160,9 @@
21153
21160
  this.compositionActive = false;
21154
21161
  }
21155
21162
  onKeydown(ev) {
21163
+ if (this.env.model.getters.getEditionMode() === "inactive") {
21164
+ return;
21165
+ }
21156
21166
  let handler = this.keyMapping[ev.key];
21157
21167
  if (handler) {
21158
21168
  handler.call(this, ev);
@@ -21163,22 +21173,44 @@
21163
21173
  }
21164
21174
  }
21165
21175
  updateCursorIfNeeded() {
21166
- if (!this.env.model.getters.isSelectingForComposer()) {
21176
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
21177
+ !(this.env.model.getters.getEditionMode() === "inactive");
21178
+ if (moveCursor) {
21167
21179
  const { start, end } = this.contentHelper.getCurrentSelection();
21168
21180
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
21169
21181
  this.isKeyStillDown = true;
21170
21182
  }
21171
21183
  }
21184
+ onPaste(ev) {
21185
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
21186
+ ev.stopPropagation();
21187
+ }
21188
+ }
21172
21189
  /*
21173
21190
  * Triggered automatically by the content-editable between the keydown and key up
21174
21191
  * */
21175
- onInput() {
21176
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
21192
+ onInput(ev) {
21193
+ if (!this.shouldProcessInputEvents) {
21177
21194
  return;
21178
21195
  }
21196
+ if (ev.inputType === "insertFromPaste" &&
21197
+ this.env.model.getters.getEditionMode() === "inactive") {
21198
+ return;
21199
+ }
21200
+ ev.stopPropagation();
21201
+ let content;
21202
+ if (this.env.model.getters.getEditionMode() === "inactive") {
21203
+ content = ev.data || "";
21204
+ }
21205
+ else {
21206
+ content = this.contentHelper.getText();
21207
+ }
21208
+ if (this.props.focus === "inactive") {
21209
+ return this.props.onComposerCellFocused?.(content);
21210
+ }
21179
21211
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
21180
21212
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
21181
- content: this.contentHelper.getText(),
21213
+ content,
21182
21214
  selection: this.contentHelper.getCurrentSelection(),
21183
21215
  });
21184
21216
  }
@@ -21249,9 +21281,8 @@
21249
21281
  }
21250
21282
  const newSelection = this.contentHelper.getCurrentSelection();
21251
21283
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
21252
- if (this.props.focus === "inactive") {
21253
- this.props.onComposerContentFocused(newSelection);
21254
- }
21284
+ this.props.onComposerContentFocused();
21285
+ if (this.props.focus === "inactive") ;
21255
21286
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
21256
21287
  this.processTokenAtCursor();
21257
21288
  }
@@ -21395,7 +21426,7 @@
21395
21426
  const highlights = this.env.model.getters.getHighlights();
21396
21427
  const refSheet = sheetName
21397
21428
  ? this.env.model.getters.getSheetIdByName(sheetName)
21398
- : this.env.model.getters.getCurrentEditedCell().sheetId;
21429
+ : this.env.model.getters.getCurrentEditedCell()?.sheetId;
21399
21430
  const highlight = highlights.find((highlight) => {
21400
21431
  if (highlight.sheetId !== refSheet)
21401
21432
  return false;
@@ -21472,12 +21503,13 @@
21472
21503
  }
21473
21504
  }
21474
21505
  Composer.props = {
21475
- focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
21476
- onComposerContentFocused: Function,
21477
21506
  inputStyle: { type: String, optional: true },
21478
21507
  rect: { type: Object, optional: true },
21479
21508
  delimitation: { type: Object, optional: true },
21480
- onComposerUnmounted: { type: Function, optional: true },
21509
+ focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
21510
+ onComposerCellFocused: { type: Function, optional: true },
21511
+ onComposerContentFocused: Function,
21512
+ isDefaultFocus: { type: Boolean, optional: true },
21481
21513
  };
21482
21514
 
21483
21515
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
@@ -21511,51 +21543,26 @@
21511
21543
  class GridComposer extends owl.Component {
21512
21544
  static template = "o-spreadsheet-GridComposer";
21513
21545
  static components = { Composer };
21514
- gridComposerRef;
21515
- zone;
21516
- rect;
21546
+ // TODORAR see if we can keep it undefined
21547
+ rect = this.defaultRect;
21548
+ isEditing = false;
21517
21549
  isCellReferenceVisible;
21518
- composerState;
21550
+ get defaultRect() {
21551
+ return { x: 0, y: 0, width: 0, height: 0 };
21552
+ }
21519
21553
  setup() {
21520
- this.gridComposerRef = owl.useRef("gridComposer");
21521
- this.composerState = owl.useState({
21522
- rect: undefined,
21523
- delimitation: undefined,
21524
- });
21525
- const { sheetId, col, row } = this.env.model.getters.getActivePosition();
21526
- this.zone = this.env.model.getters.expandZone(sheetId, positionToZone({ col, row }));
21527
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
21528
- this.isCellReferenceVisible = false;
21529
- owl.onMounted(() => {
21530
- const el = this.gridComposerRef.el;
21531
- this.composerState.rect = {
21532
- x: this.rect.x,
21533
- y: this.rect.y,
21534
- width: el.clientWidth,
21535
- height: el.clientHeight,
21536
- };
21537
- this.composerState.delimitation = {
21538
- width: el.parentElement.clientWidth,
21539
- height: el.parentElement.clientHeight,
21540
- };
21541
- });
21542
21554
  owl.onWillUpdateProps(() => {
21543
- if (this.isCellReferenceVisible) {
21544
- return;
21545
- }
21546
- const sheetId = this.env.model.getters.getActiveSheetId();
21547
- const zone = this.env.model.getters.getSelectedZone();
21548
- const rect = this.env.model.getters.getVisibleRect(zone);
21549
- if (!deepEquals(rect, this.rect) ||
21550
- sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
21551
- this.isCellReferenceVisible = true;
21552
- }
21555
+ this.updateComponentPosition();
21556
+ this.updateCellReferenceVisibility();
21553
21557
  });
21554
21558
  }
21555
21559
  get shouldDisplayCellReference() {
21556
21560
  return this.isCellReferenceVisible;
21557
21561
  }
21558
21562
  get cellReference() {
21563
+ if (!this.env.model.getters.getCurrentEditedCell()) {
21564
+ return "";
21565
+ }
21559
21566
  const { col, row, sheetId } = this.env.model.getters.getCurrentEditedCell();
21560
21567
  const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
21561
21568
  return `${prefixSheet ? getCanonicalSheetName(this.env.model.getters.getSheetName(sheetId)) + "!" : ""}${toXC(col, row)}`;
@@ -21567,7 +21574,27 @@
21567
21574
  top: `${top - GRID_CELL_REFERENCE_TOP_OFFSET}px`,
21568
21575
  });
21569
21576
  }
21577
+ get composerProps() {
21578
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
21579
+ return {
21580
+ rect: { ...this.rect },
21581
+ delimitation: {
21582
+ width,
21583
+ height,
21584
+ },
21585
+ focus: this.props.focus,
21586
+ isDefaultFocus: true,
21587
+ onComposerContentFocused: this.props.onComposerContentFocused,
21588
+ onComposerCellFocused: this.props.onComposerCellFocused,
21589
+ };
21590
+ }
21570
21591
  get containerStyle() {
21592
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
21593
+ return `
21594
+ position: absolute;
21595
+ z-index: -1000;
21596
+ `;
21597
+ }
21571
21598
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
21572
21599
  const cell = this.env.model.getters.getActiveCell();
21573
21600
  const position = this.env.model.getters.getActivePosition();
@@ -21587,6 +21614,8 @@
21587
21614
  if (!isFormula) {
21588
21615
  textAlign = style.align || cell.defaultAlign;
21589
21616
  }
21617
+ const maxHeight = this.props.gridDims.height - this.rect.y;
21618
+ const maxWidth = this.props.gridDims.width - this.rect.x;
21590
21619
  /**
21591
21620
  * min-size is on the container, not the composer element, because we want to have the same size as the cell by default,
21592
21621
  * including all the paddings/margins of the composer
@@ -21598,6 +21627,8 @@
21598
21627
  top: `${top}px`,
21599
21628
  "min-width": `${width + 1}px`,
21600
21629
  "min-height": `${height + 1}px`,
21630
+ "max-width": `${maxWidth}px`,
21631
+ "max-height": `${maxHeight}px`,
21601
21632
  background,
21602
21633
  color,
21603
21634
  "font-size": `${fontSizeInPixels(fontSize)}px`,
@@ -21607,20 +21638,38 @@
21607
21638
  "text-align": textAlign,
21608
21639
  });
21609
21640
  }
21610
- get composerStyle() {
21611
- const maxHeight = this.props.gridDims.height - this.rect.y;
21612
- const maxWidth = this.props.gridDims.width - this.rect.x;
21613
- return cssPropertiesToCss({
21614
- "max-width": `${maxWidth}px`,
21615
- "max-height": `${maxHeight}px`,
21616
- });
21641
+ updateComponentPosition() {
21642
+ const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
21643
+ if (this.isEditing !== isEditing) {
21644
+ this.isEditing = isEditing;
21645
+ if (!isEditing) {
21646
+ this.rect = this.defaultRect;
21647
+ this.env.focusableElement.focus();
21648
+ return;
21649
+ }
21650
+ const position = this.env.model.getters.getActivePosition();
21651
+ const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
21652
+ this.rect = this.env.model.getters.getVisibleRect(zone);
21653
+ }
21654
+ }
21655
+ updateCellReferenceVisibility() {
21656
+ if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
21657
+ return;
21658
+ }
21659
+ const sheetId = this.env.model.getters.getActiveSheetId();
21660
+ const zone = this.env.model.getters.getSelectedZone();
21661
+ const rect = this.env.model.getters.getVisibleRect(zone);
21662
+ if (!deepEquals(rect, this.rect) ||
21663
+ sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
21664
+ this.isCellReferenceVisible = true;
21665
+ }
21617
21666
  }
21618
21667
  }
21619
21668
  GridComposer.props = {
21620
21669
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
21621
- onComposerUnmounted: Function,
21622
21670
  onComposerContentFocused: Function,
21623
21671
  gridDims: Object,
21672
+ onComposerCellFocused: Function,
21624
21673
  };
21625
21674
 
21626
21675
  const CSS$1 = css /* scss */ `
@@ -22489,7 +22538,6 @@
22489
22538
  this.props.onCellDoubleClicked(col, row);
22490
22539
  }
22491
22540
  onContextMenu(ev) {
22492
- ev.preventDefault();
22493
22541
  const [col, row] = this.getCartesianCoordinates(ev);
22494
22542
  this.props.onCellRightClicked(col, row, { x: ev.clientX, y: ev.clientY });
22495
22543
  }
@@ -23583,7 +23631,6 @@
23583
23631
  HEADER_WIDTH = HEADER_WIDTH;
23584
23632
  menuState;
23585
23633
  gridRef;
23586
- hiddenInput;
23587
23634
  onMouseWheel;
23588
23635
  canvasPosition;
23589
23636
  hoveredCell;
@@ -23594,17 +23641,16 @@
23594
23641
  menuItems: [],
23595
23642
  });
23596
23643
  this.gridRef = owl.useRef("grid");
23597
- this.hiddenInput = owl.useRef("hiddenInput");
23598
23644
  this.canvasPosition = useAbsoluteBoundingRect(this.gridRef);
23599
23645
  this.hoveredCell = owl.useState({ col: undefined, row: undefined });
23600
23646
  owl.useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
23601
23647
  owl.useExternalListener(document.body, "cut", this.copy.bind(this, true));
23602
23648
  owl.useExternalListener(document.body, "copy", this.copy.bind(this, false));
23603
23649
  owl.useExternalListener(document.body, "paste", this.paste);
23604
- owl.onMounted(() => this.focus());
23605
- this.props.exposeFocus(() => this.focus());
23650
+ owl.onMounted(() => this.focusDefaultElement());
23651
+ this.props.exposeFocus(() => this.focusDefaultElement());
23606
23652
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
23607
- owl.useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
23653
+ owl.useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
23608
23654
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
23609
23655
  this.moveCanvas(deltaX, deltaY);
23610
23656
  this.hoveredCell.col = undefined;
@@ -23627,7 +23673,7 @@
23627
23673
  if (this.env.model.getters.hasOpenedPopover()) {
23628
23674
  this.closeOpenedPopover();
23629
23675
  }
23630
- this.focus();
23676
+ this.focusDefaultElement();
23631
23677
  }
23632
23678
  // this map will handle most of the actions that should happen on key down. The arrow keys are managed in the key
23633
23679
  // down itself
@@ -23797,10 +23843,10 @@
23797
23843
  PAGEUP: () => this.env.model.dispatch("SHIFT_VIEWPORT_UP"),
23798
23844
  "CTRL+K": () => INSERT_LINK(this.env),
23799
23845
  };
23800
- focus() {
23846
+ focusDefaultElement() {
23801
23847
  if (!this.env.model.getters.getSelectedFigureId() &&
23802
23848
  this.env.model.getters.getEditionMode() === "inactive") {
23803
- this.hiddenInput.el?.focus();
23849
+ this.env.focusableElement.focus();
23804
23850
  }
23805
23851
  }
23806
23852
  get gridEl() {
@@ -23944,19 +23990,6 @@
23944
23990
  return;
23945
23991
  }
23946
23992
  }
23947
- onInput(ev) {
23948
- // the user meant to paste in the sheet, not open the composer with the pasted content
23949
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
23950
- return;
23951
- }
23952
- if (ev.data) {
23953
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
23954
- // character
23955
- ev.preventDefault();
23956
- ev.stopPropagation();
23957
- this.props.onGridComposerCellFocused(ev.data);
23958
- }
23959
- }
23960
23993
  // ---------------------------------------------------------------------------
23961
23994
  // Context Menu
23962
23995
  // ---------------------------------------------------------------------------
@@ -24066,7 +24099,7 @@
24066
24099
  }
24067
24100
  closeMenu() {
24068
24101
  this.menuState.isOpen = false;
24069
- this.focus();
24102
+ this.focusDefaultElement();
24070
24103
  }
24071
24104
  }
24072
24105
  Grid.props = {
@@ -28726,6 +28759,31 @@
28726
28759
  return data;
28727
28760
  },
28728
28761
  },
28762
+ {
28763
+ description: "Fix datafilter duplication",
28764
+ from: 12,
28765
+ to: 12.5,
28766
+ applyMigration(data) {
28767
+ for (let sheet of data.sheets || []) {
28768
+ let knownDataFilterZones = [];
28769
+ for (let filterTable of sheet.filterTables || []) {
28770
+ const zone = toZone(filterTable.range);
28771
+ // See commit message for the details
28772
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
28773
+ if (intersectZoneIndex !== -1) {
28774
+ knownDataFilterZones[intersectZoneIndex] = zone;
28775
+ }
28776
+ else {
28777
+ knownDataFilterZones.push(zone);
28778
+ }
28779
+ }
28780
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
28781
+ range: zoneToXc(zone),
28782
+ }));
28783
+ }
28784
+ return data;
28785
+ },
28786
+ },
28729
28787
  {
28730
28788
  description: "Change Border description structure",
28731
28789
  from: 12,
@@ -29516,7 +29574,7 @@
29516
29574
  const currentBorder = this.getCellBorder(cmd);
29517
29575
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
29518
29576
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
29519
- return 93 /* CommandResult.NoChanges */;
29577
+ return 94 /* CommandResult.NoChanges */;
29520
29578
  }
29521
29579
  return 0 /* CommandResult.Success */;
29522
29580
  }
@@ -29795,13 +29853,13 @@
29795
29853
  /*
29796
29854
  * Reconstructs the original formula string based on a normalized form and its dependencies
29797
29855
  */
29798
- buildFormulaContent(sheetId, cell, dependencies) {
29856
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
29799
29857
  const ranges = dependencies || cell.dependencies;
29800
29858
  let rangeIndex = 0;
29801
29859
  return concat(cell.compiledFormula.tokens.map((token) => {
29802
29860
  if (token.type === "REFERENCE") {
29803
29861
  const range = ranges[rangeIndex++];
29804
- return this.getters.getRangeString(range, sheetId);
29862
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
29805
29863
  }
29806
29864
  return token.value;
29807
29865
  }));
@@ -30038,9 +30096,9 @@
30038
30096
  checkUselessClearCell(cmd) {
30039
30097
  const cell = this.getters.getCell(cmd);
30040
30098
  if (!cell)
30041
- return 93 /* CommandResult.NoChanges */;
30099
+ return 94 /* CommandResult.NoChanges */;
30042
30100
  if (!cell.content && !cell.style && !cell.format) {
30043
- return 93 /* CommandResult.NoChanges */;
30101
+ return 94 /* CommandResult.NoChanges */;
30044
30102
  }
30045
30103
  return 0 /* CommandResult.Success */;
30046
30104
  }
@@ -30240,13 +30298,13 @@
30240
30298
  }
30241
30299
  checkChartDuplicate(cmd) {
30242
30300
  return this.getters.getFigureSheetId(cmd.id)
30243
- ? 84 /* CommandResult.DuplicatedChartId */
30301
+ ? 85 /* CommandResult.DuplicatedChartId */
30244
30302
  : 0 /* CommandResult.Success */;
30245
30303
  }
30246
30304
  checkChartExists(cmd) {
30247
30305
  return this.getters.getFigureSheetId(cmd.id)
30248
30306
  ? 0 /* CommandResult.Success */
30249
- : 85 /* CommandResult.ChartDoesNotExist */;
30307
+ : 86 /* CommandResult.ChartDoesNotExist */;
30250
30308
  }
30251
30309
  }
30252
30310
 
@@ -30351,7 +30409,13 @@
30351
30409
  }
30352
30410
  }
30353
30411
  exportForExcel(data) {
30354
- this.export(data);
30412
+ if (data.sheets) {
30413
+ for (let sheet of data.sheets) {
30414
+ if (this.cfRules[sheet.id]) {
30415
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
30416
+ }
30417
+ }
30418
+ }
30355
30419
  }
30356
30420
  // ---------------------------------------------------------------------------
30357
30421
  // Getters
@@ -30400,11 +30464,11 @@
30400
30464
  // ---------------------------------------------------------------------------
30401
30465
  // Private
30402
30466
  // ---------------------------------------------------------------------------
30403
- mapToConditionalFormat(sheetId, cf) {
30467
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
30404
30468
  return {
30405
30469
  ...cf,
30406
30470
  ranges: cf.ranges.map((range) => {
30407
- return this.getters.getRangeString(range, sheetId);
30471
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
30408
30472
  }),
30409
30473
  };
30410
30474
  }
@@ -30437,10 +30501,10 @@
30437
30501
  return 27 /* CommandResult.InvalidSheetId */;
30438
30502
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
30439
30503
  if (ruleIndex === -1)
30440
- return 71 /* CommandResult.InvalidConditionalFormatId */;
30504
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
30441
30505
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
30442
30506
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
30443
- return 71 /* CommandResult.InvalidConditionalFormatId */;
30507
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
30444
30508
  }
30445
30509
  return 0 /* CommandResult.Success */;
30446
30510
  }
@@ -30481,10 +30545,10 @@
30481
30545
  const errors = [];
30482
30546
  const isEmpty = (value) => value === undefined || value === "";
30483
30547
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
30484
- errors.push(51 /* CommandResult.FirstArgMissing */);
30548
+ errors.push(52 /* CommandResult.FirstArgMissing */);
30485
30549
  }
30486
30550
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
30487
- errors.push(52 /* CommandResult.SecondArgMissing */);
30551
+ errors.push(53 /* CommandResult.SecondArgMissing */);
30488
30552
  }
30489
30553
  return errors.length ? errors : 0 /* CommandResult.Success */;
30490
30554
  }
@@ -30496,15 +30560,15 @@
30496
30560
  (threshold.value === "" || isNaN(threshold.value))) {
30497
30561
  switch (thresholdName) {
30498
30562
  case "min":
30499
- return 53 /* CommandResult.MinNaN */;
30563
+ return 54 /* CommandResult.MinNaN */;
30500
30564
  case "max":
30501
- return 55 /* CommandResult.MaxNaN */;
30565
+ return 56 /* CommandResult.MaxNaN */;
30502
30566
  case "mid":
30503
- return 54 /* CommandResult.MidNaN */;
30567
+ return 55 /* CommandResult.MidNaN */;
30504
30568
  case "upperInflectionPoint":
30505
- return 56 /* CommandResult.ValueUpperInflectionNaN */;
30569
+ return 57 /* CommandResult.ValueUpperInflectionNaN */;
30506
30570
  case "lowerInflectionPoint":
30507
- return 57 /* CommandResult.ValueLowerInflectionNaN */;
30571
+ return 58 /* CommandResult.ValueLowerInflectionNaN */;
30508
30572
  }
30509
30573
  }
30510
30574
  return 0 /* CommandResult.Success */;
@@ -30518,15 +30582,15 @@
30518
30582
  catch (error) {
30519
30583
  switch (thresholdName) {
30520
30584
  case "min":
30521
- return 58 /* CommandResult.MinInvalidFormula */;
30585
+ return 59 /* CommandResult.MinInvalidFormula */;
30522
30586
  case "max":
30523
- return 60 /* CommandResult.MaxInvalidFormula */;
30587
+ return 61 /* CommandResult.MaxInvalidFormula */;
30524
30588
  case "mid":
30525
- return 59 /* CommandResult.MidInvalidFormula */;
30589
+ return 60 /* CommandResult.MidInvalidFormula */;
30526
30590
  case "upperInflectionPoint":
30527
- return 61 /* CommandResult.ValueUpperInvalidFormula */;
30591
+ return 62 /* CommandResult.ValueUpperInvalidFormula */;
30528
30592
  case "lowerInflectionPoint":
30529
- return 62 /* CommandResult.ValueLowerInvalidFormula */;
30593
+ return 63 /* CommandResult.ValueLowerInvalidFormula */;
30530
30594
  }
30531
30595
  }
30532
30596
  return 0 /* CommandResult.Success */;
@@ -30543,7 +30607,7 @@
30543
30607
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
30544
30608
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
30545
30609
  Number(minValue) > Number(maxValue)) {
30546
- return 48 /* CommandResult.LowerBiggerThanUpper */;
30610
+ return 49 /* CommandResult.LowerBiggerThanUpper */;
30547
30611
  }
30548
30612
  return 0 /* CommandResult.Success */;
30549
30613
  }
@@ -30553,7 +30617,7 @@
30553
30617
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
30554
30618
  rule.minimum.type === rule.maximum.type &&
30555
30619
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
30556
- return 47 /* CommandResult.MinBiggerThanMax */;
30620
+ return 48 /* CommandResult.MinBiggerThanMax */;
30557
30621
  }
30558
30622
  return 0 /* CommandResult.Success */;
30559
30623
  }
@@ -30564,7 +30628,7 @@
30564
30628
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
30565
30629
  rule.midpoint.type === rule.maximum.type &&
30566
30630
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
30567
- return 49 /* CommandResult.MidBiggerThanMax */;
30631
+ return 50 /* CommandResult.MidBiggerThanMax */;
30568
30632
  }
30569
30633
  return 0 /* CommandResult.Success */;
30570
30634
  }
@@ -30575,7 +30639,7 @@
30575
30639
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
30576
30640
  rule.minimum.type === rule.midpoint.type &&
30577
30641
  stringToNumber(minValue) >= stringToNumber(midValue)) {
30578
- return 50 /* CommandResult.MinBiggerThanMid */;
30642
+ return 51 /* CommandResult.MinBiggerThanMid */;
30579
30643
  }
30580
30644
  return 0 /* CommandResult.Success */;
30581
30645
  }
@@ -30705,13 +30769,13 @@
30705
30769
  }
30706
30770
  checkFigureExists(sheetId, figureId) {
30707
30771
  if (this.figures[sheetId]?.[figureId] === undefined) {
30708
- return 70 /* CommandResult.FigureDoesNotExist */;
30772
+ return 71 /* CommandResult.FigureDoesNotExist */;
30709
30773
  }
30710
30774
  return 0 /* CommandResult.Success */;
30711
30775
  }
30712
30776
  checkFigureDuplicate(figureId) {
30713
30777
  if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
30714
- return 82 /* CommandResult.DuplicatedFigureId */;
30778
+ return 83 /* CommandResult.DuplicatedFigureId */;
30715
30779
  }
30716
30780
  return 0 /* CommandResult.Success */;
30717
30781
  }
@@ -30821,12 +30885,12 @@
30821
30885
  switch (cmd.type) {
30822
30886
  case "CREATE_FILTER_TABLE":
30823
30887
  if (!areZonesContinuous(...cmd.target)) {
30824
- return 81 /* CommandResult.NonContinuousTargets */;
30888
+ return 82 /* CommandResult.NonContinuousTargets */;
30825
30889
  }
30826
30890
  const zone = union(...cmd.target);
30827
30891
  const checkFilterOverlap = () => {
30828
30892
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
30829
- return 78 /* CommandResult.FilterOverlap */;
30893
+ return 79 /* CommandResult.FilterOverlap */;
30830
30894
  }
30831
30895
  return 0 /* CommandResult.Success */;
30832
30896
  };
@@ -30834,7 +30898,7 @@
30834
30898
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
30835
30899
  for (let merge of mergesInTarget) {
30836
30900
  if (overlap(zone, merge)) {
30837
- return 80 /* CommandResult.MergeInFilter */;
30901
+ return 81 /* CommandResult.MergeInFilter */;
30838
30902
  }
30839
30903
  }
30840
30904
  return 0 /* CommandResult.Success */;
@@ -30844,7 +30908,7 @@
30844
30908
  for (let merge of cmd.target) {
30845
30909
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
30846
30910
  if (overlap(filterTable.zone, merge)) {
30847
- return 80 /* CommandResult.MergeInFilter */;
30911
+ return 81 /* CommandResult.MergeInFilter */;
30848
30912
  }
30849
30913
  }
30850
30914
  }
@@ -31329,10 +31393,10 @@
31329
31393
  : this.getters.getNumberRows(cmd.sheetId);
31330
31394
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
31331
31395
  if (hiddenElements.size >= elements) {
31332
- return 66 /* CommandResult.TooManyHiddenElements */;
31396
+ return 67 /* CommandResult.TooManyHiddenElements */;
31333
31397
  }
31334
31398
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31335
- return 86 /* CommandResult.InvalidHeaderIndex */;
31399
+ return 87 /* CommandResult.InvalidHeaderIndex */;
31336
31400
  }
31337
31401
  else {
31338
31402
  return 0 /* CommandResult.Success */;
@@ -31875,7 +31939,7 @@
31875
31939
  for (const zone of target) {
31876
31940
  for (const zone2 of target) {
31877
31941
  if (zone !== zone2 && overlap(zone, zone2)) {
31878
- return 65 /* CommandResult.MergeOverlap */;
31942
+ return 66 /* CommandResult.MergeOverlap */;
31879
31943
  }
31880
31944
  }
31881
31945
  }
@@ -31889,7 +31953,7 @@
31889
31953
  for (const zone of target) {
31890
31954
  if ((zone.left < xSplit && zone.right >= xSplit) ||
31891
31955
  (zone.top < ySplit && zone.bottom >= ySplit)) {
31892
- return 75 /* CommandResult.FrozenPaneOverlap */;
31956
+ return 76 /* CommandResult.FrozenPaneOverlap */;
31893
31957
  }
31894
31958
  }
31895
31959
  return 0 /* CommandResult.Success */;
@@ -32347,8 +32411,9 @@
32347
32411
  *
32348
32412
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
32349
32413
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
32414
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
32350
32415
  */
32351
- getRangeString(range, forSheetId) {
32416
+ getRangeString(range, forSheetId, useFixedZone = false) {
32352
32417
  if (!range) {
32353
32418
  return INCORRECT_RANGE_STRING;
32354
32419
  }
@@ -32375,7 +32440,7 @@
32375
32440
  if (prefixSheet && !sheetName) {
32376
32441
  return INCORRECT_RANGE_STRING;
32377
32442
  }
32378
- let rangeString = this.getRangePartString(rangeImpl, 0);
32443
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
32379
32444
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
32380
32445
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
32381
32446
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -32385,7 +32450,7 @@
32385
32450
  rangeImpl.parts[1].rowFixed ||
32386
32451
  rangeImpl.parts[1].colFixed) {
32387
32452
  rangeString += ":";
32388
- rangeString += this.getRangePartString(rangeImpl, 1);
32453
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
32389
32454
  }
32390
32455
  }
32391
32456
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -32415,13 +32480,13 @@
32415
32480
  /**
32416
32481
  * Get a Xc string that represent a part of a range
32417
32482
  */
32418
- getRangePartString(range, part) {
32419
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
32483
+ getRangePartString(range, part, useFixedZone = false) {
32484
+ const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
32420
32485
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
32421
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
32486
+ const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
32422
32487
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
32423
32488
  let str = "";
32424
- if (range.isFullCol) {
32489
+ if (range.isFullCol && !useFixedZone) {
32425
32490
  if (part === 0 && range.unboundedZone.hasHeader) {
32426
32491
  str = colFixed + col + rowFixed + row;
32427
32492
  }
@@ -32429,7 +32494,7 @@
32429
32494
  str = colFixed + col;
32430
32495
  }
32431
32496
  }
32432
- else if (range.isFullRow) {
32497
+ else if (range.isFullRow && !useFixedZone) {
32433
32498
  if (part === 0 && range.unboundedZone.hasHeader) {
32434
32499
  str = colFixed + col + rowFixed + row;
32435
32500
  }
@@ -32525,10 +32590,10 @@
32525
32590
  ? this.getNumberCols(cmd.sheetId)
32526
32591
  : this.getNumberRows(cmd.sheetId);
32527
32592
  if (cmd.base < 0 || cmd.base >= elements) {
32528
- return 86 /* CommandResult.InvalidHeaderIndex */;
32593
+ return 87 /* CommandResult.InvalidHeaderIndex */;
32529
32594
  }
32530
32595
  else if (cmd.quantity <= 0) {
32531
- return 87 /* CommandResult.InvalidQuantity */;
32596
+ return 88 /* CommandResult.InvalidQuantity */;
32532
32597
  }
32533
32598
  return 0 /* CommandResult.Success */;
32534
32599
  case "REMOVE_COLUMNS_ROWS": {
@@ -32536,7 +32601,7 @@
32536
32601
  ? this.getNumberCols(cmd.sheetId)
32537
32602
  : this.getNumberRows(cmd.sheetId);
32538
32603
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
32539
- return 86 /* CommandResult.InvalidHeaderIndex */;
32604
+ return 87 /* CommandResult.InvalidHeaderIndex */;
32540
32605
  }
32541
32606
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
32542
32607
  return 8 /* CommandResult.NotEnoughElements */;
@@ -33002,18 +33067,18 @@
33002
33067
  checkRowFreezeQuantity(cmd) {
33003
33068
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
33004
33069
  ? 0 /* CommandResult.Success */
33005
- : 74 /* CommandResult.InvalidFreezeQuantity */;
33070
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
33006
33071
  }
33007
33072
  checkColFreezeQuantity(cmd) {
33008
33073
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
33009
33074
  ? 0 /* CommandResult.Success */
33010
- : 74 /* CommandResult.InvalidFreezeQuantity */;
33075
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
33011
33076
  }
33012
33077
  checkRowFreezeOverlapMerge(cmd) {
33013
33078
  const merges = this.getters.getMerges(cmd.sheetId);
33014
33079
  for (let merge of merges) {
33015
33080
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
33016
- return 65 /* CommandResult.MergeOverlap */;
33081
+ return 66 /* CommandResult.MergeOverlap */;
33017
33082
  }
33018
33083
  }
33019
33084
  return 0 /* CommandResult.Success */;
@@ -33022,7 +33087,7 @@
33022
33087
  const merges = this.getters.getMerges(cmd.sheetId);
33023
33088
  for (let merge of merges) {
33024
33089
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
33025
- return 65 /* CommandResult.MergeOverlap */;
33090
+ return 66 /* CommandResult.MergeOverlap */;
33026
33091
  }
33027
33092
  }
33028
33093
  return 0 /* CommandResult.Success */;
@@ -33753,10 +33818,8 @@
33753
33818
  * that are actually present in the grid.
33754
33819
  */
33755
33820
  function range(range) {
33821
+ assertRangeValid(range);
33756
33822
  const sheetId = range.sheetId;
33757
- if (!isZoneValid(range.zone)) {
33758
- throw new InvalidReferenceError();
33759
- }
33760
33823
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
33761
33824
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
33762
33825
  const sheetZone = getters.getSheetZone(sheetId);
@@ -33791,23 +33854,26 @@
33791
33854
  * The `compute` of the formula's function must process it completely
33792
33855
  */
33793
33856
  function refFn(range, isMeta, functionName, paramNumber) {
33857
+ assertRangeValid(range);
33794
33858
  if (isMeta) {
33795
33859
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
33796
33860
  return { value: zoneToXc(range.zone) };
33797
33861
  }
33798
- if (!isZoneValid(range.zone)) {
33799
- throw new InvalidReferenceError();
33800
- }
33801
33862
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
33802
33863
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
33803
33864
  throw new Error(paramNumber
33804
33865
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
33805
33866
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
33806
33867
  }
33868
+ return readCell(range);
33869
+ }
33870
+ function assertRangeValid(range) {
33871
+ if (!isZoneValid(range.zone)) {
33872
+ throw new InvalidReferenceError();
33873
+ }
33807
33874
  if (range.invalidSheetName) {
33808
33875
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
33809
33876
  }
33810
- return readCell(range);
33811
33877
  }
33812
33878
  return [refFn, range, evalContext];
33813
33879
  }
@@ -33827,6 +33893,10 @@
33827
33893
  if (cell.format !== evaluatedCell.format) {
33828
33894
  exportedCellData.computedFormat = evaluatedCell.format;
33829
33895
  }
33896
+ // if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
33897
+ if (cell.isFormula && cell.dependencies.length) {
33898
+ exportedCellData.content = this.getters.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
33899
+ }
33830
33900
  }
33831
33901
  }
33832
33902
  }
@@ -34292,7 +34362,7 @@
34292
34362
  switch (cmd.type) {
34293
34363
  case "UPDATE_FILTER":
34294
34364
  if (!this.getters.getFilterId(cmd)) {
34295
- return 79 /* CommandResult.FilterNotFound */;
34365
+ return 80 /* CommandResult.FilterNotFound */;
34296
34366
  }
34297
34367
  break;
34298
34368
  }
@@ -35262,7 +35332,7 @@
35262
35332
  }
35263
35333
  checkPositiveDimension(cmd) {
35264
35334
  if (cmd.width < 0 || cmd.height < 0) {
35265
- return 68 /* CommandResult.InvalidViewportSize */;
35335
+ return 69 /* CommandResult.InvalidViewportSize */;
35266
35336
  }
35267
35337
  return 0 /* CommandResult.Success */;
35268
35338
  }
@@ -35272,7 +35342,7 @@
35272
35342
  cmd.gridOffsetY === this.gridOffsetY &&
35273
35343
  cmd.width === width &&
35274
35344
  cmd.height === height) {
35275
- return 76 /* CommandResult.ValuesNotChanged */;
35345
+ return 77 /* CommandResult.ValuesNotChanged */;
35276
35346
  }
35277
35347
  return 0 /* CommandResult.Success */;
35278
35348
  }
@@ -35280,7 +35350,7 @@
35280
35350
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
35281
35351
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
35282
35352
  (!pane.canScrollVertically && offsetY > 0)) {
35283
- return 69 /* CommandResult.InvalidScrollingDirection */;
35353
+ return 70 /* CommandResult.InvalidScrollingDirection */;
35284
35354
  }
35285
35355
  return 0 /* CommandResult.Success */;
35286
35356
  }
@@ -35535,7 +35605,7 @@
35535
35605
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
35536
35606
  return 0 /* CommandResult.Success */;
35537
35607
  }
35538
- return 45 /* CommandResult.InvalidAutofillSelection */;
35608
+ return 46 /* CommandResult.InvalidAutofillSelection */;
35539
35609
  case "AUTOFILL_AUTO":
35540
35610
  const zone = this.getters.getSelectedZone();
35541
35611
  return zone.top === zone.bottom
@@ -36139,7 +36209,7 @@
36139
36209
  cellPopoverRegistry.get(cmd.popoverType);
36140
36210
  }
36141
36211
  catch (error) {
36142
- return 72 /* CommandResult.InvalidCellPopover */;
36212
+ return 73 /* CommandResult.InvalidCellPopover */;
36143
36213
  }
36144
36214
  return 0 /* CommandResult.Success */;
36145
36215
  default:
@@ -38275,21 +38345,6 @@
38275
38345
  // ---------------------------------------------------------------------------
38276
38346
  // Command Handling
38277
38347
  // ---------------------------------------------------------------------------
38278
- allowDispatch(cmd) {
38279
- switch (cmd.type) {
38280
- case "ADD_EMPTY_RANGE":
38281
- if (this.inputHasSingleRange && this.ranges.length === 1) {
38282
- return 30 /* CommandResult.MaximumRangesReached */;
38283
- }
38284
- break;
38285
- case "CHANGE_RANGE":
38286
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
38287
- return 30 /* CommandResult.MaximumRangesReached */;
38288
- }
38289
- break;
38290
- }
38291
- return 0 /* CommandResult.Success */;
38292
- }
38293
38348
  handleEvent(event) {
38294
38349
  const xc = zoneToXc(event.anchor.zone);
38295
38350
  const inputSheetId = this.activeSheet;
@@ -38505,6 +38560,15 @@
38505
38560
  // Command Handling
38506
38561
  // ---------------------------------------------------------------------------
38507
38562
  allowDispatch(cmd) {
38563
+ switch (cmd.type) {
38564
+ case "FOCUS_RANGE":
38565
+ case "CHANGE_RANGE":
38566
+ case "ADD_EMPTY_RANGE":
38567
+ case "REMOVE_RANGE":
38568
+ if (!this.inputs[cmd.id]) {
38569
+ return 31 /* CommandResult.InvalidInputId */;
38570
+ }
38571
+ }
38508
38572
  switch (cmd.type) {
38509
38573
  case "FOCUS_RANGE":
38510
38574
  const index = this.currentInput?.getIndex(cmd.rangeId);
@@ -38512,9 +38576,19 @@
38512
38576
  return 29 /* CommandResult.InputAlreadyFocused */;
38513
38577
  }
38514
38578
  break;
38515
- }
38516
- if (this.currentInput) {
38517
- return this.currentInput.allowDispatch(cmd);
38579
+ case "ADD_EMPTY_RANGE":
38580
+ const input = this.inputs[cmd.id];
38581
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
38582
+ return 30 /* CommandResult.MaximumRangesReached */;
38583
+ }
38584
+ break;
38585
+ case "CHANGE_RANGE": {
38586
+ const input = this.inputs[cmd.id];
38587
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
38588
+ return 30 /* CommandResult.MaximumRangesReached */;
38589
+ }
38590
+ break;
38591
+ }
38518
38592
  }
38519
38593
  return 0 /* CommandResult.Success */;
38520
38594
  }
@@ -38638,7 +38712,7 @@
38638
38712
  /*Test the presence of single cells*/
38639
38713
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
38640
38714
  if (singleCells) {
38641
- return 63 /* CommandResult.InvalidSortZone */;
38715
+ return 64 /* CommandResult.InvalidSortZone */;
38642
38716
  }
38643
38717
  return 0 /* CommandResult.Success */;
38644
38718
  }
@@ -38657,7 +38731,7 @@
38657
38731
  ];
38658
38732
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
38659
38733
  })) {
38660
- return 63 /* CommandResult.InvalidSortZone */;
38734
+ return 64 /* CommandResult.InvalidSortZone */;
38661
38735
  }
38662
38736
  return 0 /* CommandResult.Success */;
38663
38737
  }
@@ -39160,7 +39234,7 @@
39160
39234
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
39161
39235
  const zones = this.getters.getCommandZones(cmd);
39162
39236
  if (!sheetId && zones.length > 0) {
39163
- return 92 /* CommandResult.NoActiveSheet */;
39237
+ return 93 /* CommandResult.NoActiveSheet */;
39164
39238
  }
39165
39239
  if (sheetId && zones.length > 0) {
39166
39240
  return this.getters.checkZonesExistInSheet(sheetId, zones);
@@ -39642,13 +39716,13 @@
39642
39716
  }
39643
39717
  checkSingleColSelected() {
39644
39718
  if (!this.getters.isSingleColSelected()) {
39645
- return 88 /* CommandResult.MoreThanOneColumnSelected */;
39719
+ return 89 /* CommandResult.MoreThanOneColumnSelected */;
39646
39720
  }
39647
39721
  return 0 /* CommandResult.Success */;
39648
39722
  }
39649
39723
  checkNonEmptySelector(cmd) {
39650
39724
  if (cmd.separator === "") {
39651
- return 89 /* CommandResult.EmptySplitSeparator */;
39725
+ return 90 /* CommandResult.EmptySplitSeparator */;
39652
39726
  }
39653
39727
  return 0 /* CommandResult.Success */;
39654
39728
  }
@@ -39659,7 +39733,7 @@
39659
39733
  const selection = this.getters.getSelectedZones()[0];
39660
39734
  const splitted = this.getSplittedCols(selection, cmd.separator);
39661
39735
  if (this.willSplittedColsOverwriteContent(selection, splitted)) {
39662
- return 90 /* CommandResult.SplitWillOverwriteContent */;
39736
+ return 91 /* CommandResult.SplitWillOverwriteContent */;
39663
39737
  }
39664
39738
  return 0 /* CommandResult.Success */;
39665
39739
  }
@@ -39670,7 +39744,7 @@
39670
39744
  return 0 /* CommandResult.Success */;
39671
39745
  }
39672
39746
  }
39673
- return 91 /* CommandResult.NoSplitSeparatorInSelection */;
39747
+ return 92 /* CommandResult.NoSplitSeparatorInSelection */;
39674
39748
  }
39675
39749
  }
39676
39750
 
@@ -39817,7 +39891,7 @@
39817
39891
  for (const zone of this.getPasteZones(target)) {
39818
39892
  if ((zone.left < xSplit && zone.right >= xSplit) ||
39819
39893
  (zone.top < ySplit && zone.bottom >= ySplit)) {
39820
- return 75 /* CommandResult.FrozenPaneOverlap */;
39894
+ return 76 /* CommandResult.FrozenPaneOverlap */;
39821
39895
  }
39822
39896
  }
39823
39897
  return 0 /* CommandResult.Success */;
@@ -40211,7 +40285,7 @@
40211
40285
  }
40212
40286
  isPasteAllowed(target, option) {
40213
40287
  if (target.length === 0) {
40214
- return 73 /* CommandResult.EmptyTarget */;
40288
+ return 74 /* CommandResult.EmptyTarget */;
40215
40289
  }
40216
40290
  if (option?.pasteOption !== undefined) {
40217
40291
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -40952,7 +41026,7 @@
40952
41026
  validateSelection(length, start, end) {
40953
41027
  return start >= 0 && start <= length && end >= 0 && end <= length
40954
41028
  ? 0 /* CommandResult.Success */
40955
- : 46 /* CommandResult.WrongComposerSelection */;
41029
+ : 47 /* CommandResult.WrongComposerSelection */;
40956
41030
  }
40957
41031
  onColumnsRemoved(cmd) {
40958
41032
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -41167,7 +41241,7 @@
41167
41241
  getZoneReference(zone, fixedParts = [{ colFixed: false, rowFixed: false }]) {
41168
41242
  const sheetId = this.getters.getActiveSheetId();
41169
41243
  let selectedXc = this.getters.zoneToXC(sheetId, zone, fixedParts);
41170
- if (this.getters.getCurrentEditedCell().sheetId !== this.getters.getActiveSheetId()) {
41244
+ if (this.getters.getCurrentEditedCell()?.sheetId !== this.getters.getActiveSheetId()) {
41171
41245
  const sheetName = getCanonicalSheetName(this.getters.getSheetName(this.getters.getActiveSheetId()));
41172
41246
  selectedXc = `${sheetName}!${selectedXc}`;
41173
41247
  }
@@ -41182,7 +41256,7 @@
41182
41256
  _fixedParts.pop();
41183
41257
  }
41184
41258
  const newRange = range.clone({ parts: _fixedParts });
41185
- return this.getters.getSelectionRangeString(newRange, this.getters.getCurrentEditedCell().sheetId);
41259
+ return this.getters.getSelectionRangeString(newRange, this.getters.getCurrentEditedCell()?.sheetId || this.getters.getActiveSheetId());
41186
41260
  }
41187
41261
  /**
41188
41262
  * Replace the current selection by a new text.
@@ -41215,7 +41289,7 @@
41215
41289
  if (!this.currentContent.startsWith("=") || this.mode === "inactive") {
41216
41290
  return;
41217
41291
  }
41218
- const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
41292
+ const editionSheetId = this.getters.getCurrentEditedCell()?.sheetId || this.getters.getActiveSheetId();
41219
41293
  const XCs = this.getReferencedRanges().map((range) => this.getters.getRangeString(range, editionSheetId));
41220
41294
  const colorsToKeep = {};
41221
41295
  for (const xc of XCs) {
@@ -41244,7 +41318,7 @@
41244
41318
  if (!this.currentContent.startsWith("=") || this.mode === "inactive") {
41245
41319
  return [];
41246
41320
  }
41247
- const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
41321
+ const editionSheetId = this.getters.getCurrentEditedCell()?.sheetId || this.getters.getActiveSheetId();
41248
41322
  const rangeColor = (rangeString) => {
41249
41323
  const colorIndex = this.colorIndexByRange[rangeString];
41250
41324
  return colors$1[colorIndex % colors$1.length];
@@ -41262,10 +41336,11 @@
41262
41336
  * Return ranges currently referenced in the composer
41263
41337
  */
41264
41338
  getReferencedRanges() {
41265
- const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
41266
- return this.currentTokens
41339
+ const editionSheetId = this.getters.getCurrentEditedCell()?.sheetId || this.getters.getActiveSheetId();
41340
+ const referenceRanges = this.currentTokens
41267
41341
  .filter((token) => token.type === "REFERENCE")
41268
41342
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
41343
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
41269
41344
  }
41270
41345
  /**
41271
41346
  * Function used to determine when composer selection can start.
@@ -41904,7 +41979,7 @@
41904
41979
  const headers = [cmd.base, ...cmd.elements];
41905
41980
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
41906
41981
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
41907
- return 86 /* CommandResult.InvalidHeaderIndex */;
41982
+ return 87 /* CommandResult.InvalidHeaderIndex */;
41908
41983
  }
41909
41984
  return 0 /* CommandResult.Success */;
41910
41985
  }
@@ -42072,6 +42147,16 @@
42072
42147
  }
42073
42148
  }
42074
42149
 
42150
+ class FocusableElement {
42151
+ focusableElement = undefined;
42152
+ setFocusableElement(element) {
42153
+ this.focusableElement = element;
42154
+ }
42155
+ focus() {
42156
+ this.focusableElement?.focus();
42157
+ }
42158
+ }
42159
+
42075
42160
  const RIPPLE_KEY_FRAMES = [
42076
42161
  { transform: "scale(0)" },
42077
42162
  { transform: "scale(0.8)", offset: 0.33 },
@@ -44100,6 +44185,7 @@
44100
44185
  _t: Spreadsheet._t,
44101
44186
  clipboard: this.env.clipboard || instantiateClipboard(),
44102
44187
  startCellEdition: (content) => this.onGridComposerCellFocused(content),
44188
+ focusableElement: new FocusableElement(),
44103
44189
  });
44104
44190
  owl.useExternalListener(window, "resize", () => this.render(true));
44105
44191
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -44206,17 +44292,18 @@
44206
44292
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
44207
44293
  this.composer.topBarFocus = "contentFocus";
44208
44294
  this.composer.gridFocusMode = "inactive";
44209
- this.setComposerContent({ selection } || {});
44295
+ this.setComposerContent({ selection });
44210
44296
  }
44211
- onGridComposerContentFocused() {
44297
+ onGridComposerContentFocused(selection) {
44212
44298
  if (this.model.getters.isReadonly()) {
44213
44299
  return;
44214
44300
  }
44215
44301
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
44216
44302
  this.composer.topBarFocus = "inactive";
44217
44303
  this.composer.gridFocusMode = "contentFocus";
44218
- this.setComposerContent({});
44304
+ this.setComposerContent({ selection });
44219
44305
  }
44306
+ // TODO: either both are defined or none of them. change those args to an object
44220
44307
  onGridComposerCellFocused(content, selection) {
44221
44308
  if (this.model.getters.isReadonly()) {
44222
44309
  return;
@@ -45253,7 +45340,7 @@
45253
45340
  */
45254
45341
  moveAnchorCell(direction, step = 1) {
45255
45342
  if (step !== "end" && step <= 0) {
45256
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
45343
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
45257
45344
  }
45258
45345
  const { col, row } = this.getNextAvailablePosition(direction, step);
45259
45346
  return this.selectCell(col, row);
@@ -45299,7 +45386,7 @@
45299
45386
  */
45300
45387
  resizeAnchorZone(direction, step = 1) {
45301
45388
  if (step !== "end" && step <= 0) {
45302
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
45389
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
45303
45390
  }
45304
45391
  const sheetId = this.getters.getActiveSheetId();
45305
45392
  const anchor = this.anchor;
@@ -46126,12 +46213,7 @@
46126
46213
  attrs.push(["t", "str"]);
46127
46214
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
46128
46215
  }
46129
- node = escapeXml /*xml*/ `
46130
- <f>
46131
- ${XlsxFormula}
46132
- </f>
46133
- ${cycle}
46134
- `;
46216
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
46135
46217
  return { attrs, node };
46136
46218
  }
46137
46219
  else {
@@ -46953,11 +47035,10 @@
46953
47035
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
46954
47036
  }
46955
47037
  attributes.push(...additionalAttrs);
46956
- cellNodes.push(escapeXml /*xml*/ `
46957
- <c ${formatAttributes(attributes)}>
46958
- ${cellNode}
46959
- </c>
46960
- `);
47038
+ // prettier-ignore
47039
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
47040
+ ${cellNode}
47041
+ </c>`);
46961
47042
  }
46962
47043
  }
46963
47044
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -47642,10 +47723,10 @@
47642
47723
  const command = createCommand(type, payload);
47643
47724
  let status = this.status;
47644
47725
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
47645
- return new DispatchResult(67 /* CommandResult.Readonly */);
47726
+ return new DispatchResult(68 /* CommandResult.Readonly */);
47646
47727
  }
47647
47728
  if (!this.session.canApplyOptimisticUpdate()) {
47648
- return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
47729
+ return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
47649
47730
  }
47650
47731
  switch (status) {
47651
47732
  case 0 /* Status.Ready */:
@@ -47926,9 +48007,9 @@
47926
48007
  Object.defineProperty(exports, '__esModule', { value: true });
47927
48008
 
47928
48009
 
47929
- __info__.version = '16.3.22';
47930
- __info__.date = '2024-01-17T10:24:07.652Z';
47931
- __info__.hash = '2c1b136';
48010
+ __info__.version = '16.3.25';
48011
+ __info__.date = '2024-02-09T13:07:06.947Z';
48012
+ __info__.hash = 'b53bf1b';
47932
48013
 
47933
48014
 
47934
48015
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);