@odoo/o-spreadsheet 16.4.19 → 16.4.21

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.
@@ -2219,27 +2219,30 @@ function roundFormat(format) {
2219
2219
  }
2220
2220
  function createLargeNumberFormat(format, magnitude, postFix, locale) {
2221
2221
  const internalFormat = parseFormat(format || "#,##0");
2222
- const largeNumberFormat = internalFormat
2223
- .map((formatPart) => {
2224
- if (formatPart.type === "NUMBER") {
2225
- return [
2226
- {
2227
- ...formatPart,
2228
- format: {
2229
- ...formatPart.format,
2230
- magnitude,
2231
- decimalPart: undefined,
2232
- },
2233
- },
2234
- {
2235
- type: "STRING",
2236
- format: postFix,
2237
- },
2238
- ];
2222
+ const largeNumberFormat = [];
2223
+ for (let i = 0; i < internalFormat.length; i++) {
2224
+ const formatPart = internalFormat[i];
2225
+ if (formatPart.type !== "NUMBER") {
2226
+ largeNumberFormat.push(formatPart);
2227
+ continue;
2239
2228
  }
2240
- return formatPart;
2241
- })
2242
- .flat();
2229
+ largeNumberFormat.push({
2230
+ ...formatPart,
2231
+ format: {
2232
+ ...formatPart.format,
2233
+ magnitude,
2234
+ decimalPart: undefined,
2235
+ },
2236
+ });
2237
+ largeNumberFormat.push({
2238
+ type: "STRING",
2239
+ format: postFix,
2240
+ });
2241
+ const nextFormatPart = internalFormat[i + 1];
2242
+ if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2243
+ i++;
2244
+ }
2245
+ }
2243
2246
  return convertInternalFormatToFormat(largeNumberFormat);
2244
2247
  }
2245
2248
  function changeDecimalPlaces(format, step, locale) {
@@ -4258,71 +4261,72 @@ exports.CommandResult = void 0;
4258
4261
  CommandResult[CommandResult["InputAlreadyFocused"] = 30] = "InputAlreadyFocused";
4259
4262
  CommandResult[CommandResult["MaximumRangesReached"] = 31] = "MaximumRangesReached";
4260
4263
  CommandResult[CommandResult["MinimumRangesReached"] = 32] = "MinimumRangesReached";
4261
- CommandResult[CommandResult["InvalidChartDefinition"] = 33] = "InvalidChartDefinition";
4262
- CommandResult[CommandResult["InvalidDataSet"] = 34] = "InvalidDataSet";
4263
- CommandResult[CommandResult["InvalidLabelRange"] = 35] = "InvalidLabelRange";
4264
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 36] = "InvalidScorecardKeyValue";
4265
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 37] = "InvalidScorecardBaseline";
4266
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 38] = "InvalidGaugeDataRange";
4267
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 39] = "EmptyGaugeRangeMin";
4268
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 40] = "GaugeRangeMinNaN";
4269
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 41] = "EmptyGaugeRangeMax";
4270
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 42] = "GaugeRangeMaxNaN";
4271
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 43] = "GaugeRangeMinBiggerThanRangeMax";
4272
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 44] = "GaugeLowerInflectionPointNaN";
4273
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 45] = "GaugeUpperInflectionPointNaN";
4274
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 46] = "GaugeLowerBiggerThanUpper";
4275
- CommandResult[CommandResult["InvalidAutofillSelection"] = 47] = "InvalidAutofillSelection";
4276
- CommandResult[CommandResult["WrongComposerSelection"] = 48] = "WrongComposerSelection";
4277
- CommandResult[CommandResult["MinBiggerThanMax"] = 49] = "MinBiggerThanMax";
4278
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 50] = "LowerBiggerThanUpper";
4279
- CommandResult[CommandResult["MidBiggerThanMax"] = 51] = "MidBiggerThanMax";
4280
- CommandResult[CommandResult["MinBiggerThanMid"] = 52] = "MinBiggerThanMid";
4281
- CommandResult[CommandResult["FirstArgMissing"] = 53] = "FirstArgMissing";
4282
- CommandResult[CommandResult["SecondArgMissing"] = 54] = "SecondArgMissing";
4283
- CommandResult[CommandResult["MinNaN"] = 55] = "MinNaN";
4284
- CommandResult[CommandResult["MidNaN"] = 56] = "MidNaN";
4285
- CommandResult[CommandResult["MaxNaN"] = 57] = "MaxNaN";
4286
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 58] = "ValueUpperInflectionNaN";
4287
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 59] = "ValueLowerInflectionNaN";
4288
- CommandResult[CommandResult["MinInvalidFormula"] = 60] = "MinInvalidFormula";
4289
- CommandResult[CommandResult["MidInvalidFormula"] = 61] = "MidInvalidFormula";
4290
- CommandResult[CommandResult["MaxInvalidFormula"] = 62] = "MaxInvalidFormula";
4291
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 63] = "ValueUpperInvalidFormula";
4292
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 64] = "ValueLowerInvalidFormula";
4293
- CommandResult[CommandResult["InvalidSortZone"] = 65] = "InvalidSortZone";
4294
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 66] = "WaitingSessionConfirmation";
4295
- CommandResult[CommandResult["MergeOverlap"] = 67] = "MergeOverlap";
4296
- CommandResult[CommandResult["TooManyHiddenElements"] = 68] = "TooManyHiddenElements";
4297
- CommandResult[CommandResult["Readonly"] = 69] = "Readonly";
4298
- CommandResult[CommandResult["InvalidViewportSize"] = 70] = "InvalidViewportSize";
4299
- CommandResult[CommandResult["InvalidScrollingDirection"] = 71] = "InvalidScrollingDirection";
4300
- CommandResult[CommandResult["FigureDoesNotExist"] = 72] = "FigureDoesNotExist";
4301
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 73] = "InvalidConditionalFormatId";
4302
- CommandResult[CommandResult["InvalidCellPopover"] = 74] = "InvalidCellPopover";
4303
- CommandResult[CommandResult["EmptyTarget"] = 75] = "EmptyTarget";
4304
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 76] = "InvalidFreezeQuantity";
4305
- CommandResult[CommandResult["FrozenPaneOverlap"] = 77] = "FrozenPaneOverlap";
4306
- CommandResult[CommandResult["ValuesNotChanged"] = 78] = "ValuesNotChanged";
4307
- CommandResult[CommandResult["InvalidFilterZone"] = 79] = "InvalidFilterZone";
4308
- CommandResult[CommandResult["FilterOverlap"] = 80] = "FilterOverlap";
4309
- CommandResult[CommandResult["FilterNotFound"] = 81] = "FilterNotFound";
4310
- CommandResult[CommandResult["MergeInFilter"] = 82] = "MergeInFilter";
4311
- CommandResult[CommandResult["NonContinuousTargets"] = 83] = "NonContinuousTargets";
4312
- CommandResult[CommandResult["DuplicatedFigureId"] = 84] = "DuplicatedFigureId";
4313
- CommandResult[CommandResult["InvalidSelectionStep"] = 85] = "InvalidSelectionStep";
4314
- CommandResult[CommandResult["DuplicatedChartId"] = 86] = "DuplicatedChartId";
4315
- CommandResult[CommandResult["ChartDoesNotExist"] = 87] = "ChartDoesNotExist";
4316
- CommandResult[CommandResult["InvalidHeaderIndex"] = 88] = "InvalidHeaderIndex";
4317
- CommandResult[CommandResult["InvalidQuantity"] = 89] = "InvalidQuantity";
4318
- CommandResult[CommandResult["MoreThanOneColumnSelected"] = 90] = "MoreThanOneColumnSelected";
4319
- CommandResult[CommandResult["EmptySplitSeparator"] = 91] = "EmptySplitSeparator";
4320
- CommandResult[CommandResult["SplitWillOverwriteContent"] = 92] = "SplitWillOverwriteContent";
4321
- CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 93] = "NoSplitSeparatorInSelection";
4322
- CommandResult[CommandResult["NoActiveSheet"] = 94] = "NoActiveSheet";
4323
- CommandResult[CommandResult["InvalidLocale"] = 95] = "InvalidLocale";
4324
- CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 96] = "AlreadyInPaintingFormatMode";
4325
- CommandResult[CommandResult["NoChanges"] = 97] = "NoChanges";
4264
+ CommandResult[CommandResult["InvalidInputId"] = 33] = "InvalidInputId";
4265
+ CommandResult[CommandResult["InvalidChartDefinition"] = 34] = "InvalidChartDefinition";
4266
+ CommandResult[CommandResult["InvalidDataSet"] = 35] = "InvalidDataSet";
4267
+ CommandResult[CommandResult["InvalidLabelRange"] = 36] = "InvalidLabelRange";
4268
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 37] = "InvalidScorecardKeyValue";
4269
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 38] = "InvalidScorecardBaseline";
4270
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 39] = "InvalidGaugeDataRange";
4271
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 40] = "EmptyGaugeRangeMin";
4272
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 41] = "GaugeRangeMinNaN";
4273
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 42] = "EmptyGaugeRangeMax";
4274
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 43] = "GaugeRangeMaxNaN";
4275
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 44] = "GaugeRangeMinBiggerThanRangeMax";
4276
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 45] = "GaugeLowerInflectionPointNaN";
4277
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 46] = "GaugeUpperInflectionPointNaN";
4278
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 47] = "GaugeLowerBiggerThanUpper";
4279
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 48] = "InvalidAutofillSelection";
4280
+ CommandResult[CommandResult["WrongComposerSelection"] = 49] = "WrongComposerSelection";
4281
+ CommandResult[CommandResult["MinBiggerThanMax"] = 50] = "MinBiggerThanMax";
4282
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 51] = "LowerBiggerThanUpper";
4283
+ CommandResult[CommandResult["MidBiggerThanMax"] = 52] = "MidBiggerThanMax";
4284
+ CommandResult[CommandResult["MinBiggerThanMid"] = 53] = "MinBiggerThanMid";
4285
+ CommandResult[CommandResult["FirstArgMissing"] = 54] = "FirstArgMissing";
4286
+ CommandResult[CommandResult["SecondArgMissing"] = 55] = "SecondArgMissing";
4287
+ CommandResult[CommandResult["MinNaN"] = 56] = "MinNaN";
4288
+ CommandResult[CommandResult["MidNaN"] = 57] = "MidNaN";
4289
+ CommandResult[CommandResult["MaxNaN"] = 58] = "MaxNaN";
4290
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 59] = "ValueUpperInflectionNaN";
4291
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 60] = "ValueLowerInflectionNaN";
4292
+ CommandResult[CommandResult["MinInvalidFormula"] = 61] = "MinInvalidFormula";
4293
+ CommandResult[CommandResult["MidInvalidFormula"] = 62] = "MidInvalidFormula";
4294
+ CommandResult[CommandResult["MaxInvalidFormula"] = 63] = "MaxInvalidFormula";
4295
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 64] = "ValueUpperInvalidFormula";
4296
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 65] = "ValueLowerInvalidFormula";
4297
+ CommandResult[CommandResult["InvalidSortZone"] = 66] = "InvalidSortZone";
4298
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 67] = "WaitingSessionConfirmation";
4299
+ CommandResult[CommandResult["MergeOverlap"] = 68] = "MergeOverlap";
4300
+ CommandResult[CommandResult["TooManyHiddenElements"] = 69] = "TooManyHiddenElements";
4301
+ CommandResult[CommandResult["Readonly"] = 70] = "Readonly";
4302
+ CommandResult[CommandResult["InvalidViewportSize"] = 71] = "InvalidViewportSize";
4303
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 72] = "InvalidScrollingDirection";
4304
+ CommandResult[CommandResult["FigureDoesNotExist"] = 73] = "FigureDoesNotExist";
4305
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 74] = "InvalidConditionalFormatId";
4306
+ CommandResult[CommandResult["InvalidCellPopover"] = 75] = "InvalidCellPopover";
4307
+ CommandResult[CommandResult["EmptyTarget"] = 76] = "EmptyTarget";
4308
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 77] = "InvalidFreezeQuantity";
4309
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 78] = "FrozenPaneOverlap";
4310
+ CommandResult[CommandResult["ValuesNotChanged"] = 79] = "ValuesNotChanged";
4311
+ CommandResult[CommandResult["InvalidFilterZone"] = 80] = "InvalidFilterZone";
4312
+ CommandResult[CommandResult["FilterOverlap"] = 81] = "FilterOverlap";
4313
+ CommandResult[CommandResult["FilterNotFound"] = 82] = "FilterNotFound";
4314
+ CommandResult[CommandResult["MergeInFilter"] = 83] = "MergeInFilter";
4315
+ CommandResult[CommandResult["NonContinuousTargets"] = 84] = "NonContinuousTargets";
4316
+ CommandResult[CommandResult["DuplicatedFigureId"] = 85] = "DuplicatedFigureId";
4317
+ CommandResult[CommandResult["InvalidSelectionStep"] = 86] = "InvalidSelectionStep";
4318
+ CommandResult[CommandResult["DuplicatedChartId"] = 87] = "DuplicatedChartId";
4319
+ CommandResult[CommandResult["ChartDoesNotExist"] = 88] = "ChartDoesNotExist";
4320
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 89] = "InvalidHeaderIndex";
4321
+ CommandResult[CommandResult["InvalidQuantity"] = 90] = "InvalidQuantity";
4322
+ CommandResult[CommandResult["MoreThanOneColumnSelected"] = 91] = "MoreThanOneColumnSelected";
4323
+ CommandResult[CommandResult["EmptySplitSeparator"] = 92] = "EmptySplitSeparator";
4324
+ CommandResult[CommandResult["SplitWillOverwriteContent"] = 93] = "SplitWillOverwriteContent";
4325
+ CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 94] = "NoSplitSeparatorInSelection";
4326
+ CommandResult[CommandResult["NoActiveSheet"] = 95] = "NoActiveSheet";
4327
+ CommandResult[CommandResult["InvalidLocale"] = 96] = "InvalidLocale";
4328
+ CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 97] = "AlreadyInPaintingFormatMode";
4329
+ CommandResult[CommandResult["NoChanges"] = 98] = "NoChanges";
4326
4330
  })(exports.CommandResult || (exports.CommandResult = {}));
4327
4331
 
4328
4332
  const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
@@ -15971,14 +15975,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
15971
15975
  : undefined));
15972
15976
  }
15973
15977
  }
15974
- else if (zone.left === zone.right && zone.top === zone.bottom) {
15975
- // A single cell. If it's only the title, the dataset is not added.
15976
- if (!dataSetsHaveTitle) {
15977
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
15978
- }
15979
- }
15980
15978
  else {
15981
- /* 1 row or 1 column */
15979
+ /* 1 cell, 1 row or 1 column */
15982
15980
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
15983
15981
  ? {
15984
15982
  top: zone.top,
@@ -16027,8 +16025,10 @@ function toExcelDataset(getters, ds) {
16027
16025
  }
16028
16026
  const dataRange = ds.dataRange.clone({ zone: dataZone });
16029
16027
  return {
16030
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
16031
- range: getters.getRangeString(dataRange, "forceSheetReference"),
16028
+ label: ds.labelCell
16029
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
16030
+ : undefined,
16031
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
16032
16032
  };
16033
16033
  }
16034
16034
  function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
@@ -16041,7 +16041,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
16041
16041
  zone.top = zone.top + 1;
16042
16042
  }
16043
16043
  const range = labelRange.clone({ zone });
16044
- return getters.getRangeString(range, "forceSheetReference");
16044
+ return getters.getRangeString(range, "forceSheetReference", true);
16045
16045
  }
16046
16046
  /**
16047
16047
  * Transform a chart definition which supports dataSets (dataSets and LabelRange)
@@ -16107,11 +16107,11 @@ function checkDataset(definition) {
16107
16107
  if (definition.dataSets) {
16108
16108
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
16109
16109
  if (invalidRanges) {
16110
- return 34 /* CommandResult.InvalidDataSet */;
16110
+ return 35 /* CommandResult.InvalidDataSet */;
16111
16111
  }
16112
16112
  const zones = definition.dataSets.map(toUnboundedZone);
16113
16113
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
16114
- return 34 /* CommandResult.InvalidDataSet */;
16114
+ return 35 /* CommandResult.InvalidDataSet */;
16115
16115
  }
16116
16116
  }
16117
16117
  return 0 /* CommandResult.Success */;
@@ -16120,7 +16120,7 @@ function checkLabelRange(definition) {
16120
16120
  if (definition.labelRange) {
16121
16121
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
16122
16122
  if (invalidLabels) {
16123
- return 35 /* CommandResult.InvalidLabelRange */;
16123
+ return 36 /* CommandResult.InvalidLabelRange */;
16124
16124
  }
16125
16125
  }
16126
16126
  return 0 /* CommandResult.Success */;
@@ -16207,22 +16207,22 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
16207
16207
  const CfTerms = {
16208
16208
  Errors: {
16209
16209
  [26 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
16210
- [53 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16211
- [54 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16212
- [55 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16213
- [56 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16214
- [57 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16215
- [58 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16216
- [59 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16217
- [49 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16218
- [52 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16219
- [51 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16220
- [50 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16221
- [60 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16222
- [62 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16223
- [61 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16224
- [63 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16225
- [64 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16210
+ [54 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16211
+ [55 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16212
+ [56 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16213
+ [57 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16214
+ [58 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16215
+ [59 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16216
+ [60 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16217
+ [50 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16218
+ [53 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16219
+ [52 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16220
+ [51 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16221
+ [61 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16222
+ [63 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16223
+ [62 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16224
+ [64 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16225
+ [65 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16226
16226
  [25 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
16227
16227
  Unexpected: _lt("The rule is invalid for an unknown reason"),
16228
16228
  },
@@ -16250,20 +16250,20 @@ const ChartTerms = {
16250
16250
  Errors: {
16251
16251
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
16252
16252
  // BASIC CHART ERRORS (LINE | BAR | PIE)
16253
- [34 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16254
- [35 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16253
+ [35 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16254
+ [36 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16255
16255
  // SCORECARD CHART ERRORS
16256
- [36 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16257
- [37 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16256
+ [37 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16257
+ [38 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16258
16258
  // GAUGE CHART ERRORS
16259
- [38 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16260
- [39 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16261
- [40 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16262
- [41 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16263
- [42 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16264
- [43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16265
- [44 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16266
- [45 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16259
+ [39 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16260
+ [40 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16261
+ [41 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16262
+ [42 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16263
+ [43 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16264
+ [44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16265
+ [45 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16266
+ [46 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16267
16267
  },
16268
16268
  };
16269
16269
  const CustomCurrencyTerms = {
@@ -16273,9 +16273,9 @@ const MergeErrorMessage = _lt("Merged cells are preventing this operation. Unmer
16273
16273
  const SplitToColumnsTerms = {
16274
16274
  Errors: {
16275
16275
  Unexpected: _lt("Cannot split the selection for an unknown reason"),
16276
- [93 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16277
- [90 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16278
- [92 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16276
+ [94 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16277
+ [91 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16278
+ [93 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16279
16279
  },
16280
16280
  };
16281
16281
 
@@ -16578,7 +16578,7 @@ class BarChart extends AbstractChart {
16578
16578
  return undefined;
16579
16579
  const dataSets = this.dataSets
16580
16580
  .map((ds) => toExcelDataset(this.getters, ds))
16581
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
16581
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
16582
16582
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
16583
16583
  return {
16584
16584
  ...this.getDefinition(),
@@ -16680,7 +16680,7 @@ function createBarChartRuntime(chart, getters) {
16680
16680
 
16681
16681
  function isDataRangeValid(definition) {
16682
16682
  return definition.dataRange && !rangeReference.test(definition.dataRange)
16683
- ? 38 /* CommandResult.InvalidGaugeDataRange */
16683
+ ? 39 /* CommandResult.InvalidGaugeDataRange */
16684
16684
  : 0 /* CommandResult.Success */;
16685
16685
  }
16686
16686
  function checkRangeLimits(check, batchValidations) {
@@ -16712,7 +16712,7 @@ function checkInflectionPointsValue(check, batchValidations) {
16712
16712
  function checkRangeMinBiggerThanRangeMax(definition) {
16713
16713
  if (definition.sectionRule) {
16714
16714
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
16715
- return 43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16715
+ return 44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16716
16716
  }
16717
16717
  }
16718
16718
  return 0 /* CommandResult.Success */;
@@ -16721,9 +16721,9 @@ function checkEmpty(value, valueName) {
16721
16721
  if (value === "") {
16722
16722
  switch (valueName) {
16723
16723
  case "rangeMin":
16724
- return 39 /* CommandResult.EmptyGaugeRangeMin */;
16724
+ return 40 /* CommandResult.EmptyGaugeRangeMin */;
16725
16725
  case "rangeMax":
16726
- return 41 /* CommandResult.EmptyGaugeRangeMax */;
16726
+ return 42 /* CommandResult.EmptyGaugeRangeMax */;
16727
16727
  }
16728
16728
  }
16729
16729
  return 0 /* CommandResult.Success */;
@@ -16732,13 +16732,13 @@ function checkNaN(value, valueName) {
16732
16732
  if (isNaN(value)) {
16733
16733
  switch (valueName) {
16734
16734
  case "rangeMin":
16735
- return 40 /* CommandResult.GaugeRangeMinNaN */;
16735
+ return 41 /* CommandResult.GaugeRangeMinNaN */;
16736
16736
  case "rangeMax":
16737
- return 42 /* CommandResult.GaugeRangeMaxNaN */;
16737
+ return 43 /* CommandResult.GaugeRangeMaxNaN */;
16738
16738
  case "lowerInflectionPointValue":
16739
- return 44 /* CommandResult.GaugeLowerInflectionPointNaN */;
16739
+ return 45 /* CommandResult.GaugeLowerInflectionPointNaN */;
16740
16740
  case "upperInflectionPointValue":
16741
- return 45 /* CommandResult.GaugeUpperInflectionPointNaN */;
16741
+ return 46 /* CommandResult.GaugeUpperInflectionPointNaN */;
16742
16742
  }
16743
16743
  }
16744
16744
  return 0 /* CommandResult.Success */;
@@ -17166,7 +17166,7 @@ class LineChart extends AbstractChart {
17166
17166
  return undefined;
17167
17167
  const dataSets = this.dataSets
17168
17168
  .map((ds) => toExcelDataset(this.getters, ds))
17169
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
17169
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
17170
17170
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
17171
17171
  return {
17172
17172
  ...this.getDefinition(),
@@ -17453,7 +17453,7 @@ class PieChart extends AbstractChart {
17453
17453
  return undefined;
17454
17454
  const dataSets = this.dataSets
17455
17455
  .map((ds) => toExcelDataset(this.getters, ds))
17456
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
17456
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
17457
17457
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
17458
17458
  return {
17459
17459
  ...this.getDefinition(),
@@ -17534,12 +17534,12 @@ function createPieChartRuntime(chart, getters) {
17534
17534
 
17535
17535
  function checkKeyValue(definition) {
17536
17536
  return definition.keyValue && !rangeReference.test(definition.keyValue)
17537
- ? 36 /* CommandResult.InvalidScorecardKeyValue */
17537
+ ? 37 /* CommandResult.InvalidScorecardKeyValue */
17538
17538
  : 0 /* CommandResult.Success */;
17539
17539
  }
17540
17540
  function checkBaseline(definition) {
17541
17541
  return definition.baseline && !rangeReference.test(definition.baseline)
17542
- ? 37 /* CommandResult.InvalidScorecardBaseline */
17542
+ ? 38 /* CommandResult.InvalidScorecardBaseline */
17543
17543
  : 0 /* CommandResult.Success */;
17544
17544
  }
17545
17545
  class ScorecardChart extends AbstractChart {
@@ -18066,7 +18066,7 @@ const AddMergeInteractiveContent = {
18066
18066
  };
18067
18067
  function interactiveAddMerge(env, sheetId, target) {
18068
18068
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
18069
- if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
18069
+ if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
18070
18070
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
18071
18071
  }
18072
18072
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -18093,7 +18093,7 @@ function handlePasteResult(env, result) {
18093
18093
  else if (result.reasons.includes(23 /* CommandResult.WrongFigurePasteOption */)) {
18094
18094
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
18095
18095
  }
18096
- else if (result.reasons.includes(77 /* CommandResult.FrozenPaneOverlap */)) {
18096
+ else if (result.reasons.includes(78 /* CommandResult.FrozenPaneOverlap */)) {
18097
18097
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
18098
18098
  }
18099
18099
  }
@@ -19268,7 +19268,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
19268
19268
  });
19269
19269
  }
19270
19270
  }
19271
- if (result.isCancelledBecause(65 /* CommandResult.InvalidSortZone */)) {
19271
+ if (result.isCancelledBecause(66 /* CommandResult.InvalidSortZone */)) {
19272
19272
  const { col, row } = anchor;
19273
19273
  env.model.selection.selectZone({ cell: { col, row }, zone });
19274
19274
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -19282,13 +19282,13 @@ const AddFilterInteractiveContent = {
19282
19282
  };
19283
19283
  function interactiveAddFilter(env, sheetId, target) {
19284
19284
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
19285
- if (result.isCancelledBecause(80 /* CommandResult.FilterOverlap */)) {
19285
+ if (result.isCancelledBecause(81 /* CommandResult.FilterOverlap */)) {
19286
19286
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
19287
19287
  }
19288
- else if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
19288
+ else if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
19289
19289
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
19290
19290
  }
19291
- else if (result.isCancelledBecause(83 /* CommandResult.NonContinuousTargets */)) {
19291
+ else if (result.isCancelledBecause(84 /* CommandResult.NonContinuousTargets */)) {
19292
19292
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
19293
19293
  }
19294
19294
  }
@@ -19725,7 +19725,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
19725
19725
  const sheetId = env.model.getters.getActiveSheetId();
19726
19726
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
19727
19727
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
19728
- if (result.isCancelledBecause(67 /* CommandResult.MergeOverlap */)) {
19728
+ if (result.isCancelledBecause(68 /* CommandResult.MergeOverlap */)) {
19729
19729
  env.raiseError(MergeErrorMessage);
19730
19730
  }
19731
19731
  }
@@ -20865,10 +20865,10 @@ class LineBarPieConfigPanel extends owl.Component {
20865
20865
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
20866
20866
  }
20867
20867
  get isDatasetInvalid() {
20868
- return !!this.state.datasetDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidDataSet */);
20868
+ return !!this.state.datasetDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidDataSet */);
20869
20869
  }
20870
20870
  get isLabelInvalid() {
20871
- return !!this.state.labelsDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidLabelRange */);
20871
+ return !!this.state.labelsDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidLabelRange */);
20872
20872
  }
20873
20873
  onUpdateDataSetsHaveTitle(ev) {
20874
20874
  this.props.updateChart(this.props.figureId, {
@@ -21542,7 +21542,7 @@ class GaugeChartConfigPanel extends owl.Component {
21542
21542
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21543
21543
  }
21544
21544
  get isDataRangeInvalid() {
21545
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidGaugeDataRange */);
21545
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause(39 /* CommandResult.InvalidGaugeDataRange */);
21546
21546
  }
21547
21547
  onDataRangeChanged(ranges) {
21548
21548
  this.dataRange = ranges[0];
@@ -21626,25 +21626,25 @@ class GaugeChartDesignPanel extends owl.Component {
21626
21626
  });
21627
21627
  }
21628
21628
  isRangeMinInvalid() {
21629
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMin */) ||
21630
- this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.GaugeRangeMinNaN */) ||
21631
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21629
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMin */) ||
21630
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMinNaN */) ||
21631
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21632
21632
  }
21633
21633
  isRangeMaxInvalid() {
21634
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.EmptyGaugeRangeMax */) ||
21635
- this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMaxNaN */) ||
21636
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21634
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.EmptyGaugeRangeMax */) ||
21635
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMaxNaN */) ||
21636
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21637
21637
  }
21638
21638
  // ---------------------------------------------------------------------------
21639
21639
  // COLOR_SECTION_TEMPLATE
21640
21640
  // ---------------------------------------------------------------------------
21641
21641
  get isLowerInflectionPointInvalid() {
21642
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21643
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21642
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21643
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21644
21644
  }
21645
21645
  get isUpperInflectionPointInvalid() {
21646
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21647
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21646
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21647
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21648
21648
  }
21649
21649
  updateSectionColor(target, color) {
21650
21650
  const sectionRule = deepCopy(this.state.sectionRule);
@@ -21732,10 +21732,10 @@ class ScorecardChartConfigPanel extends owl.Component {
21732
21732
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21733
21733
  }
21734
21734
  get isKeyValueInvalid() {
21735
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardKeyValue */);
21735
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardKeyValue */);
21736
21736
  }
21737
21737
  get isBaselineInvalid() {
21738
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardBaseline */);
21738
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidScorecardBaseline */);
21739
21739
  }
21740
21740
  onKeyValueRangeChanged(ranges) {
21741
21741
  this.keyValue = ranges[0];
@@ -22630,10 +22630,10 @@ class ConditionalFormattingPanel extends owl.Component {
22630
22630
  * Cell Is Rule
22631
22631
  ****************************************************************************/
22632
22632
  get isValue1Invalid() {
22633
- return !!this.state.errors?.includes(53 /* CommandResult.FirstArgMissing */);
22633
+ return !!this.state.errors?.includes(54 /* CommandResult.FirstArgMissing */);
22634
22634
  }
22635
22635
  get isValue2Invalid() {
22636
- return !!this.state.errors?.includes(54 /* CommandResult.SecondArgMissing */);
22636
+ return !!this.state.errors?.includes(55 /* CommandResult.SecondArgMissing */);
22637
22637
  }
22638
22638
  toggleStyle(tool) {
22639
22639
  const style = this.state.rules.cellIs.style;
@@ -22650,17 +22650,17 @@ class ConditionalFormattingPanel extends owl.Component {
22650
22650
  isValueInvalid(threshold) {
22651
22651
  switch (threshold) {
22652
22652
  case "minimum":
22653
- return (this.state.errors.includes(60 /* CommandResult.MinInvalidFormula */) ||
22654
- this.state.errors.includes(52 /* CommandResult.MinBiggerThanMid */) ||
22655
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMax */) ||
22656
- this.state.errors.includes(55 /* CommandResult.MinNaN */));
22653
+ return (this.state.errors.includes(61 /* CommandResult.MinInvalidFormula */) ||
22654
+ this.state.errors.includes(53 /* CommandResult.MinBiggerThanMid */) ||
22655
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMax */) ||
22656
+ this.state.errors.includes(56 /* CommandResult.MinNaN */));
22657
22657
  case "midpoint":
22658
- return (this.state.errors.includes(61 /* CommandResult.MidInvalidFormula */) ||
22659
- this.state.errors.includes(56 /* CommandResult.MidNaN */) ||
22660
- this.state.errors.includes(51 /* CommandResult.MidBiggerThanMax */));
22658
+ return (this.state.errors.includes(62 /* CommandResult.MidInvalidFormula */) ||
22659
+ this.state.errors.includes(57 /* CommandResult.MidNaN */) ||
22660
+ this.state.errors.includes(52 /* CommandResult.MidBiggerThanMax */));
22661
22661
  case "maximum":
22662
- return (this.state.errors.includes(62 /* CommandResult.MaxInvalidFormula */) ||
22663
- this.state.errors.includes(57 /* CommandResult.MaxNaN */));
22662
+ return (this.state.errors.includes(63 /* CommandResult.MaxInvalidFormula */) ||
22663
+ this.state.errors.includes(58 /* CommandResult.MaxNaN */));
22664
22664
  default:
22665
22665
  return false;
22666
22666
  }
@@ -22708,13 +22708,13 @@ class ConditionalFormattingPanel extends owl.Component {
22708
22708
  isInflectionPointInvalid(inflectionPoint) {
22709
22709
  switch (inflectionPoint) {
22710
22710
  case "lowerInflectionPoint":
22711
- return (this.state.errors.includes(59 /* CommandResult.ValueLowerInflectionNaN */) ||
22712
- this.state.errors.includes(64 /* CommandResult.ValueLowerInvalidFormula */) ||
22713
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22711
+ return (this.state.errors.includes(60 /* CommandResult.ValueLowerInflectionNaN */) ||
22712
+ this.state.errors.includes(65 /* CommandResult.ValueLowerInvalidFormula */) ||
22713
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22714
22714
  case "upperInflectionPoint":
22715
- return (this.state.errors.includes(58 /* CommandResult.ValueUpperInflectionNaN */) ||
22716
- this.state.errors.includes(63 /* CommandResult.ValueUpperInvalidFormula */) ||
22717
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22715
+ return (this.state.errors.includes(59 /* CommandResult.ValueUpperInflectionNaN */) ||
22716
+ this.state.errors.includes(64 /* CommandResult.ValueUpperInvalidFormula */) ||
22717
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22718
22718
  default:
22719
22719
  return true;
22720
22720
  }
@@ -23077,7 +23077,7 @@ const SplitToColumnsInteractiveContent = {
23077
23077
  };
23078
23078
  function interactiveSplitToColumns(env, separator, addNewColumns) {
23079
23079
  let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
23080
- if (result.isCancelledBecause(92 /* CommandResult.SplitWillOverwriteContent */)) {
23080
+ if (result.isCancelledBecause(93 /* CommandResult.SplitWillOverwriteContent */)) {
23081
23081
  env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
23082
23082
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
23083
23083
  separator,
@@ -23141,8 +23141,8 @@ class SplitIntoColumnsPanel extends owl.Component {
23141
23141
  const errors = new Set();
23142
23142
  for (const reason of cancelledReasons) {
23143
23143
  switch (reason) {
23144
- case 92 /* CommandResult.SplitWillOverwriteContent */:
23145
- case 91 /* CommandResult.EmptySplitSeparator */:
23144
+ case 93 /* CommandResult.SplitWillOverwriteContent */:
23145
+ case 92 /* CommandResult.EmptySplitSeparator */:
23146
23146
  break;
23147
23147
  default:
23148
23148
  errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
@@ -23157,8 +23157,8 @@ class SplitIntoColumnsPanel extends owl.Component {
23157
23157
  addNewColumns: this.state.addNewColumns,
23158
23158
  force: false,
23159
23159
  }).reasons;
23160
- if (cancelledReasons.includes(92 /* CommandResult.SplitWillOverwriteContent */)) {
23161
- warnings.push(SplitToColumnsTerms.Errors[92 /* CommandResult.SplitWillOverwriteContent */]);
23160
+ if (cancelledReasons.includes(93 /* CommandResult.SplitWillOverwriteContent */)) {
23161
+ warnings.push(SplitToColumnsTerms.Errors[93 /* CommandResult.SplitWillOverwriteContent */]);
23162
23162
  }
23163
23163
  return warnings;
23164
23164
  }
@@ -24378,6 +24378,9 @@ class Composer extends owl.Component {
24378
24378
  const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
24379
24379
  token.start <= currentSelection.start &&
24380
24380
  token.end >= currentSelection.end)[0];
24381
+ if (!token) {
24382
+ return;
24383
+ }
24381
24384
  if (token.type === "REFERENCE") {
24382
24385
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
24383
24386
  start: token.start,
@@ -31682,7 +31685,7 @@ class BordersPlugin extends CorePlugin {
31682
31685
  const currentBorder = this.getCellBorder(cmd);
31683
31686
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
31684
31687
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
31685
- return 97 /* CommandResult.NoChanges */;
31688
+ return 98 /* CommandResult.NoChanges */;
31686
31689
  }
31687
31690
  return 0 /* CommandResult.Success */;
31688
31691
  }
@@ -31927,6 +31930,10 @@ class CellPlugin extends CorePlugin {
31927
31930
  format: cell.format ? getItemId(cell.format, formats) : undefined,
31928
31931
  content: cell.content || undefined,
31929
31932
  };
31933
+ // if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
31934
+ if (cell.isFormula && cell.dependencies.length) {
31935
+ cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
31936
+ }
31930
31937
  }
31931
31938
  _sheet.cells = cells;
31932
31939
  }
@@ -31961,13 +31968,13 @@ class CellPlugin extends CorePlugin {
31961
31968
  /*
31962
31969
  * Reconstructs the original formula string based on a normalized form and its dependencies
31963
31970
  */
31964
- buildFormulaContent(sheetId, cell, dependencies) {
31971
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
31965
31972
  const ranges = dependencies || cell.dependencies;
31966
31973
  let rangeIndex = 0;
31967
31974
  return concat(cell.compiledFormula.tokens.map((token) => {
31968
31975
  if (token.type === "REFERENCE") {
31969
31976
  const range = ranges[rangeIndex++];
31970
- return this.getters.getRangeString(range, sheetId);
31977
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
31971
31978
  }
31972
31979
  return token.value;
31973
31980
  }));
@@ -32193,9 +32200,9 @@ class CellPlugin extends CorePlugin {
32193
32200
  checkUselessClearCell(cmd) {
32194
32201
  const cell = this.getters.getCell(cmd);
32195
32202
  if (!cell)
32196
- return 97 /* CommandResult.NoChanges */;
32203
+ return 98 /* CommandResult.NoChanges */;
32197
32204
  if (!cell.content && !cell.style && !cell.format) {
32198
- return 97 /* CommandResult.NoChanges */;
32205
+ return 98 /* CommandResult.NoChanges */;
32199
32206
  }
32200
32207
  return 0 /* CommandResult.Success */;
32201
32208
  }
@@ -32420,13 +32427,13 @@ class ChartPlugin extends CorePlugin {
32420
32427
  }
32421
32428
  checkChartDuplicate(cmd) {
32422
32429
  return this.getters.getFigureSheetId(cmd.id)
32423
- ? 86 /* CommandResult.DuplicatedChartId */
32430
+ ? 87 /* CommandResult.DuplicatedChartId */
32424
32431
  : 0 /* CommandResult.Success */;
32425
32432
  }
32426
32433
  checkChartExists(cmd) {
32427
32434
  return this.getters.getFigureSheetId(cmd.id)
32428
32435
  ? 0 /* CommandResult.Success */
32429
- : 87 /* CommandResult.ChartDoesNotExist */;
32436
+ : 88 /* CommandResult.ChartDoesNotExist */;
32430
32437
  }
32431
32438
  }
32432
32439
 
@@ -32536,7 +32543,13 @@ class ConditionalFormatPlugin extends CorePlugin {
32536
32543
  }
32537
32544
  }
32538
32545
  exportForExcel(data) {
32539
- this.export(data);
32546
+ if (data.sheets) {
32547
+ for (let sheet of data.sheets) {
32548
+ if (this.cfRules[sheet.id]) {
32549
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
32550
+ }
32551
+ }
32552
+ }
32540
32553
  }
32541
32554
  // ---------------------------------------------------------------------------
32542
32555
  // Getters
@@ -32601,11 +32614,11 @@ class ConditionalFormatPlugin extends CorePlugin {
32601
32614
  // ---------------------------------------------------------------------------
32602
32615
  // Private
32603
32616
  // ---------------------------------------------------------------------------
32604
- mapToConditionalFormat(sheetId, cf) {
32617
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
32605
32618
  return {
32606
32619
  ...cf,
32607
32620
  ranges: cf.ranges.map((range) => {
32608
- return this.getters.getRangeString(range, sheetId);
32621
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
32609
32622
  }),
32610
32623
  };
32611
32624
  }
@@ -32638,10 +32651,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32638
32651
  return 28 /* CommandResult.InvalidSheetId */;
32639
32652
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
32640
32653
  if (ruleIndex === -1)
32641
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32654
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32642
32655
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
32643
32656
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
32644
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32657
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32645
32658
  }
32646
32659
  return 0 /* CommandResult.Success */;
32647
32660
  }
@@ -32682,10 +32695,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32682
32695
  const errors = [];
32683
32696
  const isEmpty = (value) => value === undefined || value === "";
32684
32697
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
32685
- errors.push(53 /* CommandResult.FirstArgMissing */);
32698
+ errors.push(54 /* CommandResult.FirstArgMissing */);
32686
32699
  }
32687
32700
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
32688
- errors.push(54 /* CommandResult.SecondArgMissing */);
32701
+ errors.push(55 /* CommandResult.SecondArgMissing */);
32689
32702
  }
32690
32703
  return errors.length ? errors : 0 /* CommandResult.Success */;
32691
32704
  }
@@ -32697,15 +32710,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32697
32710
  (threshold.value === "" || isNaN(threshold.value))) {
32698
32711
  switch (thresholdName) {
32699
32712
  case "min":
32700
- return 55 /* CommandResult.MinNaN */;
32713
+ return 56 /* CommandResult.MinNaN */;
32701
32714
  case "max":
32702
- return 57 /* CommandResult.MaxNaN */;
32715
+ return 58 /* CommandResult.MaxNaN */;
32703
32716
  case "mid":
32704
- return 56 /* CommandResult.MidNaN */;
32717
+ return 57 /* CommandResult.MidNaN */;
32705
32718
  case "upperInflectionPoint":
32706
- return 58 /* CommandResult.ValueUpperInflectionNaN */;
32719
+ return 59 /* CommandResult.ValueUpperInflectionNaN */;
32707
32720
  case "lowerInflectionPoint":
32708
- return 59 /* CommandResult.ValueLowerInflectionNaN */;
32721
+ return 60 /* CommandResult.ValueLowerInflectionNaN */;
32709
32722
  }
32710
32723
  }
32711
32724
  return 0 /* CommandResult.Success */;
@@ -32719,15 +32732,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32719
32732
  catch (error) {
32720
32733
  switch (thresholdName) {
32721
32734
  case "min":
32722
- return 60 /* CommandResult.MinInvalidFormula */;
32735
+ return 61 /* CommandResult.MinInvalidFormula */;
32723
32736
  case "max":
32724
- return 62 /* CommandResult.MaxInvalidFormula */;
32737
+ return 63 /* CommandResult.MaxInvalidFormula */;
32725
32738
  case "mid":
32726
- return 61 /* CommandResult.MidInvalidFormula */;
32739
+ return 62 /* CommandResult.MidInvalidFormula */;
32727
32740
  case "upperInflectionPoint":
32728
- return 63 /* CommandResult.ValueUpperInvalidFormula */;
32741
+ return 64 /* CommandResult.ValueUpperInvalidFormula */;
32729
32742
  case "lowerInflectionPoint":
32730
- return 64 /* CommandResult.ValueLowerInvalidFormula */;
32743
+ return 65 /* CommandResult.ValueLowerInvalidFormula */;
32731
32744
  }
32732
32745
  }
32733
32746
  return 0 /* CommandResult.Success */;
@@ -32744,7 +32757,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32744
32757
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
32745
32758
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
32746
32759
  Number(minValue) > Number(maxValue)) {
32747
- return 50 /* CommandResult.LowerBiggerThanUpper */;
32760
+ return 51 /* CommandResult.LowerBiggerThanUpper */;
32748
32761
  }
32749
32762
  return 0 /* CommandResult.Success */;
32750
32763
  }
@@ -32754,7 +32767,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32754
32767
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
32755
32768
  rule.minimum.type === rule.maximum.type &&
32756
32769
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
32757
- return 49 /* CommandResult.MinBiggerThanMax */;
32770
+ return 50 /* CommandResult.MinBiggerThanMax */;
32758
32771
  }
32759
32772
  return 0 /* CommandResult.Success */;
32760
32773
  }
@@ -32765,7 +32778,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32765
32778
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32766
32779
  rule.midpoint.type === rule.maximum.type &&
32767
32780
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
32768
- return 51 /* CommandResult.MidBiggerThanMax */;
32781
+ return 52 /* CommandResult.MidBiggerThanMax */;
32769
32782
  }
32770
32783
  return 0 /* CommandResult.Success */;
32771
32784
  }
@@ -32776,7 +32789,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32776
32789
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32777
32790
  rule.minimum.type === rule.midpoint.type &&
32778
32791
  stringToNumber(minValue) >= stringToNumber(midValue)) {
32779
- return 52 /* CommandResult.MinBiggerThanMid */;
32792
+ return 53 /* CommandResult.MinBiggerThanMid */;
32780
32793
  }
32781
32794
  return 0 /* CommandResult.Success */;
32782
32795
  }
@@ -32908,13 +32921,13 @@ class FigurePlugin extends CorePlugin {
32908
32921
  }
32909
32922
  checkFigureExists(sheetId, figureId) {
32910
32923
  if (this.figures[sheetId]?.[figureId] === undefined) {
32911
- return 72 /* CommandResult.FigureDoesNotExist */;
32924
+ return 73 /* CommandResult.FigureDoesNotExist */;
32912
32925
  }
32913
32926
  return 0 /* CommandResult.Success */;
32914
32927
  }
32915
32928
  checkFigureDuplicate(figureId) {
32916
32929
  if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
32917
- return 84 /* CommandResult.DuplicatedFigureId */;
32930
+ return 85 /* CommandResult.DuplicatedFigureId */;
32918
32931
  }
32919
32932
  return 0 /* CommandResult.Success */;
32920
32933
  }
@@ -33026,12 +33039,12 @@ class FiltersPlugin extends CorePlugin {
33026
33039
  switch (cmd.type) {
33027
33040
  case "CREATE_FILTER_TABLE":
33028
33041
  if (!areZonesContinuous(...cmd.target)) {
33029
- return 83 /* CommandResult.NonContinuousTargets */;
33042
+ return 84 /* CommandResult.NonContinuousTargets */;
33030
33043
  }
33031
33044
  const zone = union(...cmd.target);
33032
33045
  const checkFilterOverlap = () => {
33033
33046
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
33034
- return 80 /* CommandResult.FilterOverlap */;
33047
+ return 81 /* CommandResult.FilterOverlap */;
33035
33048
  }
33036
33049
  return 0 /* CommandResult.Success */;
33037
33050
  };
@@ -33039,7 +33052,7 @@ class FiltersPlugin extends CorePlugin {
33039
33052
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
33040
33053
  for (let merge of mergesInTarget) {
33041
33054
  if (overlap(zone, merge)) {
33042
- return 82 /* CommandResult.MergeInFilter */;
33055
+ return 83 /* CommandResult.MergeInFilter */;
33043
33056
  }
33044
33057
  }
33045
33058
  return 0 /* CommandResult.Success */;
@@ -33049,7 +33062,7 @@ class FiltersPlugin extends CorePlugin {
33049
33062
  for (let merge of cmd.target) {
33050
33063
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
33051
33064
  if (overlap(filterTable.zone, merge)) {
33052
- return 82 /* CommandResult.MergeInFilter */;
33065
+ return 83 /* CommandResult.MergeInFilter */;
33053
33066
  }
33054
33067
  }
33055
33068
  }
@@ -33418,10 +33431,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
33418
33431
  : this.getters.getNumberRows(cmd.sheetId);
33419
33432
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
33420
33433
  if (hiddenElements.size >= elements) {
33421
- return 68 /* CommandResult.TooManyHiddenElements */;
33434
+ return 69 /* CommandResult.TooManyHiddenElements */;
33422
33435
  }
33423
33436
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
33424
- return 88 /* CommandResult.InvalidHeaderIndex */;
33437
+ return 89 /* CommandResult.InvalidHeaderIndex */;
33425
33438
  }
33426
33439
  else {
33427
33440
  return 0 /* CommandResult.Success */;
@@ -33985,7 +33998,7 @@ class MergePlugin extends CorePlugin {
33985
33998
  for (const zone of target) {
33986
33999
  for (const zone2 of target) {
33987
34000
  if (zone !== zone2 && overlap(zone, zone2)) {
33988
- return 67 /* CommandResult.MergeOverlap */;
34001
+ return 68 /* CommandResult.MergeOverlap */;
33989
34002
  }
33990
34003
  }
33991
34004
  }
@@ -33999,7 +34012,7 @@ class MergePlugin extends CorePlugin {
33999
34012
  for (const zone of target) {
34000
34013
  if ((zone.left < xSplit && zone.right >= xSplit) ||
34001
34014
  (zone.top < ySplit && zone.bottom >= ySplit)) {
34002
- return 77 /* CommandResult.FrozenPaneOverlap */;
34015
+ return 78 /* CommandResult.FrozenPaneOverlap */;
34003
34016
  }
34004
34017
  }
34005
34018
  return 0 /* CommandResult.Success */;
@@ -34442,8 +34455,9 @@ class RangeAdapter {
34442
34455
  *
34443
34456
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
34444
34457
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
34458
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
34445
34459
  */
34446
- getRangeString(range, forSheetId) {
34460
+ getRangeString(range, forSheetId, useFixedZone = false) {
34447
34461
  if (!range) {
34448
34462
  return INCORRECT_RANGE_STRING;
34449
34463
  }
@@ -34470,7 +34484,7 @@ class RangeAdapter {
34470
34484
  if (prefixSheet && !sheetName) {
34471
34485
  return INCORRECT_RANGE_STRING;
34472
34486
  }
34473
- let rangeString = this.getRangePartString(rangeImpl, 0);
34487
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
34474
34488
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
34475
34489
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
34476
34490
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -34480,7 +34494,7 @@ class RangeAdapter {
34480
34494
  rangeImpl.parts[1].rowFixed ||
34481
34495
  rangeImpl.parts[1].colFixed) {
34482
34496
  rangeString += ":";
34483
- rangeString += this.getRangePartString(rangeImpl, 1);
34497
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
34484
34498
  }
34485
34499
  }
34486
34500
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -34521,13 +34535,13 @@ class RangeAdapter {
34521
34535
  /**
34522
34536
  * Get a Xc string that represent a part of a range
34523
34537
  */
34524
- getRangePartString(range, part) {
34538
+ getRangePartString(range, part, useFixedZone = false) {
34525
34539
  const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
34526
34540
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
34527
34541
  const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
34528
34542
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
34529
34543
  let str = "";
34530
- if (range.isFullCol) {
34544
+ if (range.isFullCol && !useFixedZone) {
34531
34545
  if (part === 0 && range.unboundedZone.hasHeader) {
34532
34546
  str = colFixed + col + rowFixed + row;
34533
34547
  }
@@ -34535,7 +34549,7 @@ class RangeAdapter {
34535
34549
  str = colFixed + col;
34536
34550
  }
34537
34551
  }
34538
- else if (range.isFullRow) {
34552
+ else if (range.isFullRow && !useFixedZone) {
34539
34553
  if (part === 0 && range.unboundedZone.hasHeader) {
34540
34554
  str = colFixed + col + rowFixed + row;
34541
34555
  }
@@ -34632,10 +34646,10 @@ class SheetPlugin extends CorePlugin {
34632
34646
  ? this.getNumberCols(cmd.sheetId)
34633
34647
  : this.getNumberRows(cmd.sheetId);
34634
34648
  if (cmd.base < 0 || cmd.base >= elements) {
34635
- return 88 /* CommandResult.InvalidHeaderIndex */;
34649
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34636
34650
  }
34637
34651
  else if (cmd.quantity <= 0) {
34638
- return 89 /* CommandResult.InvalidQuantity */;
34652
+ return 90 /* CommandResult.InvalidQuantity */;
34639
34653
  }
34640
34654
  return 0 /* CommandResult.Success */;
34641
34655
  case "REMOVE_COLUMNS_ROWS": {
@@ -34643,7 +34657,7 @@ class SheetPlugin extends CorePlugin {
34643
34657
  ? this.getNumberCols(cmd.sheetId)
34644
34658
  : this.getNumberRows(cmd.sheetId);
34645
34659
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
34646
- return 88 /* CommandResult.InvalidHeaderIndex */;
34660
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34647
34661
  }
34648
34662
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
34649
34663
  return 8 /* CommandResult.NotEnoughElements */;
@@ -35123,18 +35137,18 @@ class SheetPlugin extends CorePlugin {
35123
35137
  checkRowFreezeQuantity(cmd) {
35124
35138
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
35125
35139
  ? 0 /* CommandResult.Success */
35126
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35140
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35127
35141
  }
35128
35142
  checkColFreezeQuantity(cmd) {
35129
35143
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
35130
35144
  ? 0 /* CommandResult.Success */
35131
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35145
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35132
35146
  }
35133
35147
  checkRowFreezeOverlapMerge(cmd) {
35134
35148
  const merges = this.getters.getMerges(cmd.sheetId);
35135
35149
  for (let merge of merges) {
35136
35150
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
35137
- return 67 /* CommandResult.MergeOverlap */;
35151
+ return 68 /* CommandResult.MergeOverlap */;
35138
35152
  }
35139
35153
  }
35140
35154
  return 0 /* CommandResult.Success */;
@@ -35143,7 +35157,7 @@ class SheetPlugin extends CorePlugin {
35143
35157
  const merges = this.getters.getMerges(cmd.sheetId);
35144
35158
  for (let merge of merges) {
35145
35159
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
35146
- return 67 /* CommandResult.MergeOverlap */;
35160
+ return 68 /* CommandResult.MergeOverlap */;
35147
35161
  }
35148
35162
  }
35149
35163
  return 0 /* CommandResult.Success */;
@@ -35464,7 +35478,7 @@ class SettingsPlugin extends CorePlugin {
35464
35478
  allowDispatch(cmd) {
35465
35479
  switch (cmd.type) {
35466
35480
  case "UPDATE_LOCALE":
35467
- return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 95 /* CommandResult.InvalidLocale */;
35481
+ return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 96 /* CommandResult.InvalidLocale */;
35468
35482
  }
35469
35483
  return 0 /* CommandResult.Success */;
35470
35484
  }
@@ -35545,22 +35559,17 @@ class CompilationParametersBuilder {
35545
35559
  * The `compute` of the formula's function must process it completely
35546
35560
  */
35547
35561
  refFn(range, isMeta, functionName, paramNumber) {
35562
+ this.assertRangeValid(range);
35548
35563
  if (isMeta) {
35549
35564
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
35550
35565
  return { value: zoneToXc(range.zone) };
35551
35566
  }
35552
- if (!isZoneValid(range.zone)) {
35553
- throw new InvalidReferenceError();
35554
- }
35555
35567
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
35556
35568
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
35557
35569
  throw new Error(paramNumber
35558
35570
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
35559
35571
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
35560
35572
  }
35561
- if (range.invalidSheetName) {
35562
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35563
- }
35564
35573
  return this.readCell(range);
35565
35574
  }
35566
35575
  readCell(range) {
@@ -35595,10 +35604,10 @@ class CompilationParametersBuilder {
35595
35604
  * Note that each col is possibly sparse: it only contain the values of cells
35596
35605
  * that are actually present in the grid.
35597
35606
  */
35598
- range({ sheetId, zone }) {
35599
- if (!isZoneValid(zone)) {
35600
- throw new InvalidReferenceError();
35601
- }
35607
+ range(range) {
35608
+ this.assertRangeValid(range);
35609
+ const sheetId = range.sheetId;
35610
+ const zone = range.zone;
35602
35611
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
35603
35612
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
35604
35613
  const sheetZone = this.getters.getSheetZone(sheetId);
@@ -35641,6 +35650,14 @@ class CompilationParametersBuilder {
35641
35650
  this.rangeCache[cacheKey] = result;
35642
35651
  return result;
35643
35652
  }
35653
+ assertRangeValid(range) {
35654
+ if (!isZoneValid(range.zone)) {
35655
+ throw new InvalidReferenceError();
35656
+ }
35657
+ if (range.invalidSheetName) {
35658
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35659
+ }
35660
+ }
35644
35661
  }
35645
35662
 
35646
35663
  function quickselect(arr, k, left, right, compare) {
@@ -37919,7 +37936,7 @@ class AutofillPlugin extends UIPlugin {
37919
37936
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
37920
37937
  return 0 /* CommandResult.Success */;
37921
37938
  }
37922
- return 47 /* CommandResult.InvalidAutofillSelection */;
37939
+ return 48 /* CommandResult.InvalidAutofillSelection */;
37923
37940
  case "AUTOFILL_AUTO":
37924
37941
  const zone = this.getters.getSelectedZone();
37925
37942
  return zone.top === zone.bottom
@@ -38538,7 +38555,7 @@ class CellPopoverPlugin extends UIPlugin {
38538
38555
  cellPopoverRegistry.get(cmd.popoverType);
38539
38556
  }
38540
38557
  catch (error) {
38541
- return 74 /* CommandResult.InvalidCellPopover */;
38558
+ return 75 /* CommandResult.InvalidCellPopover */;
38542
38559
  }
38543
38560
  return 0 /* CommandResult.Success */;
38544
38561
  default:
@@ -40678,27 +40695,6 @@ class SelectionInputPlugin extends UIPlugin {
40678
40695
  // ---------------------------------------------------------------------------
40679
40696
  // Command Handling
40680
40697
  // ---------------------------------------------------------------------------
40681
- allowDispatch(cmd) {
40682
- switch (cmd.type) {
40683
- case "ADD_RANGE":
40684
- case "ADD_EMPTY_RANGE":
40685
- if (this.inputHasSingleRange && this.ranges.length === 1) {
40686
- return 31 /* CommandResult.MaximumRangesReached */;
40687
- }
40688
- break;
40689
- case "REMOVE_RANGE":
40690
- if (this.ranges.length === 1) {
40691
- return 32 /* CommandResult.MinimumRangesReached */;
40692
- }
40693
- break;
40694
- case "CHANGE_RANGE":
40695
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
40696
- return 31 /* CommandResult.MaximumRangesReached */;
40697
- }
40698
- break;
40699
- }
40700
- return 0 /* CommandResult.Success */;
40701
- }
40702
40698
  handleEvent(event) {
40703
40699
  const inputSheetId = this.activeSheet;
40704
40700
  const sheetId = this.getters.getActiveSheetId();
@@ -40918,6 +40914,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40918
40914
  // Command Handling
40919
40915
  // ---------------------------------------------------------------------------
40920
40916
  allowDispatch(cmd) {
40917
+ switch (cmd.type) {
40918
+ case "FOCUS_RANGE":
40919
+ case "CHANGE_RANGE":
40920
+ case "ADD_EMPTY_RANGE":
40921
+ case "REMOVE_RANGE":
40922
+ if (!this.inputs[cmd.id]) {
40923
+ return 33 /* CommandResult.InvalidInputId */;
40924
+ }
40925
+ }
40921
40926
  switch (cmd.type) {
40922
40927
  case "FOCUS_RANGE":
40923
40928
  const index = this.currentInput?.getIndex(cmd.rangeId);
@@ -40925,9 +40930,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40925
40930
  return 30 /* CommandResult.InputAlreadyFocused */;
40926
40931
  }
40927
40932
  break;
40928
- }
40929
- if (this.currentInput) {
40930
- return this.currentInput.allowDispatch(cmd);
40933
+ case "ADD_RANGE":
40934
+ case "ADD_EMPTY_RANGE":
40935
+ const input = this.inputs[cmd.id];
40936
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
40937
+ return 31 /* CommandResult.MaximumRangesReached */;
40938
+ }
40939
+ break;
40940
+ case "REMOVE_RANGE":
40941
+ if (this.inputs[cmd.id].ranges.length === 1) {
40942
+ return 32 /* CommandResult.MinimumRangesReached */;
40943
+ }
40944
+ break;
40945
+ case "CHANGE_RANGE": {
40946
+ const input = this.inputs[cmd.id];
40947
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
40948
+ return 31 /* CommandResult.MaximumRangesReached */;
40949
+ }
40950
+ break;
40951
+ }
40931
40952
  }
40932
40953
  return 0 /* CommandResult.Success */;
40933
40954
  }
@@ -41057,7 +41078,7 @@ class SortPlugin extends UIPlugin {
41057
41078
  /*Test the presence of single cells*/
41058
41079
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
41059
41080
  if (singleCells) {
41060
- return 65 /* CommandResult.InvalidSortZone */;
41081
+ return 66 /* CommandResult.InvalidSortZone */;
41061
41082
  }
41062
41083
  return 0 /* CommandResult.Success */;
41063
41084
  }
@@ -41076,7 +41097,7 @@ class SortPlugin extends UIPlugin {
41076
41097
  ];
41077
41098
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
41078
41099
  })) {
41079
- return 65 /* CommandResult.InvalidSortZone */;
41100
+ return 66 /* CommandResult.InvalidSortZone */;
41080
41101
  }
41081
41102
  return 0 /* CommandResult.Success */;
41082
41103
  }
@@ -41514,7 +41535,7 @@ class SheetUIPlugin extends UIPlugin {
41514
41535
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
41515
41536
  const zones = this.getters.getCommandZones(cmd);
41516
41537
  if (!sheetId && zones.length > 0) {
41517
- return 94 /* CommandResult.NoActiveSheet */;
41538
+ return 95 /* CommandResult.NoActiveSheet */;
41518
41539
  }
41519
41540
  if (sheetId && zones.length > 0) {
41520
41541
  return this.getters.checkZonesExistInSheet(sheetId, zones);
@@ -41996,13 +42017,13 @@ class SplitToColumnsPlugin extends UIPlugin {
41996
42017
  }
41997
42018
  checkSingleColSelected() {
41998
42019
  if (!this.getters.isSingleColSelected()) {
41999
- return 90 /* CommandResult.MoreThanOneColumnSelected */;
42020
+ return 91 /* CommandResult.MoreThanOneColumnSelected */;
42000
42021
  }
42001
42022
  return 0 /* CommandResult.Success */;
42002
42023
  }
42003
42024
  checkNonEmptySelector(cmd) {
42004
42025
  if (cmd.separator === "") {
42005
- return 91 /* CommandResult.EmptySplitSeparator */;
42026
+ return 92 /* CommandResult.EmptySplitSeparator */;
42006
42027
  }
42007
42028
  return 0 /* CommandResult.Success */;
42008
42029
  }
@@ -42013,7 +42034,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42013
42034
  const selection = this.getters.getSelectedZones()[0];
42014
42035
  const splitted = this.getSplittedCols(selection, cmd.separator);
42015
42036
  if (this.willSplittedColsOverwriteContent(selection, splitted)) {
42016
- return 92 /* CommandResult.SplitWillOverwriteContent */;
42037
+ return 93 /* CommandResult.SplitWillOverwriteContent */;
42017
42038
  }
42018
42039
  return 0 /* CommandResult.Success */;
42019
42040
  }
@@ -42024,7 +42045,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42024
42045
  return 0 /* CommandResult.Success */;
42025
42046
  }
42026
42047
  }
42027
- return 93 /* CommandResult.NoSplitSeparatorInSelection */;
42048
+ return 94 /* CommandResult.NoSplitSeparatorInSelection */;
42028
42049
  }
42029
42050
  }
42030
42051
 
@@ -42172,7 +42193,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
42172
42193
  for (const zone of this.getPasteZones(target)) {
42173
42194
  if ((zone.left < xSplit && zone.right >= xSplit) ||
42174
42195
  (zone.top < ySplit && zone.bottom >= ySplit)) {
42175
- return 77 /* CommandResult.FrozenPaneOverlap */;
42196
+ return 78 /* CommandResult.FrozenPaneOverlap */;
42176
42197
  }
42177
42198
  }
42178
42199
  return 0 /* CommandResult.Success */;
@@ -42624,7 +42645,7 @@ class ClipboardFigureState {
42624
42645
  }
42625
42646
  isPasteAllowed(target, option) {
42626
42647
  if (target.length === 0) {
42627
- return 75 /* CommandResult.EmptyTarget */;
42648
+ return 76 /* CommandResult.EmptyTarget */;
42628
42649
  }
42629
42650
  if (option?.pasteOption !== undefined) {
42630
42651
  return 23 /* CommandResult.WrongFigurePasteOption */;
@@ -42857,7 +42878,7 @@ class ClipboardPlugin extends UIPlugin {
42857
42878
  }
42858
42879
  case "ACTIVATE_PAINT_FORMAT": {
42859
42880
  if (this.paintFormatStatus !== "inactive") {
42860
- return 96 /* CommandResult.AlreadyInPaintingFormatMode */;
42881
+ return 97 /* CommandResult.AlreadyInPaintingFormatMode */;
42861
42882
  }
42862
42883
  }
42863
42884
  }
@@ -43435,7 +43456,7 @@ class EditionPlugin extends UIPlugin {
43435
43456
  validateSelection(length, start, end) {
43436
43457
  return start >= 0 && start <= length && end >= 0 && end <= length
43437
43458
  ? 0 /* CommandResult.Success */
43438
- : 48 /* CommandResult.WrongComposerSelection */;
43459
+ : 49 /* CommandResult.WrongComposerSelection */;
43439
43460
  }
43440
43461
  onColumnsRemoved(cmd) {
43441
43462
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -43747,9 +43768,10 @@ class EditionPlugin extends UIPlugin {
43747
43768
  */
43748
43769
  getReferencedRanges() {
43749
43770
  const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
43750
- return this.currentTokens
43771
+ const referenceRanges = this.currentTokens
43751
43772
  .filter((token) => token.type === "REFERENCE")
43752
43773
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
43774
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
43753
43775
  }
43754
43776
  /**
43755
43777
  * Function used to determine when composer selection can start.
@@ -43816,7 +43838,7 @@ class FilterEvaluationPlugin extends UIPlugin {
43816
43838
  switch (cmd.type) {
43817
43839
  case "UPDATE_FILTER":
43818
43840
  if (!this.getters.getFilterId(cmd)) {
43819
- return 81 /* CommandResult.FilterNotFound */;
43841
+ return 82 /* CommandResult.FilterNotFound */;
43820
43842
  }
43821
43843
  break;
43822
43844
  }
@@ -44611,7 +44633,7 @@ class GridSelectionPlugin extends UIPlugin {
44611
44633
  const headers = [cmd.base, ...cmd.elements];
44612
44634
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
44613
44635
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
44614
- return 88 /* CommandResult.InvalidHeaderIndex */;
44636
+ return 89 /* CommandResult.InvalidHeaderIndex */;
44615
44637
  }
44616
44638
  return 0 /* CommandResult.Success */;
44617
44639
  }
@@ -45427,7 +45449,7 @@ class SheetViewPlugin extends UIPlugin {
45427
45449
  }
45428
45450
  checkPositiveDimension(cmd) {
45429
45451
  if (cmd.width < 0 || cmd.height < 0) {
45430
- return 70 /* CommandResult.InvalidViewportSize */;
45452
+ return 71 /* CommandResult.InvalidViewportSize */;
45431
45453
  }
45432
45454
  return 0 /* CommandResult.Success */;
45433
45455
  }
@@ -45437,7 +45459,7 @@ class SheetViewPlugin extends UIPlugin {
45437
45459
  cmd.gridOffsetY === this.gridOffsetY &&
45438
45460
  cmd.width === width &&
45439
45461
  cmd.height === height) {
45440
- return 78 /* CommandResult.ValuesNotChanged */;
45462
+ return 79 /* CommandResult.ValuesNotChanged */;
45441
45463
  }
45442
45464
  return 0 /* CommandResult.Success */;
45443
45465
  }
@@ -45445,7 +45467,7 @@ class SheetViewPlugin extends UIPlugin {
45445
45467
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
45446
45468
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
45447
45469
  (!pane.canScrollVertically && offsetY > 0)) {
45448
- return 71 /* CommandResult.InvalidScrollingDirection */;
45470
+ return 72 /* CommandResult.InvalidScrollingDirection */;
45449
45471
  }
45450
45472
  return 0 /* CommandResult.Success */;
45451
45473
  }
@@ -48904,7 +48926,7 @@ class SelectionStreamProcessorImpl {
48904
48926
  */
48905
48927
  moveAnchorCell(direction, step = 1) {
48906
48928
  if (step !== "end" && step <= 0) {
48907
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48929
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48908
48930
  }
48909
48931
  const { col, row } = this.getNextAvailablePosition(direction, step);
48910
48932
  return this.selectCell(col, row);
@@ -48950,7 +48972,7 @@ class SelectionStreamProcessorImpl {
48950
48972
  */
48951
48973
  resizeAnchorZone(direction, step = 1) {
48952
48974
  if (step !== "end" && step <= 0) {
48953
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48975
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48954
48976
  }
48955
48977
  const sheetId = this.getters.getActiveSheetId();
48956
48978
  const anchor = this.anchor;
@@ -49788,12 +49810,7 @@ function addFormula(cell) {
49788
49810
  attrs.push(["t", "str"]);
49789
49811
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
49790
49812
  }
49791
- node = escapeXml /*xml*/ `
49792
- <f>
49793
- ${XlsxFormula}
49794
- </f>
49795
- ${cycle}
49796
- `;
49813
+ node = escapeXml /*xml*/ ` <f> ${XlsxFormula} </f> ${cycle} `;
49797
49814
  return { attrs, node };
49798
49815
  }
49799
49816
  function addContent(content, sharedStrings, forceString = false) {
@@ -50612,11 +50629,10 @@ function addRows(construct, data, sheet) {
50612
50629
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
50613
50630
  }
50614
50631
  attributes.push(...additionalAttrs);
50615
- cellNodes.push(escapeXml /*xml*/ `
50616
- <c ${formatAttributes(attributes)}>
50617
- ${cellNode}
50618
- </c>
50619
- `);
50632
+ // prettier-ignore
50633
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
50634
+ ${cellNode}
50635
+ </c>`);
50620
50636
  }
50621
50637
  }
50622
50638
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -51307,10 +51323,10 @@ class Model extends EventBus {
51307
51323
  const command = createCommand(type, payload);
51308
51324
  let status = this.status;
51309
51325
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
51310
- return new DispatchResult(69 /* CommandResult.Readonly */);
51326
+ return new DispatchResult(70 /* CommandResult.Readonly */);
51311
51327
  }
51312
51328
  if (!this.session.canApplyOptimisticUpdate()) {
51313
- return new DispatchResult(66 /* CommandResult.WaitingSessionConfirmation */);
51329
+ return new DispatchResult(67 /* CommandResult.WaitingSessionConfirmation */);
51314
51330
  }
51315
51331
  switch (status) {
51316
51332
  case 0 /* Status.Ready */:
@@ -51597,6 +51613,6 @@ exports.setTranslationMethod = setTranslationMethod;
51597
51613
  exports.tokenize = tokenize;
51598
51614
 
51599
51615
 
51600
- __info__.version = '16.4.19';
51601
- __info__.date = '2024-01-17T10:27:33.027Z';
51602
- __info__.hash = 'fe01e7b';
51616
+ __info__.version = '16.4.21';
51617
+ __info__.date = '2024-02-02T13:45:48.276Z';
51618
+ __info__.hash = '73662b1';