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