@odoo/o-spreadsheet 16.1.31 → 16.1.36

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.
@@ -204,7 +204,7 @@
204
204
  const BOTTOMBAR_HEIGHT = 36;
205
205
  const DEFAULT_CELL_WIDTH = 96;
206
206
  const DEFAULT_CELL_HEIGHT = 23;
207
- const SCROLLBAR_WIDTH$1 = 15;
207
+ const SCROLLBAR_WIDTH = 15;
208
208
  const AUTOFILL_EDGE_LENGTH = 8;
209
209
  const ICON_EDGE_LENGTH = 18;
210
210
  const UNHIDE_ICON_EDGE_LENGTH = 14;
@@ -910,7 +910,7 @@
910
910
  function isDateTime(str) {
911
911
  return parseDateTime(str) !== null;
912
912
  }
913
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
913
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
914
914
  //link must start with http or https
915
915
  //https://stackoverflow.com/a/3809435/4760614
916
916
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -1673,6 +1673,9 @@
1673
1673
  function formatValue(value, format) {
1674
1674
  switch (typeof value) {
1675
1675
  case "string":
1676
+ if (value.includes('\\"')) {
1677
+ return value.replace(/\\"/g, '"');
1678
+ }
1676
1679
  return value;
1677
1680
  case "boolean":
1678
1681
  return value ? "TRUE" : "FALSE";
@@ -2002,27 +2005,30 @@
2002
2005
  }
2003
2006
  function createLargeNumberFormat(format, magnitude, postFix) {
2004
2007
  const internalFormat = parseFormat(format || "#,##0");
2005
- const largeNumberFormat = internalFormat
2006
- .map((formatPart) => {
2007
- if (formatPart.type === "NUMBER") {
2008
- return [
2009
- {
2010
- ...formatPart,
2011
- format: {
2012
- ...formatPart.format,
2013
- magnitude,
2014
- decimalPart: undefined,
2015
- },
2016
- },
2017
- {
2018
- type: "STRING",
2019
- format: postFix,
2020
- },
2021
- ];
2008
+ const largeNumberFormat = [];
2009
+ for (let i = 0; i < internalFormat.length; i++) {
2010
+ const formatPart = internalFormat[i];
2011
+ if (formatPart.type !== "NUMBER") {
2012
+ largeNumberFormat.push(formatPart);
2013
+ continue;
2022
2014
  }
2023
- return formatPart;
2024
- })
2025
- .flat();
2015
+ largeNumberFormat.push({
2016
+ ...formatPart,
2017
+ format: {
2018
+ ...formatPart.format,
2019
+ magnitude,
2020
+ decimalPart: undefined,
2021
+ },
2022
+ });
2023
+ largeNumberFormat.push({
2024
+ type: "STRING",
2025
+ format: postFix,
2026
+ });
2027
+ const nextFormatPart = internalFormat[i + 1];
2028
+ if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2029
+ i++;
2030
+ }
2031
+ }
2026
2032
  return convertInternalFormatToFormat(largeNumberFormat);
2027
2033
  }
2028
2034
  function changeDecimalPlaces(format, step) {
@@ -3667,64 +3673,65 @@
3667
3673
  CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
3668
3674
  CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
3669
3675
  CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
3670
- CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
3671
- CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
3672
- CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
3673
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
3674
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
3675
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
3676
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
3677
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
3678
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
3679
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
3680
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
3681
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
3682
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
3683
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
3684
- CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
3685
- CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
3686
- CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
3687
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
3688
- CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
3689
- CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
3690
- CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
3691
- CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
3692
- CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
3693
- CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
3694
- CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
3695
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
3696
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
3697
- CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
3698
- CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
3699
- CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
3700
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
3701
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
3702
- CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
3703
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
3704
- CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
3705
- CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
3706
- CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
3707
- CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
3708
- CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
3709
- CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
3710
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
3711
- CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
3712
- CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
3713
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
3714
- CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
3715
- CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
3716
- CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
3717
- CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
3718
- CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
3719
- CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
3720
- CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
3721
- CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
3722
- CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3723
- CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3724
- CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3725
- CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3726
- CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3727
- CommandResult[CommandResult["NoChanges"] = 88] = "NoChanges";
3676
+ CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
3677
+ CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
3678
+ CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
3679
+ CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
3680
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
3681
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
3682
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
3683
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
3684
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
3685
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
3686
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
3687
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
3688
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
3689
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
3690
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
3691
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
3692
+ CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
3693
+ CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
3694
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
3695
+ CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
3696
+ CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
3697
+ CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
3698
+ CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
3699
+ CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
3700
+ CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
3701
+ CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
3702
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
3703
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
3704
+ CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
3705
+ CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
3706
+ CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
3707
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
3708
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
3709
+ CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
3710
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
3711
+ CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
3712
+ CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
3713
+ CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
3714
+ CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
3715
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
3716
+ CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
3717
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
3718
+ CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
3719
+ CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
3720
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
3721
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
3722
+ CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
3723
+ CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
3724
+ CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
3725
+ CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
3726
+ CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
3727
+ CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
3728
+ CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
3729
+ CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
3730
+ CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
3731
+ CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
3732
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
3733
+ CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
3734
+ CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
3728
3735
  })(exports.CommandResult || (exports.CommandResult = {}));
3729
3736
 
3730
3737
  function isMatrix(x) {
@@ -3871,14 +3878,8 @@
3871
3878
  : undefined));
3872
3879
  }
3873
3880
  }
3874
- else if (zone.left === zone.right && zone.top === zone.bottom) {
3875
- // A single cell. If it's only the title, the dataset is not added.
3876
- if (!dataSetsHaveTitle) {
3877
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
3878
- }
3879
- }
3880
3881
  else {
3881
- /* 1 row or 1 column */
3882
+ /* 1 cell, 1 row or 1 column */
3882
3883
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
3883
3884
  ? {
3884
3885
  top: zone.top,
@@ -3928,8 +3929,10 @@
3928
3929
  }
3929
3930
  const dataRange = ds.dataRange.clone({ zone: dataZone });
3930
3931
  return {
3931
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
3932
- range: getters.getRangeString(dataRange, "forceSheetReference"),
3932
+ label: ds.labelCell
3933
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
3934
+ : undefined,
3935
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
3933
3936
  };
3934
3937
  }
3935
3938
  /**
@@ -3998,11 +4001,11 @@
3998
4001
  if (definition.dataSets) {
3999
4002
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
4000
4003
  if (invalidRanges) {
4001
- return 32 /* CommandResult.InvalidDataSet */;
4004
+ return 33 /* CommandResult.InvalidDataSet */;
4002
4005
  }
4003
4006
  const zones = definition.dataSets.map(toUnboundedZone);
4004
4007
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
4005
- return 32 /* CommandResult.InvalidDataSet */;
4008
+ return 33 /* CommandResult.InvalidDataSet */;
4006
4009
  }
4007
4010
  }
4008
4011
  return 0 /* CommandResult.Success */;
@@ -4011,7 +4014,7 @@
4011
4014
  if (definition.labelRange) {
4012
4015
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
4013
4016
  if (invalidLabels) {
4014
- return 33 /* CommandResult.InvalidLabelRange */;
4017
+ return 34 /* CommandResult.InvalidLabelRange */;
4015
4018
  }
4016
4019
  }
4017
4020
  return 0 /* CommandResult.Success */;
@@ -4084,22 +4087,22 @@
4084
4087
  const CfTerms = {
4085
4088
  Errors: {
4086
4089
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
4087
- [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
4088
- [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
4089
- [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
4090
- [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
4091
- [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
4092
- [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
4093
- [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
4094
- [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
4095
- [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
4096
- [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
4097
- [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
4098
- [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
4099
- [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
4100
- [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
4101
- [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
4102
- [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
4090
+ [52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
4091
+ [53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
4092
+ [54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
4093
+ [55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
4094
+ [56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
4095
+ [57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
4096
+ [58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
4097
+ [48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
4098
+ [51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
4099
+ [50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
4100
+ [49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
4101
+ [59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
4102
+ [61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
4103
+ [60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
4104
+ [62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
4105
+ [63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
4103
4106
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
4104
4107
  Unexpected: _lt("The rule is invalid for an unknown reason"),
4105
4108
  },
@@ -4127,20 +4130,20 @@
4127
4130
  Errors: {
4128
4131
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
4129
4132
  // BASIC CHART ERRORS (LINE | BAR | PIE)
4130
- [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
4131
- [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
4133
+ [33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
4134
+ [34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
4132
4135
  // SCORECARD CHART ERRORS
4133
- [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
4134
- [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
4136
+ [35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
4137
+ [36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
4135
4138
  // GAUGE CHART ERRORS
4136
- [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
4137
- [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
4138
- [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
4139
- [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
4140
- [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
4141
- [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
4142
- [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
4143
- [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
4139
+ [37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
4140
+ [38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
4141
+ [39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
4142
+ [40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
4143
+ [41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
4144
+ [42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
4145
+ [43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
4146
+ [44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
4144
4147
  },
4145
4148
  };
4146
4149
  const NumberFormatTerms = {
@@ -4426,6 +4429,9 @@
4426
4429
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4427
4430
  return {
4428
4431
  ...this.getDefinition(),
4432
+ labelRange: this.labelRange
4433
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4434
+ : undefined,
4429
4435
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4430
4436
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4431
4437
  dataSets,
@@ -4512,7 +4518,7 @@
4512
4518
 
4513
4519
  function isDataRangeValid(definition) {
4514
4520
  return definition.dataRange && !rangeReference.test(definition.dataRange)
4515
- ? 36 /* CommandResult.InvalidGaugeDataRange */
4521
+ ? 37 /* CommandResult.InvalidGaugeDataRange */
4516
4522
  : 0 /* CommandResult.Success */;
4517
4523
  }
4518
4524
  function checkRangeLimits(check, batchValidations) {
@@ -4544,7 +4550,7 @@
4544
4550
  function checkRangeMinBiggerThanRangeMax(definition) {
4545
4551
  if (definition.sectionRule) {
4546
4552
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
4547
- return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
4553
+ return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
4548
4554
  }
4549
4555
  }
4550
4556
  return 0 /* CommandResult.Success */;
@@ -4553,9 +4559,9 @@
4553
4559
  if (value === "") {
4554
4560
  switch (valueName) {
4555
4561
  case "rangeMin":
4556
- return 37 /* CommandResult.EmptyGaugeRangeMin */;
4562
+ return 38 /* CommandResult.EmptyGaugeRangeMin */;
4557
4563
  case "rangeMax":
4558
- return 39 /* CommandResult.EmptyGaugeRangeMax */;
4564
+ return 40 /* CommandResult.EmptyGaugeRangeMax */;
4559
4565
  }
4560
4566
  }
4561
4567
  return 0 /* CommandResult.Success */;
@@ -4564,13 +4570,13 @@
4564
4570
  if (isNaN(value)) {
4565
4571
  switch (valueName) {
4566
4572
  case "rangeMin":
4567
- return 38 /* CommandResult.GaugeRangeMinNaN */;
4573
+ return 39 /* CommandResult.GaugeRangeMinNaN */;
4568
4574
  case "rangeMax":
4569
- return 40 /* CommandResult.GaugeRangeMaxNaN */;
4575
+ return 41 /* CommandResult.GaugeRangeMaxNaN */;
4570
4576
  case "lowerInflectionPointValue":
4571
- return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
4577
+ return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
4572
4578
  case "upperInflectionPointValue":
4573
- return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
4579
+ return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
4574
4580
  }
4575
4581
  }
4576
4582
  return 0 /* CommandResult.Success */;
@@ -4984,6 +4990,9 @@
4984
4990
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4985
4991
  return {
4986
4992
  ...this.getDefinition(),
4993
+ labelRange: this.labelRange
4994
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4995
+ : undefined,
4987
4996
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4988
4997
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4989
4998
  dataSets,
@@ -5247,6 +5256,9 @@
5247
5256
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
5248
5257
  return {
5249
5258
  ...this.getDefinition(),
5259
+ labelRange: this.labelRange
5260
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
5261
+ : undefined,
5250
5262
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
5251
5263
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
5252
5264
  verticalAxisPosition: "left",
@@ -5321,12 +5333,12 @@
5321
5333
 
5322
5334
  function checkKeyValue(definition) {
5323
5335
  return definition.keyValue && !rangeReference.test(definition.keyValue)
5324
- ? 34 /* CommandResult.InvalidScorecardKeyValue */
5336
+ ? 35 /* CommandResult.InvalidScorecardKeyValue */
5325
5337
  : 0 /* CommandResult.Success */;
5326
5338
  }
5327
5339
  function checkBaseline(definition) {
5328
5340
  return definition.baseline && !rangeReference.test(definition.baseline)
5329
- ? 35 /* CommandResult.InvalidScorecardBaseline */
5341
+ ? 36 /* CommandResult.InvalidScorecardBaseline */
5330
5342
  : 0 /* CommandResult.Success */;
5331
5343
  }
5332
5344
  class ScorecardChart extends AbstractChart {
@@ -6368,7 +6380,7 @@
6368
6380
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
6369
6381
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
6370
6382
  }
6371
- else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
6383
+ else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
6372
6384
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
6373
6385
  }
6374
6386
  }
@@ -6655,7 +6667,7 @@
6655
6667
  });
6656
6668
  }
6657
6669
  }
6658
- if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
6670
+ if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
6659
6671
  const { col, row } = anchor;
6660
6672
  env.model.selection.selectZone({ cell: { col, row }, zone });
6661
6673
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -6669,13 +6681,13 @@
6669
6681
  };
6670
6682
  function interactiveAddFilter(env, sheetId, target) {
6671
6683
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
6672
- if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
6684
+ if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
6673
6685
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
6674
6686
  }
6675
- else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
6687
+ else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
6676
6688
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
6677
6689
  }
6678
- else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
6690
+ else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
6679
6691
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
6680
6692
  }
6681
6693
  }
@@ -7252,6 +7264,12 @@
7252
7264
  let { col, row } = env.model.getters.getActivePosition();
7253
7265
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
7254
7266
  };
7267
+ const INSERT_LINK_NAME = (env) => {
7268
+ const sheetId = env.model.getters.getActiveSheetId();
7269
+ const { col, row } = env.model.getters.getActivePosition();
7270
+ const cell = env.model.getters.getEvaluatedCell({ sheetId, col, row });
7271
+ return cell && cell.link ? _lt("Edit link") : _lt("Insert link");
7272
+ };
7255
7273
  //------------------------------------------------------------------------------
7256
7274
  // Filters action
7257
7275
  //------------------------------------------------------------------------------
@@ -7389,7 +7407,7 @@
7389
7407
  action: DELETE_CELL_SHIFT_LEFT,
7390
7408
  })
7391
7409
  .add("insert_link", {
7392
- name: _lt("Insert link"),
7410
+ name: INSERT_LINK_NAME,
7393
7411
  separator: true,
7394
7412
  sequence: 150,
7395
7413
  action: INSERT_LINK,
@@ -16548,9 +16566,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16548
16566
  break;
16549
16567
  }
16550
16568
  }
16551
- unsubscribe() {
16552
- this.mode = "inactive";
16553
- }
16554
16569
  // ---------------------------------------------------------------------------
16555
16570
  // Getters
16556
16571
  // ---------------------------------------------------------------------------
@@ -16626,7 +16641,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16626
16641
  validateSelection(length, start, end) {
16627
16642
  return start >= 0 && start <= length && end >= 0 && end <= length
16628
16643
  ? 0 /* CommandResult.Success */
16629
- : 46 /* CommandResult.WrongComposerSelection */;
16644
+ : 47 /* CommandResult.WrongComposerSelection */;
16630
16645
  }
16631
16646
  onColumnsRemoved(cmd) {
16632
16647
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -16940,9 +16955,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16940
16955
  */
16941
16956
  getReferencedRanges() {
16942
16957
  const editionSheetId = this.getters.getEditionSheet();
16943
- return this.currentTokens
16958
+ const referenceRanges = this.currentTokens
16944
16959
  .filter((token) => token.type === "REFERENCE")
16945
16960
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
16961
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
16946
16962
  }
16947
16963
  /**
16948
16964
  * Function used to determine when composer selection can start.
@@ -17442,13 +17458,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17442
17458
  setup() {
17443
17459
  owl.onMounted(() => {
17444
17460
  const el = this.composerRef.el;
17461
+ if (this.props.isDefaultFocus) {
17462
+ this.env.focusableElement.setFocusableElement(el);
17463
+ }
17445
17464
  this.contentHelper.updateEl(el);
17446
17465
  this.processContent();
17447
17466
  });
17448
- owl.onWillUnmount(() => {
17449
- var _a, _b;
17450
- (_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
17451
- });
17452
17467
  owl.onPatched(() => {
17453
17468
  if (!this.isKeyStillDown) {
17454
17469
  this.processContent();
@@ -17459,7 +17474,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17459
17474
  // Handlers
17460
17475
  // ---------------------------------------------------------------------------
17461
17476
  processArrowKeys(ev) {
17462
- if (this.env.model.getters.isSelectingForComposer()) {
17477
+ if (this.env.model.getters.isSelectingForComposer() ||
17478
+ this.env.model.getters.getEditionMode() === "inactive") {
17463
17479
  this.functionDescriptionState.showDescription = false;
17464
17480
  // Prevent the default content editable behavior which moves the cursor
17465
17481
  ev.preventDefault();
@@ -17500,21 +17516,23 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17500
17516
  var _a;
17501
17517
  ev.preventDefault();
17502
17518
  ev.stopPropagation();
17503
- if (this.autoCompleteState.showProvider) {
17504
- const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17505
- if (autoCompleteValue) {
17506
- this.autoComplete(autoCompleteValue);
17507
- return;
17519
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17520
+ if (this.autoCompleteState.showProvider) {
17521
+ const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17522
+ if (autoCompleteValue) {
17523
+ this.autoComplete(autoCompleteValue);
17524
+ return;
17525
+ }
17508
17526
  }
17509
- }
17510
- else {
17511
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17512
- // we can't let the model think that it is for a ref selection.
17513
- // todo: check if this can be removed someday
17514
- this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17527
+ else {
17528
+ // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17529
+ // we can't let the model think that it is for a ref selection.
17530
+ // todo: check if this can be removed someday
17531
+ this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17532
+ }
17533
+ this.env.model.dispatch("STOP_EDITION");
17515
17534
  }
17516
17535
  const direction = ev.shiftKey ? "left" : "right";
17517
- this.env.model.dispatch("STOP_EDITION");
17518
17536
  this.env.model.selection.moveAnchorCell(direction, 1);
17519
17537
  }
17520
17538
  processEnterKey(ev) {
@@ -17547,6 +17565,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17547
17565
  this.compositionActive = false;
17548
17566
  }
17549
17567
  onKeydown(ev) {
17568
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17569
+ return;
17570
+ }
17550
17571
  let handler = this.keyMapping[ev.key];
17551
17572
  if (handler) {
17552
17573
  handler.call(this, ev);
@@ -17557,23 +17578,46 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17557
17578
  }
17558
17579
  }
17559
17580
  updateCursorIfNeeded() {
17560
- if (!this.env.model.getters.isSelectingForComposer()) {
17581
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
17582
+ !(this.env.model.getters.getEditionMode() === "inactive");
17583
+ if (moveCursor) {
17561
17584
  const { start, end } = this.contentHelper.getCurrentSelection();
17562
17585
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
17563
17586
  this.isKeyStillDown = true;
17564
17587
  }
17565
17588
  }
17589
+ onPaste(ev) {
17590
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17591
+ ev.stopPropagation();
17592
+ }
17593
+ }
17566
17594
  /*
17567
17595
  * Triggered automatically by the content-editable between the keydown and key up
17568
17596
  * */
17569
- onInput() {
17570
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
17597
+ onInput(ev) {
17598
+ var _a, _b;
17599
+ if (!this.shouldProcessInputEvents) {
17571
17600
  return;
17572
17601
  }
17602
+ if (ev.inputType === "insertFromPaste" &&
17603
+ this.env.model.getters.getEditionMode() === "inactive") {
17604
+ return;
17605
+ }
17606
+ ev.stopPropagation();
17607
+ let content;
17608
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17609
+ content = ev.data || "";
17610
+ }
17611
+ else {
17612
+ const el = this.composerRef.el;
17613
+ content = el.childNodes.length ? el.textContent : "";
17614
+ }
17615
+ if (this.props.focus === "inactive") {
17616
+ return (_b = (_a = this.props).onComposerCellFocused) === null || _b === void 0 ? void 0 : _b.call(_a, content);
17617
+ }
17573
17618
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17574
- const el = this.composerRef.el;
17575
17619
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
17576
- content: el.childNodes.length ? el.textContent : "",
17620
+ content,
17577
17621
  selection: this.contentHelper.getCurrentSelection(),
17578
17622
  });
17579
17623
  }
@@ -17633,9 +17677,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17633
17677
  }
17634
17678
  const newSelection = this.contentHelper.getCurrentSelection();
17635
17679
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17636
- if (this.props.focus === "inactive") {
17637
- this.props.onComposerContentFocused(newSelection);
17638
- }
17680
+ this.props.onComposerContentFocused();
17681
+ if (this.props.focus === "inactive") ;
17639
17682
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
17640
17683
  this.processTokenAtCursor();
17641
17684
  }
@@ -17652,6 +17695,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17652
17695
  this.contentHelper.removeAll(); // removes the content of the composer, to be added just after
17653
17696
  this.shouldProcessInputEvents = false;
17654
17697
  if (this.props.focus !== "inactive") {
17698
+ this.contentHelper.el.focus();
17655
17699
  this.contentHelper.selectRange(0, 0); // move the cursor inside the composer at 0 0.
17656
17700
  }
17657
17701
  const content = this.getContent();
@@ -17818,18 +17862,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17818
17862
  Composer.components = { TextValueProvider, FunctionDescriptionProvider };
17819
17863
  Composer.defaultProps = {
17820
17864
  inputStyle: "",
17865
+ isDefaultFocus: false,
17821
17866
  };
17822
17867
  Composer.props = {
17823
17868
  inputStyle: { type: String, optional: true },
17824
17869
  rect: { type: Object, optional: true },
17825
17870
  delimitation: { type: Object, optional: true },
17826
17871
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17827
- onComposerUnmounted: { type: Function, optional: true },
17872
+ onComposerCellFocused: { type: Function, optional: true },
17828
17873
  onComposerContentFocused: Function,
17874
+ isDefaultFocus: { type: Boolean, optional: true },
17829
17875
  };
17830
17876
 
17831
- const SCROLLBAR_WIDTH = 14;
17832
- const SCROLLBAR_HIGHT = 15;
17833
17877
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
17834
17878
  css /* scss */ `
17835
17879
  div.o-grid-composer {
@@ -17844,35 +17888,52 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17844
17888
  * It also applies the style of the cell to the composer input.
17845
17889
  */
17846
17890
  class GridComposer extends owl.Component {
17891
+ constructor() {
17892
+ super(...arguments);
17893
+ this.rect = undefined;
17894
+ this.isEditing = false;
17895
+ }
17896
+ get defaultRect() {
17897
+ return { x: 0, y: 0, width: 0, height: 0 };
17898
+ }
17847
17899
  setup() {
17848
- this.gridComposerRef = owl.useRef("gridComposer");
17849
- this.composerState = owl.useState({
17850
- rect: undefined,
17851
- delimitation: undefined,
17852
- });
17853
- const { sheetId, col, row } = this.env.model.getters.getActivePosition();
17854
- this.zone = this.env.model.getters.expandZone(sheetId, positionToZone({ col, row }));
17855
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
17856
- owl.onMounted(() => {
17857
- const el = this.gridComposerRef.el;
17858
- //TODO Should be more correct to have a props that give the parent's clientHeight and clientWidth
17859
- const maxHeight = el.parentElement.clientHeight - this.rect.y - SCROLLBAR_HIGHT;
17860
- el.style.maxHeight = (maxHeight + "px");
17861
- const maxWidth = el.parentElement.clientWidth - this.rect.x - SCROLLBAR_WIDTH;
17862
- el.style.maxWidth = (maxWidth + "px");
17863
- this.composerState.rect = {
17864
- x: this.rect.x,
17865
- y: this.rect.y,
17866
- width: el.clientWidth,
17867
- height: el.clientHeight,
17868
- };
17869
- this.composerState.delimitation = {
17870
- width: el.parentElement.clientWidth,
17871
- height: el.parentElement.clientHeight,
17872
- };
17900
+ owl.onWillUpdateProps(() => {
17901
+ const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
17902
+ if (this.isEditing !== isEditing) {
17903
+ this.isEditing = isEditing;
17904
+ if (!isEditing) {
17905
+ this.rect = undefined;
17906
+ this.env.focusableElement.focus();
17907
+ return;
17908
+ }
17909
+ const position = this.env.model.getters.getActivePosition();
17910
+ const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
17911
+ this.rect = this.env.model.getters.getVisibleRect(zone);
17912
+ }
17873
17913
  });
17874
17914
  }
17915
+ get composerProps() {
17916
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
17917
+ return {
17918
+ rect: this.rect && { ...this.rect },
17919
+ delimitation: {
17920
+ width,
17921
+ height,
17922
+ },
17923
+ inputStyle: this.composerStyle,
17924
+ focus: this.props.focus,
17925
+ isDefaultFocus: true,
17926
+ onComposerContentFocused: this.props.onComposerContentFocused,
17927
+ onComposerCellFocused: this.props.onComposerCellFocused,
17928
+ };
17929
+ }
17875
17930
  get containerStyle() {
17931
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
17932
+ return `
17933
+ position: absolute;
17934
+ z-index: -1000;
17935
+ `;
17936
+ }
17876
17937
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
17877
17938
  const cell = this.env.model.getters.getActiveCell();
17878
17939
  const position = this.env.model.getters.getActivePosition();
@@ -17892,12 +17953,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17892
17953
  if (!isFormula) {
17893
17954
  textAlign = style.align || cell.defaultAlign;
17894
17955
  }
17956
+ const sheetDimensions = this.env.model.getters.getSheetViewDimensionWithHeaders();
17957
+ const maxWidth = sheetDimensions.width - this.rect.x;
17958
+ const maxHeight = sheetDimensions.height - this.rect.y;
17895
17959
  return `
17896
17960
  left: ${left - 1}px;
17897
17961
  top: ${top}px;
17898
17962
  min-width: ${width + 2}px;
17899
17963
  min-height: ${height + 1}px;
17900
17964
 
17965
+ max-width: ${maxWidth}px;
17966
+ max-height: ${maxHeight}px;
17967
+
17901
17968
  background: ${background};
17902
17969
  color: ${color};
17903
17970
 
@@ -17921,8 +17988,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17921
17988
  GridComposer.components = { Composer };
17922
17989
  GridComposer.props = {
17923
17990
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17924
- onComposerUnmounted: Function,
17925
17991
  onComposerContentFocused: Function,
17992
+ onComposerCellFocused: Function,
17926
17993
  };
17927
17994
 
17928
17995
  const CSS$2 = css /* scss */ `
@@ -19380,7 +19447,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19380
19447
  const sheetId = env.model.getters.getActiveSheetId();
19381
19448
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
19382
19449
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
19383
- if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
19450
+ if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
19384
19451
  env.raiseError(MergeErrorMessage);
19385
19452
  }
19386
19453
  }
@@ -20095,11 +20162,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20095
20162
  }
20096
20163
  get isDatasetInvalid() {
20097
20164
  var _a;
20098
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
20165
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
20099
20166
  }
20100
20167
  get isLabelInvalid() {
20101
20168
  var _a;
20102
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
20169
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
20103
20170
  }
20104
20171
  onUpdateDataSetsHaveTitle(ev) {
20105
20172
  this.props.updateChart(this.props.figureId, {
@@ -20472,7 +20539,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20472
20539
  }
20473
20540
  get isDataRangeInvalid() {
20474
20541
  var _a;
20475
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
20542
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
20476
20543
  }
20477
20544
  onDataRangeChanged(ranges) {
20478
20545
  this.dataRange = ranges[0];
@@ -20564,28 +20631,28 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20564
20631
  }
20565
20632
  isRangeMinInvalid() {
20566
20633
  var _a, _b, _c;
20567
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
20568
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
20569
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20634
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
20635
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
20636
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20570
20637
  }
20571
20638
  isRangeMaxInvalid() {
20572
20639
  var _a, _b, _c;
20573
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
20574
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
20575
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20640
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
20641
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
20642
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20576
20643
  }
20577
20644
  // ---------------------------------------------------------------------------
20578
20645
  // COLOR_SECTION_TEMPLATE
20579
20646
  // ---------------------------------------------------------------------------
20580
20647
  get isLowerInflectionPointInvalid() {
20581
20648
  var _a, _b;
20582
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
20583
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20649
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
20650
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20584
20651
  }
20585
20652
  get isUpperInflectionPointInvalid() {
20586
20653
  var _a, _b;
20587
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
20588
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20654
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
20655
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20589
20656
  }
20590
20657
  updateInflectionPointValue(attr, ev) {
20591
20658
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -20698,11 +20765,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20698
20765
  }
20699
20766
  get isKeyValueInvalid() {
20700
20767
  var _a;
20701
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
20768
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
20702
20769
  }
20703
20770
  get isBaselineInvalid() {
20704
20771
  var _a;
20705
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
20772
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
20706
20773
  }
20707
20774
  onKeyValueRangeChanged(ranges) {
20708
20775
  this.keyValue = ranges[0];
@@ -21558,11 +21625,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21558
21625
  ****************************************************************************/
21559
21626
  get isValue1Invalid() {
21560
21627
  var _a;
21561
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
21628
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
21562
21629
  }
21563
21630
  get isValue2Invalid() {
21564
21631
  var _a;
21565
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
21632
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
21566
21633
  }
21567
21634
  toggleStyle(tool) {
21568
21635
  const style = this.state.rules.cellIs.style;
@@ -21579,17 +21646,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21579
21646
  isValueInvalid(threshold) {
21580
21647
  switch (threshold) {
21581
21648
  case "minimum":
21582
- return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
21583
- this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
21584
- this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
21585
- this.state.errors.includes(53 /* CommandResult.MinNaN */));
21649
+ return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
21650
+ this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
21651
+ this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
21652
+ this.state.errors.includes(54 /* CommandResult.MinNaN */));
21586
21653
  case "midpoint":
21587
- return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
21588
- this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
21589
- this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
21654
+ return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
21655
+ this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
21656
+ this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
21590
21657
  case "maximum":
21591
- return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
21592
- this.state.errors.includes(55 /* CommandResult.MaxNaN */));
21658
+ return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
21659
+ this.state.errors.includes(56 /* CommandResult.MaxNaN */));
21593
21660
  default:
21594
21661
  return false;
21595
21662
  }
@@ -21638,13 +21705,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21638
21705
  isInflectionPointInvalid(inflectionPoint) {
21639
21706
  switch (inflectionPoint) {
21640
21707
  case "lowerInflectionPoint":
21641
- return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
21642
- this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
21643
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
21708
+ return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
21709
+ this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
21710
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
21644
21711
  case "upperInflectionPoint":
21645
- return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
21646
- this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
21647
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
21712
+ return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
21713
+ this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
21714
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
21648
21715
  default:
21649
21716
  return true;
21650
21717
  }
@@ -22684,7 +22751,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22684
22751
  this.props.onCellDoubleClicked(col, row);
22685
22752
  }
22686
22753
  onContextMenu(ev) {
22687
- ev.preventDefault();
22688
22754
  const [col, row] = this.getCartesianCoordinates(ev);
22689
22755
  this.props.onCellRightClicked(col, row, { x: ev.clientX, y: ev.clientY });
22690
22756
  }
@@ -23618,8 +23684,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23618
23684
  &.corner {
23619
23685
  right: 0px;
23620
23686
  bottom: 0px;
23621
- height: ${SCROLLBAR_WIDTH$1}px;
23622
- width: ${SCROLLBAR_WIDTH$1}px;
23687
+ height: ${SCROLLBAR_WIDTH}px;
23688
+ width: ${SCROLLBAR_WIDTH}px;
23623
23689
  border-top: 1px solid #e2e3e3;
23624
23690
  border-left: 1px solid #e2e3e3;
23625
23691
  }
@@ -23692,7 +23758,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23692
23758
  return {
23693
23759
  left: `${this.props.leftOffset + x}px`,
23694
23760
  bottom: "0px",
23695
- height: `${SCROLLBAR_WIDTH$1}px`,
23761
+ height: `${SCROLLBAR_WIDTH}px`,
23696
23762
  right: `0px`,
23697
23763
  };
23698
23764
  }
@@ -23737,7 +23803,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23737
23803
  return {
23738
23804
  top: `${this.props.topOffset + y}px`,
23739
23805
  right: "0px",
23740
- width: `${SCROLLBAR_WIDTH$1}px`,
23806
+ width: `${SCROLLBAR_WIDTH}px`,
23741
23807
  bottom: `0px`,
23742
23808
  };
23743
23809
  }
@@ -23911,17 +23977,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23911
23977
  menuItems: [],
23912
23978
  });
23913
23979
  this.gridRef = owl.useRef("grid");
23914
- this.hiddenInput = owl.useRef("hiddenInput");
23915
23980
  this.canvasPosition = useAbsoluteBoundingRect(this.gridRef);
23916
23981
  this.hoveredCell = owl.useState({ col: undefined, row: undefined });
23917
23982
  owl.useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
23918
23983
  owl.useExternalListener(document.body, "cut", this.copy.bind(this, true));
23919
23984
  owl.useExternalListener(document.body, "copy", this.copy.bind(this, false));
23920
23985
  owl.useExternalListener(document.body, "paste", this.paste);
23921
- owl.onMounted(() => this.focus());
23922
- this.props.exposeFocus(() => this.focus());
23986
+ owl.onMounted(() => this.focusDefaultElement());
23987
+ this.props.exposeFocus(() => this.focusDefaultElement());
23923
23988
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
23924
- owl.useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
23989
+ owl.useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
23925
23990
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
23926
23991
  this.moveCanvas(deltaX, deltaY);
23927
23992
  this.hoveredCell.col = undefined;
@@ -23936,21 +24001,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23936
24001
  return `
23937
24002
  top: ${HEADER_HEIGHT}px;
23938
24003
  left: ${HEADER_WIDTH}px;
23939
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH$1}px);
23940
- width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH$1}px);
24004
+ height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
24005
+ width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH}px);
23941
24006
  `;
23942
24007
  }
23943
24008
  onClosePopover() {
23944
24009
  if (this.env.model.getters.hasOpenedPopover()) {
23945
24010
  this.closeOpenedPopover();
23946
24011
  }
23947
- this.focus();
24012
+ this.focusDefaultElement();
23948
24013
  }
23949
- focus() {
23950
- var _a;
24014
+ focusDefaultElement() {
23951
24015
  if (!this.env.model.getters.getSelectedFigureId() &&
23952
24016
  this.env.model.getters.getEditionMode() === "inactive") {
23953
- (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
24017
+ this.env.focusableElement.focus();
23954
24018
  }
23955
24019
  }
23956
24020
  get gridEl() {
@@ -24095,19 +24159,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24095
24159
  return;
24096
24160
  }
24097
24161
  }
24098
- onInput(ev) {
24099
- // the user meant to paste in the sheet, not open the composer with the pasted content
24100
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
24101
- return;
24102
- }
24103
- if (ev.data) {
24104
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
24105
- // character
24106
- ev.preventDefault();
24107
- ev.stopPropagation();
24108
- this.props.onGridComposerCellFocused(ev.data);
24109
- }
24110
- }
24111
24162
  // ---------------------------------------------------------------------------
24112
24163
  // Context Menu
24113
24164
  // ---------------------------------------------------------------------------
@@ -24204,7 +24255,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24204
24255
  }
24205
24256
  closeMenu() {
24206
24257
  this.menuState.isOpen = false;
24207
- this.focus();
24258
+ this.focusDefaultElement();
24208
24259
  }
24209
24260
  }
24210
24261
  Grid.template = "o-spreadsheet-Grid";
@@ -27517,7 +27568,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27517
27568
  * a breaking change is made in the way the state is handled, and an upgrade
27518
27569
  * function should be defined
27519
27570
  */
27520
- const CURRENT_VERSION = 12;
27571
+ const CURRENT_VERSION = 12.5;
27521
27572
  const INITIAL_SHEET_ID = "Sheet1";
27522
27573
  /**
27523
27574
  * This function tries to load anything that could look like a valid
@@ -27783,6 +27834,31 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27783
27834
  return data;
27784
27835
  },
27785
27836
  },
27837
+ {
27838
+ description: "Fix datafilter duplication",
27839
+ from: 12,
27840
+ to: 12.5,
27841
+ applyMigration(data) {
27842
+ for (let sheet of data.sheets || []) {
27843
+ let knownDataFilterZones = [];
27844
+ for (let filterTable of sheet.filterTables || []) {
27845
+ const zone = toZone(filterTable.range);
27846
+ // See commit message for the details
27847
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
27848
+ if (intersectZoneIndex !== -1) {
27849
+ knownDataFilterZones[intersectZoneIndex] = zone;
27850
+ }
27851
+ else {
27852
+ knownDataFilterZones.push(zone);
27853
+ }
27854
+ }
27855
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
27856
+ range: zoneToXc(zone),
27857
+ }));
27858
+ }
27859
+ return data;
27860
+ },
27861
+ },
27786
27862
  ];
27787
27863
  /**
27788
27864
  * This function is used to repair faulty data independently of the migration.
@@ -28440,7 +28516,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28440
28516
  const currentBorder = this.getCellBorder(cmd);
28441
28517
  const areAllNewBordersUndefined = !((_a = cmd.border) === null || _a === void 0 ? void 0 : _a.bottom) && !((_b = cmd.border) === null || _b === void 0 ? void 0 : _b.left) && !((_c = cmd.border) === null || _c === void 0 ? void 0 : _c.right) && !((_d = cmd.border) === null || _d === void 0 ? void 0 : _d.top);
28442
28518
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
28443
- return 88 /* CommandResult.NoChanges */;
28519
+ return 89 /* CommandResult.NoChanges */;
28444
28520
  }
28445
28521
  return 0 /* CommandResult.Success */;
28446
28522
  }
@@ -28547,9 +28623,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28547
28623
  allowDispatch(cmd) {
28548
28624
  switch (cmd.type) {
28549
28625
  case "UPDATE_CELL":
28550
- return this.checkCellOutOfSheet(cmd);
28626
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
28551
28627
  case "CLEAR_CELL":
28552
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
28628
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
28553
28629
  default:
28554
28630
  return 0 /* CommandResult.Success */;
28555
28631
  }
@@ -28715,13 +28791,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28715
28791
  /*
28716
28792
  * Reconstructs the original formula string based on a normalized form and its dependencies
28717
28793
  */
28718
- buildFormulaContent(sheetId, cell, dependencies) {
28794
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
28719
28795
  const ranges = dependencies || cell.dependencies;
28720
28796
  let rangeIndex = 0;
28721
28797
  return concat(cell.compiledFormula.tokens.map((token) => {
28722
28798
  if (token.type === "REFERENCE") {
28723
28799
  const range = ranges[rangeIndex++];
28724
- return this.getters.getRangeString(range, sheetId);
28800
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
28725
28801
  }
28726
28802
  return token.value;
28727
28803
  }));
@@ -28962,9 +29038,21 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28962
29038
  checkUselessClearCell(cmd) {
28963
29039
  const cell = this.getters.getCell(cmd);
28964
29040
  if (!cell)
28965
- return 88 /* CommandResult.NoChanges */;
29041
+ return 89 /* CommandResult.NoChanges */;
28966
29042
  if (!cell.content && !cell.style && !cell.format) {
28967
- return 88 /* CommandResult.NoChanges */;
29043
+ return 89 /* CommandResult.NoChanges */;
29044
+ }
29045
+ return 0 /* CommandResult.Success */;
29046
+ }
29047
+ checkUselessUpdateCell(cmd) {
29048
+ const cell = this.getters.getCell(cmd);
29049
+ const hasContent = "content" in cmd || "formula" in cmd;
29050
+ const hasStyle = "style" in cmd;
29051
+ const hasFormat = "format" in cmd;
29052
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
29053
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
29054
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
29055
+ return 89 /* CommandResult.NoChanges */;
28968
29056
  }
28969
29057
  return 0 /* CommandResult.Success */;
28970
29058
  }
@@ -29173,13 +29261,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29173
29261
  }
29174
29262
  checkChartDuplicate(cmd) {
29175
29263
  return this.getters.getFigureSheetId(cmd.id)
29176
- ? 84 /* CommandResult.DuplicatedChartId */
29264
+ ? 85 /* CommandResult.DuplicatedChartId */
29177
29265
  : 0 /* CommandResult.Success */;
29178
29266
  }
29179
29267
  checkChartExists(cmd) {
29180
29268
  return this.getters.getFigureSheetId(cmd.id)
29181
29269
  ? 0 /* CommandResult.Success */
29182
- : 85 /* CommandResult.ChartDoesNotExist */;
29270
+ : 86 /* CommandResult.ChartDoesNotExist */;
29183
29271
  }
29184
29272
  }
29185
29273
  ChartPlugin.getters = [
@@ -29294,7 +29382,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29294
29382
  }
29295
29383
  }
29296
29384
  exportForExcel(data) {
29297
- this.export(data);
29385
+ if (data.sheets) {
29386
+ for (let sheet of data.sheets) {
29387
+ if (this.cfRules[sheet.id]) {
29388
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
29389
+ }
29390
+ }
29391
+ }
29298
29392
  }
29299
29393
  // ---------------------------------------------------------------------------
29300
29394
  // Getters
@@ -29344,11 +29438,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29344
29438
  // ---------------------------------------------------------------------------
29345
29439
  // Private
29346
29440
  // ---------------------------------------------------------------------------
29347
- mapToConditionalFormat(sheetId, cf) {
29441
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
29348
29442
  return {
29349
29443
  ...cf,
29350
29444
  ranges: cf.ranges.map((range) => {
29351
- return this.getters.getRangeString(range, sheetId);
29445
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
29352
29446
  }),
29353
29447
  };
29354
29448
  }
@@ -29381,10 +29475,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29381
29475
  return 27 /* CommandResult.InvalidSheetId */;
29382
29476
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
29383
29477
  if (ruleIndex === -1)
29384
- return 71 /* CommandResult.InvalidConditionalFormatId */;
29478
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
29385
29479
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
29386
29480
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
29387
- return 71 /* CommandResult.InvalidConditionalFormatId */;
29481
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
29388
29482
  }
29389
29483
  return 0 /* CommandResult.Success */;
29390
29484
  }
@@ -29425,10 +29519,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29425
29519
  const errors = [];
29426
29520
  const isEmpty = (value) => value === undefined || value === "";
29427
29521
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
29428
- errors.push(51 /* CommandResult.FirstArgMissing */);
29522
+ errors.push(52 /* CommandResult.FirstArgMissing */);
29429
29523
  }
29430
29524
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
29431
- errors.push(52 /* CommandResult.SecondArgMissing */);
29525
+ errors.push(53 /* CommandResult.SecondArgMissing */);
29432
29526
  }
29433
29527
  return errors.length ? errors : 0 /* CommandResult.Success */;
29434
29528
  }
@@ -29440,15 +29534,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29440
29534
  (threshold.value === "" || isNaN(threshold.value))) {
29441
29535
  switch (thresholdName) {
29442
29536
  case "min":
29443
- return 53 /* CommandResult.MinNaN */;
29537
+ return 54 /* CommandResult.MinNaN */;
29444
29538
  case "max":
29445
- return 55 /* CommandResult.MaxNaN */;
29539
+ return 56 /* CommandResult.MaxNaN */;
29446
29540
  case "mid":
29447
- return 54 /* CommandResult.MidNaN */;
29541
+ return 55 /* CommandResult.MidNaN */;
29448
29542
  case "upperInflectionPoint":
29449
- return 56 /* CommandResult.ValueUpperInflectionNaN */;
29543
+ return 57 /* CommandResult.ValueUpperInflectionNaN */;
29450
29544
  case "lowerInflectionPoint":
29451
- return 57 /* CommandResult.ValueLowerInflectionNaN */;
29545
+ return 58 /* CommandResult.ValueLowerInflectionNaN */;
29452
29546
  }
29453
29547
  }
29454
29548
  return 0 /* CommandResult.Success */;
@@ -29462,15 +29556,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29462
29556
  catch (error) {
29463
29557
  switch (thresholdName) {
29464
29558
  case "min":
29465
- return 58 /* CommandResult.MinInvalidFormula */;
29559
+ return 59 /* CommandResult.MinInvalidFormula */;
29466
29560
  case "max":
29467
- return 60 /* CommandResult.MaxInvalidFormula */;
29561
+ return 61 /* CommandResult.MaxInvalidFormula */;
29468
29562
  case "mid":
29469
- return 59 /* CommandResult.MidInvalidFormula */;
29563
+ return 60 /* CommandResult.MidInvalidFormula */;
29470
29564
  case "upperInflectionPoint":
29471
- return 61 /* CommandResult.ValueUpperInvalidFormula */;
29565
+ return 62 /* CommandResult.ValueUpperInvalidFormula */;
29472
29566
  case "lowerInflectionPoint":
29473
- return 62 /* CommandResult.ValueLowerInvalidFormula */;
29567
+ return 63 /* CommandResult.ValueLowerInvalidFormula */;
29474
29568
  }
29475
29569
  }
29476
29570
  return 0 /* CommandResult.Success */;
@@ -29487,7 +29581,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29487
29581
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
29488
29582
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
29489
29583
  Number(minValue) > Number(maxValue)) {
29490
- return 48 /* CommandResult.LowerBiggerThanUpper */;
29584
+ return 49 /* CommandResult.LowerBiggerThanUpper */;
29491
29585
  }
29492
29586
  return 0 /* CommandResult.Success */;
29493
29587
  }
@@ -29497,7 +29591,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29497
29591
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
29498
29592
  rule.minimum.type === rule.maximum.type &&
29499
29593
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
29500
- return 47 /* CommandResult.MinBiggerThanMax */;
29594
+ return 48 /* CommandResult.MinBiggerThanMax */;
29501
29595
  }
29502
29596
  return 0 /* CommandResult.Success */;
29503
29597
  }
@@ -29509,7 +29603,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29509
29603
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
29510
29604
  rule.midpoint.type === rule.maximum.type &&
29511
29605
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
29512
- return 49 /* CommandResult.MidBiggerThanMax */;
29606
+ return 50 /* CommandResult.MidBiggerThanMax */;
29513
29607
  }
29514
29608
  return 0 /* CommandResult.Success */;
29515
29609
  }
@@ -29521,7 +29615,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29521
29615
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
29522
29616
  rule.minimum.type === rule.midpoint.type &&
29523
29617
  stringToNumber(minValue) >= stringToNumber(midValue)) {
29524
- return 50 /* CommandResult.MinBiggerThanMid */;
29618
+ return 51 /* CommandResult.MinBiggerThanMid */;
29525
29619
  }
29526
29620
  return 0 /* CommandResult.Success */;
29527
29621
  }
@@ -29622,13 +29716,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29622
29716
  checkFigureExists(sheetId, figureId) {
29623
29717
  var _a;
29624
29718
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
29625
- return 70 /* CommandResult.FigureDoesNotExist */;
29719
+ return 71 /* CommandResult.FigureDoesNotExist */;
29626
29720
  }
29627
29721
  return 0 /* CommandResult.Success */;
29628
29722
  }
29629
29723
  checkFigureDuplicate(figureId) {
29630
29724
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
29631
- return 82 /* CommandResult.DuplicatedFigureId */;
29725
+ return 83 /* CommandResult.DuplicatedFigureId */;
29632
29726
  }
29633
29727
  return 0 /* CommandResult.Success */;
29634
29728
  }
@@ -29730,12 +29824,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29730
29824
  switch (cmd.type) {
29731
29825
  case "CREATE_FILTER_TABLE":
29732
29826
  if (!areZonesContinuous(...cmd.target)) {
29733
- return 81 /* CommandResult.NonContinuousTargets */;
29827
+ return 82 /* CommandResult.NonContinuousTargets */;
29734
29828
  }
29735
29829
  const zone = union(...cmd.target);
29736
29830
  const checkFilterOverlap = () => {
29737
29831
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
29738
- return 78 /* CommandResult.FilterOverlap */;
29832
+ return 79 /* CommandResult.FilterOverlap */;
29739
29833
  }
29740
29834
  return 0 /* CommandResult.Success */;
29741
29835
  };
@@ -29743,7 +29837,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29743
29837
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
29744
29838
  for (let merge of mergesInTarget) {
29745
29839
  if (overlap(zone, merge)) {
29746
- return 80 /* CommandResult.MergeInFilter */;
29840
+ return 81 /* CommandResult.MergeInFilter */;
29747
29841
  }
29748
29842
  }
29749
29843
  return 0 /* CommandResult.Success */;
@@ -29753,7 +29847,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29753
29847
  for (let merge of cmd.target) {
29754
29848
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
29755
29849
  if (overlap(filterTable.zone, merge)) {
29756
- return 80 /* CommandResult.MergeInFilter */;
29850
+ return 81 /* CommandResult.MergeInFilter */;
29757
29851
  }
29758
29852
  }
29759
29853
  }
@@ -30253,10 +30347,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30253
30347
  : this.getters.getNumberRows(cmd.sheetId);
30254
30348
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
30255
30349
  if (hiddenElements.size >= elements) {
30256
- return 66 /* CommandResult.TooManyHiddenElements */;
30350
+ return 67 /* CommandResult.TooManyHiddenElements */;
30257
30351
  }
30258
30352
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30259
- return 86 /* CommandResult.InvalidHeaderIndex */;
30353
+ return 87 /* CommandResult.InvalidHeaderIndex */;
30260
30354
  }
30261
30355
  else {
30262
30356
  return 0 /* CommandResult.Success */;
@@ -30782,7 +30876,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30782
30876
  for (const zone of target) {
30783
30877
  for (const zone2 of target) {
30784
30878
  if (zone !== zone2 && overlap(zone, zone2)) {
30785
- return 65 /* CommandResult.MergeOverlap */;
30879
+ return 66 /* CommandResult.MergeOverlap */;
30786
30880
  }
30787
30881
  }
30788
30882
  }
@@ -30796,7 +30890,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30796
30890
  for (const zone of target) {
30797
30891
  if ((zone.left < xSplit && zone.right >= xSplit) ||
30798
30892
  (zone.top < ySplit && zone.bottom >= ySplit)) {
30799
- return 75 /* CommandResult.FrozenPaneOverlap */;
30893
+ return 76 /* CommandResult.FrozenPaneOverlap */;
30800
30894
  }
30801
30895
  }
30802
30896
  return 0 /* CommandResult.Success */;
@@ -31259,8 +31353,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31259
31353
  *
31260
31354
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
31261
31355
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
31356
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
31262
31357
  */
31263
- getRangeString(range, forSheetId) {
31358
+ getRangeString(range, forSheetId, useFixedZone = false) {
31264
31359
  if (!range) {
31265
31360
  return INCORRECT_RANGE_STRING;
31266
31361
  }
@@ -31287,7 +31382,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31287
31382
  if (prefixSheet && !sheetName) {
31288
31383
  return INCORRECT_RANGE_STRING;
31289
31384
  }
31290
- let rangeString = this.getRangePartString(rangeImpl, 0);
31385
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
31291
31386
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
31292
31387
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
31293
31388
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -31297,7 +31392,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31297
31392
  rangeImpl.parts[1].rowFixed ||
31298
31393
  rangeImpl.parts[1].colFixed) {
31299
31394
  rangeString += ":";
31300
- rangeString += this.getRangePartString(rangeImpl, 1);
31395
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
31301
31396
  }
31302
31397
  }
31303
31398
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -31327,13 +31422,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31327
31422
  /**
31328
31423
  * Get a Xc string that represent a part of a range
31329
31424
  */
31330
- getRangePartString(range, part) {
31331
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
31425
+ getRangePartString(range, part, useFixedZone = false) {
31426
+ var _a, _b;
31427
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
31332
31428
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
31333
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
31429
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
31334
31430
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
31335
31431
  let str = "";
31336
- if (range.isFullCol) {
31432
+ if (range.isFullCol && !useFixedZone) {
31337
31433
  if (part === 0 && range.unboundedZone.hasHeader) {
31338
31434
  str = colFixed + col + rowFixed + row;
31339
31435
  }
@@ -31341,7 +31437,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31341
31437
  str = colFixed + col;
31342
31438
  }
31343
31439
  }
31344
- else if (range.isFullRow) {
31440
+ else if (range.isFullRow && !useFixedZone) {
31345
31441
  if (part === 0 && range.unboundedZone.hasHeader) {
31346
31442
  str = colFixed + col + rowFixed + row;
31347
31443
  }
@@ -31429,10 +31525,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31429
31525
  ? this.getNumberCols(cmd.sheetId)
31430
31526
  : this.getNumberRows(cmd.sheetId);
31431
31527
  if (cmd.base < 0 || cmd.base >= elements) {
31432
- return 86 /* CommandResult.InvalidHeaderIndex */;
31528
+ return 87 /* CommandResult.InvalidHeaderIndex */;
31433
31529
  }
31434
31530
  else if (cmd.quantity <= 0) {
31435
- return 87 /* CommandResult.InvalidQuantity */;
31531
+ return 88 /* CommandResult.InvalidQuantity */;
31436
31532
  }
31437
31533
  return 0 /* CommandResult.Success */;
31438
31534
  case "REMOVE_COLUMNS_ROWS": {
@@ -31440,7 +31536,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31440
31536
  ? this.getNumberCols(cmd.sheetId)
31441
31537
  : this.getNumberRows(cmd.sheetId);
31442
31538
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31443
- return 86 /* CommandResult.InvalidHeaderIndex */;
31539
+ return 87 /* CommandResult.InvalidHeaderIndex */;
31444
31540
  }
31445
31541
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
31446
31542
  return 8 /* CommandResult.NotEnoughElements */;
@@ -31884,18 +31980,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31884
31980
  checkRowFreezeQuantity(cmd) {
31885
31981
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
31886
31982
  ? 0 /* CommandResult.Success */
31887
- : 74 /* CommandResult.InvalidFreezeQuantity */;
31983
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
31888
31984
  }
31889
31985
  checkColFreezeQuantity(cmd) {
31890
31986
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
31891
31987
  ? 0 /* CommandResult.Success */
31892
- : 74 /* CommandResult.InvalidFreezeQuantity */;
31988
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
31893
31989
  }
31894
31990
  checkRowFreezeOverlapMerge(cmd) {
31895
31991
  const merges = this.getters.getMerges(cmd.sheetId);
31896
31992
  for (let merge of merges) {
31897
31993
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
31898
- return 65 /* CommandResult.MergeOverlap */;
31994
+ return 66 /* CommandResult.MergeOverlap */;
31899
31995
  }
31900
31996
  }
31901
31997
  return 0 /* CommandResult.Success */;
@@ -31904,7 +32000,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31904
32000
  const merges = this.getters.getMerges(cmd.sheetId);
31905
32001
  for (let merge of merges) {
31906
32002
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
31907
- return 65 /* CommandResult.MergeOverlap */;
32003
+ return 66 /* CommandResult.MergeOverlap */;
31908
32004
  }
31909
32005
  }
31910
32006
  return 0 /* CommandResult.Success */;
@@ -32641,10 +32737,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32641
32737
  * that are actually present in the grid.
32642
32738
  */
32643
32739
  function range(range) {
32740
+ assertRangeValid(range);
32644
32741
  const sheetId = range.sheetId;
32645
- if (!isZoneValid(range.zone)) {
32646
- throw new InvalidReferenceError();
32647
- }
32648
32742
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32649
32743
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32650
32744
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32679,23 +32773,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32679
32773
  * The `compute` of the formula's function must process it completely
32680
32774
  */
32681
32775
  function refFn(range, isMeta, functionName, paramNumber) {
32776
+ assertRangeValid(range);
32682
32777
  if (isMeta) {
32683
32778
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32684
32779
  return { value: zoneToXc(range.zone) };
32685
32780
  }
32686
- if (!isZoneValid(range.zone)) {
32687
- throw new InvalidReferenceError();
32688
- }
32689
32781
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32690
32782
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32691
32783
  throw new Error(paramNumber
32692
32784
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32693
32785
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32694
32786
  }
32787
+ return readCell(range);
32788
+ }
32789
+ function assertRangeValid(range) {
32790
+ if (!isZoneValid(range.zone)) {
32791
+ throw new InvalidReferenceError();
32792
+ }
32695
32793
  if (range.invalidSheetName) {
32696
32794
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32697
32795
  }
32698
- return readCell(range);
32699
32796
  }
32700
32797
  return [refFn, range, evalContext];
32701
32798
  }
@@ -32715,6 +32812,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32715
32812
  if (cell.format !== evaluatedCell.format) {
32716
32813
  exportedCellData.computedFormat = evaluatedCell.format;
32717
32814
  }
32815
+ // if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
32816
+ if (cell.isFormula && cell.dependencies.length) {
32817
+ exportedCellData.content = this.getters.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
32818
+ }
32718
32819
  }
32719
32820
  }
32720
32821
  }
@@ -33194,7 +33295,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
33194
33295
  switch (cmd.type) {
33195
33296
  case "UPDATE_FILTER":
33196
33297
  if (!this.getters.getFilterId(cmd)) {
33197
- return 79 /* CommandResult.FilterNotFound */;
33298
+ return 80 /* CommandResult.FilterNotFound */;
33198
33299
  }
33199
33300
  break;
33200
33301
  }
@@ -34140,7 +34241,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34140
34241
  }
34141
34242
  checkPositiveDimension(cmd) {
34142
34243
  if (cmd.width < 0 || cmd.height < 0) {
34143
- return 68 /* CommandResult.InvalidViewportSize */;
34244
+ return 69 /* CommandResult.InvalidViewportSize */;
34144
34245
  }
34145
34246
  return 0 /* CommandResult.Success */;
34146
34247
  }
@@ -34150,7 +34251,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34150
34251
  cmd.gridOffsetY === this.gridOffsetY &&
34151
34252
  cmd.width === width &&
34152
34253
  cmd.height === height) {
34153
- return 76 /* CommandResult.ValuesNotChanged */;
34254
+ return 77 /* CommandResult.ValuesNotChanged */;
34154
34255
  }
34155
34256
  return 0 /* CommandResult.Success */;
34156
34257
  }
@@ -34158,7 +34259,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34158
34259
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
34159
34260
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
34160
34261
  (!pane.canScrollVertically && offsetY > 0)) {
34161
- return 69 /* CommandResult.InvalidScrollingDirection */;
34262
+ return 70 /* CommandResult.InvalidScrollingDirection */;
34162
34263
  }
34163
34264
  return 0 /* CommandResult.Success */;
34164
34265
  }
@@ -34414,7 +34515,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34414
34515
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
34415
34516
  return 0 /* CommandResult.Success */;
34416
34517
  }
34417
- return 45 /* CommandResult.InvalidAutofillSelection */;
34518
+ return 46 /* CommandResult.InvalidAutofillSelection */;
34418
34519
  case "AUTOFILL_AUTO":
34419
34520
  const zone = this.getters.getSelectedZone();
34420
34521
  return zone.top === zone.bottom
@@ -34575,8 +34676,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34575
34676
  let row = zone.bottom;
34576
34677
  if (col > 0) {
34577
34678
  let leftPosition = { sheetId, col: col - 1, row };
34578
- while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
34579
- ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content)) {
34679
+ while ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content) {
34580
34680
  row += 1;
34581
34681
  leftPosition = { sheetId, col: col - 1, row };
34582
34682
  }
@@ -34585,8 +34685,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34585
34685
  col = zone.right;
34586
34686
  if (col <= this.getters.getNumberCols(sheetId)) {
34587
34687
  let rightPosition = { sheetId, col: col + 1, row };
34588
- while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
34589
- ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content)) {
34688
+ while ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content) {
34590
34689
  row += 1;
34591
34690
  rightPosition = { sheetId, col: col + 1, row };
34592
34691
  }
@@ -35016,7 +35115,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35016
35115
  cellPopoverRegistry.get(cmd.popoverType);
35017
35116
  }
35018
35117
  catch (error) {
35019
- return 72 /* CommandResult.InvalidCellPopover */;
35118
+ return 73 /* CommandResult.InvalidCellPopover */;
35020
35119
  }
35021
35120
  return 0 /* CommandResult.Success */;
35022
35121
  default:
@@ -36219,21 +36318,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36219
36318
  // ---------------------------------------------------------------------------
36220
36319
  // Command Handling
36221
36320
  // ---------------------------------------------------------------------------
36222
- allowDispatch(cmd) {
36223
- switch (cmd.type) {
36224
- case "ADD_EMPTY_RANGE":
36225
- if (this.inputHasSingleRange && this.ranges.length === 1) {
36226
- return 30 /* CommandResult.MaximumRangesReached */;
36227
- }
36228
- break;
36229
- case "CHANGE_RANGE":
36230
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
36231
- return 30 /* CommandResult.MaximumRangesReached */;
36232
- }
36233
- break;
36234
- }
36235
- return 0 /* CommandResult.Success */;
36236
- }
36237
36321
  handleEvent(event) {
36238
36322
  const xc = zoneToXc(event.anchor.zone);
36239
36323
  const inputSheetId = this.activeSheet;
@@ -36293,9 +36377,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36293
36377
  }
36294
36378
  }
36295
36379
  }
36296
- unsubscribe() {
36297
- this.unfocus();
36298
- }
36299
36380
  // ---------------------------------------------------------------------------
36300
36381
  // Getters || only callable by the parent
36301
36382
  // ---------------------------------------------------------------------------
@@ -36445,6 +36526,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36445
36526
  // ---------------------------------------------------------------------------
36446
36527
  allowDispatch(cmd) {
36447
36528
  var _a, _b;
36529
+ switch (cmd.type) {
36530
+ case "FOCUS_RANGE":
36531
+ case "CHANGE_RANGE":
36532
+ case "ADD_EMPTY_RANGE":
36533
+ case "REMOVE_RANGE":
36534
+ if (!this.inputs[cmd.id]) {
36535
+ return 31 /* CommandResult.InvalidInputId */;
36536
+ }
36537
+ }
36448
36538
  switch (cmd.type) {
36449
36539
  case "FOCUS_RANGE":
36450
36540
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -36452,9 +36542,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36452
36542
  return 29 /* CommandResult.InputAlreadyFocused */;
36453
36543
  }
36454
36544
  break;
36455
- }
36456
- if (this.currentInput) {
36457
- return this.currentInput.allowDispatch(cmd);
36545
+ case "ADD_EMPTY_RANGE":
36546
+ const input = this.inputs[cmd.id];
36547
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
36548
+ return 30 /* CommandResult.MaximumRangesReached */;
36549
+ }
36550
+ break;
36551
+ case "CHANGE_RANGE": {
36552
+ const input = this.inputs[cmd.id];
36553
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
36554
+ return 30 /* CommandResult.MaximumRangesReached */;
36555
+ }
36556
+ break;
36557
+ }
36458
36558
  }
36459
36559
  return 0 /* CommandResult.Success */;
36460
36560
  }
@@ -36483,9 +36583,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36483
36583
  break;
36484
36584
  case "FOCUS_RANGE":
36485
36585
  case "CHANGE_RANGE":
36486
- if (cmd.id !== this.focusedInputId) {
36487
- const input = this.inputs[cmd.id];
36488
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
36586
+ const input = this.inputs[cmd.id];
36587
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
36588
+ if (range) {
36489
36589
  const sheetId = this.getters.getActiveSheetId();
36490
36590
  const zone = this.getters.getRangeFromSheetXC(sheetId, (range === null || range === void 0 ? void 0 : range.xc) || "A1").zone;
36491
36591
  this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
@@ -36495,9 +36595,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36495
36595
  }
36496
36596
  (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.handle(cmd);
36497
36597
  }
36498
- unsubscribe() {
36499
- this.unfocus();
36500
- }
36501
36598
  // ---------------------------------------------------------------------------
36502
36599
  // Getters
36503
36600
  // ---------------------------------------------------------------------------
@@ -37437,7 +37534,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37437
37534
  /*Test the presence of single cells*/
37438
37535
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
37439
37536
  if (singleCells) {
37440
- return 63 /* CommandResult.InvalidSortZone */;
37537
+ return 64 /* CommandResult.InvalidSortZone */;
37441
37538
  }
37442
37539
  return 0 /* CommandResult.Success */;
37443
37540
  }
@@ -37456,7 +37553,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37456
37553
  ];
37457
37554
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37458
37555
  })) {
37459
- return 63 /* CommandResult.InvalidSortZone */;
37556
+ return 64 /* CommandResult.InvalidSortZone */;
37460
37557
  }
37461
37558
  return 0 /* CommandResult.Success */;
37462
37559
  }
@@ -38084,7 +38181,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
38084
38181
  for (const zone of this.getPasteZones(target)) {
38085
38182
  if ((zone.left < xSplit && zone.right >= xSplit) ||
38086
38183
  (zone.top < ySplit && zone.bottom >= ySplit)) {
38087
- return 75 /* CommandResult.FrozenPaneOverlap */;
38184
+ return 76 /* CommandResult.FrozenPaneOverlap */;
38088
38185
  }
38089
38186
  }
38090
38187
  return 0 /* CommandResult.Success */;
@@ -38472,7 +38569,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
38472
38569
  }
38473
38570
  isPasteAllowed(target, option) {
38474
38571
  if (target.length === 0) {
38475
- return 73 /* CommandResult.EmptyTarget */;
38572
+ return 74 /* CommandResult.EmptyTarget */;
38476
38573
  }
38477
38574
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
38478
38575
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -39383,7 +39480,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39383
39480
  const headers = [cmd.base, ...cmd.elements];
39384
39481
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
39385
39482
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
39386
- return 86 /* CommandResult.InvalidHeaderIndex */;
39483
+ return 87 /* CommandResult.InvalidHeaderIndex */;
39387
39484
  }
39388
39485
  return 0 /* CommandResult.Success */;
39389
39486
  }
@@ -39568,6 +39665,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39568
39665
  }
39569
39666
  }
39570
39667
 
39668
+ class FocusableElement {
39669
+ constructor() {
39670
+ this.focusableElement = undefined;
39671
+ }
39672
+ setFocusableElement(element) {
39673
+ this.focusableElement = element;
39674
+ }
39675
+ focus() {
39676
+ var _a;
39677
+ (_a = this.focusableElement) === null || _a === void 0 ? void 0 : _a.focus();
39678
+ }
39679
+ }
39680
+
39571
39681
  // -----------------------------------------------------------------------------
39572
39682
  // SpreadSheet
39573
39683
  // -----------------------------------------------------------------------------
@@ -40191,7 +40301,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40191
40301
  };
40192
40302
  function interactiveAddMerge(env, sheetId, target) {
40193
40303
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
40194
- if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
40304
+ if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
40195
40305
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
40196
40306
  }
40197
40307
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40811,8 +40921,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40811
40921
  &.corner {
40812
40922
  right: 0px;
40813
40923
  bottom: 0px;
40814
- height: ${SCROLLBAR_WIDTH$1}px;
40815
- width: ${SCROLLBAR_WIDTH$1}px;
40924
+ height: ${SCROLLBAR_WIDTH}px;
40925
+ width: ${SCROLLBAR_WIDTH}px;
40816
40926
  border-top: 1px solid #e2e3e3;
40817
40927
  border-left: 1px solid #e2e3e3;
40818
40928
  }
@@ -40859,6 +40969,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40859
40969
  toggleSidePanel: this.toggleSidePanel.bind(this),
40860
40970
  _t: Spreadsheet._t,
40861
40971
  clipboard: this.env.clipboard || instantiateClipboard(),
40972
+ focusableElement: new FocusableElement(),
40862
40973
  });
40863
40974
  owl.useExternalListener(window, "resize", () => this.render(true));
40864
40975
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -40957,17 +41068,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40957
41068
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40958
41069
  this.composer.topBarFocus = "contentFocus";
40959
41070
  this.composer.gridFocusMode = "inactive";
40960
- this.setComposerContent({ selection } || {});
41071
+ this.setComposerContent({ selection });
40961
41072
  }
40962
- onGridComposerContentFocused() {
41073
+ onGridComposerContentFocused(selection) {
40963
41074
  if (this.model.getters.isReadonly()) {
40964
41075
  return;
40965
41076
  }
40966
41077
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40967
41078
  this.composer.topBarFocus = "inactive";
40968
41079
  this.composer.gridFocusMode = "contentFocus";
40969
- this.setComposerContent({});
41080
+ this.setComposerContent({ selection });
40970
41081
  }
41082
+ // TODO: either both are defined or none of them. change those args to an object
40971
41083
  onGridComposerCellFocused(content, selection) {
40972
41084
  if (this.model.getters.isReadonly()) {
40973
41085
  return;
@@ -41948,18 +42060,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41948
42060
  if (this.observers.find((sub) => sub.owner === owner)) {
41949
42061
  throw new Error("You are already subscribed forever");
41950
42062
  }
41951
- if ((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) {
42063
+ if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) && this.mainSubscription.owner !== owner) {
41952
42064
  (_c = (_b = this.mainSubscription.callbacks).release) === null || _c === void 0 ? void 0 : _c.call(_b);
41953
42065
  }
41954
42066
  this.mainSubscription = { owner, callbacks };
41955
42067
  }
41956
42068
  release(owner) {
41957
- var _a, _b, _c, _d;
42069
+ var _a;
41958
42070
  if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) !== owner ||
41959
42071
  this.observers.find((sub) => sub.owner === owner)) {
41960
42072
  return;
41961
42073
  }
41962
- (_d = (_b = this.mainSubscription) === null || _b === void 0 ? void 0 : (_c = _b.callbacks).release) === null || _d === void 0 ? void 0 : _d.call(_c);
41963
42074
  this.mainSubscription = this.defaultSubscription;
41964
42075
  }
41965
42076
  /**
@@ -42066,7 +42177,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42066
42177
  */
42067
42178
  moveAnchorCell(direction, step = 1) {
42068
42179
  if (step !== "end" && step <= 0) {
42069
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
42180
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
42070
42181
  }
42071
42182
  const { col, row } = this.getNextAvailablePosition(direction, step);
42072
42183
  return this.selectCell(col, row);
@@ -42112,7 +42223,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42112
42223
  */
42113
42224
  resizeAnchorZone(direction, step = 1) {
42114
42225
  if (step !== "end" && step <= 0) {
42115
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
42226
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
42116
42227
  }
42117
42228
  const sheetId = this.getters.getActiveSheetId();
42118
42229
  const anchor = this.anchor;
@@ -42427,11 +42538,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42427
42538
  * next cluster if the given cell is outside a cluster or at the border of a cluster in the given direction.
42428
42539
  */
42429
42540
  getEndOfCluster(startPosition, dim, dir) {
42430
- const sheet = this.getters.getActiveSheet();
42431
42541
  let currentPosition = startPosition;
42432
42542
  // If both the current cell and the next cell are not empty, we want to go to the end of the cluster
42433
42543
  const nextCellPosition = this.getNextCellPosition(startPosition, dim, dir);
42434
- let mode = !this.isCellEmpty(currentPosition, sheet.id) && !this.isCellEmpty(nextCellPosition, sheet.id)
42544
+ let mode = !this.isEvaluatedCellEmpty(currentPosition) && !this.isEvaluatedCellEmpty(nextCellPosition)
42435
42545
  ? "endOfCluster"
42436
42546
  : "nextCluster";
42437
42547
  while (true) {
@@ -42441,7 +42551,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42441
42551
  currentPosition.row === nextCellPosition.row) {
42442
42552
  break;
42443
42553
  }
42444
- const isNextCellEmpty = this.isCellEmpty(nextCellPosition, sheet.id);
42554
+ const isNextCellEmpty = this.isEvaluatedCellEmpty(nextCellPosition);
42445
42555
  if (mode === "endOfCluster" && isNextCellEmpty) {
42446
42556
  break;
42447
42557
  }
@@ -42455,14 +42565,25 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42455
42565
  return dim === "cols" ? currentPosition.col : currentPosition.row;
42456
42566
  }
42457
42567
  /**
42458
- * Check if a cell is empty or undefined in the model. If the cell is part of a merge,
42459
- * check if the merge containing the cell is empty.
42568
+ * Check if a cell evaluated value is empty. If the cell is part of a merge,
42569
+ * the check applies to the main cell of the merge.
42460
42570
  */
42461
- isCellEmpty({ col, row }, sheetId = this.getters.getActiveSheetId()) {
42571
+ isEvaluatedCellEmpty({ col, row }) {
42572
+ const sheetId = this.getters.getActiveSheetId();
42462
42573
  const position = this.getters.getMainCellPosition({ sheetId, col, row });
42463
42574
  const cell = this.getters.getEvaluatedCell(position);
42464
42575
  return cell.type === CellValueType.empty;
42465
42576
  }
42577
+ /**
42578
+ * Checks if a cell is empty (i.e. does not have a content). If the cell is part of a merge,
42579
+ * the check applies to the main cell of the merge.
42580
+ */
42581
+ isCellEmpty({ col, row }) {
42582
+ var _a;
42583
+ const sheetId = this.getters.getActiveSheetId();
42584
+ const position = this.getters.getMainCellPosition({ sheetId, col, row });
42585
+ return !((_a = this.getters.getCell(position)) === null || _a === void 0 ? void 0 : _a.content);
42586
+ }
42466
42587
  /** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
42467
42588
  *
42468
42589
  * This has the same behaviour as getNextAvailablePosition() for certain arguments, but use this method instead
@@ -42941,12 +43062,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42941
43062
  attrs.push(["t", "str"]);
42942
43063
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
42943
43064
  }
42944
- node = escapeXml /*xml*/ `
42945
- <f>
42946
- ${XlsxFormula}
42947
- </f>
42948
- ${cycle}
42949
- `;
43065
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
42950
43066
  return { attrs, node };
42951
43067
  }
42952
43068
  else {
@@ -43687,11 +43803,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43687
43803
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
43688
43804
  }
43689
43805
  attributes.push(...additionalAttrs);
43690
- cellNodes.push(escapeXml /*xml*/ `
43691
- <c ${formatAttributes(attributes)}>
43692
- ${cellNode}
43693
- </c>
43694
- `);
43806
+ // prettier-ignore
43807
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
43808
+ ${cellNode}
43809
+ </c>`);
43695
43810
  }
43696
43811
  }
43697
43812
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -44072,10 +44187,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44072
44187
  const command = { ...payload, type };
44073
44188
  let status = this.status;
44074
44189
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
44075
- return new DispatchResult(67 /* CommandResult.Readonly */);
44190
+ return new DispatchResult(68 /* CommandResult.Readonly */);
44076
44191
  }
44077
44192
  if (!this.session.canApplyOptimisticUpdate()) {
44078
- return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
44193
+ return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
44079
44194
  }
44080
44195
  switch (status) {
44081
44196
  case 0 /* Status.Ready */:
@@ -44448,7 +44563,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44448
44563
  BOTTOMBAR_HEIGHT,
44449
44564
  DEFAULT_CELL_WIDTH,
44450
44565
  DEFAULT_CELL_HEIGHT,
44451
- SCROLLBAR_WIDTH: SCROLLBAR_WIDTH$1,
44566
+ SCROLLBAR_WIDTH,
44452
44567
  };
44453
44568
  const registries = {
44454
44569
  autofillModifiersRegistry,
@@ -44565,9 +44680,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44565
44680
  Object.defineProperty(exports, '__esModule', { value: true });
44566
44681
 
44567
44682
 
44568
- __info__.version = '16.1.31';
44569
- __info__.date = '2024-01-12T13:42:11.001Z';
44570
- __info__.hash = 'f51befa';
44683
+ __info__.version = '16.1.36';
44684
+ __info__.date = '2024-02-16T14:16:11.082Z';
44685
+ __info__.hash = 'ad5301c';
44571
44686
 
44572
44687
 
44573
44688
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);