@odoo/o-spreadsheet 16.0.60 → 16.0.63
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 +372 -271
- package/dist/o-spreadsheet.d.ts +80 -69
- package/dist/o-spreadsheet.esm.js +372 -271
- package/dist/o-spreadsheet.iife.js +372 -271
- package/dist/o-spreadsheet.iife.min.js +237 -237
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +3 -1
|
@@ -1098,9 +1098,16 @@ function deepEquals(o1, o2) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
return true;
|
|
1100
1100
|
}
|
|
1101
|
-
/**
|
|
1101
|
+
/**
|
|
1102
|
+
* Check if the given array contains all the values of the other array.
|
|
1103
|
+
* It makes the assumption that both array do not contain duplicates.
|
|
1104
|
+
*/
|
|
1102
1105
|
function includesAll(arr, values) {
|
|
1103
|
-
|
|
1106
|
+
if (arr.length < values.length) {
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
const set = new Set(arr);
|
|
1110
|
+
return values.every((value) => set.has(value));
|
|
1104
1111
|
}
|
|
1105
1112
|
/**
|
|
1106
1113
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
@@ -2375,15 +2382,48 @@ class UuidGenerator {
|
|
|
2375
2382
|
setIsFastStrategy(isFast) {
|
|
2376
2383
|
this.isFastIdStrategy = isFast;
|
|
2377
2384
|
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Generates a custom UUID using a simple 26^8 method (8-character alphanumeric string with lowercase letters)
|
|
2387
|
+
* This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
|
|
2388
|
+
* it also has a smaller size, which is preferable to alleviate the overall data size.
|
|
2389
|
+
*
|
|
2390
|
+
* This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
|
|
2391
|
+
* as they will appear several times in the revisions and local history.
|
|
2392
|
+
*
|
|
2393
|
+
*/
|
|
2394
|
+
smallUuid() {
|
|
2395
|
+
if (this.isFastIdStrategy) {
|
|
2396
|
+
this.fastIdStart++;
|
|
2397
|
+
return String(this.fastIdStart);
|
|
2398
|
+
}
|
|
2399
|
+
else if (window.crypto) {
|
|
2400
|
+
return "10000000-1000".replace(/[01]/g, (c) => {
|
|
2401
|
+
const n = Number(c);
|
|
2402
|
+
return (n ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (n / 4)))).toString(16);
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
else {
|
|
2406
|
+
// mainly for jest and other browsers that do not have the crypto functionality
|
|
2407
|
+
return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
|
|
2408
|
+
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
2409
|
+
return v.toString(16);
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
|
|
2415
|
+
* This method should be used when you need to avoid collisions at all costs, like the id of a revision.
|
|
2416
|
+
*/
|
|
2378
2417
|
uuidv4() {
|
|
2379
2418
|
if (this.isFastIdStrategy) {
|
|
2380
2419
|
this.fastIdStart++;
|
|
2381
2420
|
return String(this.fastIdStart);
|
|
2382
|
-
//@ts-ignore
|
|
2383
2421
|
}
|
|
2384
|
-
else if (window.crypto
|
|
2385
|
-
|
|
2386
|
-
|
|
2422
|
+
else if (window.crypto) {
|
|
2423
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => {
|
|
2424
|
+
const n = Number(c);
|
|
2425
|
+
return (n ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (n / 4)))).toString(16);
|
|
2426
|
+
});
|
|
2387
2427
|
}
|
|
2388
2428
|
else {
|
|
2389
2429
|
// mainly for jest and other browsers that do not have the crypto functionality
|
|
@@ -2488,17 +2528,20 @@ function toZoneWithoutBoundaryChanges(xc) {
|
|
|
2488
2528
|
*/
|
|
2489
2529
|
function toUnboundedZone(xc) {
|
|
2490
2530
|
const zone = toZoneWithoutBoundaryChanges(xc);
|
|
2531
|
+
reorderZone(zone);
|
|
2532
|
+
return zone;
|
|
2533
|
+
}
|
|
2534
|
+
function reorderZone(zone) {
|
|
2491
2535
|
if (zone.right !== undefined && zone.right < zone.left) {
|
|
2492
|
-
const
|
|
2536
|
+
const right = zone.left;
|
|
2493
2537
|
zone.left = zone.right;
|
|
2494
|
-
zone.right =
|
|
2538
|
+
zone.right = right;
|
|
2495
2539
|
}
|
|
2496
2540
|
if (zone.bottom !== undefined && zone.bottom < zone.top) {
|
|
2497
|
-
const
|
|
2541
|
+
const bottom = zone.top;
|
|
2498
2542
|
zone.top = zone.bottom;
|
|
2499
|
-
zone.bottom =
|
|
2543
|
+
zone.bottom = bottom;
|
|
2500
2544
|
}
|
|
2501
|
-
return zone;
|
|
2502
2545
|
}
|
|
2503
2546
|
/**
|
|
2504
2547
|
* Convert from a cartesian reference to a Zone.
|
|
@@ -3386,67 +3429,68 @@ var CommandResult;
|
|
|
3386
3429
|
CommandResult[CommandResult["InvalidRange"] = 25] = "InvalidRange";
|
|
3387
3430
|
CommandResult[CommandResult["InvalidZones"] = 26] = "InvalidZones";
|
|
3388
3431
|
CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
|
|
3389
|
-
CommandResult[CommandResult["
|
|
3390
|
-
CommandResult[CommandResult["
|
|
3391
|
-
CommandResult[CommandResult["
|
|
3392
|
-
CommandResult[CommandResult["
|
|
3393
|
-
CommandResult[CommandResult["
|
|
3394
|
-
CommandResult[CommandResult["
|
|
3395
|
-
CommandResult[CommandResult["
|
|
3396
|
-
CommandResult[CommandResult["
|
|
3397
|
-
CommandResult[CommandResult["
|
|
3398
|
-
CommandResult[CommandResult["
|
|
3399
|
-
CommandResult[CommandResult["
|
|
3400
|
-
CommandResult[CommandResult["
|
|
3401
|
-
CommandResult[CommandResult["
|
|
3402
|
-
CommandResult[CommandResult["
|
|
3403
|
-
CommandResult[CommandResult["
|
|
3404
|
-
CommandResult[CommandResult["
|
|
3405
|
-
CommandResult[CommandResult["
|
|
3406
|
-
CommandResult[CommandResult["
|
|
3407
|
-
CommandResult[CommandResult["
|
|
3408
|
-
CommandResult[CommandResult["
|
|
3409
|
-
CommandResult[CommandResult["
|
|
3410
|
-
CommandResult[CommandResult["
|
|
3411
|
-
CommandResult[CommandResult["
|
|
3412
|
-
CommandResult[CommandResult["
|
|
3413
|
-
CommandResult[CommandResult["
|
|
3414
|
-
CommandResult[CommandResult["
|
|
3415
|
-
CommandResult[CommandResult["
|
|
3416
|
-
CommandResult[CommandResult["
|
|
3417
|
-
CommandResult[CommandResult["
|
|
3418
|
-
CommandResult[CommandResult["
|
|
3419
|
-
CommandResult[CommandResult["
|
|
3420
|
-
CommandResult[CommandResult["
|
|
3421
|
-
CommandResult[CommandResult["
|
|
3422
|
-
CommandResult[CommandResult["
|
|
3423
|
-
CommandResult[CommandResult["
|
|
3424
|
-
CommandResult[CommandResult["
|
|
3425
|
-
CommandResult[CommandResult["
|
|
3426
|
-
CommandResult[CommandResult["
|
|
3427
|
-
CommandResult[CommandResult["
|
|
3428
|
-
CommandResult[CommandResult["
|
|
3429
|
-
CommandResult[CommandResult["
|
|
3430
|
-
CommandResult[CommandResult["
|
|
3431
|
-
CommandResult[CommandResult["
|
|
3432
|
-
CommandResult[CommandResult["
|
|
3433
|
-
CommandResult[CommandResult["
|
|
3434
|
-
CommandResult[CommandResult["
|
|
3435
|
-
CommandResult[CommandResult["
|
|
3436
|
-
CommandResult[CommandResult["
|
|
3437
|
-
CommandResult[CommandResult["
|
|
3438
|
-
CommandResult[CommandResult["
|
|
3439
|
-
CommandResult[CommandResult["
|
|
3440
|
-
CommandResult[CommandResult["
|
|
3441
|
-
CommandResult[CommandResult["
|
|
3442
|
-
CommandResult[CommandResult["
|
|
3443
|
-
CommandResult[CommandResult["
|
|
3444
|
-
CommandResult[CommandResult["
|
|
3445
|
-
CommandResult[CommandResult["
|
|
3446
|
-
CommandResult[CommandResult["
|
|
3447
|
-
CommandResult[CommandResult["
|
|
3448
|
-
CommandResult[CommandResult["
|
|
3449
|
-
CommandResult[CommandResult["
|
|
3432
|
+
CommandResult[CommandResult["InvalidCellId"] = 28] = "InvalidCellId";
|
|
3433
|
+
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
3434
|
+
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
3435
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
3436
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
3437
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
3438
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
3439
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
3440
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
3441
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
3442
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
3443
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
3444
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
3445
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
3446
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
3447
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
3448
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
3449
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
3450
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
3451
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
3452
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
3453
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
3454
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
3455
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
3456
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
3457
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
3458
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
3459
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
3460
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
3461
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
3462
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
3463
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
3464
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
3465
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
3466
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
3467
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
3468
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
3469
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
3470
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
3471
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
3472
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
3473
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
3474
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
3475
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
3476
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
3477
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
3478
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
3479
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
3480
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
3481
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
3482
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
3483
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
3484
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
3485
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
3486
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
3487
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
3488
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
3489
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
3490
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
3491
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
3492
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
3493
|
+
CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
|
|
3450
3494
|
})(CommandResult || (CommandResult = {}));
|
|
3451
3495
|
|
|
3452
3496
|
function isMatrix(x) {
|
|
@@ -4976,7 +5020,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
4976
5020
|
});
|
|
4977
5021
|
}
|
|
4978
5022
|
}
|
|
4979
|
-
if (result.isCancelledBecause(
|
|
5023
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
4980
5024
|
const { col, row } = anchor;
|
|
4981
5025
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
4982
5026
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -4999,13 +5043,13 @@ const AddFilterInteractiveContent = {
|
|
|
4999
5043
|
};
|
|
5000
5044
|
function interactiveAddFilter(env, sheetId, target) {
|
|
5001
5045
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
5002
|
-
if (result.isCancelledBecause(
|
|
5046
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
5003
5047
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
5004
5048
|
}
|
|
5005
|
-
else if (result.isCancelledBecause(
|
|
5049
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
5006
5050
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
5007
5051
|
}
|
|
5008
|
-
else if (result.isCancelledBecause(
|
|
5052
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
5009
5053
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
5010
5054
|
}
|
|
5011
5055
|
}
|
|
@@ -5027,7 +5071,7 @@ function handlePasteResult(env, result) {
|
|
|
5027
5071
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
5028
5072
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
5029
5073
|
}
|
|
5030
|
-
else if (result.reasons.includes(
|
|
5074
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
5031
5075
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
5032
5076
|
}
|
|
5033
5077
|
}
|
|
@@ -5532,7 +5576,7 @@ const UNHIDE_ROWS_ACTION = (env) => {
|
|
|
5532
5576
|
const CREATE_SHEET_ACTION = (env) => {
|
|
5533
5577
|
const activeSheetId = env.model.getters.getActiveSheetId();
|
|
5534
5578
|
const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
|
|
5535
|
-
const sheetId = env.model.uuidGenerator.
|
|
5579
|
+
const sheetId = env.model.uuidGenerator.smallUuid();
|
|
5536
5580
|
env.model.dispatch("CREATE_SHEET", { sheetId, position });
|
|
5537
5581
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
5538
5582
|
};
|
|
@@ -5543,7 +5587,7 @@ const CREATE_CHART = (env) => {
|
|
|
5543
5587
|
const getters = env.model.getters;
|
|
5544
5588
|
const zone = getters.getSelectedZone();
|
|
5545
5589
|
let dataSetZone = zone;
|
|
5546
|
-
const id = env.model.uuidGenerator.
|
|
5590
|
+
const id = env.model.uuidGenerator.smallUuid();
|
|
5547
5591
|
let labelRange;
|
|
5548
5592
|
if (zone.left !== zone.right) {
|
|
5549
5593
|
dataSetZone = { ...zone, left: zone.left + 1 };
|
|
@@ -6019,7 +6063,7 @@ sheetMenuRegistry
|
|
|
6019
6063
|
name: _lt("Delete"),
|
|
6020
6064
|
sequence: 10,
|
|
6021
6065
|
isVisible: (env) => {
|
|
6022
|
-
return env.model.getters.
|
|
6066
|
+
return env.model.getters.getVisibleSheetIds().length > 1;
|
|
6023
6067
|
},
|
|
6024
6068
|
action: (env) => env.askConfirmation(_lt("Are you sure you want to delete this sheet ?"), () => {
|
|
6025
6069
|
env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
|
|
@@ -6030,7 +6074,7 @@ sheetMenuRegistry
|
|
|
6030
6074
|
sequence: 20,
|
|
6031
6075
|
action: (env) => {
|
|
6032
6076
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
6033
|
-
const sheetIdTo = env.model.uuidGenerator.
|
|
6077
|
+
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
6034
6078
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
6035
6079
|
sheetId: sheetIdFrom,
|
|
6036
6080
|
sheetIdTo,
|
|
@@ -6078,22 +6122,22 @@ sheetMenuRegistry
|
|
|
6078
6122
|
const CfTerms = {
|
|
6079
6123
|
Errors: {
|
|
6080
6124
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
6081
|
-
[
|
|
6082
|
-
[
|
|
6083
|
-
[
|
|
6084
|
-
[
|
|
6085
|
-
[
|
|
6086
|
-
[
|
|
6087
|
-
[
|
|
6088
|
-
[
|
|
6089
|
-
[
|
|
6090
|
-
[
|
|
6091
|
-
[
|
|
6092
|
-
[
|
|
6093
|
-
[
|
|
6094
|
-
[
|
|
6095
|
-
[
|
|
6096
|
-
[
|
|
6125
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
6126
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
6127
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
6128
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
6129
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
6130
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
6131
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
6132
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
6133
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
6134
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
6135
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
6136
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
6137
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
6138
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
6139
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
6140
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
6097
6141
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
6098
6142
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
6099
6143
|
},
|
|
@@ -6121,20 +6165,20 @@ const ChartTerms = {
|
|
|
6121
6165
|
Errors: {
|
|
6122
6166
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
6123
6167
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
6124
|
-
[
|
|
6125
|
-
[
|
|
6168
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
6169
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
6126
6170
|
// SCORECARD CHART ERRORS
|
|
6127
|
-
[
|
|
6128
|
-
[
|
|
6171
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
6172
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
6129
6173
|
// GAUGE CHART ERRORS
|
|
6130
|
-
[
|
|
6131
|
-
[
|
|
6132
|
-
[
|
|
6133
|
-
[
|
|
6134
|
-
[
|
|
6135
|
-
[
|
|
6136
|
-
[
|
|
6137
|
-
[
|
|
6174
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
6175
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
6176
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
6177
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
6178
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
6179
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
6180
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
6181
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
6138
6182
|
},
|
|
6139
6183
|
};
|
|
6140
6184
|
const NumberFormatTerms = {
|
|
@@ -6158,7 +6202,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
6158
6202
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
6159
6203
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
6160
6204
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
6161
|
-
if (result.isCancelledBecause(
|
|
6205
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
6162
6206
|
env.raiseError(MergeErrorMessage);
|
|
6163
6207
|
}
|
|
6164
6208
|
}
|
|
@@ -6669,7 +6713,7 @@ css /* scss */ `
|
|
|
6669
6713
|
class SelectionInput extends Component {
|
|
6670
6714
|
constructor() {
|
|
6671
6715
|
super(...arguments);
|
|
6672
|
-
this.id = uuidGenerator$1.
|
|
6716
|
+
this.id = uuidGenerator$1.smallUuid();
|
|
6673
6717
|
this.previousRanges = this.props.ranges || [];
|
|
6674
6718
|
this.originSheet = this.env.model.getters.getActiveSheetId();
|
|
6675
6719
|
this.state = useState({
|
|
@@ -6804,11 +6848,11 @@ class LineBarPieConfigPanel extends Component {
|
|
|
6804
6848
|
}
|
|
6805
6849
|
get isDatasetInvalid() {
|
|
6806
6850
|
var _a;
|
|
6807
|
-
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
6851
|
+
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
|
|
6808
6852
|
}
|
|
6809
6853
|
get isLabelInvalid() {
|
|
6810
6854
|
var _a;
|
|
6811
|
-
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
6855
|
+
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
|
|
6812
6856
|
}
|
|
6813
6857
|
onUpdateDataSetsHaveTitle(ev) {
|
|
6814
6858
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -7152,11 +7196,11 @@ function checkDataset(definition) {
|
|
|
7152
7196
|
if (definition.dataSets) {
|
|
7153
7197
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
7154
7198
|
if (invalidRanges) {
|
|
7155
|
-
return
|
|
7199
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
7156
7200
|
}
|
|
7157
7201
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
7158
7202
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
7159
|
-
return
|
|
7203
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
7160
7204
|
}
|
|
7161
7205
|
}
|
|
7162
7206
|
return 0 /* CommandResult.Success */;
|
|
@@ -7165,7 +7209,7 @@ function checkLabelRange(definition) {
|
|
|
7165
7209
|
if (definition.labelRange) {
|
|
7166
7210
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
7167
7211
|
if (invalidLabels) {
|
|
7168
|
-
return
|
|
7212
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
7169
7213
|
}
|
|
7170
7214
|
}
|
|
7171
7215
|
return 0 /* CommandResult.Success */;
|
|
@@ -7626,7 +7670,7 @@ chartRegistry.add("gauge", {
|
|
|
7626
7670
|
});
|
|
7627
7671
|
function isDataRangeValid(definition) {
|
|
7628
7672
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
7629
|
-
?
|
|
7673
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
7630
7674
|
: 0 /* CommandResult.Success */;
|
|
7631
7675
|
}
|
|
7632
7676
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -7658,7 +7702,7 @@ function checkInflectionPointsValue(check, batchValidations) {
|
|
|
7658
7702
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7659
7703
|
if (definition.sectionRule) {
|
|
7660
7704
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
7661
|
-
return
|
|
7705
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
7662
7706
|
}
|
|
7663
7707
|
}
|
|
7664
7708
|
return 0 /* CommandResult.Success */;
|
|
@@ -7667,9 +7711,9 @@ function checkEmpty(value, valueName) {
|
|
|
7667
7711
|
if (value === "") {
|
|
7668
7712
|
switch (valueName) {
|
|
7669
7713
|
case "rangeMin":
|
|
7670
|
-
return
|
|
7714
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
7671
7715
|
case "rangeMax":
|
|
7672
|
-
return
|
|
7716
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
7673
7717
|
}
|
|
7674
7718
|
}
|
|
7675
7719
|
return 0 /* CommandResult.Success */;
|
|
@@ -7678,13 +7722,13 @@ function checkNaN(value, valueName) {
|
|
|
7678
7722
|
if (isNaN(value)) {
|
|
7679
7723
|
switch (valueName) {
|
|
7680
7724
|
case "rangeMin":
|
|
7681
|
-
return
|
|
7725
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
7682
7726
|
case "rangeMax":
|
|
7683
|
-
return
|
|
7727
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
7684
7728
|
case "lowerInflectionPointValue":
|
|
7685
|
-
return
|
|
7729
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
7686
7730
|
case "upperInflectionPointValue":
|
|
7687
|
-
return
|
|
7731
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
7688
7732
|
}
|
|
7689
7733
|
}
|
|
7690
7734
|
return 0 /* CommandResult.Success */;
|
|
@@ -8425,7 +8469,7 @@ function createPieChartRuntime(chart, getters) {
|
|
|
8425
8469
|
const dataset = {
|
|
8426
8470
|
label,
|
|
8427
8471
|
data,
|
|
8428
|
-
borderColor: "#FFFFFF",
|
|
8472
|
+
borderColor: chart.background || "#FFFFFF",
|
|
8429
8473
|
backgroundColor,
|
|
8430
8474
|
};
|
|
8431
8475
|
config.data.datasets.push(dataset);
|
|
@@ -8444,12 +8488,12 @@ chartRegistry.add("scorecard", {
|
|
|
8444
8488
|
});
|
|
8445
8489
|
function checkKeyValue(definition) {
|
|
8446
8490
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
8447
|
-
?
|
|
8491
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
8448
8492
|
: 0 /* CommandResult.Success */;
|
|
8449
8493
|
}
|
|
8450
8494
|
function checkBaseline(definition) {
|
|
8451
8495
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
8452
|
-
?
|
|
8496
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
8453
8497
|
: 0 /* CommandResult.Success */;
|
|
8454
8498
|
}
|
|
8455
8499
|
class ScorecardChart$1 extends AbstractChart {
|
|
@@ -8878,7 +8922,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
8878
8922
|
}
|
|
8879
8923
|
get isDataRangeInvalid() {
|
|
8880
8924
|
var _a;
|
|
8881
|
-
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8925
|
+
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
|
|
8882
8926
|
}
|
|
8883
8927
|
onDataRangeChanged(ranges) {
|
|
8884
8928
|
this.dataRange = ranges[0];
|
|
@@ -8965,28 +9009,28 @@ class GaugeChartDesignPanel extends Component {
|
|
|
8965
9009
|
}
|
|
8966
9010
|
isRangeMinInvalid() {
|
|
8967
9011
|
var _a, _b, _c;
|
|
8968
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8969
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
8970
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
9012
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
|
|
9013
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
|
|
9014
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
8971
9015
|
}
|
|
8972
9016
|
isRangeMaxInvalid() {
|
|
8973
9017
|
var _a, _b, _c;
|
|
8974
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8975
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
8976
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
9018
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
|
|
9019
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
|
|
9020
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
8977
9021
|
}
|
|
8978
9022
|
// ---------------------------------------------------------------------------
|
|
8979
9023
|
// COLOR_SECTION_TEMPLATE
|
|
8980
9024
|
// ---------------------------------------------------------------------------
|
|
8981
9025
|
get isLowerInflectionPointInvalid() {
|
|
8982
9026
|
var _a, _b;
|
|
8983
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8984
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
9027
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
|
|
9028
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
8985
9029
|
}
|
|
8986
9030
|
get isUpperInflectionPointInvalid() {
|
|
8987
9031
|
var _a, _b;
|
|
8988
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8989
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
9032
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
|
|
9033
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
8990
9034
|
}
|
|
8991
9035
|
updateInflectionPointValue(attr, ev) {
|
|
8992
9036
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -9089,11 +9133,11 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
9089
9133
|
}
|
|
9090
9134
|
get isKeyValueInvalid() {
|
|
9091
9135
|
var _a;
|
|
9092
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
9136
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
|
|
9093
9137
|
}
|
|
9094
9138
|
get isBaselineInvalid() {
|
|
9095
9139
|
var _a;
|
|
9096
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
9140
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
|
|
9097
9141
|
}
|
|
9098
9142
|
onKeyValueRangeChanged(ranges) {
|
|
9099
9143
|
this.keyValue = ranges[0];
|
|
@@ -9786,7 +9830,7 @@ class ConditionalFormattingPanel extends Component {
|
|
|
9786
9830
|
rule: this.getEditorRule(),
|
|
9787
9831
|
id: this.state.mode === "edit"
|
|
9788
9832
|
? this.state.currentCF.id
|
|
9789
|
-
: this.env.model.uuidGenerator.
|
|
9833
|
+
: this.env.model.uuidGenerator.smallUuid(),
|
|
9790
9834
|
},
|
|
9791
9835
|
ranges: this.state.currentCF.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
|
|
9792
9836
|
sheetId,
|
|
@@ -9854,7 +9898,7 @@ class ConditionalFormattingPanel extends Component {
|
|
|
9854
9898
|
this.state.mode = "add";
|
|
9855
9899
|
this.state.currentCFType = "CellIsRule";
|
|
9856
9900
|
this.state.currentCF = {
|
|
9857
|
-
id: this.env.model.uuidGenerator.
|
|
9901
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
9858
9902
|
ranges: this.env.model.getters
|
|
9859
9903
|
.getSelectedZones()
|
|
9860
9904
|
.map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
|
|
@@ -9933,11 +9977,11 @@ class ConditionalFormattingPanel extends Component {
|
|
|
9933
9977
|
****************************************************************************/
|
|
9934
9978
|
get isValue1Invalid() {
|
|
9935
9979
|
var _a;
|
|
9936
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
9980
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
|
|
9937
9981
|
}
|
|
9938
9982
|
get isValue2Invalid() {
|
|
9939
9983
|
var _a;
|
|
9940
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
9984
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
|
|
9941
9985
|
}
|
|
9942
9986
|
toggleStyle(tool) {
|
|
9943
9987
|
const style = this.state.rules.cellIs.style;
|
|
@@ -9954,17 +9998,17 @@ class ConditionalFormattingPanel extends Component {
|
|
|
9954
9998
|
isValueInvalid(threshold) {
|
|
9955
9999
|
switch (threshold) {
|
|
9956
10000
|
case "minimum":
|
|
9957
|
-
return (this.state.errors.includes(
|
|
9958
|
-
this.state.errors.includes(
|
|
9959
|
-
this.state.errors.includes(
|
|
9960
|
-
this.state.errors.includes(
|
|
10001
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
10002
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
10003
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
10004
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
9961
10005
|
case "midpoint":
|
|
9962
|
-
return (this.state.errors.includes(
|
|
9963
|
-
this.state.errors.includes(
|
|
9964
|
-
this.state.errors.includes(
|
|
10006
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
10007
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
10008
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
9965
10009
|
case "maximum":
|
|
9966
|
-
return (this.state.errors.includes(
|
|
9967
|
-
this.state.errors.includes(
|
|
10010
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
10011
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
9968
10012
|
default:
|
|
9969
10013
|
return false;
|
|
9970
10014
|
}
|
|
@@ -10016,13 +10060,13 @@ class ConditionalFormattingPanel extends Component {
|
|
|
10016
10060
|
isInflectionPointInvalid(inflectionPoint) {
|
|
10017
10061
|
switch (inflectionPoint) {
|
|
10018
10062
|
case "lowerInflectionPoint":
|
|
10019
|
-
return (this.state.errors.includes(
|
|
10020
|
-
this.state.errors.includes(
|
|
10021
|
-
this.state.errors.includes(
|
|
10063
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
10064
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
10065
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
10022
10066
|
case "upperInflectionPoint":
|
|
10023
|
-
return (this.state.errors.includes(
|
|
10024
|
-
this.state.errors.includes(
|
|
10025
|
-
this.state.errors.includes(
|
|
10067
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
10068
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
10069
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
10026
10070
|
default:
|
|
10027
10071
|
return true;
|
|
10028
10072
|
}
|
|
@@ -10342,7 +10386,7 @@ class TopBarComponentRegistry extends Registry {
|
|
|
10342
10386
|
this.uuidGenerator = new UuidGenerator();
|
|
10343
10387
|
}
|
|
10344
10388
|
add(name, value) {
|
|
10345
|
-
const component = { ...value, id: this.uuidGenerator.
|
|
10389
|
+
const component = { ...value, id: this.uuidGenerator.smallUuid() };
|
|
10346
10390
|
return super.add(name, component);
|
|
10347
10391
|
}
|
|
10348
10392
|
}
|
|
@@ -12340,6 +12384,26 @@ const LN = {
|
|
|
12340
12384
|
isExported: true,
|
|
12341
12385
|
};
|
|
12342
12386
|
// -----------------------------------------------------------------------------
|
|
12387
|
+
// LOG
|
|
12388
|
+
// -----------------------------------------------------------------------------
|
|
12389
|
+
const LOG = {
|
|
12390
|
+
description: _lt("The logarithm of a number, for a given base."),
|
|
12391
|
+
args: args(`
|
|
12392
|
+
value (number) ${_lt("The value for which to calculate the logarithm, base e.")}
|
|
12393
|
+
base (number, default=10) ${_lt("The base of the logarithm.")}
|
|
12394
|
+
`),
|
|
12395
|
+
returns: ["NUMBER"],
|
|
12396
|
+
compute: function (value, base = 10) {
|
|
12397
|
+
const _value = toNumber(value);
|
|
12398
|
+
const _base = toNumber(base);
|
|
12399
|
+
assert(() => _value > 0, _lt("The value (%s) must be strictly positive.", _value.toString()));
|
|
12400
|
+
assert(() => _base > 0, _lt("The base (%s) must be strictly positive.", _base.toString()));
|
|
12401
|
+
assert(() => _base !== 1, _lt("The base must be different from 1."));
|
|
12402
|
+
return Math.log10(_value) / Math.log10(_base);
|
|
12403
|
+
},
|
|
12404
|
+
isExported: true,
|
|
12405
|
+
};
|
|
12406
|
+
// -----------------------------------------------------------------------------
|
|
12343
12407
|
// MOD
|
|
12344
12408
|
// -----------------------------------------------------------------------------
|
|
12345
12409
|
const MOD = {
|
|
@@ -12808,6 +12872,7 @@ var math = /*#__PURE__*/Object.freeze({
|
|
|
12808
12872
|
ISO_CEILING: ISO_CEILING,
|
|
12809
12873
|
ISODD: ISODD,
|
|
12810
12874
|
LN: LN,
|
|
12875
|
+
LOG: LOG,
|
|
12811
12876
|
MOD: MOD,
|
|
12812
12877
|
ODD: ODD,
|
|
12813
12878
|
PI: PI,
|
|
@@ -19684,7 +19749,7 @@ class EditionPlugin extends UIPlugin {
|
|
|
19684
19749
|
validateSelection(length, start, end) {
|
|
19685
19750
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
19686
19751
|
? 0 /* CommandResult.Success */
|
|
19687
|
-
:
|
|
19752
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
19688
19753
|
}
|
|
19689
19754
|
onColumnsRemoved(cmd) {
|
|
19690
19755
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -27244,7 +27309,7 @@ function forceUnicityOfFigure(data) {
|
|
|
27244
27309
|
for (const sheet of data.sheets || []) {
|
|
27245
27310
|
for (const figure of sheet.figures || []) {
|
|
27246
27311
|
if (figureIds.has(figure.id)) {
|
|
27247
|
-
figure.id += uuidGenerator.
|
|
27312
|
+
figure.id += uuidGenerator.smallUuid();
|
|
27248
27313
|
}
|
|
27249
27314
|
figureIds.add(figure.id);
|
|
27250
27315
|
}
|
|
@@ -27929,7 +27994,7 @@ class BordersPlugin extends CorePlugin {
|
|
|
27929
27994
|
const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
|
|
27930
27995
|
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);
|
|
27931
27996
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
27932
|
-
return
|
|
27997
|
+
return 89 /* CommandResult.NoChanges */;
|
|
27933
27998
|
}
|
|
27934
27999
|
return 0 /* CommandResult.Success */;
|
|
27935
28000
|
}
|
|
@@ -28035,11 +28100,16 @@ class CellPlugin extends CorePlugin {
|
|
|
28035
28100
|
// Command Handling
|
|
28036
28101
|
// ---------------------------------------------------------------------------
|
|
28037
28102
|
allowDispatch(cmd) {
|
|
28103
|
+
var _a;
|
|
28038
28104
|
switch (cmd.type) {
|
|
28039
28105
|
case "UPDATE_CELL":
|
|
28040
28106
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
28041
28107
|
case "CLEAR_CELL":
|
|
28042
28108
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
28109
|
+
case "UPDATE_CELL_POSITION":
|
|
28110
|
+
return !cmd.cellId || ((_a = this.cells[cmd.sheetId]) === null || _a === void 0 ? void 0 : _a[cmd.cellId])
|
|
28111
|
+
? 0 /* CommandResult.Success */
|
|
28112
|
+
: 28 /* CommandResult.InvalidCellId */;
|
|
28043
28113
|
default:
|
|
28044
28114
|
return 0 /* CommandResult.Success */;
|
|
28045
28115
|
}
|
|
@@ -28078,6 +28148,9 @@ class CellPlugin extends CorePlugin {
|
|
|
28078
28148
|
format: "",
|
|
28079
28149
|
});
|
|
28080
28150
|
break;
|
|
28151
|
+
case "DELETE_SHEET": {
|
|
28152
|
+
this.history.update("cells", cmd.sheetId, undefined);
|
|
28153
|
+
}
|
|
28081
28154
|
}
|
|
28082
28155
|
}
|
|
28083
28156
|
/**
|
|
@@ -28393,9 +28466,9 @@ class CellPlugin extends CorePlugin {
|
|
|
28393
28466
|
checkUselessClearCell(cmd) {
|
|
28394
28467
|
const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
|
|
28395
28468
|
if (!cell)
|
|
28396
|
-
return
|
|
28469
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28397
28470
|
if (!cell.content && !cell.style && !cell.format) {
|
|
28398
|
-
return
|
|
28471
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28399
28472
|
}
|
|
28400
28473
|
return 0 /* CommandResult.Success */;
|
|
28401
28474
|
}
|
|
@@ -28407,7 +28480,7 @@ class CellPlugin extends CorePlugin {
|
|
|
28407
28480
|
if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
|
|
28408
28481
|
(!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
|
|
28409
28482
|
(!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
|
|
28410
|
-
return
|
|
28483
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28411
28484
|
}
|
|
28412
28485
|
return 0 /* CommandResult.Success */;
|
|
28413
28486
|
}
|
|
@@ -28616,13 +28689,13 @@ class ChartPlugin extends CorePlugin {
|
|
|
28616
28689
|
}
|
|
28617
28690
|
checkChartDuplicate(cmd) {
|
|
28618
28691
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28619
|
-
?
|
|
28692
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
28620
28693
|
: 0 /* CommandResult.Success */;
|
|
28621
28694
|
}
|
|
28622
28695
|
checkChartExists(cmd) {
|
|
28623
28696
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28624
28697
|
? 0 /* CommandResult.Success */
|
|
28625
|
-
:
|
|
28698
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
28626
28699
|
}
|
|
28627
28700
|
}
|
|
28628
28701
|
ChartPlugin.getters = [
|
|
@@ -28830,10 +28903,10 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28830
28903
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
28831
28904
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
28832
28905
|
if (ruleIndex === -1)
|
|
28833
|
-
return
|
|
28906
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28834
28907
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
28835
28908
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
28836
|
-
return
|
|
28909
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28837
28910
|
}
|
|
28838
28911
|
return 0 /* CommandResult.Success */;
|
|
28839
28912
|
}
|
|
@@ -28874,10 +28947,10 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28874
28947
|
const errors = [];
|
|
28875
28948
|
const isEmpty = (value) => value === undefined || value === "";
|
|
28876
28949
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
28877
|
-
errors.push(
|
|
28950
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
28878
28951
|
}
|
|
28879
28952
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
28880
|
-
errors.push(
|
|
28953
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
28881
28954
|
}
|
|
28882
28955
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
28883
28956
|
}
|
|
@@ -28889,15 +28962,15 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28889
28962
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
28890
28963
|
switch (thresholdName) {
|
|
28891
28964
|
case "min":
|
|
28892
|
-
return
|
|
28965
|
+
return 54 /* CommandResult.MinNaN */;
|
|
28893
28966
|
case "max":
|
|
28894
|
-
return
|
|
28967
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
28895
28968
|
case "mid":
|
|
28896
|
-
return
|
|
28969
|
+
return 55 /* CommandResult.MidNaN */;
|
|
28897
28970
|
case "upperInflectionPoint":
|
|
28898
|
-
return
|
|
28971
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
28899
28972
|
case "lowerInflectionPoint":
|
|
28900
|
-
return
|
|
28973
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
28901
28974
|
}
|
|
28902
28975
|
}
|
|
28903
28976
|
return 0 /* CommandResult.Success */;
|
|
@@ -28911,15 +28984,15 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28911
28984
|
catch (error) {
|
|
28912
28985
|
switch (thresholdName) {
|
|
28913
28986
|
case "min":
|
|
28914
|
-
return
|
|
28987
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
28915
28988
|
case "max":
|
|
28916
|
-
return
|
|
28989
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
28917
28990
|
case "mid":
|
|
28918
|
-
return
|
|
28991
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
28919
28992
|
case "upperInflectionPoint":
|
|
28920
|
-
return
|
|
28993
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
28921
28994
|
case "lowerInflectionPoint":
|
|
28922
|
-
return
|
|
28995
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
28923
28996
|
}
|
|
28924
28997
|
}
|
|
28925
28998
|
return 0 /* CommandResult.Success */;
|
|
@@ -28936,7 +29009,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28936
29009
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
28937
29010
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
28938
29011
|
Number(minValue) > Number(maxValue)) {
|
|
28939
|
-
return
|
|
29012
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
28940
29013
|
}
|
|
28941
29014
|
return 0 /* CommandResult.Success */;
|
|
28942
29015
|
}
|
|
@@ -28946,7 +29019,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28946
29019
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
28947
29020
|
rule.minimum.type === rule.maximum.type &&
|
|
28948
29021
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
28949
|
-
return
|
|
29022
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
28950
29023
|
}
|
|
28951
29024
|
return 0 /* CommandResult.Success */;
|
|
28952
29025
|
}
|
|
@@ -28958,7 +29031,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28958
29031
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
28959
29032
|
rule.midpoint.type === rule.maximum.type &&
|
|
28960
29033
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
28961
|
-
return
|
|
29034
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
28962
29035
|
}
|
|
28963
29036
|
return 0 /* CommandResult.Success */;
|
|
28964
29037
|
}
|
|
@@ -28970,7 +29043,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
28970
29043
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
28971
29044
|
rule.minimum.type === rule.midpoint.type &&
|
|
28972
29045
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
28973
|
-
return
|
|
29046
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
28974
29047
|
}
|
|
28975
29048
|
return 0 /* CommandResult.Success */;
|
|
28976
29049
|
}
|
|
@@ -29080,13 +29153,13 @@ class FigurePlugin extends CorePlugin {
|
|
|
29080
29153
|
checkFigureExists(sheetId, figureId) {
|
|
29081
29154
|
var _a;
|
|
29082
29155
|
if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
|
|
29083
|
-
return
|
|
29156
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
29084
29157
|
}
|
|
29085
29158
|
return 0 /* CommandResult.Success */;
|
|
29086
29159
|
}
|
|
29087
29160
|
checkFigureDuplicate(figureId) {
|
|
29088
29161
|
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
29089
|
-
return
|
|
29162
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
29090
29163
|
}
|
|
29091
29164
|
return 0 /* CommandResult.Success */;
|
|
29092
29165
|
}
|
|
@@ -29134,10 +29207,10 @@ class FilterTable {
|
|
|
29134
29207
|
this.filters = [];
|
|
29135
29208
|
this.zone = zone;
|
|
29136
29209
|
const uuid = new UuidGenerator();
|
|
29137
|
-
this.id = uuid.
|
|
29210
|
+
this.id = uuid.smallUuid();
|
|
29138
29211
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
29139
29212
|
const filterZone = { ...this.zone, left: i, right: i };
|
|
29140
|
-
this.filters.push(new Filter(uuid.
|
|
29213
|
+
this.filters.push(new Filter(uuid.smallUuid(), filterZone));
|
|
29141
29214
|
}
|
|
29142
29215
|
}
|
|
29143
29216
|
/** Get zone of the table without the headers */
|
|
@@ -29188,12 +29261,12 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29188
29261
|
switch (cmd.type) {
|
|
29189
29262
|
case "CREATE_FILTER_TABLE":
|
|
29190
29263
|
if (!areZonesContinuous(...cmd.target)) {
|
|
29191
|
-
return
|
|
29264
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
29192
29265
|
}
|
|
29193
29266
|
const zone = union(...cmd.target);
|
|
29194
29267
|
const checkFilterOverlap = () => {
|
|
29195
29268
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
29196
|
-
return
|
|
29269
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
29197
29270
|
}
|
|
29198
29271
|
return 0 /* CommandResult.Success */;
|
|
29199
29272
|
};
|
|
@@ -29201,7 +29274,7 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29201
29274
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
29202
29275
|
for (let merge of mergesInTarget) {
|
|
29203
29276
|
if (overlap(zone, merge)) {
|
|
29204
|
-
return
|
|
29277
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29205
29278
|
}
|
|
29206
29279
|
}
|
|
29207
29280
|
return 0 /* CommandResult.Success */;
|
|
@@ -29211,7 +29284,7 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29211
29284
|
for (let merge of cmd.target) {
|
|
29212
29285
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
29213
29286
|
if (overlap(filterTable.zone, merge)) {
|
|
29214
|
-
return
|
|
29287
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29215
29288
|
}
|
|
29216
29289
|
}
|
|
29217
29290
|
}
|
|
@@ -29317,7 +29390,7 @@ class FiltersPlugin extends CorePlugin {
|
|
|
29317
29390
|
if (filters.length < zoneToDimension(zone).width) {
|
|
29318
29391
|
for (let col = zone.left; col <= zone.right; col++) {
|
|
29319
29392
|
if (!filters.find((filter) => filter.col === col)) {
|
|
29320
|
-
filters.push(new Filter(this.uuidGenerator.
|
|
29393
|
+
filters.push(new Filter(this.uuidGenerator.smallUuid(), { ...zone, left: col, right: col }));
|
|
29321
29394
|
}
|
|
29322
29395
|
}
|
|
29323
29396
|
filters.sort((f1, f2) => f1.col - f2.col);
|
|
@@ -29721,10 +29794,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29721
29794
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
29722
29795
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
29723
29796
|
if (hiddenElements.size >= elements) {
|
|
29724
|
-
return
|
|
29797
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
29725
29798
|
}
|
|
29726
29799
|
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
29727
|
-
return
|
|
29800
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
29728
29801
|
}
|
|
29729
29802
|
else {
|
|
29730
29803
|
return 0 /* CommandResult.Success */;
|
|
@@ -30127,7 +30200,7 @@ class MergePlugin extends CorePlugin {
|
|
|
30127
30200
|
for (const zone of target) {
|
|
30128
30201
|
for (const zone2 of target) {
|
|
30129
30202
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
30130
|
-
return
|
|
30203
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30131
30204
|
}
|
|
30132
30205
|
}
|
|
30133
30206
|
}
|
|
@@ -30141,7 +30214,7 @@ class MergePlugin extends CorePlugin {
|
|
|
30141
30214
|
for (const zone of target) {
|
|
30142
30215
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
30143
30216
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
30144
|
-
return
|
|
30217
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
30145
30218
|
}
|
|
30146
30219
|
}
|
|
30147
30220
|
return 0 /* CommandResult.Success */;
|
|
@@ -30359,6 +30432,9 @@ class SheetPlugin extends CorePlugin {
|
|
|
30359
30432
|
case "CREATE_SHEET": {
|
|
30360
30433
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
30361
30434
|
}
|
|
30435
|
+
case "DUPLICATE_SHEET": {
|
|
30436
|
+
return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
|
|
30437
|
+
}
|
|
30362
30438
|
case "MOVE_SHEET":
|
|
30363
30439
|
const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
|
|
30364
30440
|
if (cmd.direction === "left") {
|
|
@@ -30380,7 +30456,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30380
30456
|
case "RENAME_SHEET":
|
|
30381
30457
|
return this.isRenameAllowed(cmd);
|
|
30382
30458
|
case "DELETE_SHEET":
|
|
30383
|
-
return this.
|
|
30459
|
+
return this.getVisibleSheetIds().length > 1
|
|
30384
30460
|
? 0 /* CommandResult.Success */
|
|
30385
30461
|
: 9 /* CommandResult.NotEnoughSheets */;
|
|
30386
30462
|
case "ADD_COLUMNS_ROWS":
|
|
@@ -30388,10 +30464,10 @@ class SheetPlugin extends CorePlugin {
|
|
|
30388
30464
|
? this.getNumberCols(cmd.sheetId)
|
|
30389
30465
|
: this.getNumberRows(cmd.sheetId);
|
|
30390
30466
|
if (cmd.base < 0 || cmd.base >= elements) {
|
|
30391
|
-
return
|
|
30467
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
30392
30468
|
}
|
|
30393
30469
|
else if (cmd.quantity <= 0) {
|
|
30394
|
-
return
|
|
30470
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
30395
30471
|
}
|
|
30396
30472
|
return 0 /* CommandResult.Success */;
|
|
30397
30473
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -30399,7 +30475,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30399
30475
|
? this.getNumberCols(cmd.sheetId)
|
|
30400
30476
|
: this.getNumberRows(cmd.sheetId);
|
|
30401
30477
|
if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
30402
|
-
return
|
|
30478
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
30403
30479
|
}
|
|
30404
30480
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
30405
30481
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -30856,18 +30932,18 @@ class SheetPlugin extends CorePlugin {
|
|
|
30856
30932
|
checkRowFreezeQuantity(cmd) {
|
|
30857
30933
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
30858
30934
|
? 0 /* CommandResult.Success */
|
|
30859
|
-
:
|
|
30935
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
30860
30936
|
}
|
|
30861
30937
|
checkColFreezeQuantity(cmd) {
|
|
30862
30938
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
30863
30939
|
? 0 /* CommandResult.Success */
|
|
30864
|
-
:
|
|
30940
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
30865
30941
|
}
|
|
30866
30942
|
checkRowFreezeOverlapMerge(cmd) {
|
|
30867
30943
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
30868
30944
|
for (let merge of merges) {
|
|
30869
30945
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
30870
|
-
return
|
|
30946
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30871
30947
|
}
|
|
30872
30948
|
}
|
|
30873
30949
|
return 0 /* CommandResult.Success */;
|
|
@@ -30876,7 +30952,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
30876
30952
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
30877
30953
|
for (let merge of merges) {
|
|
30878
30954
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
30879
|
-
return
|
|
30955
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30880
30956
|
}
|
|
30881
30957
|
}
|
|
30882
30958
|
return 0 /* CommandResult.Success */;
|
|
@@ -31186,6 +31262,9 @@ class SheetPlugin extends CorePlugin {
|
|
|
31186
31262
|
zones.push(...cmd.target);
|
|
31187
31263
|
}
|
|
31188
31264
|
if ("ranges" in cmd && Array.isArray(cmd.ranges)) {
|
|
31265
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
31266
|
+
return 27 /* CommandResult.InvalidSheetId */;
|
|
31267
|
+
}
|
|
31189
31268
|
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
31190
31269
|
}
|
|
31191
31270
|
if (!zones.every(isZoneValid)) {
|
|
@@ -31307,7 +31386,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
31307
31386
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
31308
31387
|
return 0 /* CommandResult.Success */;
|
|
31309
31388
|
}
|
|
31310
|
-
return
|
|
31389
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
31311
31390
|
case "AUTOFILL_AUTO":
|
|
31312
31391
|
const zone = this.getters.getSelectedZone();
|
|
31313
31392
|
return zone.top === zone.bottom
|
|
@@ -31907,7 +31986,7 @@ class CellPopoverPlugin extends UIPlugin {
|
|
|
31907
31986
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
31908
31987
|
}
|
|
31909
31988
|
catch (error) {
|
|
31910
|
-
return
|
|
31989
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
31911
31990
|
}
|
|
31912
31991
|
return 0 /* CommandResult.Success */;
|
|
31913
31992
|
default:
|
|
@@ -32131,7 +32210,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
32131
32210
|
for (const zone of this.getPasteZones(target)) {
|
|
32132
32211
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
32133
32212
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
32134
|
-
return
|
|
32213
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
32135
32214
|
}
|
|
32136
32215
|
}
|
|
32137
32216
|
return 0 /* CommandResult.Success */;
|
|
@@ -32491,7 +32570,7 @@ class ClipboardFigureState {
|
|
|
32491
32570
|
}
|
|
32492
32571
|
isPasteAllowed(target, option) {
|
|
32493
32572
|
if (target.length === 0) {
|
|
32494
|
-
return
|
|
32573
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
32495
32574
|
}
|
|
32496
32575
|
if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
|
|
32497
32576
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -32508,7 +32587,7 @@ class ClipboardFigureState {
|
|
|
32508
32587
|
y: this.getters.getRowDimensions(sheetId, target[0].top).start,
|
|
32509
32588
|
};
|
|
32510
32589
|
const newChart = this.copiedChart.copyInSheetId(sheetId);
|
|
32511
|
-
const newId = new UuidGenerator().
|
|
32590
|
+
const newId = new UuidGenerator().smallUuid();
|
|
32512
32591
|
this.dispatch("CREATE_CHART", {
|
|
32513
32592
|
id: newId,
|
|
32514
32593
|
sheetId,
|
|
@@ -33638,7 +33717,9 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33638
33717
|
const cfInTarget = this.getters
|
|
33639
33718
|
.getConditionalFormats(targetSheetId)
|
|
33640
33719
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33641
|
-
return cfInTarget
|
|
33720
|
+
return cfInTarget
|
|
33721
|
+
? cfInTarget
|
|
33722
|
+
: { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
33642
33723
|
}
|
|
33643
33724
|
}
|
|
33644
33725
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
@@ -33654,7 +33735,7 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
33654
33735
|
switch (cmd.type) {
|
|
33655
33736
|
case "UPDATE_FILTER":
|
|
33656
33737
|
if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
|
|
33657
|
-
return
|
|
33738
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
33658
33739
|
}
|
|
33659
33740
|
break;
|
|
33660
33741
|
}
|
|
@@ -35160,23 +35241,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35160
35241
|
gridSelection: deepCopy(gridSelection),
|
|
35161
35242
|
};
|
|
35162
35243
|
}
|
|
35163
|
-
|
|
35164
|
-
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
35165
|
-
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
35166
|
-
if (this.activeSheet.id in this.sheetsData) {
|
|
35167
|
-
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
35168
|
-
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
35169
|
-
}
|
|
35170
|
-
else {
|
|
35171
|
-
this.selectCell(0, 0);
|
|
35172
|
-
}
|
|
35173
|
-
const { col, row } = this.gridSelection.anchor.cell;
|
|
35174
|
-
this.moveClient({
|
|
35175
|
-
sheetId: this.getters.getActiveSheetId(),
|
|
35176
|
-
col,
|
|
35177
|
-
row,
|
|
35178
|
-
});
|
|
35179
|
-
}
|
|
35244
|
+
this.fallbackToVisibleSheet();
|
|
35180
35245
|
const sheetId = this.getters.getActiveSheetId();
|
|
35181
35246
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
35182
35247
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
@@ -35186,6 +35251,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35186
35251
|
}
|
|
35187
35252
|
}
|
|
35188
35253
|
finalize() {
|
|
35254
|
+
this.fallbackToVisibleSheet();
|
|
35189
35255
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
35190
35256
|
this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
|
|
35191
35257
|
}
|
|
@@ -35484,10 +35550,29 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
35484
35550
|
const headers = [cmd.base, ...cmd.elements];
|
|
35485
35551
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
35486
35552
|
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
35487
|
-
return
|
|
35553
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
35488
35554
|
}
|
|
35489
35555
|
return 0 /* CommandResult.Success */;
|
|
35490
35556
|
}
|
|
35557
|
+
fallbackToVisibleSheet() {
|
|
35558
|
+
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
35559
|
+
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
35560
|
+
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
35561
|
+
if (this.activeSheet.id in this.sheetsData) {
|
|
35562
|
+
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
35563
|
+
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
35564
|
+
}
|
|
35565
|
+
else {
|
|
35566
|
+
this.selectCell(0, 0);
|
|
35567
|
+
}
|
|
35568
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
35569
|
+
this.moveClient({
|
|
35570
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
35571
|
+
col,
|
|
35572
|
+
row,
|
|
35573
|
+
});
|
|
35574
|
+
}
|
|
35575
|
+
}
|
|
35491
35576
|
//-------------------------------------------
|
|
35492
35577
|
// Helpers for extensions
|
|
35493
35578
|
// ------------------------------------------
|
|
@@ -35712,7 +35797,7 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
35712
35797
|
setContent(index, xc) {
|
|
35713
35798
|
this.ranges[index] = {
|
|
35714
35799
|
...this.ranges[index],
|
|
35715
|
-
id: uuidGenerator.
|
|
35800
|
+
id: uuidGenerator.smallUuid(),
|
|
35716
35801
|
xc,
|
|
35717
35802
|
};
|
|
35718
35803
|
}
|
|
@@ -35827,26 +35912,26 @@ class SelectionInputsManagerPlugin extends UIPlugin {
|
|
|
35827
35912
|
case "ADD_EMPTY_RANGE":
|
|
35828
35913
|
case "REMOVE_RANGE":
|
|
35829
35914
|
if (!this.inputs[cmd.id]) {
|
|
35830
|
-
return
|
|
35915
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
35831
35916
|
}
|
|
35832
35917
|
}
|
|
35833
35918
|
switch (cmd.type) {
|
|
35834
35919
|
case "FOCUS_RANGE":
|
|
35835
35920
|
const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
|
|
35836
35921
|
if (this.focusedInputId === cmd.id && ((_b = this.currentInput) === null || _b === void 0 ? void 0 : _b.focusedRangeIndex) === index) {
|
|
35837
|
-
return
|
|
35922
|
+
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
35838
35923
|
}
|
|
35839
35924
|
break;
|
|
35840
35925
|
case "ADD_EMPTY_RANGE":
|
|
35841
35926
|
const input = this.inputs[cmd.id];
|
|
35842
35927
|
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
35843
|
-
return
|
|
35928
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35844
35929
|
}
|
|
35845
35930
|
break;
|
|
35846
35931
|
case "CHANGE_RANGE": {
|
|
35847
35932
|
const input = this.inputs[cmd.id];
|
|
35848
35933
|
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
35849
|
-
return
|
|
35934
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35850
35935
|
}
|
|
35851
35936
|
break;
|
|
35852
35937
|
}
|
|
@@ -36037,6 +36122,9 @@ function updateChartRangesTransformation(toTransform, executed) {
|
|
|
36037
36122
|
}
|
|
36038
36123
|
function createSheetTransformation(cmd, executed) {
|
|
36039
36124
|
var _a;
|
|
36125
|
+
if (cmd.sheetId === executed.sheetId) {
|
|
36126
|
+
cmd = { ...cmd, sheetId: `${cmd.sheetId}~` };
|
|
36127
|
+
}
|
|
36040
36128
|
if (cmd.name === executed.name) {
|
|
36041
36129
|
return {
|
|
36042
36130
|
...cmd,
|
|
@@ -36612,21 +36700,14 @@ class Session extends EventBus {
|
|
|
36612
36700
|
if (!message)
|
|
36613
36701
|
return;
|
|
36614
36702
|
if (message.type === "REMOTE_REVISION") {
|
|
36615
|
-
|
|
36703
|
+
let revision = this.revisions.get(message.nextRevisionId);
|
|
36616
36704
|
if (revision.commands.length === 0) {
|
|
36617
36705
|
/**
|
|
36618
|
-
* The command is empty, we have to
|
|
36706
|
+
* The command is empty, we have to rebase all the next local revisions
|
|
36619
36707
|
* to avoid issues with undo/redo
|
|
36620
36708
|
*/
|
|
36621
|
-
this.revisions.
|
|
36622
|
-
|
|
36623
|
-
.filter((message) => message.type === "REMOTE_REVISION")
|
|
36624
|
-
.map((message) => message.nextRevisionId);
|
|
36625
|
-
this.trigger("pending-revisions-dropped", { revisionIds });
|
|
36626
|
-
this.waitingAck = false;
|
|
36627
|
-
this.waitingUndoRedoAck = false;
|
|
36628
|
-
this.pendingMessages = [];
|
|
36629
|
-
return;
|
|
36709
|
+
this.revisions.rebase(revision.id);
|
|
36710
|
+
revision = this.revisions.get(message.nextRevisionId);
|
|
36630
36711
|
}
|
|
36631
36712
|
message = {
|
|
36632
36713
|
...message,
|
|
@@ -36650,7 +36731,6 @@ class Session extends EventBus {
|
|
|
36650
36731
|
switch (message.type) {
|
|
36651
36732
|
case "REMOTE_REVISION":
|
|
36652
36733
|
case "REVISION_REDONE":
|
|
36653
|
-
case "REVISION_UNDONE":
|
|
36654
36734
|
case "SNAPSHOT_CREATED":
|
|
36655
36735
|
this.waitingAck = false;
|
|
36656
36736
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
@@ -36658,6 +36738,25 @@ class Session extends EventBus {
|
|
|
36658
36738
|
this.processedRevisions.add(message.nextRevisionId);
|
|
36659
36739
|
this.sendPendingMessage();
|
|
36660
36740
|
break;
|
|
36741
|
+
case "REVISION_UNDONE": {
|
|
36742
|
+
this.waitingAck = false;
|
|
36743
|
+
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
36744
|
+
const firstPendingRevisionId = this.pendingMessages.findIndex((message) => message.type === "REMOTE_REVISION");
|
|
36745
|
+
if (firstPendingRevisionId !== -1) {
|
|
36746
|
+
/**
|
|
36747
|
+
* Some revisions undergo transformations that may cause issues with
|
|
36748
|
+
* undo/redo if the transformation is destructive (we don't get back
|
|
36749
|
+
* the original command by transforming it with the inverse).
|
|
36750
|
+
* To prevent these problems, we must rebase all subsequent local
|
|
36751
|
+
* revisions.
|
|
36752
|
+
*/
|
|
36753
|
+
this.revisions.rebase(this.pendingMessages[firstPendingRevisionId].nextRevisionId);
|
|
36754
|
+
}
|
|
36755
|
+
this.serverRevisionId = message.nextRevisionId;
|
|
36756
|
+
this.processedRevisions.add(message.nextRevisionId);
|
|
36757
|
+
this.sendPendingMessage();
|
|
36758
|
+
break;
|
|
36759
|
+
}
|
|
36661
36760
|
}
|
|
36662
36761
|
}
|
|
36663
36762
|
isAlreadyProcessed(message) {
|
|
@@ -37528,7 +37627,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37528
37627
|
}
|
|
37529
37628
|
checkPositiveDimension(cmd) {
|
|
37530
37629
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
37531
|
-
return
|
|
37630
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
37532
37631
|
}
|
|
37533
37632
|
return 0 /* CommandResult.Success */;
|
|
37534
37633
|
}
|
|
@@ -37538,7 +37637,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37538
37637
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
37539
37638
|
cmd.width === width &&
|
|
37540
37639
|
cmd.height === height) {
|
|
37541
|
-
return
|
|
37640
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
37542
37641
|
}
|
|
37543
37642
|
return 0 /* CommandResult.Success */;
|
|
37544
37643
|
}
|
|
@@ -37546,7 +37645,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37546
37645
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
37547
37646
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
37548
37647
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
37549
|
-
return
|
|
37648
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
37550
37649
|
}
|
|
37551
37650
|
return 0 /* CommandResult.Success */;
|
|
37552
37651
|
}
|
|
@@ -37773,7 +37872,7 @@ class SortPlugin extends UIPlugin {
|
|
|
37773
37872
|
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
37774
37873
|
for (let col = zone.left; col <= zone.right; col++) {
|
|
37775
37874
|
if (!this.getters.isInMerge(sheetId, col, row)) {
|
|
37776
|
-
return
|
|
37875
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37777
37876
|
}
|
|
37778
37877
|
}
|
|
37779
37878
|
}
|
|
@@ -37794,7 +37893,7 @@ class SortPlugin extends UIPlugin {
|
|
|
37794
37893
|
];
|
|
37795
37894
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
37796
37895
|
})) {
|
|
37797
|
-
return
|
|
37896
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37798
37897
|
}
|
|
37799
37898
|
return 0 /* CommandResult.Success */;
|
|
37800
37899
|
}
|
|
@@ -38460,7 +38559,7 @@ class BottomBar extends Component {
|
|
|
38460
38559
|
addSheet() {
|
|
38461
38560
|
const activeSheetId = this.env.model.getters.getActiveSheetId();
|
|
38462
38561
|
const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
|
|
38463
|
-
const sheetId = this.env.model.uuidGenerator.
|
|
38562
|
+
const sheetId = this.env.model.uuidGenerator.smallUuid();
|
|
38464
38563
|
const name = this.env.model.getters.getNextSheetName(this.env._t("Sheet"));
|
|
38465
38564
|
this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
|
|
38466
38565
|
this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
@@ -38949,7 +39048,7 @@ const AddMergeInteractiveContent = {
|
|
|
38949
39048
|
};
|
|
38950
39049
|
function interactiveAddMerge(env, sheetId, target) {
|
|
38951
39050
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
38952
|
-
if (result.isCancelledBecause(
|
|
39051
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
38953
39052
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
38954
39053
|
}
|
|
38955
39054
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -40082,7 +40181,7 @@ class Tree {
|
|
|
40082
40181
|
}
|
|
40083
40182
|
/**
|
|
40084
40183
|
* Drop the operation and all following operations in every
|
|
40085
|
-
*
|
|
40184
|
+
* branches
|
|
40086
40185
|
*/
|
|
40087
40186
|
drop(operationId) {
|
|
40088
40187
|
for (const branch of this.branches) {
|
|
@@ -40379,9 +40478,16 @@ class SelectiveHistory {
|
|
|
40379
40478
|
this.fastForward();
|
|
40380
40479
|
this.insert(redoId, this.buildEmpty(redoId), insertAfter);
|
|
40381
40480
|
}
|
|
40382
|
-
|
|
40481
|
+
rebase(operationId) {
|
|
40482
|
+
const operation = this.get(operationId);
|
|
40483
|
+
const execution = [...this.tree.execution(this.HEAD_BRANCH).startAfter(operationId)];
|
|
40383
40484
|
this.revertBefore(operationId);
|
|
40485
|
+
const baseId = this.HEAD_OPERATION.id;
|
|
40384
40486
|
this.tree.drop(operationId);
|
|
40487
|
+
this.insert(operationId, operation, baseId);
|
|
40488
|
+
for (const { operation } of execution) {
|
|
40489
|
+
this.insert(operation.id, operation.data, this.HEAD_OPERATION.id);
|
|
40490
|
+
}
|
|
40385
40491
|
}
|
|
40386
40492
|
/**
|
|
40387
40493
|
* Revert the state as it was *before* the given operation was executed.
|
|
@@ -40504,7 +40610,6 @@ class LocalHistory extends EventBus$1 {
|
|
|
40504
40610
|
this.session.on("new-local-state-update", this, this.onNewLocalStateUpdate);
|
|
40505
40611
|
this.session.on("revision-undone", this, ({ commands }) => this.selectiveUndo(commands));
|
|
40506
40612
|
this.session.on("revision-redone", this, ({ commands }) => this.selectiveRedo(commands));
|
|
40507
|
-
this.session.on("pending-revisions-dropped", this, ({ revisionIds }) => this.drop(revisionIds));
|
|
40508
40613
|
this.session.on("snapshot", this, () => {
|
|
40509
40614
|
this.undoStack = [];
|
|
40510
40615
|
this.redoStack = [];
|
|
@@ -40557,10 +40662,6 @@ class LocalHistory extends EventBus$1 {
|
|
|
40557
40662
|
canRedo() {
|
|
40558
40663
|
return this.redoStack.length > 0;
|
|
40559
40664
|
}
|
|
40560
|
-
drop(revisionIds) {
|
|
40561
|
-
this.undoStack = this.undoStack.filter((id) => !revisionIds.includes(id));
|
|
40562
|
-
this.redoStack = [];
|
|
40563
|
-
}
|
|
40564
40665
|
onNewLocalStateUpdate({ id }) {
|
|
40565
40666
|
this.undoStack.push(id);
|
|
40566
40667
|
this.redoStack = [];
|
|
@@ -41141,7 +41242,7 @@ class SelectionStreamProcessor {
|
|
|
41141
41242
|
*/
|
|
41142
41243
|
moveAnchorCell(direction, step = 1) {
|
|
41143
41244
|
if (step !== "end" && step <= 0) {
|
|
41144
|
-
return new DispatchResult(
|
|
41245
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
41145
41246
|
}
|
|
41146
41247
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
41147
41248
|
return this.selectCell(col, row);
|
|
@@ -41187,7 +41288,7 @@ class SelectionStreamProcessor {
|
|
|
41187
41288
|
*/
|
|
41188
41289
|
resizeAnchorZone(direction, step = 1) {
|
|
41189
41290
|
if (step !== "end" && step <= 0) {
|
|
41190
|
-
return new DispatchResult(
|
|
41291
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
41191
41292
|
}
|
|
41192
41293
|
const sheetId = this.getters.getActiveSheetId();
|
|
41193
41294
|
const anchor = this.anchor;
|
|
@@ -43133,10 +43234,10 @@ class Model extends EventBus {
|
|
|
43133
43234
|
const command = { type, ...payload };
|
|
43134
43235
|
let status = this.status;
|
|
43135
43236
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
43136
|
-
return new DispatchResult(
|
|
43237
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
43137
43238
|
}
|
|
43138
43239
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
43139
|
-
return new DispatchResult(
|
|
43240
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
43140
43241
|
}
|
|
43141
43242
|
switch (status) {
|
|
43142
43243
|
case 0 /* Status.Ready */:
|
|
@@ -43338,7 +43439,7 @@ class Model extends EventBus {
|
|
|
43338
43439
|
}
|
|
43339
43440
|
setupConfig(config) {
|
|
43340
43441
|
const client = config.client || {
|
|
43341
|
-
id: this.uuidGenerator.
|
|
43442
|
+
id: this.uuidGenerator.smallUuid(),
|
|
43342
43443
|
name: _lt("Anonymous").toString(),
|
|
43343
43444
|
};
|
|
43344
43445
|
const transportService = config.transportService || new LocalTransportService();
|
|
@@ -43558,6 +43659,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43558
43659
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43559
43660
|
|
|
43560
43661
|
|
|
43561
|
-
__info__.version = '16.0.
|
|
43562
|
-
__info__.date = '2025-02-
|
|
43563
|
-
__info__.hash = '
|
|
43662
|
+
__info__.version = '16.0.63';
|
|
43663
|
+
__info__.date = '2025-02-25T05:54:41.386Z';
|
|
43664
|
+
__info__.hash = 'b01aca6';
|