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