@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.
@@ -207,7 +207,7 @@ const TOPBAR_HEIGHT = 63;
207
207
  const BOTTOMBAR_HEIGHT = 36;
208
208
  const DEFAULT_CELL_WIDTH = 96;
209
209
  const DEFAULT_CELL_HEIGHT = 23;
210
- const SCROLLBAR_WIDTH$1 = 15;
210
+ const SCROLLBAR_WIDTH = 15;
211
211
  const AUTOFILL_EDGE_LENGTH = 8;
212
212
  const ICON_EDGE_LENGTH = 18;
213
213
  const UNHIDE_ICON_EDGE_LENGTH = 14;
@@ -913,7 +913,7 @@ function isBoolean(str) {
913
913
  function isDateTime(str) {
914
914
  return parseDateTime(str) !== null;
915
915
  }
916
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
916
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
917
917
  //link must start with http or https
918
918
  //https://stackoverflow.com/a/3809435/4760614
919
919
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -1676,6 +1676,9 @@ function parseFormat(formatString) {
1676
1676
  function formatValue(value, format) {
1677
1677
  switch (typeof value) {
1678
1678
  case "string":
1679
+ if (value.includes('\\"')) {
1680
+ return value.replace(/\\"/g, '"');
1681
+ }
1679
1682
  return value;
1680
1683
  case "boolean":
1681
1684
  return value ? "TRUE" : "FALSE";
@@ -2005,27 +2008,30 @@ function detectFormat(content) {
2005
2008
  }
2006
2009
  function createLargeNumberFormat(format, magnitude, postFix) {
2007
2010
  const internalFormat = parseFormat(format || "#,##0");
2008
- const largeNumberFormat = internalFormat
2009
- .map((formatPart) => {
2010
- if (formatPart.type === "NUMBER") {
2011
- return [
2012
- {
2013
- ...formatPart,
2014
- format: {
2015
- ...formatPart.format,
2016
- magnitude,
2017
- decimalPart: undefined,
2018
- },
2019
- },
2020
- {
2021
- type: "STRING",
2022
- format: postFix,
2023
- },
2024
- ];
2011
+ const largeNumberFormat = [];
2012
+ for (let i = 0; i < internalFormat.length; i++) {
2013
+ const formatPart = internalFormat[i];
2014
+ if (formatPart.type !== "NUMBER") {
2015
+ largeNumberFormat.push(formatPart);
2016
+ continue;
2025
2017
  }
2026
- return formatPart;
2027
- })
2028
- .flat();
2018
+ largeNumberFormat.push({
2019
+ ...formatPart,
2020
+ format: {
2021
+ ...formatPart.format,
2022
+ magnitude,
2023
+ decimalPart: undefined,
2024
+ },
2025
+ });
2026
+ largeNumberFormat.push({
2027
+ type: "STRING",
2028
+ format: postFix,
2029
+ });
2030
+ const nextFormatPart = internalFormat[i + 1];
2031
+ if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2032
+ i++;
2033
+ }
2034
+ }
2029
2035
  return convertInternalFormatToFormat(largeNumberFormat);
2030
2036
  }
2031
2037
  function changeDecimalPlaces(format, step) {
@@ -3670,64 +3676,65 @@ exports.CommandResult = void 0;
3670
3676
  CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
3671
3677
  CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
3672
3678
  CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
3673
- CommandResult[CommandResult["InvalidChartDefinition"] = 31] = "InvalidChartDefinition";
3674
- CommandResult[CommandResult["InvalidDataSet"] = 32] = "InvalidDataSet";
3675
- CommandResult[CommandResult["InvalidLabelRange"] = 33] = "InvalidLabelRange";
3676
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 34] = "InvalidScorecardKeyValue";
3677
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 35] = "InvalidScorecardBaseline";
3678
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 36] = "InvalidGaugeDataRange";
3679
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 37] = "EmptyGaugeRangeMin";
3680
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 38] = "GaugeRangeMinNaN";
3681
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 39] = "EmptyGaugeRangeMax";
3682
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 40] = "GaugeRangeMaxNaN";
3683
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 41] = "GaugeRangeMinBiggerThanRangeMax";
3684
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 42] = "GaugeLowerInflectionPointNaN";
3685
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 43] = "GaugeUpperInflectionPointNaN";
3686
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 44] = "GaugeLowerBiggerThanUpper";
3687
- CommandResult[CommandResult["InvalidAutofillSelection"] = 45] = "InvalidAutofillSelection";
3688
- CommandResult[CommandResult["WrongComposerSelection"] = 46] = "WrongComposerSelection";
3689
- CommandResult[CommandResult["MinBiggerThanMax"] = 47] = "MinBiggerThanMax";
3690
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 48] = "LowerBiggerThanUpper";
3691
- CommandResult[CommandResult["MidBiggerThanMax"] = 49] = "MidBiggerThanMax";
3692
- CommandResult[CommandResult["MinBiggerThanMid"] = 50] = "MinBiggerThanMid";
3693
- CommandResult[CommandResult["FirstArgMissing"] = 51] = "FirstArgMissing";
3694
- CommandResult[CommandResult["SecondArgMissing"] = 52] = "SecondArgMissing";
3695
- CommandResult[CommandResult["MinNaN"] = 53] = "MinNaN";
3696
- CommandResult[CommandResult["MidNaN"] = 54] = "MidNaN";
3697
- CommandResult[CommandResult["MaxNaN"] = 55] = "MaxNaN";
3698
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 56] = "ValueUpperInflectionNaN";
3699
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 57] = "ValueLowerInflectionNaN";
3700
- CommandResult[CommandResult["MinInvalidFormula"] = 58] = "MinInvalidFormula";
3701
- CommandResult[CommandResult["MidInvalidFormula"] = 59] = "MidInvalidFormula";
3702
- CommandResult[CommandResult["MaxInvalidFormula"] = 60] = "MaxInvalidFormula";
3703
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 61] = "ValueUpperInvalidFormula";
3704
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 62] = "ValueLowerInvalidFormula";
3705
- CommandResult[CommandResult["InvalidSortZone"] = 63] = "InvalidSortZone";
3706
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 64] = "WaitingSessionConfirmation";
3707
- CommandResult[CommandResult["MergeOverlap"] = 65] = "MergeOverlap";
3708
- CommandResult[CommandResult["TooManyHiddenElements"] = 66] = "TooManyHiddenElements";
3709
- CommandResult[CommandResult["Readonly"] = 67] = "Readonly";
3710
- CommandResult[CommandResult["InvalidViewportSize"] = 68] = "InvalidViewportSize";
3711
- CommandResult[CommandResult["InvalidScrollingDirection"] = 69] = "InvalidScrollingDirection";
3712
- CommandResult[CommandResult["FigureDoesNotExist"] = 70] = "FigureDoesNotExist";
3713
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 71] = "InvalidConditionalFormatId";
3714
- CommandResult[CommandResult["InvalidCellPopover"] = 72] = "InvalidCellPopover";
3715
- CommandResult[CommandResult["EmptyTarget"] = 73] = "EmptyTarget";
3716
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 74] = "InvalidFreezeQuantity";
3717
- CommandResult[CommandResult["FrozenPaneOverlap"] = 75] = "FrozenPaneOverlap";
3718
- CommandResult[CommandResult["ValuesNotChanged"] = 76] = "ValuesNotChanged";
3719
- CommandResult[CommandResult["InvalidFilterZone"] = 77] = "InvalidFilterZone";
3720
- CommandResult[CommandResult["FilterOverlap"] = 78] = "FilterOverlap";
3721
- CommandResult[CommandResult["FilterNotFound"] = 79] = "FilterNotFound";
3722
- CommandResult[CommandResult["MergeInFilter"] = 80] = "MergeInFilter";
3723
- CommandResult[CommandResult["NonContinuousTargets"] = 81] = "NonContinuousTargets";
3724
- CommandResult[CommandResult["DuplicatedFigureId"] = 82] = "DuplicatedFigureId";
3725
- CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
3726
- CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
3727
- CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
3728
- CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
3729
- CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
3730
- CommandResult[CommandResult["NoChanges"] = 88] = "NoChanges";
3679
+ CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
3680
+ CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
3681
+ CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
3682
+ CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
3683
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
3684
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
3685
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
3686
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
3687
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
3688
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
3689
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
3690
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
3691
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
3692
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
3693
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
3694
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
3695
+ CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
3696
+ CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
3697
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
3698
+ CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
3699
+ CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
3700
+ CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
3701
+ CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
3702
+ CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
3703
+ CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
3704
+ CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
3705
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
3706
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
3707
+ CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
3708
+ CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
3709
+ CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
3710
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
3711
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
3712
+ CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
3713
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
3714
+ CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
3715
+ CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
3716
+ CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
3717
+ CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
3718
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
3719
+ CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
3720
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
3721
+ CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
3722
+ CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
3723
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
3724
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
3725
+ CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
3726
+ CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
3727
+ CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
3728
+ CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
3729
+ CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
3730
+ CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
3731
+ CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
3732
+ CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
3733
+ CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
3734
+ CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
3735
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
3736
+ CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
3737
+ CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
3731
3738
  })(exports.CommandResult || (exports.CommandResult = {}));
3732
3739
 
3733
3740
  function isMatrix(x) {
@@ -3874,14 +3881,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
3874
3881
  : undefined));
3875
3882
  }
3876
3883
  }
3877
- else if (zone.left === zone.right && zone.top === zone.bottom) {
3878
- // A single cell. If it's only the title, the dataset is not added.
3879
- if (!dataSetsHaveTitle) {
3880
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
3881
- }
3882
- }
3883
3884
  else {
3884
- /* 1 row or 1 column */
3885
+ /* 1 cell, 1 row or 1 column */
3885
3886
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
3886
3887
  ? {
3887
3888
  top: zone.top,
@@ -3931,8 +3932,10 @@ function toExcelDataset(getters, ds) {
3931
3932
  }
3932
3933
  const dataRange = ds.dataRange.clone({ zone: dataZone });
3933
3934
  return {
3934
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
3935
- range: getters.getRangeString(dataRange, "forceSheetReference"),
3935
+ label: ds.labelCell
3936
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
3937
+ : undefined,
3938
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
3936
3939
  };
3937
3940
  }
3938
3941
  /**
@@ -4001,11 +4004,11 @@ function checkDataset(definition) {
4001
4004
  if (definition.dataSets) {
4002
4005
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
4003
4006
  if (invalidRanges) {
4004
- return 32 /* CommandResult.InvalidDataSet */;
4007
+ return 33 /* CommandResult.InvalidDataSet */;
4005
4008
  }
4006
4009
  const zones = definition.dataSets.map(toUnboundedZone);
4007
4010
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
4008
- return 32 /* CommandResult.InvalidDataSet */;
4011
+ return 33 /* CommandResult.InvalidDataSet */;
4009
4012
  }
4010
4013
  }
4011
4014
  return 0 /* CommandResult.Success */;
@@ -4014,7 +4017,7 @@ function checkLabelRange(definition) {
4014
4017
  if (definition.labelRange) {
4015
4018
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
4016
4019
  if (invalidLabels) {
4017
- return 33 /* CommandResult.InvalidLabelRange */;
4020
+ return 34 /* CommandResult.InvalidLabelRange */;
4018
4021
  }
4019
4022
  }
4020
4023
  return 0 /* CommandResult.Success */;
@@ -4087,22 +4090,22 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
4087
4090
  const CfTerms = {
4088
4091
  Errors: {
4089
4092
  [25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
4090
- [51 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
4091
- [52 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
4092
- [53 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
4093
- [54 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
4094
- [55 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
4095
- [56 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
4096
- [57 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
4097
- [47 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
4098
- [50 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
4099
- [49 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
4100
- [48 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
4101
- [58 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
4102
- [60 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
4103
- [59 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
4104
- [61 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
4105
- [62 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
4093
+ [52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
4094
+ [53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
4095
+ [54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
4096
+ [55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
4097
+ [56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
4098
+ [57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
4099
+ [58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
4100
+ [48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
4101
+ [51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
4102
+ [50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
4103
+ [49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
4104
+ [59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
4105
+ [61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
4106
+ [60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
4107
+ [62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
4108
+ [63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
4106
4109
  [24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
4107
4110
  Unexpected: _lt("The rule is invalid for an unknown reason"),
4108
4111
  },
@@ -4130,20 +4133,20 @@ const ChartTerms = {
4130
4133
  Errors: {
4131
4134
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
4132
4135
  // BASIC CHART ERRORS (LINE | BAR | PIE)
4133
- [32 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
4134
- [33 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
4136
+ [33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
4137
+ [34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
4135
4138
  // SCORECARD CHART ERRORS
4136
- [34 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
4137
- [35 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
4139
+ [35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
4140
+ [36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
4138
4141
  // GAUGE CHART ERRORS
4139
- [36 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
4140
- [37 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
4141
- [38 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
4142
- [39 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
4143
- [40 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
4144
- [41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
4145
- [42 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
4146
- [43 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
4142
+ [37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
4143
+ [38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
4144
+ [39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
4145
+ [40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
4146
+ [41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
4147
+ [42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
4148
+ [43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
4149
+ [44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
4147
4150
  },
4148
4151
  };
4149
4152
  const NumberFormatTerms = {
@@ -4429,6 +4432,9 @@ class BarChart extends AbstractChart {
4429
4432
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4430
4433
  return {
4431
4434
  ...this.getDefinition(),
4435
+ labelRange: this.labelRange
4436
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4437
+ : undefined,
4432
4438
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4433
4439
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4434
4440
  dataSets,
@@ -4515,7 +4521,7 @@ function createBarChartRuntime(chart, getters) {
4515
4521
 
4516
4522
  function isDataRangeValid(definition) {
4517
4523
  return definition.dataRange && !rangeReference.test(definition.dataRange)
4518
- ? 36 /* CommandResult.InvalidGaugeDataRange */
4524
+ ? 37 /* CommandResult.InvalidGaugeDataRange */
4519
4525
  : 0 /* CommandResult.Success */;
4520
4526
  }
4521
4527
  function checkRangeLimits(check, batchValidations) {
@@ -4547,7 +4553,7 @@ function checkInflectionPointsValue(check, batchValidations) {
4547
4553
  function checkRangeMinBiggerThanRangeMax(definition) {
4548
4554
  if (definition.sectionRule) {
4549
4555
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
4550
- return 41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
4556
+ return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
4551
4557
  }
4552
4558
  }
4553
4559
  return 0 /* CommandResult.Success */;
@@ -4556,9 +4562,9 @@ function checkEmpty(value, valueName) {
4556
4562
  if (value === "") {
4557
4563
  switch (valueName) {
4558
4564
  case "rangeMin":
4559
- return 37 /* CommandResult.EmptyGaugeRangeMin */;
4565
+ return 38 /* CommandResult.EmptyGaugeRangeMin */;
4560
4566
  case "rangeMax":
4561
- return 39 /* CommandResult.EmptyGaugeRangeMax */;
4567
+ return 40 /* CommandResult.EmptyGaugeRangeMax */;
4562
4568
  }
4563
4569
  }
4564
4570
  return 0 /* CommandResult.Success */;
@@ -4567,13 +4573,13 @@ function checkNaN(value, valueName) {
4567
4573
  if (isNaN(value)) {
4568
4574
  switch (valueName) {
4569
4575
  case "rangeMin":
4570
- return 38 /* CommandResult.GaugeRangeMinNaN */;
4576
+ return 39 /* CommandResult.GaugeRangeMinNaN */;
4571
4577
  case "rangeMax":
4572
- return 40 /* CommandResult.GaugeRangeMaxNaN */;
4578
+ return 41 /* CommandResult.GaugeRangeMaxNaN */;
4573
4579
  case "lowerInflectionPointValue":
4574
- return 42 /* CommandResult.GaugeLowerInflectionPointNaN */;
4580
+ return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
4575
4581
  case "upperInflectionPointValue":
4576
- return 43 /* CommandResult.GaugeUpperInflectionPointNaN */;
4582
+ return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
4577
4583
  }
4578
4584
  }
4579
4585
  return 0 /* CommandResult.Success */;
@@ -4987,6 +4993,9 @@ class LineChart extends AbstractChart {
4987
4993
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4988
4994
  return {
4989
4995
  ...this.getDefinition(),
4996
+ labelRange: this.labelRange
4997
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4998
+ : undefined,
4990
4999
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4991
5000
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4992
5001
  dataSets,
@@ -5250,6 +5259,9 @@ class PieChart extends AbstractChart {
5250
5259
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
5251
5260
  return {
5252
5261
  ...this.getDefinition(),
5262
+ labelRange: this.labelRange
5263
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
5264
+ : undefined,
5253
5265
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
5254
5266
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
5255
5267
  verticalAxisPosition: "left",
@@ -5324,12 +5336,12 @@ function createPieChartRuntime(chart, getters) {
5324
5336
 
5325
5337
  function checkKeyValue(definition) {
5326
5338
  return definition.keyValue && !rangeReference.test(definition.keyValue)
5327
- ? 34 /* CommandResult.InvalidScorecardKeyValue */
5339
+ ? 35 /* CommandResult.InvalidScorecardKeyValue */
5328
5340
  : 0 /* CommandResult.Success */;
5329
5341
  }
5330
5342
  function checkBaseline(definition) {
5331
5343
  return definition.baseline && !rangeReference.test(definition.baseline)
5332
- ? 35 /* CommandResult.InvalidScorecardBaseline */
5344
+ ? 36 /* CommandResult.InvalidScorecardBaseline */
5333
5345
  : 0 /* CommandResult.Success */;
5334
5346
  }
5335
5347
  class ScorecardChart extends AbstractChart {
@@ -6371,7 +6383,7 @@ function handlePasteResult(env, result) {
6371
6383
  else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
6372
6384
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
6373
6385
  }
6374
- else if (result.reasons.includes(75 /* CommandResult.FrozenPaneOverlap */)) {
6386
+ else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
6375
6387
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
6376
6388
  }
6377
6389
  }
@@ -6658,7 +6670,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
6658
6670
  });
6659
6671
  }
6660
6672
  }
6661
- if (result.isCancelledBecause(63 /* CommandResult.InvalidSortZone */)) {
6673
+ if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
6662
6674
  const { col, row } = anchor;
6663
6675
  env.model.selection.selectZone({ cell: { col, row }, zone });
6664
6676
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -6672,13 +6684,13 @@ const AddFilterInteractiveContent = {
6672
6684
  };
6673
6685
  function interactiveAddFilter(env, sheetId, target) {
6674
6686
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
6675
- if (result.isCancelledBecause(78 /* CommandResult.FilterOverlap */)) {
6687
+ if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
6676
6688
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
6677
6689
  }
6678
- else if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
6690
+ else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
6679
6691
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
6680
6692
  }
6681
- else if (result.isCancelledBecause(81 /* CommandResult.NonContinuousTargets */)) {
6693
+ else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
6682
6694
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
6683
6695
  }
6684
6696
  }
@@ -7255,6 +7267,12 @@ const INSERT_LINK = (env) => {
7255
7267
  let { col, row } = env.model.getters.getActivePosition();
7256
7268
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
7257
7269
  };
7270
+ const INSERT_LINK_NAME = (env) => {
7271
+ const sheetId = env.model.getters.getActiveSheetId();
7272
+ const { col, row } = env.model.getters.getActivePosition();
7273
+ const cell = env.model.getters.getEvaluatedCell({ sheetId, col, row });
7274
+ return cell && cell.link ? _lt("Edit link") : _lt("Insert link");
7275
+ };
7258
7276
  //------------------------------------------------------------------------------
7259
7277
  // Filters action
7260
7278
  //------------------------------------------------------------------------------
@@ -7392,7 +7410,7 @@ cellMenuRegistry
7392
7410
  action: DELETE_CELL_SHIFT_LEFT,
7393
7411
  })
7394
7412
  .add("insert_link", {
7395
- name: _lt("Insert link"),
7413
+ name: INSERT_LINK_NAME,
7396
7414
  separator: true,
7397
7415
  sequence: 150,
7398
7416
  action: INSERT_LINK,
@@ -16551,9 +16569,6 @@ class EditionPlugin extends UIPlugin {
16551
16569
  break;
16552
16570
  }
16553
16571
  }
16554
- unsubscribe() {
16555
- this.mode = "inactive";
16556
- }
16557
16572
  // ---------------------------------------------------------------------------
16558
16573
  // Getters
16559
16574
  // ---------------------------------------------------------------------------
@@ -16629,7 +16644,7 @@ class EditionPlugin extends UIPlugin {
16629
16644
  validateSelection(length, start, end) {
16630
16645
  return start >= 0 && start <= length && end >= 0 && end <= length
16631
16646
  ? 0 /* CommandResult.Success */
16632
- : 46 /* CommandResult.WrongComposerSelection */;
16647
+ : 47 /* CommandResult.WrongComposerSelection */;
16633
16648
  }
16634
16649
  onColumnsRemoved(cmd) {
16635
16650
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -16943,9 +16958,10 @@ class EditionPlugin extends UIPlugin {
16943
16958
  */
16944
16959
  getReferencedRanges() {
16945
16960
  const editionSheetId = this.getters.getEditionSheet();
16946
- return this.currentTokens
16961
+ const referenceRanges = this.currentTokens
16947
16962
  .filter((token) => token.type === "REFERENCE")
16948
16963
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
16964
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
16949
16965
  }
16950
16966
  /**
16951
16967
  * Function used to determine when composer selection can start.
@@ -17445,13 +17461,12 @@ class Composer extends owl.Component {
17445
17461
  setup() {
17446
17462
  owl.onMounted(() => {
17447
17463
  const el = this.composerRef.el;
17464
+ if (this.props.isDefaultFocus) {
17465
+ this.env.focusableElement.setFocusableElement(el);
17466
+ }
17448
17467
  this.contentHelper.updateEl(el);
17449
17468
  this.processContent();
17450
17469
  });
17451
- owl.onWillUnmount(() => {
17452
- var _a, _b;
17453
- (_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
17454
- });
17455
17470
  owl.onPatched(() => {
17456
17471
  if (!this.isKeyStillDown) {
17457
17472
  this.processContent();
@@ -17462,7 +17477,8 @@ class Composer extends owl.Component {
17462
17477
  // Handlers
17463
17478
  // ---------------------------------------------------------------------------
17464
17479
  processArrowKeys(ev) {
17465
- if (this.env.model.getters.isSelectingForComposer()) {
17480
+ if (this.env.model.getters.isSelectingForComposer() ||
17481
+ this.env.model.getters.getEditionMode() === "inactive") {
17466
17482
  this.functionDescriptionState.showDescription = false;
17467
17483
  // Prevent the default content editable behavior which moves the cursor
17468
17484
  ev.preventDefault();
@@ -17503,21 +17519,23 @@ class Composer extends owl.Component {
17503
17519
  var _a;
17504
17520
  ev.preventDefault();
17505
17521
  ev.stopPropagation();
17506
- if (this.autoCompleteState.showProvider) {
17507
- const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17508
- if (autoCompleteValue) {
17509
- this.autoComplete(autoCompleteValue);
17510
- return;
17522
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17523
+ if (this.autoCompleteState.showProvider) {
17524
+ const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17525
+ if (autoCompleteValue) {
17526
+ this.autoComplete(autoCompleteValue);
17527
+ return;
17528
+ }
17511
17529
  }
17512
- }
17513
- else {
17514
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17515
- // we can't let the model think that it is for a ref selection.
17516
- // todo: check if this can be removed someday
17517
- this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17530
+ else {
17531
+ // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17532
+ // we can't let the model think that it is for a ref selection.
17533
+ // todo: check if this can be removed someday
17534
+ this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17535
+ }
17536
+ this.env.model.dispatch("STOP_EDITION");
17518
17537
  }
17519
17538
  const direction = ev.shiftKey ? "left" : "right";
17520
- this.env.model.dispatch("STOP_EDITION");
17521
17539
  this.env.model.selection.moveAnchorCell(direction, 1);
17522
17540
  }
17523
17541
  processEnterKey(ev) {
@@ -17550,6 +17568,9 @@ class Composer extends owl.Component {
17550
17568
  this.compositionActive = false;
17551
17569
  }
17552
17570
  onKeydown(ev) {
17571
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17572
+ return;
17573
+ }
17553
17574
  let handler = this.keyMapping[ev.key];
17554
17575
  if (handler) {
17555
17576
  handler.call(this, ev);
@@ -17560,23 +17581,46 @@ class Composer extends owl.Component {
17560
17581
  }
17561
17582
  }
17562
17583
  updateCursorIfNeeded() {
17563
- if (!this.env.model.getters.isSelectingForComposer()) {
17584
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
17585
+ !(this.env.model.getters.getEditionMode() === "inactive");
17586
+ if (moveCursor) {
17564
17587
  const { start, end } = this.contentHelper.getCurrentSelection();
17565
17588
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
17566
17589
  this.isKeyStillDown = true;
17567
17590
  }
17568
17591
  }
17592
+ onPaste(ev) {
17593
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17594
+ ev.stopPropagation();
17595
+ }
17596
+ }
17569
17597
  /*
17570
17598
  * Triggered automatically by the content-editable between the keydown and key up
17571
17599
  * */
17572
- onInput() {
17573
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
17600
+ onInput(ev) {
17601
+ var _a, _b;
17602
+ if (!this.shouldProcessInputEvents) {
17574
17603
  return;
17575
17604
  }
17605
+ if (ev.inputType === "insertFromPaste" &&
17606
+ this.env.model.getters.getEditionMode() === "inactive") {
17607
+ return;
17608
+ }
17609
+ ev.stopPropagation();
17610
+ let content;
17611
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17612
+ content = ev.data || "";
17613
+ }
17614
+ else {
17615
+ const el = this.composerRef.el;
17616
+ content = el.childNodes.length ? el.textContent : "";
17617
+ }
17618
+ if (this.props.focus === "inactive") {
17619
+ return (_b = (_a = this.props).onComposerCellFocused) === null || _b === void 0 ? void 0 : _b.call(_a, content);
17620
+ }
17576
17621
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17577
- const el = this.composerRef.el;
17578
17622
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
17579
- content: el.childNodes.length ? el.textContent : "",
17623
+ content,
17580
17624
  selection: this.contentHelper.getCurrentSelection(),
17581
17625
  });
17582
17626
  }
@@ -17636,9 +17680,8 @@ class Composer extends owl.Component {
17636
17680
  }
17637
17681
  const newSelection = this.contentHelper.getCurrentSelection();
17638
17682
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17639
- if (this.props.focus === "inactive") {
17640
- this.props.onComposerContentFocused(newSelection);
17641
- }
17683
+ this.props.onComposerContentFocused();
17684
+ if (this.props.focus === "inactive") ;
17642
17685
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
17643
17686
  this.processTokenAtCursor();
17644
17687
  }
@@ -17655,6 +17698,7 @@ class Composer extends owl.Component {
17655
17698
  this.contentHelper.removeAll(); // removes the content of the composer, to be added just after
17656
17699
  this.shouldProcessInputEvents = false;
17657
17700
  if (this.props.focus !== "inactive") {
17701
+ this.contentHelper.el.focus();
17658
17702
  this.contentHelper.selectRange(0, 0); // move the cursor inside the composer at 0 0.
17659
17703
  }
17660
17704
  const content = this.getContent();
@@ -17821,18 +17865,18 @@ Composer.template = "o-spreadsheet-Composer";
17821
17865
  Composer.components = { TextValueProvider, FunctionDescriptionProvider };
17822
17866
  Composer.defaultProps = {
17823
17867
  inputStyle: "",
17868
+ isDefaultFocus: false,
17824
17869
  };
17825
17870
  Composer.props = {
17826
17871
  inputStyle: { type: String, optional: true },
17827
17872
  rect: { type: Object, optional: true },
17828
17873
  delimitation: { type: Object, optional: true },
17829
17874
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17830
- onComposerUnmounted: { type: Function, optional: true },
17875
+ onComposerCellFocused: { type: Function, optional: true },
17831
17876
  onComposerContentFocused: Function,
17877
+ isDefaultFocus: { type: Boolean, optional: true },
17832
17878
  };
17833
17879
 
17834
- const SCROLLBAR_WIDTH = 14;
17835
- const SCROLLBAR_HIGHT = 15;
17836
17880
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
17837
17881
  css /* scss */ `
17838
17882
  div.o-grid-composer {
@@ -17847,35 +17891,52 @@ css /* scss */ `
17847
17891
  * It also applies the style of the cell to the composer input.
17848
17892
  */
17849
17893
  class GridComposer extends owl.Component {
17894
+ constructor() {
17895
+ super(...arguments);
17896
+ this.rect = undefined;
17897
+ this.isEditing = false;
17898
+ }
17899
+ get defaultRect() {
17900
+ return { x: 0, y: 0, width: 0, height: 0 };
17901
+ }
17850
17902
  setup() {
17851
- this.gridComposerRef = owl.useRef("gridComposer");
17852
- this.composerState = owl.useState({
17853
- rect: undefined,
17854
- delimitation: undefined,
17855
- });
17856
- const { sheetId, col, row } = this.env.model.getters.getActivePosition();
17857
- this.zone = this.env.model.getters.expandZone(sheetId, positionToZone({ col, row }));
17858
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
17859
- owl.onMounted(() => {
17860
- const el = this.gridComposerRef.el;
17861
- //TODO Should be more correct to have a props that give the parent's clientHeight and clientWidth
17862
- const maxHeight = el.parentElement.clientHeight - this.rect.y - SCROLLBAR_HIGHT;
17863
- el.style.maxHeight = (maxHeight + "px");
17864
- const maxWidth = el.parentElement.clientWidth - this.rect.x - SCROLLBAR_WIDTH;
17865
- el.style.maxWidth = (maxWidth + "px");
17866
- this.composerState.rect = {
17867
- x: this.rect.x,
17868
- y: this.rect.y,
17869
- width: el.clientWidth,
17870
- height: el.clientHeight,
17871
- };
17872
- this.composerState.delimitation = {
17873
- width: el.parentElement.clientWidth,
17874
- height: el.parentElement.clientHeight,
17875
- };
17903
+ owl.onWillUpdateProps(() => {
17904
+ const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
17905
+ if (this.isEditing !== isEditing) {
17906
+ this.isEditing = isEditing;
17907
+ if (!isEditing) {
17908
+ this.rect = undefined;
17909
+ this.env.focusableElement.focus();
17910
+ return;
17911
+ }
17912
+ const position = this.env.model.getters.getActivePosition();
17913
+ const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
17914
+ this.rect = this.env.model.getters.getVisibleRect(zone);
17915
+ }
17876
17916
  });
17877
17917
  }
17918
+ get composerProps() {
17919
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
17920
+ return {
17921
+ rect: this.rect && { ...this.rect },
17922
+ delimitation: {
17923
+ width,
17924
+ height,
17925
+ },
17926
+ inputStyle: this.composerStyle,
17927
+ focus: this.props.focus,
17928
+ isDefaultFocus: true,
17929
+ onComposerContentFocused: this.props.onComposerContentFocused,
17930
+ onComposerCellFocused: this.props.onComposerCellFocused,
17931
+ };
17932
+ }
17878
17933
  get containerStyle() {
17934
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
17935
+ return `
17936
+ position: absolute;
17937
+ z-index: -1000;
17938
+ `;
17939
+ }
17879
17940
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
17880
17941
  const cell = this.env.model.getters.getActiveCell();
17881
17942
  const position = this.env.model.getters.getActivePosition();
@@ -17895,12 +17956,18 @@ class GridComposer extends owl.Component {
17895
17956
  if (!isFormula) {
17896
17957
  textAlign = style.align || cell.defaultAlign;
17897
17958
  }
17959
+ const sheetDimensions = this.env.model.getters.getSheetViewDimensionWithHeaders();
17960
+ const maxWidth = sheetDimensions.width - this.rect.x;
17961
+ const maxHeight = sheetDimensions.height - this.rect.y;
17898
17962
  return `
17899
17963
  left: ${left - 1}px;
17900
17964
  top: ${top}px;
17901
17965
  min-width: ${width + 2}px;
17902
17966
  min-height: ${height + 1}px;
17903
17967
 
17968
+ max-width: ${maxWidth}px;
17969
+ max-height: ${maxHeight}px;
17970
+
17904
17971
  background: ${background};
17905
17972
  color: ${color};
17906
17973
 
@@ -17924,8 +17991,8 @@ GridComposer.template = "o-spreadsheet-GridComposer";
17924
17991
  GridComposer.components = { Composer };
17925
17992
  GridComposer.props = {
17926
17993
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17927
- onComposerUnmounted: Function,
17928
17994
  onComposerContentFocused: Function,
17995
+ onComposerCellFocused: Function,
17929
17996
  };
17930
17997
 
17931
17998
  const CSS$2 = css /* scss */ `
@@ -19383,7 +19450,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
19383
19450
  const sheetId = env.model.getters.getActiveSheetId();
19384
19451
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
19385
19452
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
19386
- if (result.isCancelledBecause(65 /* CommandResult.MergeOverlap */)) {
19453
+ if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
19387
19454
  env.raiseError(MergeErrorMessage);
19388
19455
  }
19389
19456
  }
@@ -20098,11 +20165,11 @@ class LineBarPieConfigPanel extends owl.Component {
20098
20165
  }
20099
20166
  get isDatasetInvalid() {
20100
20167
  var _a;
20101
- return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidDataSet */));
20168
+ return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
20102
20169
  }
20103
20170
  get isLabelInvalid() {
20104
20171
  var _a;
20105
- return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
20172
+ return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
20106
20173
  }
20107
20174
  onUpdateDataSetsHaveTitle(ev) {
20108
20175
  this.props.updateChart(this.props.figureId, {
@@ -20475,7 +20542,7 @@ class GaugeChartConfigPanel extends owl.Component {
20475
20542
  }
20476
20543
  get isDataRangeInvalid() {
20477
20544
  var _a;
20478
- return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidGaugeDataRange */));
20545
+ return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
20479
20546
  }
20480
20547
  onDataRangeChanged(ranges) {
20481
20548
  this.dataRange = ranges[0];
@@ -20567,28 +20634,28 @@ class GaugeChartDesignPanel extends owl.Component {
20567
20634
  }
20568
20635
  isRangeMinInvalid() {
20569
20636
  var _a, _b, _c;
20570
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.EmptyGaugeRangeMin */)) ||
20571
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(38 /* CommandResult.GaugeRangeMinNaN */)) ||
20572
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20637
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
20638
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
20639
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20573
20640
  }
20574
20641
  isRangeMaxInvalid() {
20575
20642
  var _a, _b, _c;
20576
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMax */)) ||
20577
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(40 /* CommandResult.GaugeRangeMaxNaN */)) ||
20578
- ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(41 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20643
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
20644
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
20645
+ ((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
20579
20646
  }
20580
20647
  // ---------------------------------------------------------------------------
20581
20648
  // COLOR_SECTION_TEMPLATE
20582
20649
  // ---------------------------------------------------------------------------
20583
20650
  get isLowerInflectionPointInvalid() {
20584
20651
  var _a, _b;
20585
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(42 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
20586
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20652
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
20653
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20587
20654
  }
20588
20655
  get isUpperInflectionPointInvalid() {
20589
20656
  var _a, _b;
20590
- return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
20591
- ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(44 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20657
+ return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
20658
+ ((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
20592
20659
  }
20593
20660
  updateInflectionPointValue(attr, ev) {
20594
20661
  const sectionRule = deepCopy(this.props.definition.sectionRule);
@@ -20701,11 +20768,11 @@ class ScorecardChartConfigPanel extends owl.Component {
20701
20768
  }
20702
20769
  get isKeyValueInvalid() {
20703
20770
  var _a;
20704
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidScorecardKeyValue */));
20771
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
20705
20772
  }
20706
20773
  get isBaselineInvalid() {
20707
20774
  var _a;
20708
- return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardBaseline */));
20775
+ return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
20709
20776
  }
20710
20777
  onKeyValueRangeChanged(ranges) {
20711
20778
  this.keyValue = ranges[0];
@@ -21561,11 +21628,11 @@ class ConditionalFormattingPanel extends owl.Component {
21561
21628
  ****************************************************************************/
21562
21629
  get isValue1Invalid() {
21563
21630
  var _a;
21564
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(51 /* CommandResult.FirstArgMissing */));
21631
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
21565
21632
  }
21566
21633
  get isValue2Invalid() {
21567
21634
  var _a;
21568
- return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.SecondArgMissing */));
21635
+ return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
21569
21636
  }
21570
21637
  toggleStyle(tool) {
21571
21638
  const style = this.state.rules.cellIs.style;
@@ -21582,17 +21649,17 @@ class ConditionalFormattingPanel extends owl.Component {
21582
21649
  isValueInvalid(threshold) {
21583
21650
  switch (threshold) {
21584
21651
  case "minimum":
21585
- return (this.state.errors.includes(58 /* CommandResult.MinInvalidFormula */) ||
21586
- this.state.errors.includes(50 /* CommandResult.MinBiggerThanMid */) ||
21587
- this.state.errors.includes(47 /* CommandResult.MinBiggerThanMax */) ||
21588
- this.state.errors.includes(53 /* CommandResult.MinNaN */));
21652
+ return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
21653
+ this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
21654
+ this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
21655
+ this.state.errors.includes(54 /* CommandResult.MinNaN */));
21589
21656
  case "midpoint":
21590
- return (this.state.errors.includes(59 /* CommandResult.MidInvalidFormula */) ||
21591
- this.state.errors.includes(54 /* CommandResult.MidNaN */) ||
21592
- this.state.errors.includes(49 /* CommandResult.MidBiggerThanMax */));
21657
+ return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
21658
+ this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
21659
+ this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
21593
21660
  case "maximum":
21594
- return (this.state.errors.includes(60 /* CommandResult.MaxInvalidFormula */) ||
21595
- this.state.errors.includes(55 /* CommandResult.MaxNaN */));
21661
+ return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
21662
+ this.state.errors.includes(56 /* CommandResult.MaxNaN */));
21596
21663
  default:
21597
21664
  return false;
21598
21665
  }
@@ -21641,13 +21708,13 @@ class ConditionalFormattingPanel extends owl.Component {
21641
21708
  isInflectionPointInvalid(inflectionPoint) {
21642
21709
  switch (inflectionPoint) {
21643
21710
  case "lowerInflectionPoint":
21644
- return (this.state.errors.includes(57 /* CommandResult.ValueLowerInflectionNaN */) ||
21645
- this.state.errors.includes(62 /* CommandResult.ValueLowerInvalidFormula */) ||
21646
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
21711
+ return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
21712
+ this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
21713
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
21647
21714
  case "upperInflectionPoint":
21648
- return (this.state.errors.includes(56 /* CommandResult.ValueUpperInflectionNaN */) ||
21649
- this.state.errors.includes(61 /* CommandResult.ValueUpperInvalidFormula */) ||
21650
- this.state.errors.includes(48 /* CommandResult.LowerBiggerThanUpper */));
21715
+ return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
21716
+ this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
21717
+ this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
21651
21718
  default:
21652
21719
  return true;
21653
21720
  }
@@ -22687,7 +22754,6 @@ class GridOverlay extends owl.Component {
22687
22754
  this.props.onCellDoubleClicked(col, row);
22688
22755
  }
22689
22756
  onContextMenu(ev) {
22690
- ev.preventDefault();
22691
22757
  const [col, row] = this.getCartesianCoordinates(ev);
22692
22758
  this.props.onCellRightClicked(col, row, { x: ev.clientX, y: ev.clientY });
22693
22759
  }
@@ -23621,8 +23687,8 @@ css /* scss */ `
23621
23687
  &.corner {
23622
23688
  right: 0px;
23623
23689
  bottom: 0px;
23624
- height: ${SCROLLBAR_WIDTH$1}px;
23625
- width: ${SCROLLBAR_WIDTH$1}px;
23690
+ height: ${SCROLLBAR_WIDTH}px;
23691
+ width: ${SCROLLBAR_WIDTH}px;
23626
23692
  border-top: 1px solid #e2e3e3;
23627
23693
  border-left: 1px solid #e2e3e3;
23628
23694
  }
@@ -23695,7 +23761,7 @@ class HorizontalScrollBar extends owl.Component {
23695
23761
  return {
23696
23762
  left: `${this.props.leftOffset + x}px`,
23697
23763
  bottom: "0px",
23698
- height: `${SCROLLBAR_WIDTH$1}px`,
23764
+ height: `${SCROLLBAR_WIDTH}px`,
23699
23765
  right: `0px`,
23700
23766
  };
23701
23767
  }
@@ -23740,7 +23806,7 @@ class VerticalScrollBar extends owl.Component {
23740
23806
  return {
23741
23807
  top: `${this.props.topOffset + y}px`,
23742
23808
  right: "0px",
23743
- width: `${SCROLLBAR_WIDTH$1}px`,
23809
+ width: `${SCROLLBAR_WIDTH}px`,
23744
23810
  bottom: `0px`,
23745
23811
  };
23746
23812
  }
@@ -23914,17 +23980,16 @@ class Grid extends owl.Component {
23914
23980
  menuItems: [],
23915
23981
  });
23916
23982
  this.gridRef = owl.useRef("grid");
23917
- this.hiddenInput = owl.useRef("hiddenInput");
23918
23983
  this.canvasPosition = useAbsoluteBoundingRect(this.gridRef);
23919
23984
  this.hoveredCell = owl.useState({ col: undefined, row: undefined });
23920
23985
  owl.useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
23921
23986
  owl.useExternalListener(document.body, "cut", this.copy.bind(this, true));
23922
23987
  owl.useExternalListener(document.body, "copy", this.copy.bind(this, false));
23923
23988
  owl.useExternalListener(document.body, "paste", this.paste);
23924
- owl.onMounted(() => this.focus());
23925
- this.props.exposeFocus(() => this.focus());
23989
+ owl.onMounted(() => this.focusDefaultElement());
23990
+ this.props.exposeFocus(() => this.focusDefaultElement());
23926
23991
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
23927
- owl.useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
23992
+ owl.useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
23928
23993
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
23929
23994
  this.moveCanvas(deltaX, deltaY);
23930
23995
  this.hoveredCell.col = undefined;
@@ -23939,21 +24004,20 @@ class Grid extends owl.Component {
23939
24004
  return `
23940
24005
  top: ${HEADER_HEIGHT}px;
23941
24006
  left: ${HEADER_WIDTH}px;
23942
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH$1}px);
23943
- width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH$1}px);
24007
+ height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
24008
+ width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH}px);
23944
24009
  `;
23945
24010
  }
23946
24011
  onClosePopover() {
23947
24012
  if (this.env.model.getters.hasOpenedPopover()) {
23948
24013
  this.closeOpenedPopover();
23949
24014
  }
23950
- this.focus();
24015
+ this.focusDefaultElement();
23951
24016
  }
23952
- focus() {
23953
- var _a;
24017
+ focusDefaultElement() {
23954
24018
  if (!this.env.model.getters.getSelectedFigureId() &&
23955
24019
  this.env.model.getters.getEditionMode() === "inactive") {
23956
- (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
24020
+ this.env.focusableElement.focus();
23957
24021
  }
23958
24022
  }
23959
24023
  get gridEl() {
@@ -24098,19 +24162,6 @@ class Grid extends owl.Component {
24098
24162
  return;
24099
24163
  }
24100
24164
  }
24101
- onInput(ev) {
24102
- // the user meant to paste in the sheet, not open the composer with the pasted content
24103
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
24104
- return;
24105
- }
24106
- if (ev.data) {
24107
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
24108
- // character
24109
- ev.preventDefault();
24110
- ev.stopPropagation();
24111
- this.props.onGridComposerCellFocused(ev.data);
24112
- }
24113
- }
24114
24165
  // ---------------------------------------------------------------------------
24115
24166
  // Context Menu
24116
24167
  // ---------------------------------------------------------------------------
@@ -24207,7 +24258,7 @@ class Grid extends owl.Component {
24207
24258
  }
24208
24259
  closeMenu() {
24209
24260
  this.menuState.isOpen = false;
24210
- this.focus();
24261
+ this.focusDefaultElement();
24211
24262
  }
24212
24263
  }
24213
24264
  Grid.template = "o-spreadsheet-Grid";
@@ -27520,7 +27571,7 @@ function normalizeV9(formula) {
27520
27571
  * a breaking change is made in the way the state is handled, and an upgrade
27521
27572
  * function should be defined
27522
27573
  */
27523
- const CURRENT_VERSION = 12;
27574
+ const CURRENT_VERSION = 12.5;
27524
27575
  const INITIAL_SHEET_ID = "Sheet1";
27525
27576
  /**
27526
27577
  * This function tries to load anything that could look like a valid
@@ -27786,6 +27837,31 @@ const MIGRATIONS = [
27786
27837
  return data;
27787
27838
  },
27788
27839
  },
27840
+ {
27841
+ description: "Fix datafilter duplication",
27842
+ from: 12,
27843
+ to: 12.5,
27844
+ applyMigration(data) {
27845
+ for (let sheet of data.sheets || []) {
27846
+ let knownDataFilterZones = [];
27847
+ for (let filterTable of sheet.filterTables || []) {
27848
+ const zone = toZone(filterTable.range);
27849
+ // See commit message for the details
27850
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
27851
+ if (intersectZoneIndex !== -1) {
27852
+ knownDataFilterZones[intersectZoneIndex] = zone;
27853
+ }
27854
+ else {
27855
+ knownDataFilterZones.push(zone);
27856
+ }
27857
+ }
27858
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
27859
+ range: zoneToXc(zone),
27860
+ }));
27861
+ }
27862
+ return data;
27863
+ },
27864
+ },
27789
27865
  ];
27790
27866
  /**
27791
27867
  * This function is used to repair faulty data independently of the migration.
@@ -28443,7 +28519,7 @@ class BordersPlugin extends CorePlugin {
28443
28519
  const currentBorder = this.getCellBorder(cmd);
28444
28520
  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);
28445
28521
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
28446
- return 88 /* CommandResult.NoChanges */;
28522
+ return 89 /* CommandResult.NoChanges */;
28447
28523
  }
28448
28524
  return 0 /* CommandResult.Success */;
28449
28525
  }
@@ -28550,9 +28626,9 @@ class CellPlugin extends CorePlugin {
28550
28626
  allowDispatch(cmd) {
28551
28627
  switch (cmd.type) {
28552
28628
  case "UPDATE_CELL":
28553
- return this.checkCellOutOfSheet(cmd);
28629
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
28554
28630
  case "CLEAR_CELL":
28555
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
28631
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
28556
28632
  default:
28557
28633
  return 0 /* CommandResult.Success */;
28558
28634
  }
@@ -28718,13 +28794,13 @@ class CellPlugin extends CorePlugin {
28718
28794
  /*
28719
28795
  * Reconstructs the original formula string based on a normalized form and its dependencies
28720
28796
  */
28721
- buildFormulaContent(sheetId, cell, dependencies) {
28797
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
28722
28798
  const ranges = dependencies || cell.dependencies;
28723
28799
  let rangeIndex = 0;
28724
28800
  return concat(cell.compiledFormula.tokens.map((token) => {
28725
28801
  if (token.type === "REFERENCE") {
28726
28802
  const range = ranges[rangeIndex++];
28727
- return this.getters.getRangeString(range, sheetId);
28803
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
28728
28804
  }
28729
28805
  return token.value;
28730
28806
  }));
@@ -28965,9 +29041,21 @@ class CellPlugin extends CorePlugin {
28965
29041
  checkUselessClearCell(cmd) {
28966
29042
  const cell = this.getters.getCell(cmd);
28967
29043
  if (!cell)
28968
- return 88 /* CommandResult.NoChanges */;
29044
+ return 89 /* CommandResult.NoChanges */;
28969
29045
  if (!cell.content && !cell.style && !cell.format) {
28970
- return 88 /* CommandResult.NoChanges */;
29046
+ return 89 /* CommandResult.NoChanges */;
29047
+ }
29048
+ return 0 /* CommandResult.Success */;
29049
+ }
29050
+ checkUselessUpdateCell(cmd) {
29051
+ const cell = this.getters.getCell(cmd);
29052
+ const hasContent = "content" in cmd || "formula" in cmd;
29053
+ const hasStyle = "style" in cmd;
29054
+ const hasFormat = "format" in cmd;
29055
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
29056
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
29057
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
29058
+ return 89 /* CommandResult.NoChanges */;
28971
29059
  }
28972
29060
  return 0 /* CommandResult.Success */;
28973
29061
  }
@@ -29176,13 +29264,13 @@ class ChartPlugin extends CorePlugin {
29176
29264
  }
29177
29265
  checkChartDuplicate(cmd) {
29178
29266
  return this.getters.getFigureSheetId(cmd.id)
29179
- ? 84 /* CommandResult.DuplicatedChartId */
29267
+ ? 85 /* CommandResult.DuplicatedChartId */
29180
29268
  : 0 /* CommandResult.Success */;
29181
29269
  }
29182
29270
  checkChartExists(cmd) {
29183
29271
  return this.getters.getFigureSheetId(cmd.id)
29184
29272
  ? 0 /* CommandResult.Success */
29185
- : 85 /* CommandResult.ChartDoesNotExist */;
29273
+ : 86 /* CommandResult.ChartDoesNotExist */;
29186
29274
  }
29187
29275
  }
29188
29276
  ChartPlugin.getters = [
@@ -29297,7 +29385,13 @@ class ConditionalFormatPlugin extends CorePlugin {
29297
29385
  }
29298
29386
  }
29299
29387
  exportForExcel(data) {
29300
- this.export(data);
29388
+ if (data.sheets) {
29389
+ for (let sheet of data.sheets) {
29390
+ if (this.cfRules[sheet.id]) {
29391
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
29392
+ }
29393
+ }
29394
+ }
29301
29395
  }
29302
29396
  // ---------------------------------------------------------------------------
29303
29397
  // Getters
@@ -29347,11 +29441,11 @@ class ConditionalFormatPlugin extends CorePlugin {
29347
29441
  // ---------------------------------------------------------------------------
29348
29442
  // Private
29349
29443
  // ---------------------------------------------------------------------------
29350
- mapToConditionalFormat(sheetId, cf) {
29444
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
29351
29445
  return {
29352
29446
  ...cf,
29353
29447
  ranges: cf.ranges.map((range) => {
29354
- return this.getters.getRangeString(range, sheetId);
29448
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
29355
29449
  }),
29356
29450
  };
29357
29451
  }
@@ -29384,10 +29478,10 @@ class ConditionalFormatPlugin extends CorePlugin {
29384
29478
  return 27 /* CommandResult.InvalidSheetId */;
29385
29479
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
29386
29480
  if (ruleIndex === -1)
29387
- return 71 /* CommandResult.InvalidConditionalFormatId */;
29481
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
29388
29482
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
29389
29483
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
29390
- return 71 /* CommandResult.InvalidConditionalFormatId */;
29484
+ return 72 /* CommandResult.InvalidConditionalFormatId */;
29391
29485
  }
29392
29486
  return 0 /* CommandResult.Success */;
29393
29487
  }
@@ -29428,10 +29522,10 @@ class ConditionalFormatPlugin extends CorePlugin {
29428
29522
  const errors = [];
29429
29523
  const isEmpty = (value) => value === undefined || value === "";
29430
29524
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
29431
- errors.push(51 /* CommandResult.FirstArgMissing */);
29525
+ errors.push(52 /* CommandResult.FirstArgMissing */);
29432
29526
  }
29433
29527
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
29434
- errors.push(52 /* CommandResult.SecondArgMissing */);
29528
+ errors.push(53 /* CommandResult.SecondArgMissing */);
29435
29529
  }
29436
29530
  return errors.length ? errors : 0 /* CommandResult.Success */;
29437
29531
  }
@@ -29443,15 +29537,15 @@ class ConditionalFormatPlugin extends CorePlugin {
29443
29537
  (threshold.value === "" || isNaN(threshold.value))) {
29444
29538
  switch (thresholdName) {
29445
29539
  case "min":
29446
- return 53 /* CommandResult.MinNaN */;
29540
+ return 54 /* CommandResult.MinNaN */;
29447
29541
  case "max":
29448
- return 55 /* CommandResult.MaxNaN */;
29542
+ return 56 /* CommandResult.MaxNaN */;
29449
29543
  case "mid":
29450
- return 54 /* CommandResult.MidNaN */;
29544
+ return 55 /* CommandResult.MidNaN */;
29451
29545
  case "upperInflectionPoint":
29452
- return 56 /* CommandResult.ValueUpperInflectionNaN */;
29546
+ return 57 /* CommandResult.ValueUpperInflectionNaN */;
29453
29547
  case "lowerInflectionPoint":
29454
- return 57 /* CommandResult.ValueLowerInflectionNaN */;
29548
+ return 58 /* CommandResult.ValueLowerInflectionNaN */;
29455
29549
  }
29456
29550
  }
29457
29551
  return 0 /* CommandResult.Success */;
@@ -29465,15 +29559,15 @@ class ConditionalFormatPlugin extends CorePlugin {
29465
29559
  catch (error) {
29466
29560
  switch (thresholdName) {
29467
29561
  case "min":
29468
- return 58 /* CommandResult.MinInvalidFormula */;
29562
+ return 59 /* CommandResult.MinInvalidFormula */;
29469
29563
  case "max":
29470
- return 60 /* CommandResult.MaxInvalidFormula */;
29564
+ return 61 /* CommandResult.MaxInvalidFormula */;
29471
29565
  case "mid":
29472
- return 59 /* CommandResult.MidInvalidFormula */;
29566
+ return 60 /* CommandResult.MidInvalidFormula */;
29473
29567
  case "upperInflectionPoint":
29474
- return 61 /* CommandResult.ValueUpperInvalidFormula */;
29568
+ return 62 /* CommandResult.ValueUpperInvalidFormula */;
29475
29569
  case "lowerInflectionPoint":
29476
- return 62 /* CommandResult.ValueLowerInvalidFormula */;
29570
+ return 63 /* CommandResult.ValueLowerInvalidFormula */;
29477
29571
  }
29478
29572
  }
29479
29573
  return 0 /* CommandResult.Success */;
@@ -29490,7 +29584,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29490
29584
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
29491
29585
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
29492
29586
  Number(minValue) > Number(maxValue)) {
29493
- return 48 /* CommandResult.LowerBiggerThanUpper */;
29587
+ return 49 /* CommandResult.LowerBiggerThanUpper */;
29494
29588
  }
29495
29589
  return 0 /* CommandResult.Success */;
29496
29590
  }
@@ -29500,7 +29594,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29500
29594
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
29501
29595
  rule.minimum.type === rule.maximum.type &&
29502
29596
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
29503
- return 47 /* CommandResult.MinBiggerThanMax */;
29597
+ return 48 /* CommandResult.MinBiggerThanMax */;
29504
29598
  }
29505
29599
  return 0 /* CommandResult.Success */;
29506
29600
  }
@@ -29512,7 +29606,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29512
29606
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
29513
29607
  rule.midpoint.type === rule.maximum.type &&
29514
29608
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
29515
- return 49 /* CommandResult.MidBiggerThanMax */;
29609
+ return 50 /* CommandResult.MidBiggerThanMax */;
29516
29610
  }
29517
29611
  return 0 /* CommandResult.Success */;
29518
29612
  }
@@ -29524,7 +29618,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29524
29618
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
29525
29619
  rule.minimum.type === rule.midpoint.type &&
29526
29620
  stringToNumber(minValue) >= stringToNumber(midValue)) {
29527
- return 50 /* CommandResult.MinBiggerThanMid */;
29621
+ return 51 /* CommandResult.MinBiggerThanMid */;
29528
29622
  }
29529
29623
  return 0 /* CommandResult.Success */;
29530
29624
  }
@@ -29625,13 +29719,13 @@ class FigurePlugin extends CorePlugin {
29625
29719
  checkFigureExists(sheetId, figureId) {
29626
29720
  var _a;
29627
29721
  if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
29628
- return 70 /* CommandResult.FigureDoesNotExist */;
29722
+ return 71 /* CommandResult.FigureDoesNotExist */;
29629
29723
  }
29630
29724
  return 0 /* CommandResult.Success */;
29631
29725
  }
29632
29726
  checkFigureDuplicate(figureId) {
29633
29727
  if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
29634
- return 82 /* CommandResult.DuplicatedFigureId */;
29728
+ return 83 /* CommandResult.DuplicatedFigureId */;
29635
29729
  }
29636
29730
  return 0 /* CommandResult.Success */;
29637
29731
  }
@@ -29733,12 +29827,12 @@ class FiltersPlugin extends CorePlugin {
29733
29827
  switch (cmd.type) {
29734
29828
  case "CREATE_FILTER_TABLE":
29735
29829
  if (!areZonesContinuous(...cmd.target)) {
29736
- return 81 /* CommandResult.NonContinuousTargets */;
29830
+ return 82 /* CommandResult.NonContinuousTargets */;
29737
29831
  }
29738
29832
  const zone = union(...cmd.target);
29739
29833
  const checkFilterOverlap = () => {
29740
29834
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
29741
- return 78 /* CommandResult.FilterOverlap */;
29835
+ return 79 /* CommandResult.FilterOverlap */;
29742
29836
  }
29743
29837
  return 0 /* CommandResult.Success */;
29744
29838
  };
@@ -29746,7 +29840,7 @@ class FiltersPlugin extends CorePlugin {
29746
29840
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
29747
29841
  for (let merge of mergesInTarget) {
29748
29842
  if (overlap(zone, merge)) {
29749
- return 80 /* CommandResult.MergeInFilter */;
29843
+ return 81 /* CommandResult.MergeInFilter */;
29750
29844
  }
29751
29845
  }
29752
29846
  return 0 /* CommandResult.Success */;
@@ -29756,7 +29850,7 @@ class FiltersPlugin extends CorePlugin {
29756
29850
  for (let merge of cmd.target) {
29757
29851
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
29758
29852
  if (overlap(filterTable.zone, merge)) {
29759
- return 80 /* CommandResult.MergeInFilter */;
29853
+ return 81 /* CommandResult.MergeInFilter */;
29760
29854
  }
29761
29855
  }
29762
29856
  }
@@ -30256,10 +30350,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
30256
30350
  : this.getters.getNumberRows(cmd.sheetId);
30257
30351
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
30258
30352
  if (hiddenElements.size >= elements) {
30259
- return 66 /* CommandResult.TooManyHiddenElements */;
30353
+ return 67 /* CommandResult.TooManyHiddenElements */;
30260
30354
  }
30261
30355
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30262
- return 86 /* CommandResult.InvalidHeaderIndex */;
30356
+ return 87 /* CommandResult.InvalidHeaderIndex */;
30263
30357
  }
30264
30358
  else {
30265
30359
  return 0 /* CommandResult.Success */;
@@ -30785,7 +30879,7 @@ class MergePlugin extends CorePlugin {
30785
30879
  for (const zone of target) {
30786
30880
  for (const zone2 of target) {
30787
30881
  if (zone !== zone2 && overlap(zone, zone2)) {
30788
- return 65 /* CommandResult.MergeOverlap */;
30882
+ return 66 /* CommandResult.MergeOverlap */;
30789
30883
  }
30790
30884
  }
30791
30885
  }
@@ -30799,7 +30893,7 @@ class MergePlugin extends CorePlugin {
30799
30893
  for (const zone of target) {
30800
30894
  if ((zone.left < xSplit && zone.right >= xSplit) ||
30801
30895
  (zone.top < ySplit && zone.bottom >= ySplit)) {
30802
- return 75 /* CommandResult.FrozenPaneOverlap */;
30896
+ return 76 /* CommandResult.FrozenPaneOverlap */;
30803
30897
  }
30804
30898
  }
30805
30899
  return 0 /* CommandResult.Success */;
@@ -31262,8 +31356,9 @@ class RangeAdapter {
31262
31356
  *
31263
31357
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
31264
31358
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
31359
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
31265
31360
  */
31266
- getRangeString(range, forSheetId) {
31361
+ getRangeString(range, forSheetId, useFixedZone = false) {
31267
31362
  if (!range) {
31268
31363
  return INCORRECT_RANGE_STRING;
31269
31364
  }
@@ -31290,7 +31385,7 @@ class RangeAdapter {
31290
31385
  if (prefixSheet && !sheetName) {
31291
31386
  return INCORRECT_RANGE_STRING;
31292
31387
  }
31293
- let rangeString = this.getRangePartString(rangeImpl, 0);
31388
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
31294
31389
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
31295
31390
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
31296
31391
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -31300,7 +31395,7 @@ class RangeAdapter {
31300
31395
  rangeImpl.parts[1].rowFixed ||
31301
31396
  rangeImpl.parts[1].colFixed) {
31302
31397
  rangeString += ":";
31303
- rangeString += this.getRangePartString(rangeImpl, 1);
31398
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
31304
31399
  }
31305
31400
  }
31306
31401
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -31330,13 +31425,14 @@ class RangeAdapter {
31330
31425
  /**
31331
31426
  * Get a Xc string that represent a part of a range
31332
31427
  */
31333
- getRangePartString(range, part) {
31334
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
31428
+ getRangePartString(range, part, useFixedZone = false) {
31429
+ var _a, _b;
31430
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
31335
31431
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
31336
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
31432
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
31337
31433
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
31338
31434
  let str = "";
31339
- if (range.isFullCol) {
31435
+ if (range.isFullCol && !useFixedZone) {
31340
31436
  if (part === 0 && range.unboundedZone.hasHeader) {
31341
31437
  str = colFixed + col + rowFixed + row;
31342
31438
  }
@@ -31344,7 +31440,7 @@ class RangeAdapter {
31344
31440
  str = colFixed + col;
31345
31441
  }
31346
31442
  }
31347
- else if (range.isFullRow) {
31443
+ else if (range.isFullRow && !useFixedZone) {
31348
31444
  if (part === 0 && range.unboundedZone.hasHeader) {
31349
31445
  str = colFixed + col + rowFixed + row;
31350
31446
  }
@@ -31432,10 +31528,10 @@ class SheetPlugin extends CorePlugin {
31432
31528
  ? this.getNumberCols(cmd.sheetId)
31433
31529
  : this.getNumberRows(cmd.sheetId);
31434
31530
  if (cmd.base < 0 || cmd.base >= elements) {
31435
- return 86 /* CommandResult.InvalidHeaderIndex */;
31531
+ return 87 /* CommandResult.InvalidHeaderIndex */;
31436
31532
  }
31437
31533
  else if (cmd.quantity <= 0) {
31438
- return 87 /* CommandResult.InvalidQuantity */;
31534
+ return 88 /* CommandResult.InvalidQuantity */;
31439
31535
  }
31440
31536
  return 0 /* CommandResult.Success */;
31441
31537
  case "REMOVE_COLUMNS_ROWS": {
@@ -31443,7 +31539,7 @@ class SheetPlugin extends CorePlugin {
31443
31539
  ? this.getNumberCols(cmd.sheetId)
31444
31540
  : this.getNumberRows(cmd.sheetId);
31445
31541
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31446
- return 86 /* CommandResult.InvalidHeaderIndex */;
31542
+ return 87 /* CommandResult.InvalidHeaderIndex */;
31447
31543
  }
31448
31544
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
31449
31545
  return 8 /* CommandResult.NotEnoughElements */;
@@ -31887,18 +31983,18 @@ class SheetPlugin extends CorePlugin {
31887
31983
  checkRowFreezeQuantity(cmd) {
31888
31984
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
31889
31985
  ? 0 /* CommandResult.Success */
31890
- : 74 /* CommandResult.InvalidFreezeQuantity */;
31986
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
31891
31987
  }
31892
31988
  checkColFreezeQuantity(cmd) {
31893
31989
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
31894
31990
  ? 0 /* CommandResult.Success */
31895
- : 74 /* CommandResult.InvalidFreezeQuantity */;
31991
+ : 75 /* CommandResult.InvalidFreezeQuantity */;
31896
31992
  }
31897
31993
  checkRowFreezeOverlapMerge(cmd) {
31898
31994
  const merges = this.getters.getMerges(cmd.sheetId);
31899
31995
  for (let merge of merges) {
31900
31996
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
31901
- return 65 /* CommandResult.MergeOverlap */;
31997
+ return 66 /* CommandResult.MergeOverlap */;
31902
31998
  }
31903
31999
  }
31904
32000
  return 0 /* CommandResult.Success */;
@@ -31907,7 +32003,7 @@ class SheetPlugin extends CorePlugin {
31907
32003
  const merges = this.getters.getMerges(cmd.sheetId);
31908
32004
  for (let merge of merges) {
31909
32005
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
31910
- return 65 /* CommandResult.MergeOverlap */;
32006
+ return 66 /* CommandResult.MergeOverlap */;
31911
32007
  }
31912
32008
  }
31913
32009
  return 0 /* CommandResult.Success */;
@@ -32644,10 +32740,8 @@ class EvaluationPlugin extends UIPlugin {
32644
32740
  * that are actually present in the grid.
32645
32741
  */
32646
32742
  function range(range) {
32743
+ assertRangeValid(range);
32647
32744
  const sheetId = range.sheetId;
32648
- if (!isZoneValid(range.zone)) {
32649
- throw new InvalidReferenceError();
32650
- }
32651
32745
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
32652
32746
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
32653
32747
  const sheetZone = getters.getSheetZone(sheetId);
@@ -32682,23 +32776,26 @@ class EvaluationPlugin extends UIPlugin {
32682
32776
  * The `compute` of the formula's function must process it completely
32683
32777
  */
32684
32778
  function refFn(range, isMeta, functionName, paramNumber) {
32779
+ assertRangeValid(range);
32685
32780
  if (isMeta) {
32686
32781
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
32687
32782
  return { value: zoneToXc(range.zone) };
32688
32783
  }
32689
- if (!isZoneValid(range.zone)) {
32690
- throw new InvalidReferenceError();
32691
- }
32692
32784
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
32693
32785
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
32694
32786
  throw new Error(paramNumber
32695
32787
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
32696
32788
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
32697
32789
  }
32790
+ return readCell(range);
32791
+ }
32792
+ function assertRangeValid(range) {
32793
+ if (!isZoneValid(range.zone)) {
32794
+ throw new InvalidReferenceError();
32795
+ }
32698
32796
  if (range.invalidSheetName) {
32699
32797
  throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
32700
32798
  }
32701
- return readCell(range);
32702
32799
  }
32703
32800
  return [refFn, range, evalContext];
32704
32801
  }
@@ -32718,6 +32815,10 @@ class EvaluationPlugin extends UIPlugin {
32718
32815
  if (cell.format !== evaluatedCell.format) {
32719
32816
  exportedCellData.computedFormat = evaluatedCell.format;
32720
32817
  }
32818
+ // if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
32819
+ if (cell.isFormula && cell.dependencies.length) {
32820
+ exportedCellData.content = this.getters.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
32821
+ }
32721
32822
  }
32722
32823
  }
32723
32824
  }
@@ -33197,7 +33298,7 @@ class FilterEvaluationPlugin extends UIPlugin {
33197
33298
  switch (cmd.type) {
33198
33299
  case "UPDATE_FILTER":
33199
33300
  if (!this.getters.getFilterId(cmd)) {
33200
- return 79 /* CommandResult.FilterNotFound */;
33301
+ return 80 /* CommandResult.FilterNotFound */;
33201
33302
  }
33202
33303
  break;
33203
33304
  }
@@ -34143,7 +34244,7 @@ class SheetViewPlugin extends UIPlugin {
34143
34244
  }
34144
34245
  checkPositiveDimension(cmd) {
34145
34246
  if (cmd.width < 0 || cmd.height < 0) {
34146
- return 68 /* CommandResult.InvalidViewportSize */;
34247
+ return 69 /* CommandResult.InvalidViewportSize */;
34147
34248
  }
34148
34249
  return 0 /* CommandResult.Success */;
34149
34250
  }
@@ -34153,7 +34254,7 @@ class SheetViewPlugin extends UIPlugin {
34153
34254
  cmd.gridOffsetY === this.gridOffsetY &&
34154
34255
  cmd.width === width &&
34155
34256
  cmd.height === height) {
34156
- return 76 /* CommandResult.ValuesNotChanged */;
34257
+ return 77 /* CommandResult.ValuesNotChanged */;
34157
34258
  }
34158
34259
  return 0 /* CommandResult.Success */;
34159
34260
  }
@@ -34161,7 +34262,7 @@ class SheetViewPlugin extends UIPlugin {
34161
34262
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
34162
34263
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
34163
34264
  (!pane.canScrollVertically && offsetY > 0)) {
34164
- return 69 /* CommandResult.InvalidScrollingDirection */;
34265
+ return 70 /* CommandResult.InvalidScrollingDirection */;
34165
34266
  }
34166
34267
  return 0 /* CommandResult.Success */;
34167
34268
  }
@@ -34417,7 +34518,7 @@ class AutofillPlugin extends UIPlugin {
34417
34518
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
34418
34519
  return 0 /* CommandResult.Success */;
34419
34520
  }
34420
- return 45 /* CommandResult.InvalidAutofillSelection */;
34521
+ return 46 /* CommandResult.InvalidAutofillSelection */;
34421
34522
  case "AUTOFILL_AUTO":
34422
34523
  const zone = this.getters.getSelectedZone();
34423
34524
  return zone.top === zone.bottom
@@ -34578,8 +34679,7 @@ class AutofillPlugin extends UIPlugin {
34578
34679
  let row = zone.bottom;
34579
34680
  if (col > 0) {
34580
34681
  let leftPosition = { sheetId, col: col - 1, row };
34581
- while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
34582
- ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content)) {
34682
+ while ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content) {
34583
34683
  row += 1;
34584
34684
  leftPosition = { sheetId, col: col - 1, row };
34585
34685
  }
@@ -34588,8 +34688,7 @@ class AutofillPlugin extends UIPlugin {
34588
34688
  col = zone.right;
34589
34689
  if (col <= this.getters.getNumberCols(sheetId)) {
34590
34690
  let rightPosition = { sheetId, col: col + 1, row };
34591
- while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
34592
- ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content)) {
34691
+ while ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content) {
34593
34692
  row += 1;
34594
34693
  rightPosition = { sheetId, col: col + 1, row };
34595
34694
  }
@@ -35019,7 +35118,7 @@ class CellPopoverPlugin extends UIPlugin {
35019
35118
  cellPopoverRegistry.get(cmd.popoverType);
35020
35119
  }
35021
35120
  catch (error) {
35022
- return 72 /* CommandResult.InvalidCellPopover */;
35121
+ return 73 /* CommandResult.InvalidCellPopover */;
35023
35122
  }
35024
35123
  return 0 /* CommandResult.Success */;
35025
35124
  default:
@@ -36222,21 +36321,6 @@ class SelectionInputPlugin extends UIPlugin {
36222
36321
  // ---------------------------------------------------------------------------
36223
36322
  // Command Handling
36224
36323
  // ---------------------------------------------------------------------------
36225
- allowDispatch(cmd) {
36226
- switch (cmd.type) {
36227
- case "ADD_EMPTY_RANGE":
36228
- if (this.inputHasSingleRange && this.ranges.length === 1) {
36229
- return 30 /* CommandResult.MaximumRangesReached */;
36230
- }
36231
- break;
36232
- case "CHANGE_RANGE":
36233
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
36234
- return 30 /* CommandResult.MaximumRangesReached */;
36235
- }
36236
- break;
36237
- }
36238
- return 0 /* CommandResult.Success */;
36239
- }
36240
36324
  handleEvent(event) {
36241
36325
  const xc = zoneToXc(event.anchor.zone);
36242
36326
  const inputSheetId = this.activeSheet;
@@ -36296,9 +36380,6 @@ class SelectionInputPlugin extends UIPlugin {
36296
36380
  }
36297
36381
  }
36298
36382
  }
36299
- unsubscribe() {
36300
- this.unfocus();
36301
- }
36302
36383
  // ---------------------------------------------------------------------------
36303
36384
  // Getters || only callable by the parent
36304
36385
  // ---------------------------------------------------------------------------
@@ -36448,6 +36529,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
36448
36529
  // ---------------------------------------------------------------------------
36449
36530
  allowDispatch(cmd) {
36450
36531
  var _a, _b;
36532
+ switch (cmd.type) {
36533
+ case "FOCUS_RANGE":
36534
+ case "CHANGE_RANGE":
36535
+ case "ADD_EMPTY_RANGE":
36536
+ case "REMOVE_RANGE":
36537
+ if (!this.inputs[cmd.id]) {
36538
+ return 31 /* CommandResult.InvalidInputId */;
36539
+ }
36540
+ }
36451
36541
  switch (cmd.type) {
36452
36542
  case "FOCUS_RANGE":
36453
36543
  const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
@@ -36455,9 +36545,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
36455
36545
  return 29 /* CommandResult.InputAlreadyFocused */;
36456
36546
  }
36457
36547
  break;
36458
- }
36459
- if (this.currentInput) {
36460
- return this.currentInput.allowDispatch(cmd);
36548
+ case "ADD_EMPTY_RANGE":
36549
+ const input = this.inputs[cmd.id];
36550
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
36551
+ return 30 /* CommandResult.MaximumRangesReached */;
36552
+ }
36553
+ break;
36554
+ case "CHANGE_RANGE": {
36555
+ const input = this.inputs[cmd.id];
36556
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
36557
+ return 30 /* CommandResult.MaximumRangesReached */;
36558
+ }
36559
+ break;
36560
+ }
36461
36561
  }
36462
36562
  return 0 /* CommandResult.Success */;
36463
36563
  }
@@ -36486,9 +36586,9 @@ class SelectionInputsManagerPlugin extends UIPlugin {
36486
36586
  break;
36487
36587
  case "FOCUS_RANGE":
36488
36588
  case "CHANGE_RANGE":
36489
- if (cmd.id !== this.focusedInputId) {
36490
- const input = this.inputs[cmd.id];
36491
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
36589
+ const input = this.inputs[cmd.id];
36590
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
36591
+ if (range) {
36492
36592
  const sheetId = this.getters.getActiveSheetId();
36493
36593
  const zone = this.getters.getRangeFromSheetXC(sheetId, (range === null || range === void 0 ? void 0 : range.xc) || "A1").zone;
36494
36594
  this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
@@ -36498,9 +36598,6 @@ class SelectionInputsManagerPlugin extends UIPlugin {
36498
36598
  }
36499
36599
  (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.handle(cmd);
36500
36600
  }
36501
- unsubscribe() {
36502
- this.unfocus();
36503
- }
36504
36601
  // ---------------------------------------------------------------------------
36505
36602
  // Getters
36506
36603
  // ---------------------------------------------------------------------------
@@ -37440,7 +37537,7 @@ class SortPlugin extends UIPlugin {
37440
37537
  /*Test the presence of single cells*/
37441
37538
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
37442
37539
  if (singleCells) {
37443
- return 63 /* CommandResult.InvalidSortZone */;
37540
+ return 64 /* CommandResult.InvalidSortZone */;
37444
37541
  }
37445
37542
  return 0 /* CommandResult.Success */;
37446
37543
  }
@@ -37459,7 +37556,7 @@ class SortPlugin extends UIPlugin {
37459
37556
  ];
37460
37557
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
37461
37558
  })) {
37462
- return 63 /* CommandResult.InvalidSortZone */;
37559
+ return 64 /* CommandResult.InvalidSortZone */;
37463
37560
  }
37464
37561
  return 0 /* CommandResult.Success */;
37465
37562
  }
@@ -38087,7 +38184,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
38087
38184
  for (const zone of this.getPasteZones(target)) {
38088
38185
  if ((zone.left < xSplit && zone.right >= xSplit) ||
38089
38186
  (zone.top < ySplit && zone.bottom >= ySplit)) {
38090
- return 75 /* CommandResult.FrozenPaneOverlap */;
38187
+ return 76 /* CommandResult.FrozenPaneOverlap */;
38091
38188
  }
38092
38189
  }
38093
38190
  return 0 /* CommandResult.Success */;
@@ -38475,7 +38572,7 @@ class ClipboardFigureState {
38475
38572
  }
38476
38573
  isPasteAllowed(target, option) {
38477
38574
  if (target.length === 0) {
38478
- return 73 /* CommandResult.EmptyTarget */;
38575
+ return 74 /* CommandResult.EmptyTarget */;
38479
38576
  }
38480
38577
  if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
38481
38578
  return 22 /* CommandResult.WrongFigurePasteOption */;
@@ -39386,7 +39483,7 @@ class GridSelectionPlugin extends UIPlugin {
39386
39483
  const headers = [cmd.base, ...cmd.elements];
39387
39484
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
39388
39485
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
39389
- return 86 /* CommandResult.InvalidHeaderIndex */;
39486
+ return 87 /* CommandResult.InvalidHeaderIndex */;
39390
39487
  }
39391
39488
  return 0 /* CommandResult.Success */;
39392
39489
  }
@@ -39571,6 +39668,19 @@ class ImageProvider {
39571
39668
  }
39572
39669
  }
39573
39670
 
39671
+ class FocusableElement {
39672
+ constructor() {
39673
+ this.focusableElement = undefined;
39674
+ }
39675
+ setFocusableElement(element) {
39676
+ this.focusableElement = element;
39677
+ }
39678
+ focus() {
39679
+ var _a;
39680
+ (_a = this.focusableElement) === null || _a === void 0 ? void 0 : _a.focus();
39681
+ }
39682
+ }
39683
+
39574
39684
  // -----------------------------------------------------------------------------
39575
39685
  // SpreadSheet
39576
39686
  // -----------------------------------------------------------------------------
@@ -40194,7 +40304,7 @@ const AddMergeInteractiveContent = {
40194
40304
  };
40195
40305
  function interactiveAddMerge(env, sheetId, target) {
40196
40306
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
40197
- if (result.isCancelledBecause(80 /* CommandResult.MergeInFilter */)) {
40307
+ if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
40198
40308
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
40199
40309
  }
40200
40310
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -40814,8 +40924,8 @@ css /* scss */ `
40814
40924
  &.corner {
40815
40925
  right: 0px;
40816
40926
  bottom: 0px;
40817
- height: ${SCROLLBAR_WIDTH$1}px;
40818
- width: ${SCROLLBAR_WIDTH$1}px;
40927
+ height: ${SCROLLBAR_WIDTH}px;
40928
+ width: ${SCROLLBAR_WIDTH}px;
40819
40929
  border-top: 1px solid #e2e3e3;
40820
40930
  border-left: 1px solid #e2e3e3;
40821
40931
  }
@@ -40862,6 +40972,7 @@ class Spreadsheet extends owl.Component {
40862
40972
  toggleSidePanel: this.toggleSidePanel.bind(this),
40863
40973
  _t: Spreadsheet._t,
40864
40974
  clipboard: this.env.clipboard || instantiateClipboard(),
40975
+ focusableElement: new FocusableElement(),
40865
40976
  });
40866
40977
  owl.useExternalListener(window, "resize", () => this.render(true));
40867
40978
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -40960,17 +41071,18 @@ class Spreadsheet extends owl.Component {
40960
41071
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40961
41072
  this.composer.topBarFocus = "contentFocus";
40962
41073
  this.composer.gridFocusMode = "inactive";
40963
- this.setComposerContent({ selection } || {});
41074
+ this.setComposerContent({ selection });
40964
41075
  }
40965
- onGridComposerContentFocused() {
41076
+ onGridComposerContentFocused(selection) {
40966
41077
  if (this.model.getters.isReadonly()) {
40967
41078
  return;
40968
41079
  }
40969
41080
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40970
41081
  this.composer.topBarFocus = "inactive";
40971
41082
  this.composer.gridFocusMode = "contentFocus";
40972
- this.setComposerContent({});
41083
+ this.setComposerContent({ selection });
40973
41084
  }
41085
+ // TODO: either both are defined or none of them. change those args to an object
40974
41086
  onGridComposerCellFocused(content, selection) {
40975
41087
  if (this.model.getters.isReadonly()) {
40976
41088
  return;
@@ -41951,18 +42063,17 @@ class EventStream {
41951
42063
  if (this.observers.find((sub) => sub.owner === owner)) {
41952
42064
  throw new Error("You are already subscribed forever");
41953
42065
  }
41954
- if ((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) {
42066
+ if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) && this.mainSubscription.owner !== owner) {
41955
42067
  (_c = (_b = this.mainSubscription.callbacks).release) === null || _c === void 0 ? void 0 : _c.call(_b);
41956
42068
  }
41957
42069
  this.mainSubscription = { owner, callbacks };
41958
42070
  }
41959
42071
  release(owner) {
41960
- var _a, _b, _c, _d;
42072
+ var _a;
41961
42073
  if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) !== owner ||
41962
42074
  this.observers.find((sub) => sub.owner === owner)) {
41963
42075
  return;
41964
42076
  }
41965
- (_d = (_b = this.mainSubscription) === null || _b === void 0 ? void 0 : (_c = _b.callbacks).release) === null || _d === void 0 ? void 0 : _d.call(_c);
41966
42077
  this.mainSubscription = this.defaultSubscription;
41967
42078
  }
41968
42079
  /**
@@ -42069,7 +42180,7 @@ class SelectionStreamProcessor {
42069
42180
  */
42070
42181
  moveAnchorCell(direction, step = 1) {
42071
42182
  if (step !== "end" && step <= 0) {
42072
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
42183
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
42073
42184
  }
42074
42185
  const { col, row } = this.getNextAvailablePosition(direction, step);
42075
42186
  return this.selectCell(col, row);
@@ -42115,7 +42226,7 @@ class SelectionStreamProcessor {
42115
42226
  */
42116
42227
  resizeAnchorZone(direction, step = 1) {
42117
42228
  if (step !== "end" && step <= 0) {
42118
- return new DispatchResult(83 /* CommandResult.InvalidSelectionStep */);
42229
+ return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
42119
42230
  }
42120
42231
  const sheetId = this.getters.getActiveSheetId();
42121
42232
  const anchor = this.anchor;
@@ -42430,11 +42541,10 @@ class SelectionStreamProcessor {
42430
42541
  * next cluster if the given cell is outside a cluster or at the border of a cluster in the given direction.
42431
42542
  */
42432
42543
  getEndOfCluster(startPosition, dim, dir) {
42433
- const sheet = this.getters.getActiveSheet();
42434
42544
  let currentPosition = startPosition;
42435
42545
  // If both the current cell and the next cell are not empty, we want to go to the end of the cluster
42436
42546
  const nextCellPosition = this.getNextCellPosition(startPosition, dim, dir);
42437
- let mode = !this.isCellEmpty(currentPosition, sheet.id) && !this.isCellEmpty(nextCellPosition, sheet.id)
42547
+ let mode = !this.isEvaluatedCellEmpty(currentPosition) && !this.isEvaluatedCellEmpty(nextCellPosition)
42438
42548
  ? "endOfCluster"
42439
42549
  : "nextCluster";
42440
42550
  while (true) {
@@ -42444,7 +42554,7 @@ class SelectionStreamProcessor {
42444
42554
  currentPosition.row === nextCellPosition.row) {
42445
42555
  break;
42446
42556
  }
42447
- const isNextCellEmpty = this.isCellEmpty(nextCellPosition, sheet.id);
42557
+ const isNextCellEmpty = this.isEvaluatedCellEmpty(nextCellPosition);
42448
42558
  if (mode === "endOfCluster" && isNextCellEmpty) {
42449
42559
  break;
42450
42560
  }
@@ -42458,14 +42568,25 @@ class SelectionStreamProcessor {
42458
42568
  return dim === "cols" ? currentPosition.col : currentPosition.row;
42459
42569
  }
42460
42570
  /**
42461
- * Check if a cell is empty or undefined in the model. If the cell is part of a merge,
42462
- * check if the merge containing the cell is empty.
42571
+ * Check if a cell evaluated value is empty. If the cell is part of a merge,
42572
+ * the check applies to the main cell of the merge.
42463
42573
  */
42464
- isCellEmpty({ col, row }, sheetId = this.getters.getActiveSheetId()) {
42574
+ isEvaluatedCellEmpty({ col, row }) {
42575
+ const sheetId = this.getters.getActiveSheetId();
42465
42576
  const position = this.getters.getMainCellPosition({ sheetId, col, row });
42466
42577
  const cell = this.getters.getEvaluatedCell(position);
42467
42578
  return cell.type === CellValueType.empty;
42468
42579
  }
42580
+ /**
42581
+ * Checks if a cell is empty (i.e. does not have a content). If the cell is part of a merge,
42582
+ * the check applies to the main cell of the merge.
42583
+ */
42584
+ isCellEmpty({ col, row }) {
42585
+ var _a;
42586
+ const sheetId = this.getters.getActiveSheetId();
42587
+ const position = this.getters.getMainCellPosition({ sheetId, col, row });
42588
+ return !((_a = this.getters.getCell(position)) === null || _a === void 0 ? void 0 : _a.content);
42589
+ }
42469
42590
  /** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
42470
42591
  *
42471
42592
  * This has the same behaviour as getNextAvailablePosition() for certain arguments, but use this method instead
@@ -42944,12 +43065,7 @@ function addFormula(cell) {
42944
43065
  attrs.push(["t", "str"]);
42945
43066
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
42946
43067
  }
42947
- node = escapeXml /*xml*/ `
42948
- <f>
42949
- ${XlsxFormula}
42950
- </f>
42951
- ${cycle}
42952
- `;
43068
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
42953
43069
  return { attrs, node };
42954
43070
  }
42955
43071
  else {
@@ -43690,11 +43806,10 @@ function addRows(construct, data, sheet) {
43690
43806
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
43691
43807
  }
43692
43808
  attributes.push(...additionalAttrs);
43693
- cellNodes.push(escapeXml /*xml*/ `
43694
- <c ${formatAttributes(attributes)}>
43695
- ${cellNode}
43696
- </c>
43697
- `);
43809
+ // prettier-ignore
43810
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
43811
+ ${cellNode}
43812
+ </c>`);
43698
43813
  }
43699
43814
  }
43700
43815
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -44075,10 +44190,10 @@ class Model extends EventBus {
44075
44190
  const command = { ...payload, type };
44076
44191
  let status = this.status;
44077
44192
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
44078
- return new DispatchResult(67 /* CommandResult.Readonly */);
44193
+ return new DispatchResult(68 /* CommandResult.Readonly */);
44079
44194
  }
44080
44195
  if (!this.session.canApplyOptimisticUpdate()) {
44081
- return new DispatchResult(64 /* CommandResult.WaitingSessionConfirmation */);
44196
+ return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
44082
44197
  }
44083
44198
  switch (status) {
44084
44199
  case 0 /* Status.Ready */:
@@ -44451,7 +44566,7 @@ const SPREADSHEET_DIMENSIONS = {
44451
44566
  BOTTOMBAR_HEIGHT,
44452
44567
  DEFAULT_CELL_WIDTH,
44453
44568
  DEFAULT_CELL_HEIGHT,
44454
- SCROLLBAR_WIDTH: SCROLLBAR_WIDTH$1,
44569
+ SCROLLBAR_WIDTH,
44455
44570
  };
44456
44571
  const registries = {
44457
44572
  autofillModifiersRegistry,
@@ -44566,6 +44681,6 @@ exports.setTranslationMethod = setTranslationMethod;
44566
44681
  exports.tokenize = tokenize;
44567
44682
 
44568
44683
 
44569
- __info__.version = '16.1.31';
44570
- __info__.date = '2024-01-12T13:42:11.001Z';
44571
- __info__.hash = 'f51befa';
44684
+ __info__.version = '16.1.36';
44685
+ __info__.date = '2024-02-16T14:16:11.082Z';
44686
+ __info__.hash = 'ad5301c';