@odoo/o-spreadsheet 16.2.28 → 16.2.31
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 +478 -371
- package/dist/o-spreadsheet.d.ts +91 -76
- package/dist/o-spreadsheet.esm.js +478 -371
- package/dist/o-spreadsheet.iife.js +478 -371
- package/dist/o-spreadsheet.iife.min.js +99 -106
- package/dist/o_spreadsheet.xml +16 -34
- package/package.json +1 -1
|
@@ -1691,6 +1691,9 @@ function parseFormat(formatString) {
|
|
|
1691
1691
|
function formatValue(value, format) {
|
|
1692
1692
|
switch (typeof value) {
|
|
1693
1693
|
case "string":
|
|
1694
|
+
if (value.includes('\\"')) {
|
|
1695
|
+
return value.replace(/\\"/g, '"');
|
|
1696
|
+
}
|
|
1694
1697
|
return value;
|
|
1695
1698
|
case "boolean":
|
|
1696
1699
|
return value ? "TRUE" : "FALSE";
|
|
@@ -2020,27 +2023,30 @@ function detectFormat(content) {
|
|
|
2020
2023
|
}
|
|
2021
2024
|
function createLargeNumberFormat(format, magnitude, postFix) {
|
|
2022
2025
|
const internalFormat = parseFormat(format || "#,##0");
|
|
2023
|
-
const largeNumberFormat =
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
format: {
|
|
2030
|
-
...formatPart.format,
|
|
2031
|
-
magnitude,
|
|
2032
|
-
decimalPart: undefined,
|
|
2033
|
-
},
|
|
2034
|
-
},
|
|
2035
|
-
{
|
|
2036
|
-
type: "STRING",
|
|
2037
|
-
format: postFix,
|
|
2038
|
-
},
|
|
2039
|
-
];
|
|
2026
|
+
const largeNumberFormat = [];
|
|
2027
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
2028
|
+
const formatPart = internalFormat[i];
|
|
2029
|
+
if (formatPart.type !== "NUMBER") {
|
|
2030
|
+
largeNumberFormat.push(formatPart);
|
|
2031
|
+
continue;
|
|
2040
2032
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2033
|
+
largeNumberFormat.push({
|
|
2034
|
+
...formatPart,
|
|
2035
|
+
format: {
|
|
2036
|
+
...formatPart.format,
|
|
2037
|
+
magnitude,
|
|
2038
|
+
decimalPart: undefined,
|
|
2039
|
+
},
|
|
2040
|
+
});
|
|
2041
|
+
largeNumberFormat.push({
|
|
2042
|
+
type: "STRING",
|
|
2043
|
+
format: postFix,
|
|
2044
|
+
});
|
|
2045
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
2046
|
+
if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
2047
|
+
i++;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2044
2050
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
2045
2051
|
}
|
|
2046
2052
|
function changeDecimalPlaces(format, step) {
|
|
@@ -4311,64 +4317,65 @@ var CommandResult;
|
|
|
4311
4317
|
CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
|
|
4312
4318
|
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
4313
4319
|
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
4314
|
-
CommandResult[CommandResult["
|
|
4315
|
-
CommandResult[CommandResult["
|
|
4316
|
-
CommandResult[CommandResult["
|
|
4317
|
-
CommandResult[CommandResult["
|
|
4318
|
-
CommandResult[CommandResult["
|
|
4319
|
-
CommandResult[CommandResult["
|
|
4320
|
-
CommandResult[CommandResult["
|
|
4321
|
-
CommandResult[CommandResult["
|
|
4322
|
-
CommandResult[CommandResult["
|
|
4323
|
-
CommandResult[CommandResult["
|
|
4324
|
-
CommandResult[CommandResult["
|
|
4325
|
-
CommandResult[CommandResult["
|
|
4326
|
-
CommandResult[CommandResult["
|
|
4327
|
-
CommandResult[CommandResult["
|
|
4328
|
-
CommandResult[CommandResult["
|
|
4329
|
-
CommandResult[CommandResult["
|
|
4330
|
-
CommandResult[CommandResult["
|
|
4331
|
-
CommandResult[CommandResult["
|
|
4332
|
-
CommandResult[CommandResult["
|
|
4333
|
-
CommandResult[CommandResult["
|
|
4334
|
-
CommandResult[CommandResult["
|
|
4335
|
-
CommandResult[CommandResult["
|
|
4336
|
-
CommandResult[CommandResult["
|
|
4337
|
-
CommandResult[CommandResult["
|
|
4338
|
-
CommandResult[CommandResult["
|
|
4339
|
-
CommandResult[CommandResult["
|
|
4340
|
-
CommandResult[CommandResult["
|
|
4341
|
-
CommandResult[CommandResult["
|
|
4342
|
-
CommandResult[CommandResult["
|
|
4343
|
-
CommandResult[CommandResult["
|
|
4344
|
-
CommandResult[CommandResult["
|
|
4345
|
-
CommandResult[CommandResult["
|
|
4346
|
-
CommandResult[CommandResult["
|
|
4347
|
-
CommandResult[CommandResult["
|
|
4348
|
-
CommandResult[CommandResult["
|
|
4349
|
-
CommandResult[CommandResult["
|
|
4350
|
-
CommandResult[CommandResult["
|
|
4351
|
-
CommandResult[CommandResult["
|
|
4352
|
-
CommandResult[CommandResult["
|
|
4353
|
-
CommandResult[CommandResult["
|
|
4354
|
-
CommandResult[CommandResult["
|
|
4355
|
-
CommandResult[CommandResult["
|
|
4356
|
-
CommandResult[CommandResult["
|
|
4357
|
-
CommandResult[CommandResult["
|
|
4358
|
-
CommandResult[CommandResult["
|
|
4359
|
-
CommandResult[CommandResult["
|
|
4360
|
-
CommandResult[CommandResult["
|
|
4361
|
-
CommandResult[CommandResult["
|
|
4362
|
-
CommandResult[CommandResult["
|
|
4363
|
-
CommandResult[CommandResult["
|
|
4364
|
-
CommandResult[CommandResult["
|
|
4365
|
-
CommandResult[CommandResult["
|
|
4366
|
-
CommandResult[CommandResult["
|
|
4367
|
-
CommandResult[CommandResult["
|
|
4368
|
-
CommandResult[CommandResult["
|
|
4369
|
-
CommandResult[CommandResult["
|
|
4370
|
-
CommandResult[CommandResult["
|
|
4371
|
-
CommandResult[CommandResult["
|
|
4320
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
4321
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
4322
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
4323
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
4324
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
4325
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
4326
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
4327
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
4328
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
4329
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
4330
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
4331
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
4332
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
4333
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
4334
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
4335
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
4336
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
4337
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
4338
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
4339
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
4340
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
4341
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
4342
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
4343
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
4344
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
4345
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
4346
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
4347
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
4348
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
4349
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
4350
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
4351
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
4352
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
4353
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
4354
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
4355
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
4356
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
4357
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
4358
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
4359
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
4360
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
4361
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
4362
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
4363
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
4364
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
4365
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
4366
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
4367
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
4368
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
4369
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
4370
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
4371
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
4372
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
4373
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
4374
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
4375
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
4376
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
4377
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
4378
|
+
CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
|
|
4372
4379
|
})(CommandResult || (CommandResult = {}));
|
|
4373
4380
|
|
|
4374
4381
|
function isMatrix(x) {
|
|
@@ -6267,14 +6274,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
|
|
|
6267
6274
|
: undefined));
|
|
6268
6275
|
}
|
|
6269
6276
|
}
|
|
6270
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
6271
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
6272
|
-
if (!dataSetsHaveTitle) {
|
|
6273
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
6274
|
-
}
|
|
6275
|
-
}
|
|
6276
6277
|
else {
|
|
6277
|
-
/* 1 row or 1 column */
|
|
6278
|
+
/* 1 cell, 1 row or 1 column */
|
|
6278
6279
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
6279
6280
|
? {
|
|
6280
6281
|
top: zone.top,
|
|
@@ -6324,8 +6325,10 @@ function toExcelDataset(getters, ds) {
|
|
|
6324
6325
|
}
|
|
6325
6326
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
6326
6327
|
return {
|
|
6327
|
-
label: ds.labelCell
|
|
6328
|
-
|
|
6328
|
+
label: ds.labelCell
|
|
6329
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
6330
|
+
: undefined,
|
|
6331
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
6329
6332
|
};
|
|
6330
6333
|
}
|
|
6331
6334
|
/**
|
|
@@ -6394,11 +6397,11 @@ function checkDataset(definition) {
|
|
|
6394
6397
|
if (definition.dataSets) {
|
|
6395
6398
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
6396
6399
|
if (invalidRanges) {
|
|
6397
|
-
return
|
|
6400
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6398
6401
|
}
|
|
6399
6402
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
6400
6403
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
6401
|
-
return
|
|
6404
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6402
6405
|
}
|
|
6403
6406
|
}
|
|
6404
6407
|
return 0 /* CommandResult.Success */;
|
|
@@ -6407,7 +6410,7 @@ function checkLabelRange(definition) {
|
|
|
6407
6410
|
if (definition.labelRange) {
|
|
6408
6411
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
6409
6412
|
if (invalidLabels) {
|
|
6410
|
-
return
|
|
6413
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
6411
6414
|
}
|
|
6412
6415
|
}
|
|
6413
6416
|
return 0 /* CommandResult.Success */;
|
|
@@ -6480,22 +6483,22 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
|
|
|
6480
6483
|
const CfTerms = {
|
|
6481
6484
|
Errors: {
|
|
6482
6485
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
6483
|
-
[
|
|
6484
|
-
[
|
|
6485
|
-
[
|
|
6486
|
-
[
|
|
6487
|
-
[
|
|
6488
|
-
[
|
|
6489
|
-
[
|
|
6490
|
-
[
|
|
6491
|
-
[
|
|
6492
|
-
[
|
|
6493
|
-
[
|
|
6494
|
-
[
|
|
6495
|
-
[
|
|
6496
|
-
[
|
|
6497
|
-
[
|
|
6498
|
-
[
|
|
6486
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
6487
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
6488
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
6489
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
6490
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
6491
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
6492
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
6493
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
6494
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
6495
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
6496
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
6497
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
6498
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
6499
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
6500
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
6501
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
6499
6502
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
6500
6503
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
6501
6504
|
},
|
|
@@ -6523,20 +6526,20 @@ const ChartTerms = {
|
|
|
6523
6526
|
Errors: {
|
|
6524
6527
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
6525
6528
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
6526
|
-
[
|
|
6527
|
-
[
|
|
6529
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
6530
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
6528
6531
|
// SCORECARD CHART ERRORS
|
|
6529
|
-
[
|
|
6530
|
-
[
|
|
6532
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
6533
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
6531
6534
|
// GAUGE CHART ERRORS
|
|
6532
|
-
[
|
|
6533
|
-
[
|
|
6534
|
-
[
|
|
6535
|
-
[
|
|
6536
|
-
[
|
|
6537
|
-
[
|
|
6538
|
-
[
|
|
6539
|
-
[
|
|
6535
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
6536
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
6537
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
6538
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
6539
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
6540
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
6541
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
6542
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
6540
6543
|
},
|
|
6541
6544
|
};
|
|
6542
6545
|
const NumberFormatTerms = {
|
|
@@ -6850,6 +6853,9 @@ class BarChart extends AbstractChart {
|
|
|
6850
6853
|
.filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
|
|
6851
6854
|
return {
|
|
6852
6855
|
...this.getDefinition(),
|
|
6856
|
+
labelRange: this.labelRange
|
|
6857
|
+
? this.getters.getRangeString(this.labelRange, this.sheetId, true)
|
|
6858
|
+
: undefined,
|
|
6853
6859
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
6854
6860
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
6855
6861
|
dataSets,
|
|
@@ -6942,7 +6948,7 @@ function createBarChartRuntime(chart, getters) {
|
|
|
6942
6948
|
|
|
6943
6949
|
function isDataRangeValid(definition) {
|
|
6944
6950
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
6945
|
-
?
|
|
6951
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
6946
6952
|
: 0 /* CommandResult.Success */;
|
|
6947
6953
|
}
|
|
6948
6954
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -6974,7 +6980,7 @@ function checkInflectionPointsValue(check, batchValidations) {
|
|
|
6974
6980
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
6975
6981
|
if (definition.sectionRule) {
|
|
6976
6982
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
6977
|
-
return
|
|
6983
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
6978
6984
|
}
|
|
6979
6985
|
}
|
|
6980
6986
|
return 0 /* CommandResult.Success */;
|
|
@@ -6983,9 +6989,9 @@ function checkEmpty(value, valueName) {
|
|
|
6983
6989
|
if (value === "") {
|
|
6984
6990
|
switch (valueName) {
|
|
6985
6991
|
case "rangeMin":
|
|
6986
|
-
return
|
|
6992
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
6987
6993
|
case "rangeMax":
|
|
6988
|
-
return
|
|
6994
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
6989
6995
|
}
|
|
6990
6996
|
}
|
|
6991
6997
|
return 0 /* CommandResult.Success */;
|
|
@@ -6994,13 +7000,13 @@ function checkNaN(value, valueName) {
|
|
|
6994
7000
|
if (isNaN(value)) {
|
|
6995
7001
|
switch (valueName) {
|
|
6996
7002
|
case "rangeMin":
|
|
6997
|
-
return
|
|
7003
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
6998
7004
|
case "rangeMax":
|
|
6999
|
-
return
|
|
7005
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
7000
7006
|
case "lowerInflectionPointValue":
|
|
7001
|
-
return
|
|
7007
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
7002
7008
|
case "upperInflectionPointValue":
|
|
7003
|
-
return
|
|
7009
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
7004
7010
|
}
|
|
7005
7011
|
}
|
|
7006
7012
|
return 0 /* CommandResult.Success */;
|
|
@@ -7414,6 +7420,9 @@ class LineChart extends AbstractChart {
|
|
|
7414
7420
|
.filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
|
|
7415
7421
|
return {
|
|
7416
7422
|
...this.getDefinition(),
|
|
7423
|
+
labelRange: this.labelRange
|
|
7424
|
+
? this.getters.getRangeString(this.labelRange, this.sheetId, true)
|
|
7425
|
+
: undefined,
|
|
7417
7426
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
7418
7427
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
7419
7428
|
dataSets,
|
|
@@ -7687,6 +7696,9 @@ class PieChart extends AbstractChart {
|
|
|
7687
7696
|
.filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
|
|
7688
7697
|
return {
|
|
7689
7698
|
...this.getDefinition(),
|
|
7699
|
+
labelRange: this.labelRange
|
|
7700
|
+
? this.getters.getRangeString(this.labelRange, this.sheetId, true)
|
|
7701
|
+
: undefined,
|
|
7690
7702
|
backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
|
|
7691
7703
|
fontColor: toXlsxHexColor(chartFontColor(this.background)),
|
|
7692
7704
|
verticalAxisPosition: "left",
|
|
@@ -7758,12 +7770,12 @@ function createPieChartRuntime(chart, getters) {
|
|
|
7758
7770
|
|
|
7759
7771
|
function checkKeyValue(definition) {
|
|
7760
7772
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
7761
|
-
?
|
|
7773
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
7762
7774
|
: 0 /* CommandResult.Success */;
|
|
7763
7775
|
}
|
|
7764
7776
|
function checkBaseline(definition) {
|
|
7765
7777
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
7766
|
-
?
|
|
7778
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
7767
7779
|
: 0 /* CommandResult.Success */;
|
|
7768
7780
|
}
|
|
7769
7781
|
class ScorecardChart extends AbstractChart {
|
|
@@ -8493,7 +8505,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
8493
8505
|
});
|
|
8494
8506
|
}
|
|
8495
8507
|
}
|
|
8496
|
-
if (result.isCancelledBecause(
|
|
8508
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
8497
8509
|
const { col, row } = anchor;
|
|
8498
8510
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
8499
8511
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -8516,13 +8528,13 @@ const AddFilterInteractiveContent = {
|
|
|
8516
8528
|
};
|
|
8517
8529
|
function interactiveAddFilter(env, sheetId, target) {
|
|
8518
8530
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
8519
|
-
if (result.isCancelledBecause(
|
|
8531
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
8520
8532
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
8521
8533
|
}
|
|
8522
|
-
else if (result.isCancelledBecause(
|
|
8534
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
8523
8535
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
8524
8536
|
}
|
|
8525
|
-
else if (result.isCancelledBecause(
|
|
8537
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
8526
8538
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
8527
8539
|
}
|
|
8528
8540
|
}
|
|
@@ -8544,7 +8556,7 @@ function handlePasteResult(env, result) {
|
|
|
8544
8556
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
8545
8557
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
8546
8558
|
}
|
|
8547
|
-
else if (result.reasons.includes(
|
|
8559
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
8548
8560
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
8549
8561
|
}
|
|
8550
8562
|
}
|
|
@@ -9130,6 +9142,12 @@ const INSERT_LINK = (env) => {
|
|
|
9130
9142
|
let { col, row } = env.model.getters.getActivePosition();
|
|
9131
9143
|
env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
|
|
9132
9144
|
};
|
|
9145
|
+
const INSERT_LINK_NAME = (env) => {
|
|
9146
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
9147
|
+
const { col, row } = env.model.getters.getActivePosition();
|
|
9148
|
+
const cell = env.model.getters.getEvaluatedCell({ sheetId, col, row });
|
|
9149
|
+
return cell && cell.link ? _lt("Edit link") : _lt("Insert link");
|
|
9150
|
+
};
|
|
9133
9151
|
//------------------------------------------------------------------------------
|
|
9134
9152
|
// Filters action
|
|
9135
9153
|
//------------------------------------------------------------------------------
|
|
@@ -9267,7 +9285,7 @@ cellMenuRegistry
|
|
|
9267
9285
|
action: DELETE_CELL_SHIFT_LEFT,
|
|
9268
9286
|
})
|
|
9269
9287
|
.add("insert_link", {
|
|
9270
|
-
name:
|
|
9288
|
+
name: INSERT_LINK_NAME,
|
|
9271
9289
|
separator: true,
|
|
9272
9290
|
sequence: 150,
|
|
9273
9291
|
action: INSERT_LINK,
|
|
@@ -16221,7 +16239,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
16221
16239
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
16222
16240
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
16223
16241
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
16224
|
-
if (result.isCancelledBecause(
|
|
16242
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
16225
16243
|
env.raiseError(MergeErrorMessage);
|
|
16226
16244
|
}
|
|
16227
16245
|
}
|
|
@@ -17017,11 +17035,11 @@ class LineBarPieConfigPanel extends Component {
|
|
|
17017
17035
|
}
|
|
17018
17036
|
get isDatasetInvalid() {
|
|
17019
17037
|
var _a;
|
|
17020
|
-
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17038
|
+
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
|
|
17021
17039
|
}
|
|
17022
17040
|
get isLabelInvalid() {
|
|
17023
17041
|
var _a;
|
|
17024
|
-
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17042
|
+
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
|
|
17025
17043
|
}
|
|
17026
17044
|
onUpdateDataSetsHaveTitle(ev) {
|
|
17027
17045
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -17459,7 +17477,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
17459
17477
|
}
|
|
17460
17478
|
get isDataRangeInvalid() {
|
|
17461
17479
|
var _a;
|
|
17462
|
-
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17480
|
+
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
|
|
17463
17481
|
}
|
|
17464
17482
|
onDataRangeChanged(ranges) {
|
|
17465
17483
|
this.dataRange = ranges[0];
|
|
@@ -17538,28 +17556,28 @@ class GaugeChartDesignPanel extends Component {
|
|
|
17538
17556
|
}
|
|
17539
17557
|
isRangeMinInvalid() {
|
|
17540
17558
|
var _a, _b, _c;
|
|
17541
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17542
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
17543
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
17559
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
|
|
17560
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
|
|
17561
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
17544
17562
|
}
|
|
17545
17563
|
isRangeMaxInvalid() {
|
|
17546
17564
|
var _a, _b, _c;
|
|
17547
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17548
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
17549
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
17565
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
|
|
17566
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
|
|
17567
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
17550
17568
|
}
|
|
17551
17569
|
// ---------------------------------------------------------------------------
|
|
17552
17570
|
// COLOR_SECTION_TEMPLATE
|
|
17553
17571
|
// ---------------------------------------------------------------------------
|
|
17554
17572
|
get isLowerInflectionPointInvalid() {
|
|
17555
17573
|
var _a, _b;
|
|
17556
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17557
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
17574
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
|
|
17575
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
17558
17576
|
}
|
|
17559
17577
|
get isUpperInflectionPointInvalid() {
|
|
17560
17578
|
var _a, _b;
|
|
17561
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17562
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
17579
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
|
|
17580
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
17563
17581
|
}
|
|
17564
17582
|
updateInflectionPointValue(attr, ev) {
|
|
17565
17583
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -17672,11 +17690,11 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
17672
17690
|
}
|
|
17673
17691
|
get isKeyValueInvalid() {
|
|
17674
17692
|
var _a;
|
|
17675
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17693
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
|
|
17676
17694
|
}
|
|
17677
17695
|
get isBaselineInvalid() {
|
|
17678
17696
|
var _a;
|
|
17679
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
17697
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
|
|
17680
17698
|
}
|
|
17681
17699
|
onKeyValueRangeChanged(ranges) {
|
|
17682
17700
|
this.keyValue = ranges[0];
|
|
@@ -18530,11 +18548,11 @@ class ConditionalFormattingPanel extends Component {
|
|
|
18530
18548
|
****************************************************************************/
|
|
18531
18549
|
get isValue1Invalid() {
|
|
18532
18550
|
var _a;
|
|
18533
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
18551
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
|
|
18534
18552
|
}
|
|
18535
18553
|
get isValue2Invalid() {
|
|
18536
18554
|
var _a;
|
|
18537
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
18555
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
|
|
18538
18556
|
}
|
|
18539
18557
|
toggleStyle(tool) {
|
|
18540
18558
|
const style = this.state.rules.cellIs.style;
|
|
@@ -18551,17 +18569,17 @@ class ConditionalFormattingPanel extends Component {
|
|
|
18551
18569
|
isValueInvalid(threshold) {
|
|
18552
18570
|
switch (threshold) {
|
|
18553
18571
|
case "minimum":
|
|
18554
|
-
return (this.state.errors.includes(
|
|
18555
|
-
this.state.errors.includes(
|
|
18556
|
-
this.state.errors.includes(
|
|
18557
|
-
this.state.errors.includes(
|
|
18572
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
18573
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
18574
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
18575
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
18558
18576
|
case "midpoint":
|
|
18559
|
-
return (this.state.errors.includes(
|
|
18560
|
-
this.state.errors.includes(
|
|
18561
|
-
this.state.errors.includes(
|
|
18577
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
18578
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
18579
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
18562
18580
|
case "maximum":
|
|
18563
|
-
return (this.state.errors.includes(
|
|
18564
|
-
this.state.errors.includes(
|
|
18581
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
18582
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
18565
18583
|
default:
|
|
18566
18584
|
return false;
|
|
18567
18585
|
}
|
|
@@ -18610,13 +18628,13 @@ class ConditionalFormattingPanel extends Component {
|
|
|
18610
18628
|
isInflectionPointInvalid(inflectionPoint) {
|
|
18611
18629
|
switch (inflectionPoint) {
|
|
18612
18630
|
case "lowerInflectionPoint":
|
|
18613
|
-
return (this.state.errors.includes(
|
|
18614
|
-
this.state.errors.includes(
|
|
18615
|
-
this.state.errors.includes(
|
|
18631
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
18632
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
18633
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
18616
18634
|
case "upperInflectionPoint":
|
|
18617
|
-
return (this.state.errors.includes(
|
|
18618
|
-
this.state.errors.includes(
|
|
18619
|
-
this.state.errors.includes(
|
|
18635
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
18636
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
18637
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
18620
18638
|
default:
|
|
18621
18639
|
return true;
|
|
18622
18640
|
}
|
|
@@ -19953,14 +19971,13 @@ class Composer extends Component {
|
|
|
19953
19971
|
setup() {
|
|
19954
19972
|
onMounted(() => {
|
|
19955
19973
|
const el = this.composerRef.el;
|
|
19974
|
+
if (this.props.isDefaultFocus) {
|
|
19975
|
+
this.env.focusableElement.setFocusableElement(el);
|
|
19976
|
+
}
|
|
19956
19977
|
this.contentHelper.updateEl(el);
|
|
19957
19978
|
this.processContent();
|
|
19958
19979
|
this.contentHelper.scrollSelectionIntoView();
|
|
19959
19980
|
});
|
|
19960
|
-
onWillUnmount(() => {
|
|
19961
|
-
var _a, _b;
|
|
19962
|
-
(_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
19963
|
-
});
|
|
19964
19981
|
onPatched(() => {
|
|
19965
19982
|
if (!this.isKeyStillDown) {
|
|
19966
19983
|
this.processContent();
|
|
@@ -19971,7 +19988,8 @@ class Composer extends Component {
|
|
|
19971
19988
|
// Handlers
|
|
19972
19989
|
// ---------------------------------------------------------------------------
|
|
19973
19990
|
processArrowKeys(ev) {
|
|
19974
|
-
if (this.env.model.getters.isSelectingForComposer()
|
|
19991
|
+
if (this.env.model.getters.isSelectingForComposer() ||
|
|
19992
|
+
this.env.model.getters.getEditionMode() === "inactive") {
|
|
19975
19993
|
this.functionDescriptionState.showDescription = false;
|
|
19976
19994
|
// Prevent the default content editable behavior which moves the cursor
|
|
19977
19995
|
ev.preventDefault();
|
|
@@ -20012,21 +20030,23 @@ class Composer extends Component {
|
|
|
20012
20030
|
var _a;
|
|
20013
20031
|
ev.preventDefault();
|
|
20014
20032
|
ev.stopPropagation();
|
|
20015
|
-
if (this.
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20033
|
+
if (this.env.model.getters.getEditionMode() !== "inactive") {
|
|
20034
|
+
if (this.autoCompleteState.showProvider) {
|
|
20035
|
+
const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
|
|
20036
|
+
if (autoCompleteValue) {
|
|
20037
|
+
this.autoComplete(autoCompleteValue);
|
|
20038
|
+
return;
|
|
20039
|
+
}
|
|
20020
20040
|
}
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20041
|
+
else {
|
|
20042
|
+
// when completing with tab, if there is no value to complete, the active cell will be moved to the right.
|
|
20043
|
+
// we can't let the model think that it is for a ref selection.
|
|
20044
|
+
// todo: check if this can be removed someday
|
|
20045
|
+
this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
|
|
20046
|
+
}
|
|
20047
|
+
this.env.model.dispatch("STOP_EDITION");
|
|
20027
20048
|
}
|
|
20028
20049
|
const direction = ev.shiftKey ? "left" : "right";
|
|
20029
|
-
this.env.model.dispatch("STOP_EDITION");
|
|
20030
20050
|
this.env.model.selection.moveAnchorCell(direction, 1);
|
|
20031
20051
|
}
|
|
20032
20052
|
processEnterKey(ev) {
|
|
@@ -20071,6 +20091,9 @@ class Composer extends Component {
|
|
|
20071
20091
|
this.compositionActive = false;
|
|
20072
20092
|
}
|
|
20073
20093
|
onKeydown(ev) {
|
|
20094
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
20095
|
+
return;
|
|
20096
|
+
}
|
|
20074
20097
|
let handler = this.keyMapping[ev.key];
|
|
20075
20098
|
if (handler) {
|
|
20076
20099
|
handler.call(this, ev);
|
|
@@ -20081,22 +20104,45 @@ class Composer extends Component {
|
|
|
20081
20104
|
}
|
|
20082
20105
|
}
|
|
20083
20106
|
updateCursorIfNeeded() {
|
|
20084
|
-
|
|
20107
|
+
const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
|
|
20108
|
+
!(this.env.model.getters.getEditionMode() === "inactive");
|
|
20109
|
+
if (moveCursor) {
|
|
20085
20110
|
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
20086
20111
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
20087
20112
|
this.isKeyStillDown = true;
|
|
20088
20113
|
}
|
|
20089
20114
|
}
|
|
20115
|
+
onPaste(ev) {
|
|
20116
|
+
if (this.env.model.getters.getEditionMode() !== "inactive") {
|
|
20117
|
+
ev.stopPropagation();
|
|
20118
|
+
}
|
|
20119
|
+
}
|
|
20090
20120
|
/*
|
|
20091
20121
|
* Triggered automatically by the content-editable between the keydown and key up
|
|
20092
20122
|
* */
|
|
20093
|
-
onInput() {
|
|
20094
|
-
|
|
20123
|
+
onInput(ev) {
|
|
20124
|
+
var _a, _b;
|
|
20125
|
+
if (!this.shouldProcessInputEvents) {
|
|
20095
20126
|
return;
|
|
20096
20127
|
}
|
|
20128
|
+
if (ev.inputType === "insertFromPaste" &&
|
|
20129
|
+
this.env.model.getters.getEditionMode() === "inactive") {
|
|
20130
|
+
return;
|
|
20131
|
+
}
|
|
20132
|
+
ev.stopPropagation();
|
|
20133
|
+
let content;
|
|
20134
|
+
if (this.env.model.getters.getEditionMode() === "inactive") {
|
|
20135
|
+
content = ev.data || "";
|
|
20136
|
+
}
|
|
20137
|
+
else {
|
|
20138
|
+
content = this.contentHelper.getText();
|
|
20139
|
+
}
|
|
20140
|
+
if (this.props.focus === "inactive") {
|
|
20141
|
+
return (_b = (_a = this.props).onComposerCellFocused) === null || _b === void 0 ? void 0 : _b.call(_a, content);
|
|
20142
|
+
}
|
|
20097
20143
|
this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
|
|
20098
20144
|
this.env.model.dispatch("SET_CURRENT_CONTENT", {
|
|
20099
|
-
content
|
|
20145
|
+
content,
|
|
20100
20146
|
selection: this.contentHelper.getCurrentSelection(),
|
|
20101
20147
|
});
|
|
20102
20148
|
}
|
|
@@ -20167,9 +20213,8 @@ class Composer extends Component {
|
|
|
20167
20213
|
}
|
|
20168
20214
|
const newSelection = this.contentHelper.getCurrentSelection();
|
|
20169
20215
|
this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
}
|
|
20216
|
+
this.props.onComposerContentFocused();
|
|
20217
|
+
if (this.props.focus === "inactive") ;
|
|
20173
20218
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
|
|
20174
20219
|
this.processTokenAtCursor();
|
|
20175
20220
|
}
|
|
@@ -20393,14 +20438,16 @@ Composer.template = "o-spreadsheet-Composer";
|
|
|
20393
20438
|
Composer.components = { TextValueProvider, FunctionDescriptionProvider };
|
|
20394
20439
|
Composer.defaultProps = {
|
|
20395
20440
|
inputStyle: "",
|
|
20441
|
+
isDefaultFocus: false,
|
|
20396
20442
|
};
|
|
20397
20443
|
Composer.props = {
|
|
20398
|
-
focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
|
|
20399
|
-
onComposerContentFocused: Function,
|
|
20400
20444
|
inputStyle: { type: String, optional: true },
|
|
20401
20445
|
rect: { type: Object, optional: true },
|
|
20402
20446
|
delimitation: { type: Object, optional: true },
|
|
20403
|
-
|
|
20447
|
+
focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
|
|
20448
|
+
onComposerCellFocused: { type: Function, optional: true },
|
|
20449
|
+
onComposerContentFocused: Function,
|
|
20450
|
+
isDefaultFocus: { type: Boolean, optional: true },
|
|
20404
20451
|
};
|
|
20405
20452
|
|
|
20406
20453
|
const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
|
|
@@ -20432,46 +20479,28 @@ css /* scss */ `
|
|
|
20432
20479
|
* It also applies the style of the cell to the composer input.
|
|
20433
20480
|
*/
|
|
20434
20481
|
class GridComposer extends Component {
|
|
20482
|
+
constructor() {
|
|
20483
|
+
super(...arguments);
|
|
20484
|
+
// TODORAR see if we can keep it undefined
|
|
20485
|
+
this.rect = this.defaultRect;
|
|
20486
|
+
this.isEditing = false;
|
|
20487
|
+
}
|
|
20488
|
+
get defaultRect() {
|
|
20489
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
20490
|
+
}
|
|
20435
20491
|
setup() {
|
|
20436
|
-
this.gridComposerRef = useRef("gridComposer");
|
|
20437
|
-
this.composerState = useState({
|
|
20438
|
-
rect: undefined,
|
|
20439
|
-
delimitation: undefined,
|
|
20440
|
-
});
|
|
20441
|
-
const { sheetId, col, row } = this.env.model.getters.getActivePosition();
|
|
20442
|
-
this.zone = this.env.model.getters.expandZone(sheetId, positionToZone({ col, row }));
|
|
20443
|
-
this.rect = this.env.model.getters.getVisibleRect(this.zone);
|
|
20444
|
-
this.isCellReferenceVisible = false;
|
|
20445
|
-
onMounted(() => {
|
|
20446
|
-
const el = this.gridComposerRef.el;
|
|
20447
|
-
this.composerState.rect = {
|
|
20448
|
-
x: this.rect.x,
|
|
20449
|
-
y: this.rect.y,
|
|
20450
|
-
width: el.clientWidth,
|
|
20451
|
-
height: el.clientHeight,
|
|
20452
|
-
};
|
|
20453
|
-
this.composerState.delimitation = {
|
|
20454
|
-
width: el.parentElement.clientWidth,
|
|
20455
|
-
height: el.parentElement.clientHeight,
|
|
20456
|
-
};
|
|
20457
|
-
});
|
|
20458
20492
|
onWillUpdateProps(() => {
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
}
|
|
20462
|
-
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
20463
|
-
const zone = this.env.model.getters.getSelectedZone();
|
|
20464
|
-
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
20465
|
-
if (!deepEquals(rect, this.rect) ||
|
|
20466
|
-
sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
|
|
20467
|
-
this.isCellReferenceVisible = true;
|
|
20468
|
-
}
|
|
20493
|
+
this.updateComponentPosition();
|
|
20494
|
+
this.updateCellReferenceVisibility();
|
|
20469
20495
|
});
|
|
20470
20496
|
}
|
|
20471
20497
|
get shouldDisplayCellReference() {
|
|
20472
20498
|
return this.isCellReferenceVisible;
|
|
20473
20499
|
}
|
|
20474
20500
|
get cellReference() {
|
|
20501
|
+
if (!this.env.model.getters.getCurrentEditedCell()) {
|
|
20502
|
+
return "";
|
|
20503
|
+
}
|
|
20475
20504
|
const { col, row, sheetId } = this.env.model.getters.getCurrentEditedCell();
|
|
20476
20505
|
const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
|
|
20477
20506
|
return `${prefixSheet ? getComposerSheetName(this.env.model.getters.getSheetName(sheetId)) + "!" : ""}${toXC(col, row)}`;
|
|
@@ -20483,7 +20512,27 @@ class GridComposer extends Component {
|
|
|
20483
20512
|
top: `${top - GRID_CELL_REFERENCE_TOP_OFFSET}px`,
|
|
20484
20513
|
});
|
|
20485
20514
|
}
|
|
20515
|
+
get composerProps() {
|
|
20516
|
+
const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
|
|
20517
|
+
return {
|
|
20518
|
+
rect: { ...this.rect },
|
|
20519
|
+
delimitation: {
|
|
20520
|
+
width,
|
|
20521
|
+
height,
|
|
20522
|
+
},
|
|
20523
|
+
focus: this.props.focus,
|
|
20524
|
+
isDefaultFocus: true,
|
|
20525
|
+
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
20526
|
+
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
20527
|
+
};
|
|
20528
|
+
}
|
|
20486
20529
|
get containerStyle() {
|
|
20530
|
+
if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
|
|
20531
|
+
return `
|
|
20532
|
+
position: absolute;
|
|
20533
|
+
z-index: -1000;
|
|
20534
|
+
`;
|
|
20535
|
+
}
|
|
20487
20536
|
const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
|
|
20488
20537
|
const cell = this.env.model.getters.getActiveCell();
|
|
20489
20538
|
const position = this.env.model.getters.getActivePosition();
|
|
@@ -20503,6 +20552,8 @@ class GridComposer extends Component {
|
|
|
20503
20552
|
if (!isFormula) {
|
|
20504
20553
|
textAlign = style.align || cell.defaultAlign;
|
|
20505
20554
|
}
|
|
20555
|
+
const maxHeight = this.props.gridDims.height - this.rect.y;
|
|
20556
|
+
const maxWidth = this.props.gridDims.width - this.rect.x;
|
|
20506
20557
|
/**
|
|
20507
20558
|
* min-size is on the container, not the composer element, because we want to have the same size as the cell by default,
|
|
20508
20559
|
* including all the paddings/margins of the composer
|
|
@@ -20514,6 +20565,8 @@ class GridComposer extends Component {
|
|
|
20514
20565
|
top: `${top}px`,
|
|
20515
20566
|
"min-width": `${width + 1}px`,
|
|
20516
20567
|
"min-height": `${height + 1}px`,
|
|
20568
|
+
"max-width": `${maxWidth}px`,
|
|
20569
|
+
"max-height": `${maxHeight}px`,
|
|
20517
20570
|
background,
|
|
20518
20571
|
color,
|
|
20519
20572
|
"font-size": `${fontSizeInPixels(fontSize)}px`,
|
|
@@ -20523,22 +20576,40 @@ class GridComposer extends Component {
|
|
|
20523
20576
|
"text-align": textAlign,
|
|
20524
20577
|
});
|
|
20525
20578
|
}
|
|
20526
|
-
|
|
20527
|
-
const
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20579
|
+
updateComponentPosition() {
|
|
20580
|
+
const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
|
|
20581
|
+
if (this.isEditing !== isEditing) {
|
|
20582
|
+
this.isEditing = isEditing;
|
|
20583
|
+
if (!isEditing) {
|
|
20584
|
+
this.rect = this.defaultRect;
|
|
20585
|
+
this.env.focusableElement.focus();
|
|
20586
|
+
return;
|
|
20587
|
+
}
|
|
20588
|
+
const position = this.env.model.getters.getActivePosition();
|
|
20589
|
+
const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
|
|
20590
|
+
this.rect = this.env.model.getters.getVisibleRect(zone);
|
|
20591
|
+
}
|
|
20592
|
+
}
|
|
20593
|
+
updateCellReferenceVisibility() {
|
|
20594
|
+
if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
|
|
20595
|
+
return;
|
|
20596
|
+
}
|
|
20597
|
+
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
20598
|
+
const zone = this.env.model.getters.getSelectedZone();
|
|
20599
|
+
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
20600
|
+
if (!deepEquals(rect, this.rect) ||
|
|
20601
|
+
sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
|
|
20602
|
+
this.isCellReferenceVisible = true;
|
|
20603
|
+
}
|
|
20533
20604
|
}
|
|
20534
20605
|
}
|
|
20535
20606
|
GridComposer.template = "o-spreadsheet-GridComposer";
|
|
20536
20607
|
GridComposer.components = { Composer };
|
|
20537
20608
|
GridComposer.props = {
|
|
20538
20609
|
focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
|
|
20539
|
-
onComposerUnmounted: Function,
|
|
20540
20610
|
onComposerContentFocused: Function,
|
|
20541
20611
|
gridDims: Object,
|
|
20612
|
+
onComposerCellFocused: Function,
|
|
20542
20613
|
};
|
|
20543
20614
|
|
|
20544
20615
|
const CSS$1 = css /* scss */ `
|
|
@@ -21129,7 +21200,6 @@ class GridOverlay extends Component {
|
|
|
21129
21200
|
this.props.onCellDoubleClicked(col, row);
|
|
21130
21201
|
}
|
|
21131
21202
|
onContextMenu(ev) {
|
|
21132
|
-
ev.preventDefault();
|
|
21133
21203
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
21134
21204
|
this.props.onCellRightClicked(col, row, { x: ev.clientX, y: ev.clientY });
|
|
21135
21205
|
}
|
|
@@ -22356,17 +22426,16 @@ class Grid extends Component {
|
|
|
22356
22426
|
menuItems: [],
|
|
22357
22427
|
});
|
|
22358
22428
|
this.gridRef = useRef("grid");
|
|
22359
|
-
this.hiddenInput = useRef("hiddenInput");
|
|
22360
22429
|
this.canvasPosition = useAbsoluteBoundingRect(this.gridRef);
|
|
22361
22430
|
this.hoveredCell = useState({ col: undefined, row: undefined });
|
|
22362
22431
|
useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
|
|
22363
22432
|
useExternalListener(document.body, "cut", this.copy.bind(this, true));
|
|
22364
22433
|
useExternalListener(document.body, "copy", this.copy.bind(this, false));
|
|
22365
22434
|
useExternalListener(document.body, "paste", this.paste);
|
|
22366
|
-
onMounted(() => this.
|
|
22367
|
-
this.props.exposeFocus(() => this.
|
|
22435
|
+
onMounted(() => this.focusDefaultElement());
|
|
22436
|
+
this.props.exposeFocus(() => this.focusDefaultElement());
|
|
22368
22437
|
useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
|
|
22369
|
-
useEffect(() => this.
|
|
22438
|
+
useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
|
|
22370
22439
|
this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
|
|
22371
22440
|
this.moveCanvas(deltaX, deltaY);
|
|
22372
22441
|
this.hoveredCell.col = undefined;
|
|
@@ -22389,13 +22458,12 @@ class Grid extends Component {
|
|
|
22389
22458
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
22390
22459
|
this.closeOpenedPopover();
|
|
22391
22460
|
}
|
|
22392
|
-
this.
|
|
22461
|
+
this.focusDefaultElement();
|
|
22393
22462
|
}
|
|
22394
|
-
|
|
22395
|
-
var _a;
|
|
22463
|
+
focusDefaultElement() {
|
|
22396
22464
|
if (!this.env.model.getters.getSelectedFigureId() &&
|
|
22397
22465
|
this.env.model.getters.getEditionMode() === "inactive") {
|
|
22398
|
-
|
|
22466
|
+
this.env.focusableElement.focus();
|
|
22399
22467
|
}
|
|
22400
22468
|
}
|
|
22401
22469
|
get gridEl() {
|
|
@@ -22540,19 +22608,6 @@ class Grid extends Component {
|
|
|
22540
22608
|
return;
|
|
22541
22609
|
}
|
|
22542
22610
|
}
|
|
22543
|
-
onInput(ev) {
|
|
22544
|
-
// the user meant to paste in the sheet, not open the composer with the pasted content
|
|
22545
|
-
if (!ev.isComposing && ev.inputType === "insertFromPaste") {
|
|
22546
|
-
return;
|
|
22547
|
-
}
|
|
22548
|
-
if (ev.data) {
|
|
22549
|
-
// if the user types a character on the grid, it means he wants to start composing the selected cell with that
|
|
22550
|
-
// character
|
|
22551
|
-
ev.preventDefault();
|
|
22552
|
-
ev.stopPropagation();
|
|
22553
|
-
this.props.onGridComposerCellFocused(ev.data);
|
|
22554
|
-
}
|
|
22555
|
-
}
|
|
22556
22611
|
// ---------------------------------------------------------------------------
|
|
22557
22612
|
// Context Menu
|
|
22558
22613
|
// ---------------------------------------------------------------------------
|
|
@@ -22649,7 +22704,7 @@ class Grid extends Component {
|
|
|
22649
22704
|
}
|
|
22650
22705
|
closeMenu() {
|
|
22651
22706
|
this.menuState.isOpen = false;
|
|
22652
|
-
this.
|
|
22707
|
+
this.focusDefaultElement();
|
|
22653
22708
|
}
|
|
22654
22709
|
}
|
|
22655
22710
|
Grid.template = "o-spreadsheet-Grid";
|
|
@@ -27001,7 +27056,7 @@ function normalizeV9(formula) {
|
|
|
27001
27056
|
* a breaking change is made in the way the state is handled, and an upgrade
|
|
27002
27057
|
* function should be defined
|
|
27003
27058
|
*/
|
|
27004
|
-
const CURRENT_VERSION = 12;
|
|
27059
|
+
const CURRENT_VERSION = 12.5;
|
|
27005
27060
|
const INITIAL_SHEET_ID = "Sheet1";
|
|
27006
27061
|
/**
|
|
27007
27062
|
* This function tries to load anything that could look like a valid
|
|
@@ -27267,6 +27322,31 @@ const MIGRATIONS = [
|
|
|
27267
27322
|
return data;
|
|
27268
27323
|
},
|
|
27269
27324
|
},
|
|
27325
|
+
{
|
|
27326
|
+
description: "Fix datafilter duplication",
|
|
27327
|
+
from: 12,
|
|
27328
|
+
to: 12.5,
|
|
27329
|
+
applyMigration(data) {
|
|
27330
|
+
for (let sheet of data.sheets || []) {
|
|
27331
|
+
let knownDataFilterZones = [];
|
|
27332
|
+
for (let filterTable of sheet.filterTables || []) {
|
|
27333
|
+
const zone = toZone(filterTable.range);
|
|
27334
|
+
// See commit message for the details
|
|
27335
|
+
const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
|
|
27336
|
+
if (intersectZoneIndex !== -1) {
|
|
27337
|
+
knownDataFilterZones[intersectZoneIndex] = zone;
|
|
27338
|
+
}
|
|
27339
|
+
else {
|
|
27340
|
+
knownDataFilterZones.push(zone);
|
|
27341
|
+
}
|
|
27342
|
+
}
|
|
27343
|
+
sheet.filterTables = knownDataFilterZones.map((zone) => ({
|
|
27344
|
+
range: zoneToXc(zone),
|
|
27345
|
+
}));
|
|
27346
|
+
}
|
|
27347
|
+
return data;
|
|
27348
|
+
},
|
|
27349
|
+
},
|
|
27270
27350
|
];
|
|
27271
27351
|
/**
|
|
27272
27352
|
* This function is used to repair faulty data independently of the migration.
|
|
@@ -28013,7 +28093,7 @@ class BordersPlugin extends CorePlugin {
|
|
|
28013
28093
|
const currentBorder = this.getCellBorder(cmd);
|
|
28014
28094
|
const areAllNewBordersUndefined = !((_a = cmd.border) === null || _a === void 0 ? void 0 : _a.bottom) && !((_b = cmd.border) === null || _b === void 0 ? void 0 : _b.left) && !((_c = cmd.border) === null || _c === void 0 ? void 0 : _c.right) && !((_d = cmd.border) === null || _d === void 0 ? void 0 : _d.top);
|
|
28015
28095
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
28016
|
-
return
|
|
28096
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28017
28097
|
}
|
|
28018
28098
|
return 0 /* CommandResult.Success */;
|
|
28019
28099
|
}
|
|
@@ -28287,13 +28367,13 @@ class CellPlugin extends CorePlugin {
|
|
|
28287
28367
|
/*
|
|
28288
28368
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
28289
28369
|
*/
|
|
28290
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
28370
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
28291
28371
|
const ranges = dependencies || cell.dependencies;
|
|
28292
28372
|
let rangeIndex = 0;
|
|
28293
28373
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
28294
28374
|
if (token.type === "REFERENCE") {
|
|
28295
28375
|
const range = ranges[rangeIndex++];
|
|
28296
|
-
return this.getters.getRangeString(range, sheetId);
|
|
28376
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
28297
28377
|
}
|
|
28298
28378
|
return token.value;
|
|
28299
28379
|
}));
|
|
@@ -28531,9 +28611,9 @@ class CellPlugin extends CorePlugin {
|
|
|
28531
28611
|
checkUselessClearCell(cmd) {
|
|
28532
28612
|
const cell = this.getters.getCell(cmd);
|
|
28533
28613
|
if (!cell)
|
|
28534
|
-
return
|
|
28614
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28535
28615
|
if (!cell.content && !cell.style && !cell.format) {
|
|
28536
|
-
return
|
|
28616
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28537
28617
|
}
|
|
28538
28618
|
return 0 /* CommandResult.Success */;
|
|
28539
28619
|
}
|
|
@@ -28742,13 +28822,13 @@ class ChartPlugin extends CorePlugin {
|
|
|
28742
28822
|
}
|
|
28743
28823
|
checkChartDuplicate(cmd) {
|
|
28744
28824
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28745
|
-
?
|
|
28825
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
28746
28826
|
: 0 /* CommandResult.Success */;
|
|
28747
28827
|
}
|
|
28748
28828
|
checkChartExists(cmd) {
|
|
28749
28829
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28750
28830
|
? 0 /* CommandResult.Success */
|
|
28751
|
-
:
|
|
28831
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
28752
28832
|
}
|
|
28753
28833
|
}
|
|
28754
28834
|
ChartPlugin.getters = [
|
|
@@ -28863,7 +28943,13 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28863
28943
|
}
|
|
28864
28944
|
}
|
|
28865
28945
|
exportForExcel(data) {
|
|
28866
|
-
|
|
28946
|
+
if (data.sheets) {
|
|
28947
|
+
for (let sheet of data.sheets) {
|
|
28948
|
+
if (this.cfRules[sheet.id]) {
|
|
28949
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
28950
|
+
}
|
|
28951
|
+
}
|
|
28952
|
+
}
|
|
28867
28953
|
}
|
|
28868
28954
|
// ---------------------------------------------------------------------------
|
|
28869
28955
|
// Getters
|
|
@@ -28913,11 +28999,11 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28913
28999
|
// ---------------------------------------------------------------------------
|
|
28914
29000
|
// Private
|
|
28915
29001
|
// ---------------------------------------------------------------------------
|
|
28916
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
29002
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
28917
29003
|
return {
|
|
28918
29004
|
...cf,
|
|
28919
29005
|
ranges: cf.ranges.map((range) => {
|
|
28920
|
-
return this.getters.getRangeString(range, sheetId);
|
|
29006
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
28921
29007
|
}),
|
|
28922
29008
|
};
|
|
28923
29009
|
}
|
|
@@ -28950,10 +29036,10 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28950
29036
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
28951
29037
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
28952
29038
|
if (ruleIndex === -1)
|
|
28953
|
-
return
|
|
29039
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28954
29040
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
28955
29041
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
28956
|
-
return
|
|
29042
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28957
29043
|
}
|
|
28958
29044
|
return 0 /* CommandResult.Success */;
|
|
28959
29045
|
}
|
|
@@ -28994,10 +29080,10 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28994
29080
|
const errors = [];
|
|
28995
29081
|
const isEmpty = (value) => value === undefined || value === "";
|
|
28996
29082
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
28997
|
-
errors.push(
|
|
29083
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
28998
29084
|
}
|
|
28999
29085
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
29000
|
-
errors.push(
|
|
29086
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
29001
29087
|
}
|
|
29002
29088
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
29003
29089
|
}
|
|
@@ -29009,15 +29095,15 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29009
29095
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
29010
29096
|
switch (thresholdName) {
|
|
29011
29097
|
case "min":
|
|
29012
|
-
return
|
|
29098
|
+
return 54 /* CommandResult.MinNaN */;
|
|
29013
29099
|
case "max":
|
|
29014
|
-
return
|
|
29100
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
29015
29101
|
case "mid":
|
|
29016
|
-
return
|
|
29102
|
+
return 55 /* CommandResult.MidNaN */;
|
|
29017
29103
|
case "upperInflectionPoint":
|
|
29018
|
-
return
|
|
29104
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
29019
29105
|
case "lowerInflectionPoint":
|
|
29020
|
-
return
|
|
29106
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
29021
29107
|
}
|
|
29022
29108
|
}
|
|
29023
29109
|
return 0 /* CommandResult.Success */;
|
|
@@ -29031,15 +29117,15 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29031
29117
|
catch (error) {
|
|
29032
29118
|
switch (thresholdName) {
|
|
29033
29119
|
case "min":
|
|
29034
|
-
return
|
|
29120
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
29035
29121
|
case "max":
|
|
29036
|
-
return
|
|
29122
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
29037
29123
|
case "mid":
|
|
29038
|
-
return
|
|
29124
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
29039
29125
|
case "upperInflectionPoint":
|
|
29040
|
-
return
|
|
29126
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
29041
29127
|
case "lowerInflectionPoint":
|
|
29042
|
-
return
|
|
29128
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
29043
29129
|
}
|
|
29044
29130
|
}
|
|
29045
29131
|
return 0 /* CommandResult.Success */;
|
|
@@ -29056,7 +29142,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29056
29142
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
29057
29143
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
29058
29144
|
Number(minValue) > Number(maxValue)) {
|
|
29059
|
-
return
|
|
29145
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
29060
29146
|
}
|
|
29061
29147
|
return 0 /* CommandResult.Success */;
|
|
29062
29148
|
}
|
|
@@ -29066,7 +29152,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29066
29152
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
29067
29153
|
rule.minimum.type === rule.maximum.type &&
|
|
29068
29154
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
29069
|
-
return
|
|
29155
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
29070
29156
|
}
|
|
29071
29157
|
return 0 /* CommandResult.Success */;
|
|
29072
29158
|
}
|
|
@@ -29078,7 +29164,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29078
29164
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
29079
29165
|
rule.midpoint.type === rule.maximum.type &&
|
|
29080
29166
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
29081
|
-
return
|
|
29167
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
29082
29168
|
}
|
|
29083
29169
|
return 0 /* CommandResult.Success */;
|
|
29084
29170
|
}
|
|
@@ -29090,7 +29176,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
29090
29176
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
29091
29177
|
rule.minimum.type === rule.midpoint.type &&
|
|
29092
29178
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
29093
|
-
return
|
|
29179
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
29094
29180
|
}
|
|
29095
29181
|
return 0 /* CommandResult.Success */;
|
|
29096
29182
|
}
|
|
@@ -29191,13 +29277,13 @@ class FigurePlugin extends CorePlugin {
|
|
|
29191
29277
|
checkFigureExists(sheetId, figureId) {
|
|
29192
29278
|
var _a;
|
|
29193
29279
|
if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
|
|
29194
|
-
return
|
|
29280
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
29195
29281
|
}
|
|
29196
29282
|
return 0 /* CommandResult.Success */;
|
|
29197
29283
|
}
|
|
29198
29284
|
checkFigureDuplicate(figureId) {
|
|
29199
29285
|
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
29200
|
-
return
|
|
29286
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
29201
29287
|
}
|
|
29202
29288
|
return 0 /* CommandResult.Success */;
|
|
29203
29289
|
}
|
|
@@ -29299,12 +29385,12 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29299
29385
|
switch (cmd.type) {
|
|
29300
29386
|
case "CREATE_FILTER_TABLE":
|
|
29301
29387
|
if (!areZonesContinuous(...cmd.target)) {
|
|
29302
|
-
return
|
|
29388
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
29303
29389
|
}
|
|
29304
29390
|
const zone = union(...cmd.target);
|
|
29305
29391
|
const checkFilterOverlap = () => {
|
|
29306
29392
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
29307
|
-
return
|
|
29393
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
29308
29394
|
}
|
|
29309
29395
|
return 0 /* CommandResult.Success */;
|
|
29310
29396
|
};
|
|
@@ -29312,7 +29398,7 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29312
29398
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
29313
29399
|
for (let merge of mergesInTarget) {
|
|
29314
29400
|
if (overlap(zone, merge)) {
|
|
29315
|
-
return
|
|
29401
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29316
29402
|
}
|
|
29317
29403
|
}
|
|
29318
29404
|
return 0 /* CommandResult.Success */;
|
|
@@ -29322,7 +29408,7 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29322
29408
|
for (let merge of cmd.target) {
|
|
29323
29409
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
29324
29410
|
if (overlap(filterTable.zone, merge)) {
|
|
29325
|
-
return
|
|
29411
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29326
29412
|
}
|
|
29327
29413
|
}
|
|
29328
29414
|
}
|
|
@@ -29822,10 +29908,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29822
29908
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
29823
29909
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
29824
29910
|
if (hiddenElements.size >= elements) {
|
|
29825
|
-
return
|
|
29911
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
29826
29912
|
}
|
|
29827
29913
|
else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
29828
|
-
return
|
|
29914
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
29829
29915
|
}
|
|
29830
29916
|
else {
|
|
29831
29917
|
return 0 /* CommandResult.Success */;
|
|
@@ -30369,7 +30455,7 @@ class MergePlugin extends CorePlugin {
|
|
|
30369
30455
|
for (const zone of target) {
|
|
30370
30456
|
for (const zone2 of target) {
|
|
30371
30457
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
30372
|
-
return
|
|
30458
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30373
30459
|
}
|
|
30374
30460
|
}
|
|
30375
30461
|
}
|
|
@@ -30383,7 +30469,7 @@ class MergePlugin extends CorePlugin {
|
|
|
30383
30469
|
for (const zone of target) {
|
|
30384
30470
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
30385
30471
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
30386
|
-
return
|
|
30472
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
30387
30473
|
}
|
|
30388
30474
|
}
|
|
30389
30475
|
return 0 /* CommandResult.Success */;
|
|
@@ -30846,8 +30932,9 @@ class RangeAdapter {
|
|
|
30846
30932
|
*
|
|
30847
30933
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
30848
30934
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
30935
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
30849
30936
|
*/
|
|
30850
|
-
getRangeString(range, forSheetId) {
|
|
30937
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
30851
30938
|
if (!range) {
|
|
30852
30939
|
return INCORRECT_RANGE_STRING;
|
|
30853
30940
|
}
|
|
@@ -30874,7 +30961,7 @@ class RangeAdapter {
|
|
|
30874
30961
|
if (prefixSheet && !sheetName) {
|
|
30875
30962
|
return INCORRECT_RANGE_STRING;
|
|
30876
30963
|
}
|
|
30877
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
30964
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
30878
30965
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
30879
30966
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
30880
30967
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -30884,7 +30971,7 @@ class RangeAdapter {
|
|
|
30884
30971
|
rangeImpl.parts[1].rowFixed ||
|
|
30885
30972
|
rangeImpl.parts[1].colFixed) {
|
|
30886
30973
|
rangeString += ":";
|
|
30887
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
30974
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
30888
30975
|
}
|
|
30889
30976
|
}
|
|
30890
30977
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -30914,13 +31001,14 @@ class RangeAdapter {
|
|
|
30914
31001
|
/**
|
|
30915
31002
|
* Get a Xc string that represent a part of a range
|
|
30916
31003
|
*/
|
|
30917
|
-
getRangePartString(range, part) {
|
|
30918
|
-
|
|
31004
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
31005
|
+
var _a, _b;
|
|
31006
|
+
const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
|
|
30919
31007
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
30920
|
-
const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
|
|
31008
|
+
const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
|
|
30921
31009
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
30922
31010
|
let str = "";
|
|
30923
|
-
if (range.isFullCol) {
|
|
31011
|
+
if (range.isFullCol && !useFixedZone) {
|
|
30924
31012
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
30925
31013
|
str = colFixed + col + rowFixed + row;
|
|
30926
31014
|
}
|
|
@@ -30928,7 +31016,7 @@ class RangeAdapter {
|
|
|
30928
31016
|
str = colFixed + col;
|
|
30929
31017
|
}
|
|
30930
31018
|
}
|
|
30931
|
-
else if (range.isFullRow) {
|
|
31019
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
30932
31020
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
30933
31021
|
str = colFixed + col + rowFixed + row;
|
|
30934
31022
|
}
|
|
@@ -31007,10 +31095,10 @@ class SheetPlugin extends CorePlugin {
|
|
|
31007
31095
|
? this.getNumberCols(cmd.sheetId)
|
|
31008
31096
|
: this.getNumberRows(cmd.sheetId);
|
|
31009
31097
|
if (cmd.base < 0 || cmd.base >= elements) {
|
|
31010
|
-
return
|
|
31098
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31011
31099
|
}
|
|
31012
31100
|
else if (cmd.quantity <= 0) {
|
|
31013
|
-
return
|
|
31101
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
31014
31102
|
}
|
|
31015
31103
|
return 0 /* CommandResult.Success */;
|
|
31016
31104
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -31018,7 +31106,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
31018
31106
|
? this.getNumberCols(cmd.sheetId)
|
|
31019
31107
|
: this.getNumberRows(cmd.sheetId);
|
|
31020
31108
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
31021
|
-
return
|
|
31109
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31022
31110
|
}
|
|
31023
31111
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
31024
31112
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -31458,18 +31546,18 @@ class SheetPlugin extends CorePlugin {
|
|
|
31458
31546
|
checkRowFreezeQuantity(cmd) {
|
|
31459
31547
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
31460
31548
|
? 0 /* CommandResult.Success */
|
|
31461
|
-
:
|
|
31549
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
31462
31550
|
}
|
|
31463
31551
|
checkColFreezeQuantity(cmd) {
|
|
31464
31552
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
31465
31553
|
? 0 /* CommandResult.Success */
|
|
31466
|
-
:
|
|
31554
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
31467
31555
|
}
|
|
31468
31556
|
checkRowFreezeOverlapMerge(cmd) {
|
|
31469
31557
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
31470
31558
|
for (let merge of merges) {
|
|
31471
31559
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
31472
|
-
return
|
|
31560
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31473
31561
|
}
|
|
31474
31562
|
}
|
|
31475
31563
|
return 0 /* CommandResult.Success */;
|
|
@@ -31478,7 +31566,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
31478
31566
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
31479
31567
|
for (let merge of merges) {
|
|
31480
31568
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
31481
|
-
return
|
|
31569
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31482
31570
|
}
|
|
31483
31571
|
}
|
|
31484
31572
|
return 0 /* CommandResult.Success */;
|
|
@@ -32242,10 +32330,8 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
32242
32330
|
* that are actually present in the grid.
|
|
32243
32331
|
*/
|
|
32244
32332
|
function range(range) {
|
|
32333
|
+
assertRangeValid(range);
|
|
32245
32334
|
const sheetId = range.sheetId;
|
|
32246
|
-
if (!isZoneValid(range.zone)) {
|
|
32247
|
-
throw new InvalidReferenceError();
|
|
32248
|
-
}
|
|
32249
32335
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
32250
32336
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
32251
32337
|
const sheetZone = getters.getSheetZone(sheetId);
|
|
@@ -32280,23 +32366,26 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
32280
32366
|
* The `compute` of the formula's function must process it completely
|
|
32281
32367
|
*/
|
|
32282
32368
|
function refFn(range, isMeta, functionName, paramNumber) {
|
|
32369
|
+
assertRangeValid(range);
|
|
32283
32370
|
if (isMeta) {
|
|
32284
32371
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
32285
32372
|
return { value: zoneToXc(range.zone) };
|
|
32286
32373
|
}
|
|
32287
|
-
if (!isZoneValid(range.zone)) {
|
|
32288
|
-
throw new InvalidReferenceError();
|
|
32289
|
-
}
|
|
32290
32374
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
32291
32375
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
32292
32376
|
throw new Error(paramNumber
|
|
32293
32377
|
? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
32294
32378
|
: _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
32295
32379
|
}
|
|
32380
|
+
return readCell(range);
|
|
32381
|
+
}
|
|
32382
|
+
function assertRangeValid(range) {
|
|
32383
|
+
if (!isZoneValid(range.zone)) {
|
|
32384
|
+
throw new InvalidReferenceError();
|
|
32385
|
+
}
|
|
32296
32386
|
if (range.invalidSheetName) {
|
|
32297
32387
|
throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
|
|
32298
32388
|
}
|
|
32299
|
-
return readCell(range);
|
|
32300
32389
|
}
|
|
32301
32390
|
return [refFn, range, evalContext];
|
|
32302
32391
|
}
|
|
@@ -32316,6 +32405,10 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
32316
32405
|
if (cell.format !== evaluatedCell.format) {
|
|
32317
32406
|
exportedCellData.computedFormat = evaluatedCell.format;
|
|
32318
32407
|
}
|
|
32408
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
32409
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
32410
|
+
exportedCellData.content = this.getters.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
|
|
32411
|
+
}
|
|
32319
32412
|
}
|
|
32320
32413
|
}
|
|
32321
32414
|
}
|
|
@@ -32796,7 +32889,7 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
32796
32889
|
switch (cmd.type) {
|
|
32797
32890
|
case "UPDATE_FILTER":
|
|
32798
32891
|
if (!this.getters.getFilterId(cmd)) {
|
|
32799
|
-
return
|
|
32892
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
32800
32893
|
}
|
|
32801
32894
|
break;
|
|
32802
32895
|
}
|
|
@@ -33743,7 +33836,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
33743
33836
|
}
|
|
33744
33837
|
checkPositiveDimension(cmd) {
|
|
33745
33838
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
33746
|
-
return
|
|
33839
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
33747
33840
|
}
|
|
33748
33841
|
return 0 /* CommandResult.Success */;
|
|
33749
33842
|
}
|
|
@@ -33753,7 +33846,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
33753
33846
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
33754
33847
|
cmd.width === width &&
|
|
33755
33848
|
cmd.height === height) {
|
|
33756
|
-
return
|
|
33849
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
33757
33850
|
}
|
|
33758
33851
|
return 0 /* CommandResult.Success */;
|
|
33759
33852
|
}
|
|
@@ -33761,7 +33854,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
33761
33854
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
33762
33855
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
33763
33856
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
33764
|
-
return
|
|
33857
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
33765
33858
|
}
|
|
33766
33859
|
return 0 /* CommandResult.Success */;
|
|
33767
33860
|
}
|
|
@@ -34017,7 +34110,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
34017
34110
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
34018
34111
|
return 0 /* CommandResult.Success */;
|
|
34019
34112
|
}
|
|
34020
|
-
return
|
|
34113
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
34021
34114
|
case "AUTOFILL_AUTO":
|
|
34022
34115
|
const zone = this.getters.getSelectedZone();
|
|
34023
34116
|
return zone.top === zone.bottom
|
|
@@ -34619,7 +34712,7 @@ class CellPopoverPlugin extends UIPlugin {
|
|
|
34619
34712
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
34620
34713
|
}
|
|
34621
34714
|
catch (error) {
|
|
34622
|
-
return
|
|
34715
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
34623
34716
|
}
|
|
34624
34717
|
return 0 /* CommandResult.Success */;
|
|
34625
34718
|
default:
|
|
@@ -35822,21 +35915,6 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
35822
35915
|
// ---------------------------------------------------------------------------
|
|
35823
35916
|
// Command Handling
|
|
35824
35917
|
// ---------------------------------------------------------------------------
|
|
35825
|
-
allowDispatch(cmd) {
|
|
35826
|
-
switch (cmd.type) {
|
|
35827
|
-
case "ADD_EMPTY_RANGE":
|
|
35828
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
35829
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35830
|
-
}
|
|
35831
|
-
break;
|
|
35832
|
-
case "CHANGE_RANGE":
|
|
35833
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
35834
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35835
|
-
}
|
|
35836
|
-
break;
|
|
35837
|
-
}
|
|
35838
|
-
return 0 /* CommandResult.Success */;
|
|
35839
|
-
}
|
|
35840
35918
|
handleEvent(event) {
|
|
35841
35919
|
const xc = zoneToXc(event.anchor.zone);
|
|
35842
35920
|
const inputSheetId = this.activeSheet;
|
|
@@ -36047,6 +36125,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
36047
36125
|
// ---------------------------------------------------------------------------
|
|
36048
36126
|
allowDispatch(cmd) {
|
|
36049
36127
|
var _a, _b;
|
|
36128
|
+
switch (cmd.type) {
|
|
36129
|
+
case "FOCUS_RANGE":
|
|
36130
|
+
case "CHANGE_RANGE":
|
|
36131
|
+
case "ADD_EMPTY_RANGE":
|
|
36132
|
+
case "REMOVE_RANGE":
|
|
36133
|
+
if (!this.inputs[cmd.id]) {
|
|
36134
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
36135
|
+
}
|
|
36136
|
+
}
|
|
36050
36137
|
switch (cmd.type) {
|
|
36051
36138
|
case "FOCUS_RANGE":
|
|
36052
36139
|
const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
|
|
@@ -36054,9 +36141,19 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
36054
36141
|
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
36055
36142
|
}
|
|
36056
36143
|
break;
|
|
36057
|
-
|
|
36058
|
-
|
|
36059
|
-
|
|
36144
|
+
case "ADD_EMPTY_RANGE":
|
|
36145
|
+
const input = this.inputs[cmd.id];
|
|
36146
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
36147
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36148
|
+
}
|
|
36149
|
+
break;
|
|
36150
|
+
case "CHANGE_RANGE": {
|
|
36151
|
+
const input = this.inputs[cmd.id];
|
|
36152
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
36153
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36154
|
+
}
|
|
36155
|
+
break;
|
|
36156
|
+
}
|
|
36060
36157
|
}
|
|
36061
36158
|
return 0 /* CommandResult.Success */;
|
|
36062
36159
|
}
|
|
@@ -37036,7 +37133,7 @@ class SortPlugin extends UIPlugin {
|
|
|
37036
37133
|
/*Test the presence of single cells*/
|
|
37037
37134
|
const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
|
|
37038
37135
|
if (singleCells) {
|
|
37039
|
-
return
|
|
37136
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37040
37137
|
}
|
|
37041
37138
|
return 0 /* CommandResult.Success */;
|
|
37042
37139
|
}
|
|
@@ -37055,7 +37152,7 @@ class SortPlugin extends UIPlugin {
|
|
|
37055
37152
|
];
|
|
37056
37153
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
37057
37154
|
})) {
|
|
37058
|
-
return
|
|
37155
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37059
37156
|
}
|
|
37060
37157
|
return 0 /* CommandResult.Success */;
|
|
37061
37158
|
}
|
|
@@ -37695,7 +37792,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
37695
37792
|
for (const zone of this.getPasteZones(target)) {
|
|
37696
37793
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
37697
37794
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
37698
|
-
return
|
|
37795
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
37699
37796
|
}
|
|
37700
37797
|
}
|
|
37701
37798
|
return 0 /* CommandResult.Success */;
|
|
@@ -38083,7 +38180,7 @@ class ClipboardFigureState {
|
|
|
38083
38180
|
}
|
|
38084
38181
|
isPasteAllowed(target, option) {
|
|
38085
38182
|
if (target.length === 0) {
|
|
38086
|
-
return
|
|
38183
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
38087
38184
|
}
|
|
38088
38185
|
if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
|
|
38089
38186
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -38800,7 +38897,7 @@ class EditionPlugin extends UIPlugin {
|
|
|
38800
38897
|
validateSelection(length, start, end) {
|
|
38801
38898
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
38802
38899
|
? 0 /* CommandResult.Success */
|
|
38803
|
-
:
|
|
38900
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
38804
38901
|
}
|
|
38805
38902
|
onColumnsRemoved(cmd) {
|
|
38806
38903
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -39112,9 +39209,10 @@ class EditionPlugin extends UIPlugin {
|
|
|
39112
39209
|
*/
|
|
39113
39210
|
getReferencedRanges() {
|
|
39114
39211
|
const editionSheetId = this.getters.getEditionSheet();
|
|
39115
|
-
|
|
39212
|
+
const referenceRanges = this.currentTokens
|
|
39116
39213
|
.filter((token) => token.type === "REFERENCE")
|
|
39117
39214
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
39215
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
39118
39216
|
}
|
|
39119
39217
|
/**
|
|
39120
39218
|
* Function used to determine when composer selection can start.
|
|
@@ -39717,7 +39815,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
39717
39815
|
const headers = [cmd.base, ...cmd.elements];
|
|
39718
39816
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
39719
39817
|
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
39720
|
-
return
|
|
39818
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
39721
39819
|
}
|
|
39722
39820
|
return 0 /* CommandResult.Success */;
|
|
39723
39821
|
}
|
|
@@ -39902,6 +40000,19 @@ class ImageProvider {
|
|
|
39902
40000
|
}
|
|
39903
40001
|
}
|
|
39904
40002
|
|
|
40003
|
+
class FocusableElement {
|
|
40004
|
+
constructor() {
|
|
40005
|
+
this.focusableElement = undefined;
|
|
40006
|
+
}
|
|
40007
|
+
setFocusableElement(element) {
|
|
40008
|
+
this.focusableElement = element;
|
|
40009
|
+
}
|
|
40010
|
+
focus() {
|
|
40011
|
+
var _a;
|
|
40012
|
+
(_a = this.focusableElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
40013
|
+
}
|
|
40014
|
+
}
|
|
40015
|
+
|
|
39905
40016
|
const RIPPLE_KEY_FRAMES = [
|
|
39906
40017
|
{ transform: "scale(0)" },
|
|
39907
40018
|
{ transform: "scale(0.8)", offset: 0.33 },
|
|
@@ -41092,7 +41203,7 @@ const AddMergeInteractiveContent = {
|
|
|
41092
41203
|
};
|
|
41093
41204
|
function interactiveAddMerge(env, sheetId, target) {
|
|
41094
41205
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
41095
|
-
if (result.isCancelledBecause(
|
|
41206
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
41096
41207
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
41097
41208
|
}
|
|
41098
41209
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -41877,6 +41988,7 @@ class Spreadsheet extends Component {
|
|
|
41877
41988
|
_t: Spreadsheet._t,
|
|
41878
41989
|
clipboard: this.env.clipboard || instantiateClipboard(),
|
|
41879
41990
|
startCellEdition: (content) => this.onGridComposerCellFocused(content),
|
|
41991
|
+
focusableElement: new FocusableElement(),
|
|
41880
41992
|
});
|
|
41881
41993
|
useExternalListener(window, "resize", () => this.render(true));
|
|
41882
41994
|
useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
|
|
@@ -41975,17 +42087,18 @@ class Spreadsheet extends Component {
|
|
|
41975
42087
|
this.model.dispatch("UNFOCUS_SELECTION_INPUT");
|
|
41976
42088
|
this.composer.topBarFocus = "contentFocus";
|
|
41977
42089
|
this.composer.gridFocusMode = "inactive";
|
|
41978
|
-
this.setComposerContent({ selection }
|
|
42090
|
+
this.setComposerContent({ selection });
|
|
41979
42091
|
}
|
|
41980
|
-
onGridComposerContentFocused() {
|
|
42092
|
+
onGridComposerContentFocused(selection) {
|
|
41981
42093
|
if (this.model.getters.isReadonly()) {
|
|
41982
42094
|
return;
|
|
41983
42095
|
}
|
|
41984
42096
|
this.model.dispatch("UNFOCUS_SELECTION_INPUT");
|
|
41985
42097
|
this.composer.topBarFocus = "inactive";
|
|
41986
42098
|
this.composer.gridFocusMode = "contentFocus";
|
|
41987
|
-
this.setComposerContent({});
|
|
42099
|
+
this.setComposerContent({ selection });
|
|
41988
42100
|
}
|
|
42101
|
+
// TODO: either both are defined or none of them. change those args to an object
|
|
41989
42102
|
onGridComposerCellFocused(content, selection) {
|
|
41990
42103
|
if (this.model.getters.isReadonly()) {
|
|
41991
42104
|
return;
|
|
@@ -43086,7 +43199,7 @@ class SelectionStreamProcessorImpl {
|
|
|
43086
43199
|
*/
|
|
43087
43200
|
moveAnchorCell(direction, step = 1) {
|
|
43088
43201
|
if (step !== "end" && step <= 0) {
|
|
43089
|
-
return new DispatchResult(
|
|
43202
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
43090
43203
|
}
|
|
43091
43204
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
43092
43205
|
return this.selectCell(col, row);
|
|
@@ -43132,7 +43245,7 @@ class SelectionStreamProcessorImpl {
|
|
|
43132
43245
|
*/
|
|
43133
43246
|
resizeAnchorZone(direction, step = 1) {
|
|
43134
43247
|
if (step !== "end" && step <= 0) {
|
|
43135
|
-
return new DispatchResult(
|
|
43248
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
43136
43249
|
}
|
|
43137
43250
|
const sheetId = this.getters.getActiveSheetId();
|
|
43138
43251
|
const anchor = this.anchor;
|
|
@@ -43961,12 +44074,7 @@ function addFormula(cell) {
|
|
|
43961
44074
|
attrs.push(["t", "str"]);
|
|
43962
44075
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
43963
44076
|
}
|
|
43964
|
-
node = escapeXml /*xml*/
|
|
43965
|
-
<f>
|
|
43966
|
-
${XlsxFormula}
|
|
43967
|
-
</f>
|
|
43968
|
-
${cycle}
|
|
43969
|
-
`;
|
|
44077
|
+
node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
|
|
43970
44078
|
return { attrs, node };
|
|
43971
44079
|
}
|
|
43972
44080
|
else {
|
|
@@ -44762,11 +44870,10 @@ function addRows(construct, data, sheet) {
|
|
|
44762
44870
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
44763
44871
|
}
|
|
44764
44872
|
attributes.push(...additionalAttrs);
|
|
44765
|
-
|
|
44766
|
-
|
|
44767
|
-
|
|
44768
|
-
|
|
44769
|
-
`);
|
|
44873
|
+
// prettier-ignore
|
|
44874
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
44875
|
+
${cellNode}
|
|
44876
|
+
</c>`);
|
|
44770
44877
|
}
|
|
44771
44878
|
}
|
|
44772
44879
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -45170,10 +45277,10 @@ class Model extends EventBus {
|
|
|
45170
45277
|
const command = { ...payload, type };
|
|
45171
45278
|
let status = this.status;
|
|
45172
45279
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
45173
|
-
return new DispatchResult(
|
|
45280
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
45174
45281
|
}
|
|
45175
45282
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
45176
|
-
return new DispatchResult(
|
|
45283
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
45177
45284
|
}
|
|
45178
45285
|
switch (status) {
|
|
45179
45286
|
case 0 /* Status.Ready */:
|
|
@@ -45632,6 +45739,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
45632
45739
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
45633
45740
|
|
|
45634
45741
|
|
|
45635
|
-
__info__.version = '16.2.
|
|
45636
|
-
__info__.date = '2024-
|
|
45637
|
-
__info__.hash = '
|
|
45742
|
+
__info__.version = '16.2.31';
|
|
45743
|
+
__info__.date = '2024-02-09T13:05:40.161Z';
|
|
45744
|
+
__info__.hash = '2e76bdf';
|