@odoo/o-spreadsheet 16.3.22 → 16.3.24
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.
- package/dist/o-spreadsheet.cjs.js +309 -298
- package/dist/o-spreadsheet.d.ts +68 -67
- package/dist/o-spreadsheet.esm.js +309 -298
- package/dist/o-spreadsheet.iife.js +309 -298
- package/dist/o-spreadsheet.iife.min.js +16 -23
- package/dist/o_spreadsheet.xml +5 -5
- package/package.json +1 -1
|
@@ -2074,27 +2074,30 @@
|
|
|
2074
2074
|
}
|
|
2075
2075
|
function createLargeNumberFormat(format, magnitude, postFix) {
|
|
2076
2076
|
const internalFormat = parseFormat(format || "#,##0");
|
|
2077
|
-
const largeNumberFormat =
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
format: {
|
|
2084
|
-
...formatPart.format,
|
|
2085
|
-
magnitude,
|
|
2086
|
-
decimalPart: undefined,
|
|
2087
|
-
},
|
|
2088
|
-
},
|
|
2089
|
-
{
|
|
2090
|
-
type: "STRING",
|
|
2091
|
-
format: postFix,
|
|
2092
|
-
},
|
|
2093
|
-
];
|
|
2077
|
+
const largeNumberFormat = [];
|
|
2078
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
2079
|
+
const formatPart = internalFormat[i];
|
|
2080
|
+
if (formatPart.type !== "NUMBER") {
|
|
2081
|
+
largeNumberFormat.push(formatPart);
|
|
2082
|
+
continue;
|
|
2094
2083
|
}
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2084
|
+
largeNumberFormat.push({
|
|
2085
|
+
...formatPart,
|
|
2086
|
+
format: {
|
|
2087
|
+
...formatPart.format,
|
|
2088
|
+
magnitude,
|
|
2089
|
+
decimalPart: undefined,
|
|
2090
|
+
},
|
|
2091
|
+
});
|
|
2092
|
+
largeNumberFormat.push({
|
|
2093
|
+
type: "STRING",
|
|
2094
|
+
format: postFix,
|
|
2095
|
+
});
|
|
2096
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
2097
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
2098
|
+
i++;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2098
2101
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
2099
2102
|
}
|
|
2100
2103
|
function changeDecimalPlaces(format, step) {
|
|
@@ -4436,69 +4439,70 @@
|
|
|
4436
4439
|
CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
|
|
4437
4440
|
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
4438
4441
|
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
4439
|
-
CommandResult[CommandResult["
|
|
4440
|
-
CommandResult[CommandResult["
|
|
4441
|
-
CommandResult[CommandResult["
|
|
4442
|
-
CommandResult[CommandResult["
|
|
4443
|
-
CommandResult[CommandResult["
|
|
4444
|
-
CommandResult[CommandResult["
|
|
4445
|
-
CommandResult[CommandResult["
|
|
4446
|
-
CommandResult[CommandResult["
|
|
4447
|
-
CommandResult[CommandResult["
|
|
4448
|
-
CommandResult[CommandResult["
|
|
4449
|
-
CommandResult[CommandResult["
|
|
4450
|
-
CommandResult[CommandResult["
|
|
4451
|
-
CommandResult[CommandResult["
|
|
4452
|
-
CommandResult[CommandResult["
|
|
4453
|
-
CommandResult[CommandResult["
|
|
4454
|
-
CommandResult[CommandResult["
|
|
4455
|
-
CommandResult[CommandResult["
|
|
4456
|
-
CommandResult[CommandResult["
|
|
4457
|
-
CommandResult[CommandResult["
|
|
4458
|
-
CommandResult[CommandResult["
|
|
4459
|
-
CommandResult[CommandResult["
|
|
4460
|
-
CommandResult[CommandResult["
|
|
4461
|
-
CommandResult[CommandResult["
|
|
4462
|
-
CommandResult[CommandResult["
|
|
4463
|
-
CommandResult[CommandResult["
|
|
4464
|
-
CommandResult[CommandResult["
|
|
4465
|
-
CommandResult[CommandResult["
|
|
4466
|
-
CommandResult[CommandResult["
|
|
4467
|
-
CommandResult[CommandResult["
|
|
4468
|
-
CommandResult[CommandResult["
|
|
4469
|
-
CommandResult[CommandResult["
|
|
4470
|
-
CommandResult[CommandResult["
|
|
4471
|
-
CommandResult[CommandResult["
|
|
4472
|
-
CommandResult[CommandResult["
|
|
4473
|
-
CommandResult[CommandResult["
|
|
4474
|
-
CommandResult[CommandResult["
|
|
4475
|
-
CommandResult[CommandResult["
|
|
4476
|
-
CommandResult[CommandResult["
|
|
4477
|
-
CommandResult[CommandResult["
|
|
4478
|
-
CommandResult[CommandResult["
|
|
4479
|
-
CommandResult[CommandResult["
|
|
4480
|
-
CommandResult[CommandResult["
|
|
4481
|
-
CommandResult[CommandResult["
|
|
4482
|
-
CommandResult[CommandResult["
|
|
4483
|
-
CommandResult[CommandResult["
|
|
4484
|
-
CommandResult[CommandResult["
|
|
4485
|
-
CommandResult[CommandResult["
|
|
4486
|
-
CommandResult[CommandResult["
|
|
4487
|
-
CommandResult[CommandResult["
|
|
4488
|
-
CommandResult[CommandResult["
|
|
4489
|
-
CommandResult[CommandResult["
|
|
4490
|
-
CommandResult[CommandResult["
|
|
4491
|
-
CommandResult[CommandResult["
|
|
4492
|
-
CommandResult[CommandResult["
|
|
4493
|
-
CommandResult[CommandResult["
|
|
4494
|
-
CommandResult[CommandResult["
|
|
4495
|
-
CommandResult[CommandResult["
|
|
4496
|
-
CommandResult[CommandResult["
|
|
4497
|
-
CommandResult[CommandResult["
|
|
4498
|
-
CommandResult[CommandResult["
|
|
4499
|
-
CommandResult[CommandResult["
|
|
4500
|
-
CommandResult[CommandResult["
|
|
4501
|
-
CommandResult[CommandResult["
|
|
4442
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
4443
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
4444
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
4445
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
4446
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
4447
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
4448
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
4449
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
4450
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
4451
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
4452
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
4453
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
4454
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
4455
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
4456
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
4457
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
4458
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
4459
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
4460
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
4461
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
4462
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
4463
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
4464
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
4465
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
4466
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
4467
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
4468
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
4469
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
4470
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
4471
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
4472
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
4473
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
4474
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
4475
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
4476
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
4477
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
4478
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
4479
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
4480
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
4481
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
4482
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
4483
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
4484
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
4485
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
4486
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
4487
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
4488
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
4489
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
4490
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
4491
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
4492
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
4493
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
4494
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
4495
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
4496
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
4497
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
4498
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
4499
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
4500
|
+
CommandResult[CommandResult["MoreThanOneColumnSelected"] = 89] = "MoreThanOneColumnSelected";
|
|
4501
|
+
CommandResult[CommandResult["EmptySplitSeparator"] = 90] = "EmptySplitSeparator";
|
|
4502
|
+
CommandResult[CommandResult["SplitWillOverwriteContent"] = 91] = "SplitWillOverwriteContent";
|
|
4503
|
+
CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 92] = "NoSplitSeparatorInSelection";
|
|
4504
|
+
CommandResult[CommandResult["NoActiveSheet"] = 93] = "NoActiveSheet";
|
|
4505
|
+
CommandResult[CommandResult["NoChanges"] = 94] = "NoChanges";
|
|
4502
4506
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
4503
4507
|
|
|
4504
4508
|
const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
|
|
@@ -6458,14 +6462,8 @@
|
|
|
6458
6462
|
: undefined));
|
|
6459
6463
|
}
|
|
6460
6464
|
}
|
|
6461
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
6462
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
6463
|
-
if (!dataSetsHaveTitle) {
|
|
6464
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
6465
|
-
}
|
|
6466
|
-
}
|
|
6467
6465
|
else {
|
|
6468
|
-
/* 1 row or 1 column */
|
|
6466
|
+
/* 1 cell, 1 row or 1 column */
|
|
6469
6467
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
6470
6468
|
? {
|
|
6471
6469
|
top: zone.top,
|
|
@@ -6514,8 +6512,10 @@
|
|
|
6514
6512
|
}
|
|
6515
6513
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
6516
6514
|
return {
|
|
6517
|
-
label: ds.labelCell
|
|
6518
|
-
|
|
6515
|
+
label: ds.labelCell
|
|
6516
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
6517
|
+
: undefined,
|
|
6518
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
6519
6519
|
};
|
|
6520
6520
|
}
|
|
6521
6521
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -6528,7 +6528,7 @@
|
|
|
6528
6528
|
zone.top = zone.top + 1;
|
|
6529
6529
|
}
|
|
6530
6530
|
const range = labelRange.clone({ zone });
|
|
6531
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
6531
|
+
return getters.getRangeString(range, "forceSheetReference", true);
|
|
6532
6532
|
}
|
|
6533
6533
|
/**
|
|
6534
6534
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -6594,11 +6594,11 @@
|
|
|
6594
6594
|
if (definition.dataSets) {
|
|
6595
6595
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
6596
6596
|
if (invalidRanges) {
|
|
6597
|
-
return
|
|
6597
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6598
6598
|
}
|
|
6599
6599
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
6600
6600
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
6601
|
-
return
|
|
6601
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6602
6602
|
}
|
|
6603
6603
|
}
|
|
6604
6604
|
return 0 /* CommandResult.Success */;
|
|
@@ -6607,7 +6607,7 @@
|
|
|
6607
6607
|
if (definition.labelRange) {
|
|
6608
6608
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
6609
6609
|
if (invalidLabels) {
|
|
6610
|
-
return
|
|
6610
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
6611
6611
|
}
|
|
6612
6612
|
}
|
|
6613
6613
|
return 0 /* CommandResult.Success */;
|
|
@@ -6694,22 +6694,22 @@
|
|
|
6694
6694
|
const CfTerms = {
|
|
6695
6695
|
Errors: {
|
|
6696
6696
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
6697
|
-
[
|
|
6698
|
-
[
|
|
6699
|
-
[
|
|
6700
|
-
[
|
|
6701
|
-
[
|
|
6702
|
-
[
|
|
6703
|
-
[
|
|
6704
|
-
[
|
|
6705
|
-
[
|
|
6706
|
-
[
|
|
6707
|
-
[
|
|
6708
|
-
[
|
|
6709
|
-
[
|
|
6710
|
-
[
|
|
6711
|
-
[
|
|
6712
|
-
[
|
|
6697
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
6698
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
6699
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
6700
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
6701
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
6702
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
6703
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
6704
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
6705
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
6706
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
6707
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
6708
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
6709
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
6710
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
6711
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
6712
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
6713
6713
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
6714
6714
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
6715
6715
|
},
|
|
@@ -6737,20 +6737,20 @@
|
|
|
6737
6737
|
Errors: {
|
|
6738
6738
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
6739
6739
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
6740
|
-
[
|
|
6741
|
-
[
|
|
6740
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
6741
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
6742
6742
|
// SCORECARD CHART ERRORS
|
|
6743
|
-
[
|
|
6744
|
-
[
|
|
6743
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
6744
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
6745
6745
|
// GAUGE CHART ERRORS
|
|
6746
|
-
[
|
|
6747
|
-
[
|
|
6748
|
-
[
|
|
6749
|
-
[
|
|
6750
|
-
[
|
|
6751
|
-
[
|
|
6752
|
-
[
|
|
6753
|
-
[
|
|
6746
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
6747
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
6748
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
6749
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
6750
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
6751
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
6752
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
6753
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
6754
6754
|
},
|
|
6755
6755
|
};
|
|
6756
6756
|
const CustomCurrencyTerms = {
|
|
@@ -6760,9 +6760,9 @@
|
|
|
6760
6760
|
const SplitToColumnsTerms = {
|
|
6761
6761
|
Errors: {
|
|
6762
6762
|
Unexpected: _lt("Cannot split the selection for an unknown reason"),
|
|
6763
|
-
[
|
|
6764
|
-
[
|
|
6765
|
-
[
|
|
6763
|
+
[92 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
|
|
6764
|
+
[89 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
|
|
6765
|
+
[91 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
|
|
6766
6766
|
},
|
|
6767
6767
|
};
|
|
6768
6768
|
|
|
@@ -7065,7 +7065,7 @@
|
|
|
7065
7065
|
return undefined;
|
|
7066
7066
|
const dataSets = this.dataSets
|
|
7067
7067
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7068
|
-
.filter((ds) => ds.range !== ""
|
|
7068
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7069
7069
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7070
7070
|
return {
|
|
7071
7071
|
...this.getDefinition(),
|
|
@@ -7166,7 +7166,7 @@
|
|
|
7166
7166
|
|
|
7167
7167
|
function isDataRangeValid(definition) {
|
|
7168
7168
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
7169
|
-
?
|
|
7169
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
7170
7170
|
: 0 /* CommandResult.Success */;
|
|
7171
7171
|
}
|
|
7172
7172
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -7198,7 +7198,7 @@
|
|
|
7198
7198
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7199
7199
|
if (definition.sectionRule) {
|
|
7200
7200
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
7201
|
-
return
|
|
7201
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
7202
7202
|
}
|
|
7203
7203
|
}
|
|
7204
7204
|
return 0 /* CommandResult.Success */;
|
|
@@ -7207,9 +7207,9 @@
|
|
|
7207
7207
|
if (value === "") {
|
|
7208
7208
|
switch (valueName) {
|
|
7209
7209
|
case "rangeMin":
|
|
7210
|
-
return
|
|
7210
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
7211
7211
|
case "rangeMax":
|
|
7212
|
-
return
|
|
7212
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
7213
7213
|
}
|
|
7214
7214
|
}
|
|
7215
7215
|
return 0 /* CommandResult.Success */;
|
|
@@ -7218,13 +7218,13 @@
|
|
|
7218
7218
|
if (isNaN(value)) {
|
|
7219
7219
|
switch (valueName) {
|
|
7220
7220
|
case "rangeMin":
|
|
7221
|
-
return
|
|
7221
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
7222
7222
|
case "rangeMax":
|
|
7223
|
-
return
|
|
7223
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
7224
7224
|
case "lowerInflectionPointValue":
|
|
7225
|
-
return
|
|
7225
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
7226
7226
|
case "upperInflectionPointValue":
|
|
7227
|
-
return
|
|
7227
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
7228
7228
|
}
|
|
7229
7229
|
}
|
|
7230
7230
|
return 0 /* CommandResult.Success */;
|
|
@@ -7649,7 +7649,7 @@
|
|
|
7649
7649
|
return undefined;
|
|
7650
7650
|
const dataSets = this.dataSets
|
|
7651
7651
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7652
|
-
.filter((ds) => ds.range !== ""
|
|
7652
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7653
7653
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7654
7654
|
return {
|
|
7655
7655
|
...this.getDefinition(),
|
|
@@ -7934,7 +7934,7 @@
|
|
|
7934
7934
|
return undefined;
|
|
7935
7935
|
const dataSets = this.dataSets
|
|
7936
7936
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7937
|
-
.filter((ds) => ds.range !== ""
|
|
7937
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7938
7938
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7939
7939
|
return {
|
|
7940
7940
|
...this.getDefinition(),
|
|
@@ -8014,12 +8014,12 @@
|
|
|
8014
8014
|
|
|
8015
8015
|
function checkKeyValue(definition) {
|
|
8016
8016
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
8017
|
-
?
|
|
8017
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
8018
8018
|
: 0 /* CommandResult.Success */;
|
|
8019
8019
|
}
|
|
8020
8020
|
function checkBaseline(definition) {
|
|
8021
8021
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
8022
|
-
?
|
|
8022
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
8023
8023
|
: 0 /* CommandResult.Success */;
|
|
8024
8024
|
}
|
|
8025
8025
|
class ScorecardChart extends AbstractChart {
|
|
@@ -8525,7 +8525,7 @@
|
|
|
8525
8525
|
};
|
|
8526
8526
|
function interactiveAddMerge(env, sheetId, target) {
|
|
8527
8527
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
8528
|
-
if (result.isCancelledBecause(
|
|
8528
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
8529
8529
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
8530
8530
|
}
|
|
8531
8531
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -8775,7 +8775,7 @@
|
|
|
8775
8775
|
});
|
|
8776
8776
|
}
|
|
8777
8777
|
}
|
|
8778
|
-
if (result.isCancelledBecause(
|
|
8778
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
8779
8779
|
const { col, row } = anchor;
|
|
8780
8780
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
8781
8781
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -8798,13 +8798,13 @@
|
|
|
8798
8798
|
};
|
|
8799
8799
|
function interactiveAddFilter(env, sheetId, target) {
|
|
8800
8800
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
8801
|
-
if (result.isCancelledBecause(
|
|
8801
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
8802
8802
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
8803
8803
|
}
|
|
8804
|
-
else if (result.isCancelledBecause(
|
|
8804
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
8805
8805
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
8806
8806
|
}
|
|
8807
|
-
else if (result.isCancelledBecause(
|
|
8807
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
8808
8808
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
8809
8809
|
}
|
|
8810
8810
|
}
|
|
@@ -8826,7 +8826,7 @@
|
|
|
8826
8826
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
8827
8827
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
8828
8828
|
}
|
|
8829
|
-
else if (result.reasons.includes(
|
|
8829
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
8830
8830
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
8831
8831
|
}
|
|
8832
8832
|
}
|
|
@@ -16984,7 +16984,7 @@
|
|
|
16984
16984
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
16985
16985
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
16986
16986
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
16987
|
-
if (result.isCancelledBecause(
|
|
16987
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
16988
16988
|
env.raiseError(MergeErrorMessage);
|
|
16989
16989
|
}
|
|
16990
16990
|
}
|
|
@@ -18007,10 +18007,10 @@
|
|
|
18007
18007
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18008
18008
|
}
|
|
18009
18009
|
get isDatasetInvalid() {
|
|
18010
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
18010
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidDataSet */);
|
|
18011
18011
|
}
|
|
18012
18012
|
get isLabelInvalid() {
|
|
18013
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
18013
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */);
|
|
18014
18014
|
}
|
|
18015
18015
|
onUpdateDataSetsHaveTitle(ev) {
|
|
18016
18016
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -18452,7 +18452,7 @@
|
|
|
18452
18452
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18453
18453
|
}
|
|
18454
18454
|
get isDataRangeInvalid() {
|
|
18455
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
18455
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */);
|
|
18456
18456
|
}
|
|
18457
18457
|
onDataRangeChanged(ranges) {
|
|
18458
18458
|
this.dataRange = ranges[0];
|
|
@@ -18526,25 +18526,25 @@
|
|
|
18526
18526
|
});
|
|
18527
18527
|
}
|
|
18528
18528
|
isRangeMinInvalid() {
|
|
18529
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18530
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18531
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18529
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */) ||
|
|
18530
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */) ||
|
|
18531
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
|
|
18532
18532
|
}
|
|
18533
18533
|
isRangeMaxInvalid() {
|
|
18534
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18535
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18536
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18534
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */) ||
|
|
18535
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */) ||
|
|
18536
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
|
|
18537
18537
|
}
|
|
18538
18538
|
// ---------------------------------------------------------------------------
|
|
18539
18539
|
// COLOR_SECTION_TEMPLATE
|
|
18540
18540
|
// ---------------------------------------------------------------------------
|
|
18541
18541
|
get isLowerInflectionPointInvalid() {
|
|
18542
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18543
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18542
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
|
|
18543
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
|
|
18544
18544
|
}
|
|
18545
18545
|
get isUpperInflectionPointInvalid() {
|
|
18546
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18547
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18546
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
|
|
18547
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
|
|
18548
18548
|
}
|
|
18549
18549
|
updateInflectionPointValue(attr, ev) {
|
|
18550
18550
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -18652,10 +18652,10 @@
|
|
|
18652
18652
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18653
18653
|
}
|
|
18654
18654
|
get isKeyValueInvalid() {
|
|
18655
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
18655
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */);
|
|
18656
18656
|
}
|
|
18657
18657
|
get isBaselineInvalid() {
|
|
18658
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
18658
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */);
|
|
18659
18659
|
}
|
|
18660
18660
|
onKeyValueRangeChanged(ranges) {
|
|
18661
18661
|
this.keyValue = ranges[0];
|
|
@@ -19515,10 +19515,10 @@
|
|
|
19515
19515
|
* Cell Is Rule
|
|
19516
19516
|
****************************************************************************/
|
|
19517
19517
|
get isValue1Invalid() {
|
|
19518
|
-
return !!this.state.errors?.includes(
|
|
19518
|
+
return !!this.state.errors?.includes(52 /* CommandResult.FirstArgMissing */);
|
|
19519
19519
|
}
|
|
19520
19520
|
get isValue2Invalid() {
|
|
19521
|
-
return !!this.state.errors?.includes(
|
|
19521
|
+
return !!this.state.errors?.includes(53 /* CommandResult.SecondArgMissing */);
|
|
19522
19522
|
}
|
|
19523
19523
|
toggleStyle(tool) {
|
|
19524
19524
|
const style = this.state.rules.cellIs.style;
|
|
@@ -19535,17 +19535,17 @@
|
|
|
19535
19535
|
isValueInvalid(threshold) {
|
|
19536
19536
|
switch (threshold) {
|
|
19537
19537
|
case "minimum":
|
|
19538
|
-
return (this.state.errors.includes(
|
|
19539
|
-
this.state.errors.includes(
|
|
19540
|
-
this.state.errors.includes(
|
|
19541
|
-
this.state.errors.includes(
|
|
19538
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
19539
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
19540
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
19541
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
19542
19542
|
case "midpoint":
|
|
19543
|
-
return (this.state.errors.includes(
|
|
19544
|
-
this.state.errors.includes(
|
|
19545
|
-
this.state.errors.includes(
|
|
19543
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
19544
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
19545
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
19546
19546
|
case "maximum":
|
|
19547
|
-
return (this.state.errors.includes(
|
|
19548
|
-
this.state.errors.includes(
|
|
19547
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
19548
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
19549
19549
|
default:
|
|
19550
19550
|
return false;
|
|
19551
19551
|
}
|
|
@@ -19593,13 +19593,13 @@
|
|
|
19593
19593
|
isInflectionPointInvalid(inflectionPoint) {
|
|
19594
19594
|
switch (inflectionPoint) {
|
|
19595
19595
|
case "lowerInflectionPoint":
|
|
19596
|
-
return (this.state.errors.includes(
|
|
19597
|
-
this.state.errors.includes(
|
|
19598
|
-
this.state.errors.includes(
|
|
19596
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
19597
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
19598
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
19599
19599
|
case "upperInflectionPoint":
|
|
19600
|
-
return (this.state.errors.includes(
|
|
19601
|
-
this.state.errors.includes(
|
|
19602
|
-
this.state.errors.includes(
|
|
19600
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
19601
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
19602
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
19603
19603
|
default:
|
|
19604
19604
|
return true;
|
|
19605
19605
|
}
|
|
@@ -19910,7 +19910,7 @@
|
|
|
19910
19910
|
};
|
|
19911
19911
|
function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
19912
19912
|
let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
|
|
19913
|
-
if (result.isCancelledBecause(
|
|
19913
|
+
if (result.isCancelledBecause(91 /* CommandResult.SplitWillOverwriteContent */)) {
|
|
19914
19914
|
env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
19915
19915
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
19916
19916
|
separator,
|
|
@@ -19973,8 +19973,8 @@
|
|
|
19973
19973
|
const errors = new Set();
|
|
19974
19974
|
for (const reason of cancelledReasons) {
|
|
19975
19975
|
switch (reason) {
|
|
19976
|
-
case
|
|
19977
|
-
case
|
|
19976
|
+
case 91 /* CommandResult.SplitWillOverwriteContent */:
|
|
19977
|
+
case 90 /* CommandResult.EmptySplitSeparator */:
|
|
19978
19978
|
break;
|
|
19979
19979
|
default:
|
|
19980
19980
|
errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
@@ -19989,8 +19989,8 @@
|
|
|
19989
19989
|
addNewColumns: this.state.addNewColumns,
|
|
19990
19990
|
force: false,
|
|
19991
19991
|
}).reasons;
|
|
19992
|
-
if (cancelledReasons.includes(
|
|
19993
|
-
warnings.push(SplitToColumnsTerms.Errors[
|
|
19992
|
+
if (cancelledReasons.includes(91 /* CommandResult.SplitWillOverwriteContent */)) {
|
|
19993
|
+
warnings.push(SplitToColumnsTerms.Errors[91 /* CommandResult.SplitWillOverwriteContent */]);
|
|
19994
19994
|
}
|
|
19995
19995
|
return warnings;
|
|
19996
19996
|
}
|
|
@@ -29516,7 +29516,7 @@
|
|
|
29516
29516
|
const currentBorder = this.getCellBorder(cmd);
|
|
29517
29517
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
29518
29518
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
29519
|
-
return
|
|
29519
|
+
return 94 /* CommandResult.NoChanges */;
|
|
29520
29520
|
}
|
|
29521
29521
|
return 0 /* CommandResult.Success */;
|
|
29522
29522
|
}
|
|
@@ -29761,6 +29761,10 @@
|
|
|
29761
29761
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
29762
29762
|
content: cell.content || undefined,
|
|
29763
29763
|
};
|
|
29764
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
29765
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
29766
|
+
cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
|
|
29767
|
+
}
|
|
29764
29768
|
}
|
|
29765
29769
|
_sheet.cells = cells;
|
|
29766
29770
|
}
|
|
@@ -29795,13 +29799,13 @@
|
|
|
29795
29799
|
/*
|
|
29796
29800
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
29797
29801
|
*/
|
|
29798
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
29802
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
29799
29803
|
const ranges = dependencies || cell.dependencies;
|
|
29800
29804
|
let rangeIndex = 0;
|
|
29801
29805
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
29802
29806
|
if (token.type === "REFERENCE") {
|
|
29803
29807
|
const range = ranges[rangeIndex++];
|
|
29804
|
-
return this.getters.getRangeString(range, sheetId);
|
|
29808
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
29805
29809
|
}
|
|
29806
29810
|
return token.value;
|
|
29807
29811
|
}));
|
|
@@ -30038,9 +30042,9 @@
|
|
|
30038
30042
|
checkUselessClearCell(cmd) {
|
|
30039
30043
|
const cell = this.getters.getCell(cmd);
|
|
30040
30044
|
if (!cell)
|
|
30041
|
-
return
|
|
30045
|
+
return 94 /* CommandResult.NoChanges */;
|
|
30042
30046
|
if (!cell.content && !cell.style && !cell.format) {
|
|
30043
|
-
return
|
|
30047
|
+
return 94 /* CommandResult.NoChanges */;
|
|
30044
30048
|
}
|
|
30045
30049
|
return 0 /* CommandResult.Success */;
|
|
30046
30050
|
}
|
|
@@ -30240,13 +30244,13 @@
|
|
|
30240
30244
|
}
|
|
30241
30245
|
checkChartDuplicate(cmd) {
|
|
30242
30246
|
return this.getters.getFigureSheetId(cmd.id)
|
|
30243
|
-
?
|
|
30247
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
30244
30248
|
: 0 /* CommandResult.Success */;
|
|
30245
30249
|
}
|
|
30246
30250
|
checkChartExists(cmd) {
|
|
30247
30251
|
return this.getters.getFigureSheetId(cmd.id)
|
|
30248
30252
|
? 0 /* CommandResult.Success */
|
|
30249
|
-
:
|
|
30253
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
30250
30254
|
}
|
|
30251
30255
|
}
|
|
30252
30256
|
|
|
@@ -30351,7 +30355,13 @@
|
|
|
30351
30355
|
}
|
|
30352
30356
|
}
|
|
30353
30357
|
exportForExcel(data) {
|
|
30354
|
-
|
|
30358
|
+
if (data.sheets) {
|
|
30359
|
+
for (let sheet of data.sheets) {
|
|
30360
|
+
if (this.cfRules[sheet.id]) {
|
|
30361
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
30362
|
+
}
|
|
30363
|
+
}
|
|
30364
|
+
}
|
|
30355
30365
|
}
|
|
30356
30366
|
// ---------------------------------------------------------------------------
|
|
30357
30367
|
// Getters
|
|
@@ -30400,11 +30410,11 @@
|
|
|
30400
30410
|
// ---------------------------------------------------------------------------
|
|
30401
30411
|
// Private
|
|
30402
30412
|
// ---------------------------------------------------------------------------
|
|
30403
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
30413
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
30404
30414
|
return {
|
|
30405
30415
|
...cf,
|
|
30406
30416
|
ranges: cf.ranges.map((range) => {
|
|
30407
|
-
return this.getters.getRangeString(range, sheetId);
|
|
30417
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
30408
30418
|
}),
|
|
30409
30419
|
};
|
|
30410
30420
|
}
|
|
@@ -30437,10 +30447,10 @@
|
|
|
30437
30447
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
30438
30448
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
30439
30449
|
if (ruleIndex === -1)
|
|
30440
|
-
return
|
|
30450
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
30441
30451
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
30442
30452
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
30443
|
-
return
|
|
30453
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
30444
30454
|
}
|
|
30445
30455
|
return 0 /* CommandResult.Success */;
|
|
30446
30456
|
}
|
|
@@ -30481,10 +30491,10 @@
|
|
|
30481
30491
|
const errors = [];
|
|
30482
30492
|
const isEmpty = (value) => value === undefined || value === "";
|
|
30483
30493
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
30484
|
-
errors.push(
|
|
30494
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
30485
30495
|
}
|
|
30486
30496
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
30487
|
-
errors.push(
|
|
30497
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
30488
30498
|
}
|
|
30489
30499
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
30490
30500
|
}
|
|
@@ -30496,15 +30506,15 @@
|
|
|
30496
30506
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
30497
30507
|
switch (thresholdName) {
|
|
30498
30508
|
case "min":
|
|
30499
|
-
return
|
|
30509
|
+
return 54 /* CommandResult.MinNaN */;
|
|
30500
30510
|
case "max":
|
|
30501
|
-
return
|
|
30511
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
30502
30512
|
case "mid":
|
|
30503
|
-
return
|
|
30513
|
+
return 55 /* CommandResult.MidNaN */;
|
|
30504
30514
|
case "upperInflectionPoint":
|
|
30505
|
-
return
|
|
30515
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
30506
30516
|
case "lowerInflectionPoint":
|
|
30507
|
-
return
|
|
30517
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
30508
30518
|
}
|
|
30509
30519
|
}
|
|
30510
30520
|
return 0 /* CommandResult.Success */;
|
|
@@ -30518,15 +30528,15 @@
|
|
|
30518
30528
|
catch (error) {
|
|
30519
30529
|
switch (thresholdName) {
|
|
30520
30530
|
case "min":
|
|
30521
|
-
return
|
|
30531
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
30522
30532
|
case "max":
|
|
30523
|
-
return
|
|
30533
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
30524
30534
|
case "mid":
|
|
30525
|
-
return
|
|
30535
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
30526
30536
|
case "upperInflectionPoint":
|
|
30527
|
-
return
|
|
30537
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
30528
30538
|
case "lowerInflectionPoint":
|
|
30529
|
-
return
|
|
30539
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
30530
30540
|
}
|
|
30531
30541
|
}
|
|
30532
30542
|
return 0 /* CommandResult.Success */;
|
|
@@ -30543,7 +30553,7 @@
|
|
|
30543
30553
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
30544
30554
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
30545
30555
|
Number(minValue) > Number(maxValue)) {
|
|
30546
|
-
return
|
|
30556
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
30547
30557
|
}
|
|
30548
30558
|
return 0 /* CommandResult.Success */;
|
|
30549
30559
|
}
|
|
@@ -30553,7 +30563,7 @@
|
|
|
30553
30563
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
30554
30564
|
rule.minimum.type === rule.maximum.type &&
|
|
30555
30565
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
30556
|
-
return
|
|
30566
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
30557
30567
|
}
|
|
30558
30568
|
return 0 /* CommandResult.Success */;
|
|
30559
30569
|
}
|
|
@@ -30564,7 +30574,7 @@
|
|
|
30564
30574
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
30565
30575
|
rule.midpoint.type === rule.maximum.type &&
|
|
30566
30576
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
30567
|
-
return
|
|
30577
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
30568
30578
|
}
|
|
30569
30579
|
return 0 /* CommandResult.Success */;
|
|
30570
30580
|
}
|
|
@@ -30575,7 +30585,7 @@
|
|
|
30575
30585
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
30576
30586
|
rule.minimum.type === rule.midpoint.type &&
|
|
30577
30587
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
30578
|
-
return
|
|
30588
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
30579
30589
|
}
|
|
30580
30590
|
return 0 /* CommandResult.Success */;
|
|
30581
30591
|
}
|
|
@@ -30705,13 +30715,13 @@
|
|
|
30705
30715
|
}
|
|
30706
30716
|
checkFigureExists(sheetId, figureId) {
|
|
30707
30717
|
if (this.figures[sheetId]?.[figureId] === undefined) {
|
|
30708
|
-
return
|
|
30718
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
30709
30719
|
}
|
|
30710
30720
|
return 0 /* CommandResult.Success */;
|
|
30711
30721
|
}
|
|
30712
30722
|
checkFigureDuplicate(figureId) {
|
|
30713
30723
|
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
|
|
30714
|
-
return
|
|
30724
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
30715
30725
|
}
|
|
30716
30726
|
return 0 /* CommandResult.Success */;
|
|
30717
30727
|
}
|
|
@@ -30821,12 +30831,12 @@
|
|
|
30821
30831
|
switch (cmd.type) {
|
|
30822
30832
|
case "CREATE_FILTER_TABLE":
|
|
30823
30833
|
if (!areZonesContinuous(...cmd.target)) {
|
|
30824
|
-
return
|
|
30834
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
30825
30835
|
}
|
|
30826
30836
|
const zone = union(...cmd.target);
|
|
30827
30837
|
const checkFilterOverlap = () => {
|
|
30828
30838
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
30829
|
-
return
|
|
30839
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
30830
30840
|
}
|
|
30831
30841
|
return 0 /* CommandResult.Success */;
|
|
30832
30842
|
};
|
|
@@ -30834,7 +30844,7 @@
|
|
|
30834
30844
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
30835
30845
|
for (let merge of mergesInTarget) {
|
|
30836
30846
|
if (overlap(zone, merge)) {
|
|
30837
|
-
return
|
|
30847
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
30838
30848
|
}
|
|
30839
30849
|
}
|
|
30840
30850
|
return 0 /* CommandResult.Success */;
|
|
@@ -30844,7 +30854,7 @@
|
|
|
30844
30854
|
for (let merge of cmd.target) {
|
|
30845
30855
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
30846
30856
|
if (overlap(filterTable.zone, merge)) {
|
|
30847
|
-
return
|
|
30857
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
30848
30858
|
}
|
|
30849
30859
|
}
|
|
30850
30860
|
}
|
|
@@ -31329,10 +31339,10 @@
|
|
|
31329
31339
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
31330
31340
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
31331
31341
|
if (hiddenElements.size >= elements) {
|
|
31332
|
-
return
|
|
31342
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
31333
31343
|
}
|
|
31334
31344
|
else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
31335
|
-
return
|
|
31345
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31336
31346
|
}
|
|
31337
31347
|
else {
|
|
31338
31348
|
return 0 /* CommandResult.Success */;
|
|
@@ -31875,7 +31885,7 @@
|
|
|
31875
31885
|
for (const zone of target) {
|
|
31876
31886
|
for (const zone2 of target) {
|
|
31877
31887
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
31878
|
-
return
|
|
31888
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31879
31889
|
}
|
|
31880
31890
|
}
|
|
31881
31891
|
}
|
|
@@ -31889,7 +31899,7 @@
|
|
|
31889
31899
|
for (const zone of target) {
|
|
31890
31900
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
31891
31901
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
31892
|
-
return
|
|
31902
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
31893
31903
|
}
|
|
31894
31904
|
}
|
|
31895
31905
|
return 0 /* CommandResult.Success */;
|
|
@@ -32347,8 +32357,9 @@
|
|
|
32347
32357
|
*
|
|
32348
32358
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
32349
32359
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
32360
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
32350
32361
|
*/
|
|
32351
|
-
getRangeString(range, forSheetId) {
|
|
32362
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
32352
32363
|
if (!range) {
|
|
32353
32364
|
return INCORRECT_RANGE_STRING;
|
|
32354
32365
|
}
|
|
@@ -32375,7 +32386,7 @@
|
|
|
32375
32386
|
if (prefixSheet && !sheetName) {
|
|
32376
32387
|
return INCORRECT_RANGE_STRING;
|
|
32377
32388
|
}
|
|
32378
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
32389
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
32379
32390
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
32380
32391
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
32381
32392
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -32385,7 +32396,7 @@
|
|
|
32385
32396
|
rangeImpl.parts[1].rowFixed ||
|
|
32386
32397
|
rangeImpl.parts[1].colFixed) {
|
|
32387
32398
|
rangeString += ":";
|
|
32388
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
32399
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
32389
32400
|
}
|
|
32390
32401
|
}
|
|
32391
32402
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -32415,13 +32426,13 @@
|
|
|
32415
32426
|
/**
|
|
32416
32427
|
* Get a Xc string that represent a part of a range
|
|
32417
32428
|
*/
|
|
32418
|
-
getRangePartString(range, part) {
|
|
32419
|
-
const colFixed = range.parts && range.parts[part]
|
|
32429
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
32430
|
+
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
32420
32431
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
32421
|
-
const rowFixed = range.parts && range.parts[part]
|
|
32432
|
+
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
32422
32433
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
32423
32434
|
let str = "";
|
|
32424
|
-
if (range.isFullCol) {
|
|
32435
|
+
if (range.isFullCol && !useFixedZone) {
|
|
32425
32436
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
32426
32437
|
str = colFixed + col + rowFixed + row;
|
|
32427
32438
|
}
|
|
@@ -32429,7 +32440,7 @@
|
|
|
32429
32440
|
str = colFixed + col;
|
|
32430
32441
|
}
|
|
32431
32442
|
}
|
|
32432
|
-
else if (range.isFullRow) {
|
|
32443
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
32433
32444
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
32434
32445
|
str = colFixed + col + rowFixed + row;
|
|
32435
32446
|
}
|
|
@@ -32525,10 +32536,10 @@
|
|
|
32525
32536
|
? this.getNumberCols(cmd.sheetId)
|
|
32526
32537
|
: this.getNumberRows(cmd.sheetId);
|
|
32527
32538
|
if (cmd.base < 0 || cmd.base >= elements) {
|
|
32528
|
-
return
|
|
32539
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
32529
32540
|
}
|
|
32530
32541
|
else if (cmd.quantity <= 0) {
|
|
32531
|
-
return
|
|
32542
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
32532
32543
|
}
|
|
32533
32544
|
return 0 /* CommandResult.Success */;
|
|
32534
32545
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -32536,7 +32547,7 @@
|
|
|
32536
32547
|
? this.getNumberCols(cmd.sheetId)
|
|
32537
32548
|
: this.getNumberRows(cmd.sheetId);
|
|
32538
32549
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
32539
|
-
return
|
|
32550
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
32540
32551
|
}
|
|
32541
32552
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
32542
32553
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -33002,18 +33013,18 @@
|
|
|
33002
33013
|
checkRowFreezeQuantity(cmd) {
|
|
33003
33014
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
33004
33015
|
? 0 /* CommandResult.Success */
|
|
33005
|
-
:
|
|
33016
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
33006
33017
|
}
|
|
33007
33018
|
checkColFreezeQuantity(cmd) {
|
|
33008
33019
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
33009
33020
|
? 0 /* CommandResult.Success */
|
|
33010
|
-
:
|
|
33021
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
33011
33022
|
}
|
|
33012
33023
|
checkRowFreezeOverlapMerge(cmd) {
|
|
33013
33024
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
33014
33025
|
for (let merge of merges) {
|
|
33015
33026
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
33016
|
-
return
|
|
33027
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
33017
33028
|
}
|
|
33018
33029
|
}
|
|
33019
33030
|
return 0 /* CommandResult.Success */;
|
|
@@ -33022,7 +33033,7 @@
|
|
|
33022
33033
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
33023
33034
|
for (let merge of merges) {
|
|
33024
33035
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
33025
|
-
return
|
|
33036
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
33026
33037
|
}
|
|
33027
33038
|
}
|
|
33028
33039
|
return 0 /* CommandResult.Success */;
|
|
@@ -33753,10 +33764,8 @@
|
|
|
33753
33764
|
* that are actually present in the grid.
|
|
33754
33765
|
*/
|
|
33755
33766
|
function range(range) {
|
|
33767
|
+
assertRangeValid(range);
|
|
33756
33768
|
const sheetId = range.sheetId;
|
|
33757
|
-
if (!isZoneValid(range.zone)) {
|
|
33758
|
-
throw new InvalidReferenceError();
|
|
33759
|
-
}
|
|
33760
33769
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
33761
33770
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
33762
33771
|
const sheetZone = getters.getSheetZone(sheetId);
|
|
@@ -33791,23 +33800,26 @@
|
|
|
33791
33800
|
* The `compute` of the formula's function must process it completely
|
|
33792
33801
|
*/
|
|
33793
33802
|
function refFn(range, isMeta, functionName, paramNumber) {
|
|
33803
|
+
assertRangeValid(range);
|
|
33794
33804
|
if (isMeta) {
|
|
33795
33805
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
33796
33806
|
return { value: zoneToXc(range.zone) };
|
|
33797
33807
|
}
|
|
33798
|
-
if (!isZoneValid(range.zone)) {
|
|
33799
|
-
throw new InvalidReferenceError();
|
|
33800
|
-
}
|
|
33801
33808
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
33802
33809
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
33803
33810
|
throw new Error(paramNumber
|
|
33804
33811
|
? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
33805
33812
|
: _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
33806
33813
|
}
|
|
33814
|
+
return readCell(range);
|
|
33815
|
+
}
|
|
33816
|
+
function assertRangeValid(range) {
|
|
33817
|
+
if (!isZoneValid(range.zone)) {
|
|
33818
|
+
throw new InvalidReferenceError();
|
|
33819
|
+
}
|
|
33807
33820
|
if (range.invalidSheetName) {
|
|
33808
33821
|
throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
|
|
33809
33822
|
}
|
|
33810
|
-
return readCell(range);
|
|
33811
33823
|
}
|
|
33812
33824
|
return [refFn, range, evalContext];
|
|
33813
33825
|
}
|
|
@@ -34292,7 +34304,7 @@
|
|
|
34292
34304
|
switch (cmd.type) {
|
|
34293
34305
|
case "UPDATE_FILTER":
|
|
34294
34306
|
if (!this.getters.getFilterId(cmd)) {
|
|
34295
|
-
return
|
|
34307
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
34296
34308
|
}
|
|
34297
34309
|
break;
|
|
34298
34310
|
}
|
|
@@ -35262,7 +35274,7 @@
|
|
|
35262
35274
|
}
|
|
35263
35275
|
checkPositiveDimension(cmd) {
|
|
35264
35276
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
35265
|
-
return
|
|
35277
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
35266
35278
|
}
|
|
35267
35279
|
return 0 /* CommandResult.Success */;
|
|
35268
35280
|
}
|
|
@@ -35272,7 +35284,7 @@
|
|
|
35272
35284
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
35273
35285
|
cmd.width === width &&
|
|
35274
35286
|
cmd.height === height) {
|
|
35275
|
-
return
|
|
35287
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
35276
35288
|
}
|
|
35277
35289
|
return 0 /* CommandResult.Success */;
|
|
35278
35290
|
}
|
|
@@ -35280,7 +35292,7 @@
|
|
|
35280
35292
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
35281
35293
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
35282
35294
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
35283
|
-
return
|
|
35295
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
35284
35296
|
}
|
|
35285
35297
|
return 0 /* CommandResult.Success */;
|
|
35286
35298
|
}
|
|
@@ -35535,7 +35547,7 @@
|
|
|
35535
35547
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
35536
35548
|
return 0 /* CommandResult.Success */;
|
|
35537
35549
|
}
|
|
35538
|
-
return
|
|
35550
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
35539
35551
|
case "AUTOFILL_AUTO":
|
|
35540
35552
|
const zone = this.getters.getSelectedZone();
|
|
35541
35553
|
return zone.top === zone.bottom
|
|
@@ -36139,7 +36151,7 @@
|
|
|
36139
36151
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
36140
36152
|
}
|
|
36141
36153
|
catch (error) {
|
|
36142
|
-
return
|
|
36154
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
36143
36155
|
}
|
|
36144
36156
|
return 0 /* CommandResult.Success */;
|
|
36145
36157
|
default:
|
|
@@ -38275,21 +38287,6 @@
|
|
|
38275
38287
|
// ---------------------------------------------------------------------------
|
|
38276
38288
|
// Command Handling
|
|
38277
38289
|
// ---------------------------------------------------------------------------
|
|
38278
|
-
allowDispatch(cmd) {
|
|
38279
|
-
switch (cmd.type) {
|
|
38280
|
-
case "ADD_EMPTY_RANGE":
|
|
38281
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
38282
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38283
|
-
}
|
|
38284
|
-
break;
|
|
38285
|
-
case "CHANGE_RANGE":
|
|
38286
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
38287
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38288
|
-
}
|
|
38289
|
-
break;
|
|
38290
|
-
}
|
|
38291
|
-
return 0 /* CommandResult.Success */;
|
|
38292
|
-
}
|
|
38293
38290
|
handleEvent(event) {
|
|
38294
38291
|
const xc = zoneToXc(event.anchor.zone);
|
|
38295
38292
|
const inputSheetId = this.activeSheet;
|
|
@@ -38505,6 +38502,15 @@
|
|
|
38505
38502
|
// Command Handling
|
|
38506
38503
|
// ---------------------------------------------------------------------------
|
|
38507
38504
|
allowDispatch(cmd) {
|
|
38505
|
+
switch (cmd.type) {
|
|
38506
|
+
case "FOCUS_RANGE":
|
|
38507
|
+
case "CHANGE_RANGE":
|
|
38508
|
+
case "ADD_EMPTY_RANGE":
|
|
38509
|
+
case "REMOVE_RANGE":
|
|
38510
|
+
if (!this.inputs[cmd.id]) {
|
|
38511
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
38512
|
+
}
|
|
38513
|
+
}
|
|
38508
38514
|
switch (cmd.type) {
|
|
38509
38515
|
case "FOCUS_RANGE":
|
|
38510
38516
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -38512,9 +38518,19 @@
|
|
|
38512
38518
|
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
38513
38519
|
}
|
|
38514
38520
|
break;
|
|
38515
|
-
|
|
38516
|
-
|
|
38517
|
-
|
|
38521
|
+
case "ADD_EMPTY_RANGE":
|
|
38522
|
+
const input = this.inputs[cmd.id];
|
|
38523
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
38524
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38525
|
+
}
|
|
38526
|
+
break;
|
|
38527
|
+
case "CHANGE_RANGE": {
|
|
38528
|
+
const input = this.inputs[cmd.id];
|
|
38529
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
38530
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38531
|
+
}
|
|
38532
|
+
break;
|
|
38533
|
+
}
|
|
38518
38534
|
}
|
|
38519
38535
|
return 0 /* CommandResult.Success */;
|
|
38520
38536
|
}
|
|
@@ -38638,7 +38654,7 @@
|
|
|
38638
38654
|
/*Test the presence of single cells*/
|
|
38639
38655
|
const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
|
|
38640
38656
|
if (singleCells) {
|
|
38641
|
-
return
|
|
38657
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
38642
38658
|
}
|
|
38643
38659
|
return 0 /* CommandResult.Success */;
|
|
38644
38660
|
}
|
|
@@ -38657,7 +38673,7 @@
|
|
|
38657
38673
|
];
|
|
38658
38674
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
38659
38675
|
})) {
|
|
38660
|
-
return
|
|
38676
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
38661
38677
|
}
|
|
38662
38678
|
return 0 /* CommandResult.Success */;
|
|
38663
38679
|
}
|
|
@@ -39160,7 +39176,7 @@
|
|
|
39160
39176
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
39161
39177
|
const zones = this.getters.getCommandZones(cmd);
|
|
39162
39178
|
if (!sheetId && zones.length > 0) {
|
|
39163
|
-
return
|
|
39179
|
+
return 93 /* CommandResult.NoActiveSheet */;
|
|
39164
39180
|
}
|
|
39165
39181
|
if (sheetId && zones.length > 0) {
|
|
39166
39182
|
return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
@@ -39642,13 +39658,13 @@
|
|
|
39642
39658
|
}
|
|
39643
39659
|
checkSingleColSelected() {
|
|
39644
39660
|
if (!this.getters.isSingleColSelected()) {
|
|
39645
|
-
return
|
|
39661
|
+
return 89 /* CommandResult.MoreThanOneColumnSelected */;
|
|
39646
39662
|
}
|
|
39647
39663
|
return 0 /* CommandResult.Success */;
|
|
39648
39664
|
}
|
|
39649
39665
|
checkNonEmptySelector(cmd) {
|
|
39650
39666
|
if (cmd.separator === "") {
|
|
39651
|
-
return
|
|
39667
|
+
return 90 /* CommandResult.EmptySplitSeparator */;
|
|
39652
39668
|
}
|
|
39653
39669
|
return 0 /* CommandResult.Success */;
|
|
39654
39670
|
}
|
|
@@ -39659,7 +39675,7 @@
|
|
|
39659
39675
|
const selection = this.getters.getSelectedZones()[0];
|
|
39660
39676
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
39661
39677
|
if (this.willSplittedColsOverwriteContent(selection, splitted)) {
|
|
39662
|
-
return
|
|
39678
|
+
return 91 /* CommandResult.SplitWillOverwriteContent */;
|
|
39663
39679
|
}
|
|
39664
39680
|
return 0 /* CommandResult.Success */;
|
|
39665
39681
|
}
|
|
@@ -39670,7 +39686,7 @@
|
|
|
39670
39686
|
return 0 /* CommandResult.Success */;
|
|
39671
39687
|
}
|
|
39672
39688
|
}
|
|
39673
|
-
return
|
|
39689
|
+
return 92 /* CommandResult.NoSplitSeparatorInSelection */;
|
|
39674
39690
|
}
|
|
39675
39691
|
}
|
|
39676
39692
|
|
|
@@ -39817,7 +39833,7 @@
|
|
|
39817
39833
|
for (const zone of this.getPasteZones(target)) {
|
|
39818
39834
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
39819
39835
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
39820
|
-
return
|
|
39836
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
39821
39837
|
}
|
|
39822
39838
|
}
|
|
39823
39839
|
return 0 /* CommandResult.Success */;
|
|
@@ -40211,7 +40227,7 @@
|
|
|
40211
40227
|
}
|
|
40212
40228
|
isPasteAllowed(target, option) {
|
|
40213
40229
|
if (target.length === 0) {
|
|
40214
|
-
return
|
|
40230
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
40215
40231
|
}
|
|
40216
40232
|
if (option?.pasteOption !== undefined) {
|
|
40217
40233
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -40952,7 +40968,7 @@
|
|
|
40952
40968
|
validateSelection(length, start, end) {
|
|
40953
40969
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
40954
40970
|
? 0 /* CommandResult.Success */
|
|
40955
|
-
:
|
|
40971
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
40956
40972
|
}
|
|
40957
40973
|
onColumnsRemoved(cmd) {
|
|
40958
40974
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -41263,9 +41279,10 @@
|
|
|
41263
41279
|
*/
|
|
41264
41280
|
getReferencedRanges() {
|
|
41265
41281
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
41266
|
-
|
|
41282
|
+
const referenceRanges = this.currentTokens
|
|
41267
41283
|
.filter((token) => token.type === "REFERENCE")
|
|
41268
41284
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
41285
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
41269
41286
|
}
|
|
41270
41287
|
/**
|
|
41271
41288
|
* Function used to determine when composer selection can start.
|
|
@@ -41904,7 +41921,7 @@
|
|
|
41904
41921
|
const headers = [cmd.base, ...cmd.elements];
|
|
41905
41922
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
41906
41923
|
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
41907
|
-
return
|
|
41924
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
41908
41925
|
}
|
|
41909
41926
|
return 0 /* CommandResult.Success */;
|
|
41910
41927
|
}
|
|
@@ -45253,7 +45270,7 @@
|
|
|
45253
45270
|
*/
|
|
45254
45271
|
moveAnchorCell(direction, step = 1) {
|
|
45255
45272
|
if (step !== "end" && step <= 0) {
|
|
45256
|
-
return new DispatchResult(
|
|
45273
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
45257
45274
|
}
|
|
45258
45275
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
45259
45276
|
return this.selectCell(col, row);
|
|
@@ -45299,7 +45316,7 @@
|
|
|
45299
45316
|
*/
|
|
45300
45317
|
resizeAnchorZone(direction, step = 1) {
|
|
45301
45318
|
if (step !== "end" && step <= 0) {
|
|
45302
|
-
return new DispatchResult(
|
|
45319
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
45303
45320
|
}
|
|
45304
45321
|
const sheetId = this.getters.getActiveSheetId();
|
|
45305
45322
|
const anchor = this.anchor;
|
|
@@ -46126,12 +46143,7 @@
|
|
|
46126
46143
|
attrs.push(["t", "str"]);
|
|
46127
46144
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
46128
46145
|
}
|
|
46129
|
-
node = escapeXml /*xml*/
|
|
46130
|
-
<f>
|
|
46131
|
-
${XlsxFormula}
|
|
46132
|
-
</f>
|
|
46133
|
-
${cycle}
|
|
46134
|
-
`;
|
|
46146
|
+
node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
|
|
46135
46147
|
return { attrs, node };
|
|
46136
46148
|
}
|
|
46137
46149
|
else {
|
|
@@ -46953,11 +46965,10 @@
|
|
|
46953
46965
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
46954
46966
|
}
|
|
46955
46967
|
attributes.push(...additionalAttrs);
|
|
46956
|
-
|
|
46957
|
-
|
|
46958
|
-
|
|
46959
|
-
|
|
46960
|
-
`);
|
|
46968
|
+
// prettier-ignore
|
|
46969
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
46970
|
+
${cellNode}
|
|
46971
|
+
</c>`);
|
|
46961
46972
|
}
|
|
46962
46973
|
}
|
|
46963
46974
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -47642,10 +47653,10 @@
|
|
|
47642
47653
|
const command = createCommand(type, payload);
|
|
47643
47654
|
let status = this.status;
|
|
47644
47655
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
47645
|
-
return new DispatchResult(
|
|
47656
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
47646
47657
|
}
|
|
47647
47658
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
47648
|
-
return new DispatchResult(
|
|
47659
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
47649
47660
|
}
|
|
47650
47661
|
switch (status) {
|
|
47651
47662
|
case 0 /* Status.Ready */:
|
|
@@ -47926,9 +47937,9 @@
|
|
|
47926
47937
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47927
47938
|
|
|
47928
47939
|
|
|
47929
|
-
__info__.version = '16.3.
|
|
47930
|
-
__info__.date = '2024-
|
|
47931
|
-
__info__.hash = '
|
|
47940
|
+
__info__.version = '16.3.24';
|
|
47941
|
+
__info__.date = '2024-02-02T13:45:48.440Z';
|
|
47942
|
+
__info__.hash = '0bf5f45';
|
|
47932
47943
|
|
|
47933
47944
|
|
|
47934
47945
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|