@odoo/o-spreadsheet 16.0.59 → 16.0.62
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 +458 -337
- package/dist/o-spreadsheet.d.ts +86 -81
- package/dist/o-spreadsheet.esm.js +458 -337
- package/dist/o-spreadsheet.iife.js +458 -337
- package/dist/o-spreadsheet.iife.min.js +237 -237
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -1
|
@@ -1099,9 +1099,16 @@
|
|
|
1099
1099
|
}
|
|
1100
1100
|
return true;
|
|
1101
1101
|
}
|
|
1102
|
-
/**
|
|
1102
|
+
/**
|
|
1103
|
+
* Check if the given array contains all the values of the other array.
|
|
1104
|
+
* It makes the assumption that both array do not contain duplicates.
|
|
1105
|
+
*/
|
|
1103
1106
|
function includesAll(arr, values) {
|
|
1104
|
-
|
|
1107
|
+
if (arr.length < values.length) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
const set = new Set(arr);
|
|
1111
|
+
return values.every((value) => set.has(value));
|
|
1105
1112
|
}
|
|
1106
1113
|
/**
|
|
1107
1114
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
@@ -2376,6 +2383,37 @@
|
|
|
2376
2383
|
setIsFastStrategy(isFast) {
|
|
2377
2384
|
this.isFastIdStrategy = isFast;
|
|
2378
2385
|
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Generates a custom UUID using a simple 26^8 method (8-character alphanumeric string with lowercase letters)
|
|
2388
|
+
* This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
|
|
2389
|
+
* it also has a smaller size, which is preferable to alleviate the overall data size.
|
|
2390
|
+
*
|
|
2391
|
+
* This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
|
|
2392
|
+
* as they will appear several times in the revisions and local history.
|
|
2393
|
+
*
|
|
2394
|
+
*/
|
|
2395
|
+
smallUuid() {
|
|
2396
|
+
if (this.isFastIdStrategy) {
|
|
2397
|
+
this.fastIdStart++;
|
|
2398
|
+
return String(this.fastIdStart);
|
|
2399
|
+
//@ts-ignore
|
|
2400
|
+
}
|
|
2401
|
+
else if (window.crypto && window.crypto.getRandomValues) {
|
|
2402
|
+
//@ts-ignore
|
|
2403
|
+
return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
|
|
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
|
+
*/
|
|
2379
2417
|
uuidv4() {
|
|
2380
2418
|
if (this.isFastIdStrategy) {
|
|
2381
2419
|
this.fastIdStart++;
|
|
@@ -2489,17 +2527,20 @@
|
|
|
2489
2527
|
*/
|
|
2490
2528
|
function toUnboundedZone(xc) {
|
|
2491
2529
|
const zone = toZoneWithoutBoundaryChanges(xc);
|
|
2530
|
+
reorderZone(zone);
|
|
2531
|
+
return zone;
|
|
2532
|
+
}
|
|
2533
|
+
function reorderZone(zone) {
|
|
2492
2534
|
if (zone.right !== undefined && zone.right < zone.left) {
|
|
2493
|
-
const
|
|
2535
|
+
const right = zone.left;
|
|
2494
2536
|
zone.left = zone.right;
|
|
2495
|
-
zone.right =
|
|
2537
|
+
zone.right = right;
|
|
2496
2538
|
}
|
|
2497
2539
|
if (zone.bottom !== undefined && zone.bottom < zone.top) {
|
|
2498
|
-
const
|
|
2540
|
+
const bottom = zone.top;
|
|
2499
2541
|
zone.top = zone.bottom;
|
|
2500
|
-
zone.bottom =
|
|
2542
|
+
zone.bottom = bottom;
|
|
2501
2543
|
}
|
|
2502
|
-
return zone;
|
|
2503
2544
|
}
|
|
2504
2545
|
/**
|
|
2505
2546
|
* Convert from a cartesian reference to a Zone.
|
|
@@ -3387,67 +3428,68 @@
|
|
|
3387
3428
|
CommandResult[CommandResult["InvalidRange"] = 25] = "InvalidRange";
|
|
3388
3429
|
CommandResult[CommandResult["InvalidZones"] = 26] = "InvalidZones";
|
|
3389
3430
|
CommandResult[CommandResult["InvalidSheetId"] = 27] = "InvalidSheetId";
|
|
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["
|
|
3450
|
-
CommandResult[CommandResult["
|
|
3431
|
+
CommandResult[CommandResult["InvalidCellId"] = 28] = "InvalidCellId";
|
|
3432
|
+
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
3433
|
+
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
3434
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
3435
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
3436
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
3437
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
3438
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
3439
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
3440
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
3441
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
3442
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
3443
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
3444
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
3445
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
3446
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
3447
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
3448
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
3449
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
3450
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
3451
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
3452
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
3453
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
3454
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
3455
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
3456
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
3457
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
3458
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
3459
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
3460
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
3461
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
3462
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
3463
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
3464
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
3465
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
3466
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
3467
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
3468
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
3469
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
3470
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
3471
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
3472
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
3473
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
3474
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
3475
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
3476
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
3477
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
3478
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
3479
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
3480
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
3481
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
3482
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
3483
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
3484
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
3485
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
3486
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
3487
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
3488
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
3489
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
3490
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
3491
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
3492
|
+
CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
|
|
3451
3493
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
3452
3494
|
|
|
3453
3495
|
function isMatrix(x) {
|
|
@@ -4977,7 +5019,7 @@
|
|
|
4977
5019
|
});
|
|
4978
5020
|
}
|
|
4979
5021
|
}
|
|
4980
|
-
if (result.isCancelledBecause(
|
|
5022
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
4981
5023
|
const { col, row } = anchor;
|
|
4982
5024
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
4983
5025
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -5000,13 +5042,13 @@
|
|
|
5000
5042
|
};
|
|
5001
5043
|
function interactiveAddFilter(env, sheetId, target) {
|
|
5002
5044
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
5003
|
-
if (result.isCancelledBecause(
|
|
5045
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
5004
5046
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
5005
5047
|
}
|
|
5006
|
-
else if (result.isCancelledBecause(
|
|
5048
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
5007
5049
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
5008
5050
|
}
|
|
5009
|
-
else if (result.isCancelledBecause(
|
|
5051
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
5010
5052
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
5011
5053
|
}
|
|
5012
5054
|
}
|
|
@@ -5028,7 +5070,7 @@
|
|
|
5028
5070
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
5029
5071
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
5030
5072
|
}
|
|
5031
|
-
else if (result.reasons.includes(
|
|
5073
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
5032
5074
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
5033
5075
|
}
|
|
5034
5076
|
}
|
|
@@ -5533,7 +5575,7 @@
|
|
|
5533
5575
|
const CREATE_SHEET_ACTION = (env) => {
|
|
5534
5576
|
const activeSheetId = env.model.getters.getActiveSheetId();
|
|
5535
5577
|
const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
|
|
5536
|
-
const sheetId = env.model.uuidGenerator.
|
|
5578
|
+
const sheetId = env.model.uuidGenerator.smallUuid();
|
|
5537
5579
|
env.model.dispatch("CREATE_SHEET", { sheetId, position });
|
|
5538
5580
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
5539
5581
|
};
|
|
@@ -5544,7 +5586,7 @@
|
|
|
5544
5586
|
const getters = env.model.getters;
|
|
5545
5587
|
const zone = getters.getSelectedZone();
|
|
5546
5588
|
let dataSetZone = zone;
|
|
5547
|
-
const id = env.model.uuidGenerator.
|
|
5589
|
+
const id = env.model.uuidGenerator.smallUuid();
|
|
5548
5590
|
let labelRange;
|
|
5549
5591
|
if (zone.left !== zone.right) {
|
|
5550
5592
|
dataSetZone = { ...zone, left: zone.left + 1 };
|
|
@@ -6020,7 +6062,7 @@
|
|
|
6020
6062
|
name: _lt("Delete"),
|
|
6021
6063
|
sequence: 10,
|
|
6022
6064
|
isVisible: (env) => {
|
|
6023
|
-
return env.model.getters.
|
|
6065
|
+
return env.model.getters.getVisibleSheetIds().length > 1;
|
|
6024
6066
|
},
|
|
6025
6067
|
action: (env) => env.askConfirmation(_lt("Are you sure you want to delete this sheet ?"), () => {
|
|
6026
6068
|
env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
|
|
@@ -6031,7 +6073,7 @@
|
|
|
6031
6073
|
sequence: 20,
|
|
6032
6074
|
action: (env) => {
|
|
6033
6075
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
6034
|
-
const sheetIdTo = env.model.uuidGenerator.
|
|
6076
|
+
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
6035
6077
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
6036
6078
|
sheetId: sheetIdFrom,
|
|
6037
6079
|
sheetIdTo,
|
|
@@ -6079,22 +6121,22 @@
|
|
|
6079
6121
|
const CfTerms = {
|
|
6080
6122
|
Errors: {
|
|
6081
6123
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
6082
|
-
[
|
|
6083
|
-
[
|
|
6084
|
-
[
|
|
6085
|
-
[
|
|
6086
|
-
[
|
|
6087
|
-
[
|
|
6088
|
-
[
|
|
6089
|
-
[
|
|
6090
|
-
[
|
|
6091
|
-
[
|
|
6092
|
-
[
|
|
6093
|
-
[
|
|
6094
|
-
[
|
|
6095
|
-
[
|
|
6096
|
-
[
|
|
6097
|
-
[
|
|
6124
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
6125
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
6126
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
6127
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
6128
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
6129
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
6130
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
6131
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
6132
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
6133
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
6134
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
6135
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
6136
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
6137
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
6138
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
6139
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
6098
6140
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
6099
6141
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
6100
6142
|
},
|
|
@@ -6122,20 +6164,20 @@
|
|
|
6122
6164
|
Errors: {
|
|
6123
6165
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
6124
6166
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
6125
|
-
[
|
|
6126
|
-
[
|
|
6167
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
6168
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
6127
6169
|
// SCORECARD CHART ERRORS
|
|
6128
|
-
[
|
|
6129
|
-
[
|
|
6170
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
6171
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
6130
6172
|
// GAUGE CHART ERRORS
|
|
6131
|
-
[
|
|
6132
|
-
[
|
|
6133
|
-
[
|
|
6134
|
-
[
|
|
6135
|
-
[
|
|
6136
|
-
[
|
|
6137
|
-
[
|
|
6138
|
-
[
|
|
6173
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
6174
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
6175
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
6176
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
6177
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
6178
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
6179
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
6180
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
6139
6181
|
},
|
|
6140
6182
|
};
|
|
6141
6183
|
const NumberFormatTerms = {
|
|
@@ -6159,7 +6201,7 @@
|
|
|
6159
6201
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
6160
6202
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
6161
6203
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
6162
|
-
if (result.isCancelledBecause(
|
|
6204
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
6163
6205
|
env.raiseError(MergeErrorMessage);
|
|
6164
6206
|
}
|
|
6165
6207
|
}
|
|
@@ -6670,7 +6712,7 @@
|
|
|
6670
6712
|
class SelectionInput extends owl.Component {
|
|
6671
6713
|
constructor() {
|
|
6672
6714
|
super(...arguments);
|
|
6673
|
-
this.id = uuidGenerator$1.
|
|
6715
|
+
this.id = uuidGenerator$1.smallUuid();
|
|
6674
6716
|
this.previousRanges = this.props.ranges || [];
|
|
6675
6717
|
this.originSheet = this.env.model.getters.getActiveSheetId();
|
|
6676
6718
|
this.state = owl.useState({
|
|
@@ -6805,11 +6847,11 @@
|
|
|
6805
6847
|
}
|
|
6806
6848
|
get isDatasetInvalid() {
|
|
6807
6849
|
var _a;
|
|
6808
|
-
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
6850
|
+
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
|
|
6809
6851
|
}
|
|
6810
6852
|
get isLabelInvalid() {
|
|
6811
6853
|
var _a;
|
|
6812
|
-
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
6854
|
+
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
|
|
6813
6855
|
}
|
|
6814
6856
|
onUpdateDataSetsHaveTitle(ev) {
|
|
6815
6857
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -7153,11 +7195,11 @@
|
|
|
7153
7195
|
if (definition.dataSets) {
|
|
7154
7196
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
7155
7197
|
if (invalidRanges) {
|
|
7156
|
-
return
|
|
7198
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
7157
7199
|
}
|
|
7158
7200
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
7159
7201
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
7160
|
-
return
|
|
7202
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
7161
7203
|
}
|
|
7162
7204
|
}
|
|
7163
7205
|
return 0 /* CommandResult.Success */;
|
|
@@ -7166,7 +7208,7 @@
|
|
|
7166
7208
|
if (definition.labelRange) {
|
|
7167
7209
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
7168
7210
|
if (invalidLabels) {
|
|
7169
|
-
return
|
|
7211
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
7170
7212
|
}
|
|
7171
7213
|
}
|
|
7172
7214
|
return 0 /* CommandResult.Success */;
|
|
@@ -7627,7 +7669,7 @@
|
|
|
7627
7669
|
});
|
|
7628
7670
|
function isDataRangeValid(definition) {
|
|
7629
7671
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
7630
|
-
?
|
|
7672
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
7631
7673
|
: 0 /* CommandResult.Success */;
|
|
7632
7674
|
}
|
|
7633
7675
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -7659,7 +7701,7 @@
|
|
|
7659
7701
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7660
7702
|
if (definition.sectionRule) {
|
|
7661
7703
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
7662
|
-
return
|
|
7704
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
7663
7705
|
}
|
|
7664
7706
|
}
|
|
7665
7707
|
return 0 /* CommandResult.Success */;
|
|
@@ -7668,9 +7710,9 @@
|
|
|
7668
7710
|
if (value === "") {
|
|
7669
7711
|
switch (valueName) {
|
|
7670
7712
|
case "rangeMin":
|
|
7671
|
-
return
|
|
7713
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
7672
7714
|
case "rangeMax":
|
|
7673
|
-
return
|
|
7715
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
7674
7716
|
}
|
|
7675
7717
|
}
|
|
7676
7718
|
return 0 /* CommandResult.Success */;
|
|
@@ -7679,13 +7721,13 @@
|
|
|
7679
7721
|
if (isNaN(value)) {
|
|
7680
7722
|
switch (valueName) {
|
|
7681
7723
|
case "rangeMin":
|
|
7682
|
-
return
|
|
7724
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
7683
7725
|
case "rangeMax":
|
|
7684
|
-
return
|
|
7726
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
7685
7727
|
case "lowerInflectionPointValue":
|
|
7686
|
-
return
|
|
7728
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
7687
7729
|
case "upperInflectionPointValue":
|
|
7688
|
-
return
|
|
7730
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
7689
7731
|
}
|
|
7690
7732
|
}
|
|
7691
7733
|
return 0 /* CommandResult.Success */;
|
|
@@ -8426,7 +8468,7 @@
|
|
|
8426
8468
|
const dataset = {
|
|
8427
8469
|
label,
|
|
8428
8470
|
data,
|
|
8429
|
-
borderColor: "#FFFFFF",
|
|
8471
|
+
borderColor: chart.background || "#FFFFFF",
|
|
8430
8472
|
backgroundColor,
|
|
8431
8473
|
};
|
|
8432
8474
|
config.data.datasets.push(dataset);
|
|
@@ -8445,12 +8487,12 @@
|
|
|
8445
8487
|
});
|
|
8446
8488
|
function checkKeyValue(definition) {
|
|
8447
8489
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
8448
|
-
?
|
|
8490
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
8449
8491
|
: 0 /* CommandResult.Success */;
|
|
8450
8492
|
}
|
|
8451
8493
|
function checkBaseline(definition) {
|
|
8452
8494
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
8453
|
-
?
|
|
8495
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
8454
8496
|
: 0 /* CommandResult.Success */;
|
|
8455
8497
|
}
|
|
8456
8498
|
class ScorecardChart$1 extends AbstractChart {
|
|
@@ -8879,7 +8921,7 @@
|
|
|
8879
8921
|
}
|
|
8880
8922
|
get isDataRangeInvalid() {
|
|
8881
8923
|
var _a;
|
|
8882
|
-
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8924
|
+
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
|
|
8883
8925
|
}
|
|
8884
8926
|
onDataRangeChanged(ranges) {
|
|
8885
8927
|
this.dataRange = ranges[0];
|
|
@@ -8966,28 +9008,28 @@
|
|
|
8966
9008
|
}
|
|
8967
9009
|
isRangeMinInvalid() {
|
|
8968
9010
|
var _a, _b, _c;
|
|
8969
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8970
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
8971
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
9011
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
|
|
9012
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
|
|
9013
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
8972
9014
|
}
|
|
8973
9015
|
isRangeMaxInvalid() {
|
|
8974
9016
|
var _a, _b, _c;
|
|
8975
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8976
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
8977
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
9017
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
|
|
9018
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
|
|
9019
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
8978
9020
|
}
|
|
8979
9021
|
// ---------------------------------------------------------------------------
|
|
8980
9022
|
// COLOR_SECTION_TEMPLATE
|
|
8981
9023
|
// ---------------------------------------------------------------------------
|
|
8982
9024
|
get isLowerInflectionPointInvalid() {
|
|
8983
9025
|
var _a, _b;
|
|
8984
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8985
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
9026
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
|
|
9027
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
8986
9028
|
}
|
|
8987
9029
|
get isUpperInflectionPointInvalid() {
|
|
8988
9030
|
var _a, _b;
|
|
8989
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
8990
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
9031
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
|
|
9032
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
8991
9033
|
}
|
|
8992
9034
|
updateInflectionPointValue(attr, ev) {
|
|
8993
9035
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -9090,11 +9132,11 @@
|
|
|
9090
9132
|
}
|
|
9091
9133
|
get isKeyValueInvalid() {
|
|
9092
9134
|
var _a;
|
|
9093
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
9135
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
|
|
9094
9136
|
}
|
|
9095
9137
|
get isBaselineInvalid() {
|
|
9096
9138
|
var _a;
|
|
9097
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
9139
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
|
|
9098
9140
|
}
|
|
9099
9141
|
onKeyValueRangeChanged(ranges) {
|
|
9100
9142
|
this.keyValue = ranges[0];
|
|
@@ -9787,7 +9829,7 @@
|
|
|
9787
9829
|
rule: this.getEditorRule(),
|
|
9788
9830
|
id: this.state.mode === "edit"
|
|
9789
9831
|
? this.state.currentCF.id
|
|
9790
|
-
: this.env.model.uuidGenerator.
|
|
9832
|
+
: this.env.model.uuidGenerator.smallUuid(),
|
|
9791
9833
|
},
|
|
9792
9834
|
ranges: this.state.currentCF.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
|
|
9793
9835
|
sheetId,
|
|
@@ -9855,7 +9897,7 @@
|
|
|
9855
9897
|
this.state.mode = "add";
|
|
9856
9898
|
this.state.currentCFType = "CellIsRule";
|
|
9857
9899
|
this.state.currentCF = {
|
|
9858
|
-
id: this.env.model.uuidGenerator.
|
|
9900
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
9859
9901
|
ranges: this.env.model.getters
|
|
9860
9902
|
.getSelectedZones()
|
|
9861
9903
|
.map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
|
|
@@ -9934,11 +9976,11 @@
|
|
|
9934
9976
|
****************************************************************************/
|
|
9935
9977
|
get isValue1Invalid() {
|
|
9936
9978
|
var _a;
|
|
9937
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
9979
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
|
|
9938
9980
|
}
|
|
9939
9981
|
get isValue2Invalid() {
|
|
9940
9982
|
var _a;
|
|
9941
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
9983
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
|
|
9942
9984
|
}
|
|
9943
9985
|
toggleStyle(tool) {
|
|
9944
9986
|
const style = this.state.rules.cellIs.style;
|
|
@@ -9955,17 +9997,17 @@
|
|
|
9955
9997
|
isValueInvalid(threshold) {
|
|
9956
9998
|
switch (threshold) {
|
|
9957
9999
|
case "minimum":
|
|
9958
|
-
return (this.state.errors.includes(
|
|
9959
|
-
this.state.errors.includes(
|
|
9960
|
-
this.state.errors.includes(
|
|
9961
|
-
this.state.errors.includes(
|
|
10000
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
10001
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
10002
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
10003
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
9962
10004
|
case "midpoint":
|
|
9963
|
-
return (this.state.errors.includes(
|
|
9964
|
-
this.state.errors.includes(
|
|
9965
|
-
this.state.errors.includes(
|
|
10005
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
10006
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
10007
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
9966
10008
|
case "maximum":
|
|
9967
|
-
return (this.state.errors.includes(
|
|
9968
|
-
this.state.errors.includes(
|
|
10009
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
10010
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
9969
10011
|
default:
|
|
9970
10012
|
return false;
|
|
9971
10013
|
}
|
|
@@ -10017,13 +10059,13 @@
|
|
|
10017
10059
|
isInflectionPointInvalid(inflectionPoint) {
|
|
10018
10060
|
switch (inflectionPoint) {
|
|
10019
10061
|
case "lowerInflectionPoint":
|
|
10020
|
-
return (this.state.errors.includes(
|
|
10021
|
-
this.state.errors.includes(
|
|
10022
|
-
this.state.errors.includes(
|
|
10062
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
10063
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
10064
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
10023
10065
|
case "upperInflectionPoint":
|
|
10024
|
-
return (this.state.errors.includes(
|
|
10025
|
-
this.state.errors.includes(
|
|
10026
|
-
this.state.errors.includes(
|
|
10066
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
10067
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
10068
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
10027
10069
|
default:
|
|
10028
10070
|
return true;
|
|
10029
10071
|
}
|
|
@@ -10343,7 +10385,7 @@
|
|
|
10343
10385
|
this.uuidGenerator = new UuidGenerator();
|
|
10344
10386
|
}
|
|
10345
10387
|
add(name, value) {
|
|
10346
|
-
const component = { ...value, id: this.uuidGenerator.
|
|
10388
|
+
const component = { ...value, id: this.uuidGenerator.smallUuid() };
|
|
10347
10389
|
return super.add(name, component);
|
|
10348
10390
|
}
|
|
10349
10391
|
}
|
|
@@ -12341,6 +12383,26 @@
|
|
|
12341
12383
|
isExported: true,
|
|
12342
12384
|
};
|
|
12343
12385
|
// -----------------------------------------------------------------------------
|
|
12386
|
+
// LOG
|
|
12387
|
+
// -----------------------------------------------------------------------------
|
|
12388
|
+
const LOG = {
|
|
12389
|
+
description: _lt("The logarithm of a number, for a given base."),
|
|
12390
|
+
args: args(`
|
|
12391
|
+
value (number) ${_lt("The value for which to calculate the logarithm, base e.")}
|
|
12392
|
+
base (number, default=10) ${_lt("The base of the logarithm.")}
|
|
12393
|
+
`),
|
|
12394
|
+
returns: ["NUMBER"],
|
|
12395
|
+
compute: function (value, base = 10) {
|
|
12396
|
+
const _value = toNumber(value);
|
|
12397
|
+
const _base = toNumber(base);
|
|
12398
|
+
assert(() => _value > 0, _lt("The value (%s) must be strictly positive.", _value.toString()));
|
|
12399
|
+
assert(() => _base > 0, _lt("The base (%s) must be strictly positive.", _base.toString()));
|
|
12400
|
+
assert(() => _base !== 1, _lt("The base must be different from 1."));
|
|
12401
|
+
return Math.log10(_value) / Math.log10(_base);
|
|
12402
|
+
},
|
|
12403
|
+
isExported: true,
|
|
12404
|
+
};
|
|
12405
|
+
// -----------------------------------------------------------------------------
|
|
12344
12406
|
// MOD
|
|
12345
12407
|
// -----------------------------------------------------------------------------
|
|
12346
12408
|
const MOD = {
|
|
@@ -12809,6 +12871,7 @@
|
|
|
12809
12871
|
ISO_CEILING: ISO_CEILING,
|
|
12810
12872
|
ISODD: ISODD,
|
|
12811
12873
|
LN: LN,
|
|
12874
|
+
LOG: LOG,
|
|
12812
12875
|
MOD: MOD,
|
|
12813
12876
|
ODD: ODD,
|
|
12814
12877
|
PI: PI,
|
|
@@ -19685,7 +19748,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
19685
19748
|
validateSelection(length, start, end) {
|
|
19686
19749
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
19687
19750
|
? 0 /* CommandResult.Success */
|
|
19688
|
-
:
|
|
19751
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
19689
19752
|
}
|
|
19690
19753
|
onColumnsRemoved(cmd) {
|
|
19691
19754
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -22428,6 +22491,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22428
22491
|
canvas.width = width * dpr;
|
|
22429
22492
|
canvas.height = height * dpr;
|
|
22430
22493
|
canvas.setAttribute("style", `width:${width}px;height:${height}px;`);
|
|
22494
|
+
if (width === 0 || height === 0) {
|
|
22495
|
+
return;
|
|
22496
|
+
}
|
|
22431
22497
|
// Imagine each pixel as a large square. The whole-number coordinates (0, 1, 2…)
|
|
22432
22498
|
// are the edges of the squares. If you draw a one-unit-wide line between whole-number
|
|
22433
22499
|
// coordinates, it will overlap opposite sides of the pixel square, and the resulting
|
|
@@ -27242,7 +27308,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27242
27308
|
for (const sheet of data.sheets || []) {
|
|
27243
27309
|
for (const figure of sheet.figures || []) {
|
|
27244
27310
|
if (figureIds.has(figure.id)) {
|
|
27245
|
-
figure.id += uuidGenerator.
|
|
27311
|
+
figure.id += uuidGenerator.smallUuid();
|
|
27246
27312
|
}
|
|
27247
27313
|
figureIds.add(figure.id);
|
|
27248
27314
|
}
|
|
@@ -27927,7 +27993,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27927
27993
|
const currentBorder = this.getCellBorder(cmd.sheetId, cmd.col, cmd.row);
|
|
27928
27994
|
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);
|
|
27929
27995
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
27930
|
-
return
|
|
27996
|
+
return 89 /* CommandResult.NoChanges */;
|
|
27931
27997
|
}
|
|
27932
27998
|
return 0 /* CommandResult.Success */;
|
|
27933
27999
|
}
|
|
@@ -28033,11 +28099,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28033
28099
|
// Command Handling
|
|
28034
28100
|
// ---------------------------------------------------------------------------
|
|
28035
28101
|
allowDispatch(cmd) {
|
|
28102
|
+
var _a;
|
|
28036
28103
|
switch (cmd.type) {
|
|
28037
28104
|
case "UPDATE_CELL":
|
|
28038
28105
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
28039
28106
|
case "CLEAR_CELL":
|
|
28040
28107
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
28108
|
+
case "UPDATE_CELL_POSITION":
|
|
28109
|
+
return !cmd.cellId || ((_a = this.cells[cmd.sheetId]) === null || _a === void 0 ? void 0 : _a[cmd.cellId])
|
|
28110
|
+
? 0 /* CommandResult.Success */
|
|
28111
|
+
: 28 /* CommandResult.InvalidCellId */;
|
|
28041
28112
|
default:
|
|
28042
28113
|
return 0 /* CommandResult.Success */;
|
|
28043
28114
|
}
|
|
@@ -28076,6 +28147,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28076
28147
|
format: "",
|
|
28077
28148
|
});
|
|
28078
28149
|
break;
|
|
28150
|
+
case "DELETE_SHEET": {
|
|
28151
|
+
this.history.update("cells", cmd.sheetId, undefined);
|
|
28152
|
+
}
|
|
28079
28153
|
}
|
|
28080
28154
|
}
|
|
28081
28155
|
/**
|
|
@@ -28391,9 +28465,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28391
28465
|
checkUselessClearCell(cmd) {
|
|
28392
28466
|
const cell = this.getters.getCell(cmd.sheetId, cmd.col, cmd.row);
|
|
28393
28467
|
if (!cell)
|
|
28394
|
-
return
|
|
28468
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28395
28469
|
if (!cell.content && !cell.style && !cell.format) {
|
|
28396
|
-
return
|
|
28470
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28397
28471
|
}
|
|
28398
28472
|
return 0 /* CommandResult.Success */;
|
|
28399
28473
|
}
|
|
@@ -28405,7 +28479,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28405
28479
|
if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
|
|
28406
28480
|
(!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
|
|
28407
28481
|
(!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
|
|
28408
|
-
return
|
|
28482
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28409
28483
|
}
|
|
28410
28484
|
return 0 /* CommandResult.Success */;
|
|
28411
28485
|
}
|
|
@@ -28614,13 +28688,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28614
28688
|
}
|
|
28615
28689
|
checkChartDuplicate(cmd) {
|
|
28616
28690
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28617
|
-
?
|
|
28691
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
28618
28692
|
: 0 /* CommandResult.Success */;
|
|
28619
28693
|
}
|
|
28620
28694
|
checkChartExists(cmd) {
|
|
28621
28695
|
return this.getters.getFigureSheetId(cmd.id)
|
|
28622
28696
|
? 0 /* CommandResult.Success */
|
|
28623
|
-
:
|
|
28697
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
28624
28698
|
}
|
|
28625
28699
|
}
|
|
28626
28700
|
ChartPlugin.getters = [
|
|
@@ -28828,10 +28902,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28828
28902
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
28829
28903
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
28830
28904
|
if (ruleIndex === -1)
|
|
28831
|
-
return
|
|
28905
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28832
28906
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
28833
28907
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
28834
|
-
return
|
|
28908
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
28835
28909
|
}
|
|
28836
28910
|
return 0 /* CommandResult.Success */;
|
|
28837
28911
|
}
|
|
@@ -28872,10 +28946,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28872
28946
|
const errors = [];
|
|
28873
28947
|
const isEmpty = (value) => value === undefined || value === "";
|
|
28874
28948
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
28875
|
-
errors.push(
|
|
28949
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
28876
28950
|
}
|
|
28877
28951
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
28878
|
-
errors.push(
|
|
28952
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
28879
28953
|
}
|
|
28880
28954
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
28881
28955
|
}
|
|
@@ -28887,15 +28961,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28887
28961
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
28888
28962
|
switch (thresholdName) {
|
|
28889
28963
|
case "min":
|
|
28890
|
-
return
|
|
28964
|
+
return 54 /* CommandResult.MinNaN */;
|
|
28891
28965
|
case "max":
|
|
28892
|
-
return
|
|
28966
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
28893
28967
|
case "mid":
|
|
28894
|
-
return
|
|
28968
|
+
return 55 /* CommandResult.MidNaN */;
|
|
28895
28969
|
case "upperInflectionPoint":
|
|
28896
|
-
return
|
|
28970
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
28897
28971
|
case "lowerInflectionPoint":
|
|
28898
|
-
return
|
|
28972
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
28899
28973
|
}
|
|
28900
28974
|
}
|
|
28901
28975
|
return 0 /* CommandResult.Success */;
|
|
@@ -28909,15 +28983,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28909
28983
|
catch (error) {
|
|
28910
28984
|
switch (thresholdName) {
|
|
28911
28985
|
case "min":
|
|
28912
|
-
return
|
|
28986
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
28913
28987
|
case "max":
|
|
28914
|
-
return
|
|
28988
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
28915
28989
|
case "mid":
|
|
28916
|
-
return
|
|
28990
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
28917
28991
|
case "upperInflectionPoint":
|
|
28918
|
-
return
|
|
28992
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
28919
28993
|
case "lowerInflectionPoint":
|
|
28920
|
-
return
|
|
28994
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
28921
28995
|
}
|
|
28922
28996
|
}
|
|
28923
28997
|
return 0 /* CommandResult.Success */;
|
|
@@ -28934,7 +29008,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28934
29008
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
28935
29009
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
28936
29010
|
Number(minValue) > Number(maxValue)) {
|
|
28937
|
-
return
|
|
29011
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
28938
29012
|
}
|
|
28939
29013
|
return 0 /* CommandResult.Success */;
|
|
28940
29014
|
}
|
|
@@ -28944,7 +29018,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28944
29018
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
28945
29019
|
rule.minimum.type === rule.maximum.type &&
|
|
28946
29020
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
28947
|
-
return
|
|
29021
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
28948
29022
|
}
|
|
28949
29023
|
return 0 /* CommandResult.Success */;
|
|
28950
29024
|
}
|
|
@@ -28956,7 +29030,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28956
29030
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
28957
29031
|
rule.midpoint.type === rule.maximum.type &&
|
|
28958
29032
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
28959
|
-
return
|
|
29033
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
28960
29034
|
}
|
|
28961
29035
|
return 0 /* CommandResult.Success */;
|
|
28962
29036
|
}
|
|
@@ -28968,7 +29042,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28968
29042
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
28969
29043
|
rule.minimum.type === rule.midpoint.type &&
|
|
28970
29044
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
28971
|
-
return
|
|
29045
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
28972
29046
|
}
|
|
28973
29047
|
return 0 /* CommandResult.Success */;
|
|
28974
29048
|
}
|
|
@@ -29078,13 +29152,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29078
29152
|
checkFigureExists(sheetId, figureId) {
|
|
29079
29153
|
var _a;
|
|
29080
29154
|
if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
|
|
29081
|
-
return
|
|
29155
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
29082
29156
|
}
|
|
29083
29157
|
return 0 /* CommandResult.Success */;
|
|
29084
29158
|
}
|
|
29085
29159
|
checkFigureDuplicate(figureId) {
|
|
29086
29160
|
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
29087
|
-
return
|
|
29161
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
29088
29162
|
}
|
|
29089
29163
|
return 0 /* CommandResult.Success */;
|
|
29090
29164
|
}
|
|
@@ -29132,10 +29206,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29132
29206
|
this.filters = [];
|
|
29133
29207
|
this.zone = zone;
|
|
29134
29208
|
const uuid = new UuidGenerator();
|
|
29135
|
-
this.id = uuid.
|
|
29209
|
+
this.id = uuid.smallUuid();
|
|
29136
29210
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
29137
29211
|
const filterZone = { ...this.zone, left: i, right: i };
|
|
29138
|
-
this.filters.push(new Filter(uuid.
|
|
29212
|
+
this.filters.push(new Filter(uuid.smallUuid(), filterZone));
|
|
29139
29213
|
}
|
|
29140
29214
|
}
|
|
29141
29215
|
/** Get zone of the table without the headers */
|
|
@@ -29186,12 +29260,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29186
29260
|
switch (cmd.type) {
|
|
29187
29261
|
case "CREATE_FILTER_TABLE":
|
|
29188
29262
|
if (!areZonesContinuous(...cmd.target)) {
|
|
29189
|
-
return
|
|
29263
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
29190
29264
|
}
|
|
29191
29265
|
const zone = union(...cmd.target);
|
|
29192
29266
|
const checkFilterOverlap = () => {
|
|
29193
29267
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
29194
|
-
return
|
|
29268
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
29195
29269
|
}
|
|
29196
29270
|
return 0 /* CommandResult.Success */;
|
|
29197
29271
|
};
|
|
@@ -29199,7 +29273,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29199
29273
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
29200
29274
|
for (let merge of mergesInTarget) {
|
|
29201
29275
|
if (overlap(zone, merge)) {
|
|
29202
|
-
return
|
|
29276
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29203
29277
|
}
|
|
29204
29278
|
}
|
|
29205
29279
|
return 0 /* CommandResult.Success */;
|
|
@@ -29209,7 +29283,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29209
29283
|
for (let merge of cmd.target) {
|
|
29210
29284
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
29211
29285
|
if (overlap(filterTable.zone, merge)) {
|
|
29212
|
-
return
|
|
29286
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29213
29287
|
}
|
|
29214
29288
|
}
|
|
29215
29289
|
}
|
|
@@ -29315,7 +29389,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29315
29389
|
if (filters.length < zoneToDimension(zone).width) {
|
|
29316
29390
|
for (let col = zone.left; col <= zone.right; col++) {
|
|
29317
29391
|
if (!filters.find((filter) => filter.col === col)) {
|
|
29318
|
-
filters.push(new Filter(this.uuidGenerator.
|
|
29392
|
+
filters.push(new Filter(this.uuidGenerator.smallUuid(), { ...zone, left: col, right: col }));
|
|
29319
29393
|
}
|
|
29320
29394
|
}
|
|
29321
29395
|
filters.sort((f1, f2) => f1.col - f2.col);
|
|
@@ -29719,10 +29793,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29719
29793
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
29720
29794
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
29721
29795
|
if (hiddenElements.size >= elements) {
|
|
29722
|
-
return
|
|
29796
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
29723
29797
|
}
|
|
29724
29798
|
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
29725
|
-
return
|
|
29799
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
29726
29800
|
}
|
|
29727
29801
|
else {
|
|
29728
29802
|
return 0 /* CommandResult.Success */;
|
|
@@ -30125,7 +30199,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30125
30199
|
for (const zone of target) {
|
|
30126
30200
|
for (const zone2 of target) {
|
|
30127
30201
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
30128
|
-
return
|
|
30202
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30129
30203
|
}
|
|
30130
30204
|
}
|
|
30131
30205
|
}
|
|
@@ -30139,7 +30213,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30139
30213
|
for (const zone of target) {
|
|
30140
30214
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
30141
30215
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
30142
|
-
return
|
|
30216
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
30143
30217
|
}
|
|
30144
30218
|
}
|
|
30145
30219
|
return 0 /* CommandResult.Success */;
|
|
@@ -30357,6 +30431,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30357
30431
|
case "CREATE_SHEET": {
|
|
30358
30432
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
30359
30433
|
}
|
|
30434
|
+
case "DUPLICATE_SHEET": {
|
|
30435
|
+
return this.sheets[cmd.sheetIdTo] ? 12 /* CommandResult.DuplicatedSheetId */ : 0 /* CommandResult.Success */;
|
|
30436
|
+
}
|
|
30360
30437
|
case "MOVE_SHEET":
|
|
30361
30438
|
const currentIndex = this.orderedSheetIds.indexOf(cmd.sheetId);
|
|
30362
30439
|
if (cmd.direction === "left") {
|
|
@@ -30378,7 +30455,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30378
30455
|
case "RENAME_SHEET":
|
|
30379
30456
|
return this.isRenameAllowed(cmd);
|
|
30380
30457
|
case "DELETE_SHEET":
|
|
30381
|
-
return this.
|
|
30458
|
+
return this.getVisibleSheetIds().length > 1
|
|
30382
30459
|
? 0 /* CommandResult.Success */
|
|
30383
30460
|
: 9 /* CommandResult.NotEnoughSheets */;
|
|
30384
30461
|
case "ADD_COLUMNS_ROWS":
|
|
@@ -30386,10 +30463,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30386
30463
|
? this.getNumberCols(cmd.sheetId)
|
|
30387
30464
|
: this.getNumberRows(cmd.sheetId);
|
|
30388
30465
|
if (cmd.base < 0 || cmd.base >= elements) {
|
|
30389
|
-
return
|
|
30466
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
30390
30467
|
}
|
|
30391
30468
|
else if (cmd.quantity <= 0) {
|
|
30392
|
-
return
|
|
30469
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
30393
30470
|
}
|
|
30394
30471
|
return 0 /* CommandResult.Success */;
|
|
30395
30472
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -30397,7 +30474,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30397
30474
|
? this.getNumberCols(cmd.sheetId)
|
|
30398
30475
|
: this.getNumberRows(cmd.sheetId);
|
|
30399
30476
|
if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
|
|
30400
|
-
return
|
|
30477
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
30401
30478
|
}
|
|
30402
30479
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
30403
30480
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -30854,18 +30931,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30854
30931
|
checkRowFreezeQuantity(cmd) {
|
|
30855
30932
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
30856
30933
|
? 0 /* CommandResult.Success */
|
|
30857
|
-
:
|
|
30934
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
30858
30935
|
}
|
|
30859
30936
|
checkColFreezeQuantity(cmd) {
|
|
30860
30937
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
30861
30938
|
? 0 /* CommandResult.Success */
|
|
30862
|
-
:
|
|
30939
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
30863
30940
|
}
|
|
30864
30941
|
checkRowFreezeOverlapMerge(cmd) {
|
|
30865
30942
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
30866
30943
|
for (let merge of merges) {
|
|
30867
30944
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
30868
|
-
return
|
|
30945
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30869
30946
|
}
|
|
30870
30947
|
}
|
|
30871
30948
|
return 0 /* CommandResult.Success */;
|
|
@@ -30874,7 +30951,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30874
30951
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
30875
30952
|
for (let merge of merges) {
|
|
30876
30953
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
30877
|
-
return
|
|
30954
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30878
30955
|
}
|
|
30879
30956
|
}
|
|
30880
30957
|
return 0 /* CommandResult.Success */;
|
|
@@ -31184,6 +31261,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31184
31261
|
zones.push(...cmd.target);
|
|
31185
31262
|
}
|
|
31186
31263
|
if ("ranges" in cmd && Array.isArray(cmd.ranges)) {
|
|
31264
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
31265
|
+
return 27 /* CommandResult.InvalidSheetId */;
|
|
31266
|
+
}
|
|
31187
31267
|
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
31188
31268
|
}
|
|
31189
31269
|
if (!zones.every(isZoneValid)) {
|
|
@@ -31305,7 +31385,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31305
31385
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
31306
31386
|
return 0 /* CommandResult.Success */;
|
|
31307
31387
|
}
|
|
31308
|
-
return
|
|
31388
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
31309
31389
|
case "AUTOFILL_AUTO":
|
|
31310
31390
|
const zone = this.getters.getSelectedZone();
|
|
31311
31391
|
return zone.top === zone.bottom
|
|
@@ -31905,7 +31985,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31905
31985
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
31906
31986
|
}
|
|
31907
31987
|
catch (error) {
|
|
31908
|
-
return
|
|
31988
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
31909
31989
|
}
|
|
31910
31990
|
return 0 /* CommandResult.Success */;
|
|
31911
31991
|
default:
|
|
@@ -32129,7 +32209,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32129
32209
|
for (const zone of this.getPasteZones(target)) {
|
|
32130
32210
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
32131
32211
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
32132
|
-
return
|
|
32212
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
32133
32213
|
}
|
|
32134
32214
|
}
|
|
32135
32215
|
return 0 /* CommandResult.Success */;
|
|
@@ -32489,7 +32569,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32489
32569
|
}
|
|
32490
32570
|
isPasteAllowed(target, option) {
|
|
32491
32571
|
if (target.length === 0) {
|
|
32492
|
-
return
|
|
32572
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
32493
32573
|
}
|
|
32494
32574
|
if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
|
|
32495
32575
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -32506,7 +32586,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32506
32586
|
y: this.getters.getRowDimensions(sheetId, target[0].top).start,
|
|
32507
32587
|
};
|
|
32508
32588
|
const newChart = this.copiedChart.copyInSheetId(sheetId);
|
|
32509
|
-
const newId = new UuidGenerator().
|
|
32589
|
+
const newId = new UuidGenerator().smallUuid();
|
|
32510
32590
|
this.dispatch("CREATE_CHART", {
|
|
32511
32591
|
id: newId,
|
|
32512
32592
|
sheetId,
|
|
@@ -33636,7 +33716,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
33636
33716
|
const cfInTarget = this.getters
|
|
33637
33717
|
.getConditionalFormats(targetSheetId)
|
|
33638
33718
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33639
|
-
return cfInTarget
|
|
33719
|
+
return cfInTarget
|
|
33720
|
+
? cfInTarget
|
|
33721
|
+
: { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
33640
33722
|
}
|
|
33641
33723
|
}
|
|
33642
33724
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
@@ -33652,7 +33734,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
33652
33734
|
switch (cmd.type) {
|
|
33653
33735
|
case "UPDATE_FILTER":
|
|
33654
33736
|
if (!this.getters.getFilterId(cmd.sheetId, cmd.col, cmd.row)) {
|
|
33655
|
-
return
|
|
33737
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
33656
33738
|
}
|
|
33657
33739
|
break;
|
|
33658
33740
|
}
|
|
@@ -34631,10 +34713,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34631
34713
|
const { ctx, thinLineWidth } = renderingContext;
|
|
34632
34714
|
const visibleCols = this.getters.getSheetViewVisibleCols();
|
|
34633
34715
|
const left = visibleCols[0];
|
|
34634
|
-
const right = visibleCols[visibleCols.length - 1];
|
|
34635
34716
|
const visibleRows = this.getters.getSheetViewVisibleRows();
|
|
34636
34717
|
const top = visibleRows[0];
|
|
34637
|
-
const bottom = visibleRows[visibleRows.length - 1];
|
|
34638
34718
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
34639
34719
|
const selection = this.getters.getSelectedZones();
|
|
34640
34720
|
const selectedCols = getZonesCols(selection);
|
|
@@ -34650,7 +34730,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34650
34730
|
ctx.lineWidth = thinLineWidth;
|
|
34651
34731
|
ctx.strokeStyle = "#333";
|
|
34652
34732
|
// Columns headers background
|
|
34653
|
-
for (
|
|
34733
|
+
for (const col of visibleCols) {
|
|
34654
34734
|
const colZone = { left: col, right: col, top: 0, bottom: numberOfRows - 1 };
|
|
34655
34735
|
const { x, width } = this.getters.getVisibleRect(colZone);
|
|
34656
34736
|
const colHasFilter = this.getters.doesZonesContainFilter(sheetId, [colZone]);
|
|
@@ -34670,7 +34750,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34670
34750
|
ctx.fillRect(x, 0, width, HEADER_HEIGHT);
|
|
34671
34751
|
}
|
|
34672
34752
|
// Rows headers background
|
|
34673
|
-
for (
|
|
34753
|
+
for (const row of visibleRows) {
|
|
34674
34754
|
const rowZone = { top: row, bottom: row, left: 0, right: numberOfCols - 1 };
|
|
34675
34755
|
const { y, height } = this.getters.getVisibleRect(rowZone);
|
|
34676
34756
|
const rowHasFilter = this.getters.doesZonesContainFilter(sheetId, [rowZone]);
|
|
@@ -34699,21 +34779,21 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34699
34779
|
ctx.stroke();
|
|
34700
34780
|
ctx.beginPath();
|
|
34701
34781
|
// column text + separator
|
|
34702
|
-
for (const
|
|
34703
|
-
const colSize = this.getters.getColSize(sheetId,
|
|
34704
|
-
const colName = numberToLetters(
|
|
34705
|
-
ctx.fillStyle = activeCols.has(
|
|
34706
|
-
let colStart = this.getHeaderOffset("COL", left,
|
|
34782
|
+
for (const col of visibleCols) {
|
|
34783
|
+
const colSize = this.getters.getColSize(sheetId, col);
|
|
34784
|
+
const colName = numberToLetters(col);
|
|
34785
|
+
ctx.fillStyle = activeCols.has(col) ? "#fff" : TEXT_HEADER_COLOR;
|
|
34786
|
+
let colStart = this.getHeaderOffset("COL", left, col);
|
|
34707
34787
|
ctx.fillText(colName, colStart + colSize / 2, HEADER_HEIGHT / 2);
|
|
34708
34788
|
ctx.moveTo(colStart + colSize, 0);
|
|
34709
34789
|
ctx.lineTo(colStart + colSize, HEADER_HEIGHT);
|
|
34710
34790
|
}
|
|
34711
34791
|
// row text + separator
|
|
34712
|
-
for (const
|
|
34713
|
-
const rowSize = this.getters.getRowSize(sheetId,
|
|
34714
|
-
ctx.fillStyle = activeRows.has(
|
|
34715
|
-
let rowStart = this.getHeaderOffset("ROW", top,
|
|
34716
|
-
ctx.fillText(String(
|
|
34792
|
+
for (const row of visibleRows) {
|
|
34793
|
+
const rowSize = this.getters.getRowSize(sheetId, row);
|
|
34794
|
+
ctx.fillStyle = activeRows.has(row) ? "#fff" : TEXT_HEADER_COLOR;
|
|
34795
|
+
let rowStart = this.getHeaderOffset("ROW", top, row);
|
|
34796
|
+
ctx.fillText(String(row + 1), HEADER_WIDTH / 2, rowStart + rowSize / 2);
|
|
34717
34797
|
ctx.moveTo(0, rowStart + rowSize);
|
|
34718
34798
|
ctx.lineTo(HEADER_WIDTH, rowStart + rowSize);
|
|
34719
34799
|
}
|
|
@@ -35160,23 +35240,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35160
35240
|
gridSelection: deepCopy(gridSelection),
|
|
35161
35241
|
};
|
|
35162
35242
|
}
|
|
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
|
-
}
|
|
35243
|
+
this.fallbackToVisibleSheet();
|
|
35180
35244
|
const sheetId = this.getters.getActiveSheetId();
|
|
35181
35245
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
35182
35246
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
@@ -35186,6 +35250,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35186
35250
|
}
|
|
35187
35251
|
}
|
|
35188
35252
|
finalize() {
|
|
35253
|
+
this.fallbackToVisibleSheet();
|
|
35189
35254
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
35190
35255
|
this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
|
|
35191
35256
|
}
|
|
@@ -35484,10 +35549,29 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35484
35549
|
const headers = [cmd.base, ...cmd.elements];
|
|
35485
35550
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
35486
35551
|
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
35487
|
-
return
|
|
35552
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
35488
35553
|
}
|
|
35489
35554
|
return 0 /* CommandResult.Success */;
|
|
35490
35555
|
}
|
|
35556
|
+
fallbackToVisibleSheet() {
|
|
35557
|
+
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
35558
|
+
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
35559
|
+
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
35560
|
+
if (this.activeSheet.id in this.sheetsData) {
|
|
35561
|
+
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
35562
|
+
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
35563
|
+
}
|
|
35564
|
+
else {
|
|
35565
|
+
this.selectCell(0, 0);
|
|
35566
|
+
}
|
|
35567
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
35568
|
+
this.moveClient({
|
|
35569
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
35570
|
+
col,
|
|
35571
|
+
row,
|
|
35572
|
+
});
|
|
35573
|
+
}
|
|
35574
|
+
}
|
|
35491
35575
|
//-------------------------------------------
|
|
35492
35576
|
// Helpers for extensions
|
|
35493
35577
|
// ------------------------------------------
|
|
@@ -35712,7 +35796,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35712
35796
|
setContent(index, xc) {
|
|
35713
35797
|
this.ranges[index] = {
|
|
35714
35798
|
...this.ranges[index],
|
|
35715
|
-
id: uuidGenerator.
|
|
35799
|
+
id: uuidGenerator.smallUuid(),
|
|
35716
35800
|
xc,
|
|
35717
35801
|
};
|
|
35718
35802
|
}
|
|
@@ -35827,26 +35911,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35827
35911
|
case "ADD_EMPTY_RANGE":
|
|
35828
35912
|
case "REMOVE_RANGE":
|
|
35829
35913
|
if (!this.inputs[cmd.id]) {
|
|
35830
|
-
return
|
|
35914
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
35831
35915
|
}
|
|
35832
35916
|
}
|
|
35833
35917
|
switch (cmd.type) {
|
|
35834
35918
|
case "FOCUS_RANGE":
|
|
35835
35919
|
const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
|
|
35836
35920
|
if (this.focusedInputId === cmd.id && ((_b = this.currentInput) === null || _b === void 0 ? void 0 : _b.focusedRangeIndex) === index) {
|
|
35837
|
-
return
|
|
35921
|
+
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
35838
35922
|
}
|
|
35839
35923
|
break;
|
|
35840
35924
|
case "ADD_EMPTY_RANGE":
|
|
35841
35925
|
const input = this.inputs[cmd.id];
|
|
35842
35926
|
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
35843
|
-
return
|
|
35927
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35844
35928
|
}
|
|
35845
35929
|
break;
|
|
35846
35930
|
case "CHANGE_RANGE": {
|
|
35847
35931
|
const input = this.inputs[cmd.id];
|
|
35848
35932
|
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
35849
|
-
return
|
|
35933
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
35850
35934
|
}
|
|
35851
35935
|
break;
|
|
35852
35936
|
}
|
|
@@ -36037,6 +36121,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36037
36121
|
}
|
|
36038
36122
|
function createSheetTransformation(cmd, executed) {
|
|
36039
36123
|
var _a;
|
|
36124
|
+
if (cmd.sheetId === executed.sheetId) {
|
|
36125
|
+
cmd = { ...cmd, sheetId: `${cmd.sheetId}~` };
|
|
36126
|
+
}
|
|
36040
36127
|
if (cmd.name === executed.name) {
|
|
36041
36128
|
return {
|
|
36042
36129
|
...cmd,
|
|
@@ -36612,21 +36699,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36612
36699
|
if (!message)
|
|
36613
36700
|
return;
|
|
36614
36701
|
if (message.type === "REMOTE_REVISION") {
|
|
36615
|
-
|
|
36702
|
+
let revision = this.revisions.get(message.nextRevisionId);
|
|
36616
36703
|
if (revision.commands.length === 0) {
|
|
36617
36704
|
/**
|
|
36618
|
-
* The command is empty, we have to
|
|
36705
|
+
* The command is empty, we have to rebase all the next local revisions
|
|
36619
36706
|
* to avoid issues with undo/redo
|
|
36620
36707
|
*/
|
|
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;
|
|
36708
|
+
this.revisions.rebase(revision.id);
|
|
36709
|
+
revision = this.revisions.get(message.nextRevisionId);
|
|
36630
36710
|
}
|
|
36631
36711
|
message = {
|
|
36632
36712
|
...message,
|
|
@@ -36650,7 +36730,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36650
36730
|
switch (message.type) {
|
|
36651
36731
|
case "REMOTE_REVISION":
|
|
36652
36732
|
case "REVISION_REDONE":
|
|
36653
|
-
case "REVISION_UNDONE":
|
|
36654
36733
|
case "SNAPSHOT_CREATED":
|
|
36655
36734
|
this.waitingAck = false;
|
|
36656
36735
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
@@ -36658,6 +36737,25 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36658
36737
|
this.processedRevisions.add(message.nextRevisionId);
|
|
36659
36738
|
this.sendPendingMessage();
|
|
36660
36739
|
break;
|
|
36740
|
+
case "REVISION_UNDONE": {
|
|
36741
|
+
this.waitingAck = false;
|
|
36742
|
+
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
36743
|
+
const firstPendingRevisionId = this.pendingMessages.findIndex((message) => message.type === "REMOTE_REVISION");
|
|
36744
|
+
if (firstPendingRevisionId !== -1) {
|
|
36745
|
+
/**
|
|
36746
|
+
* Some revisions undergo transformations that may cause issues with
|
|
36747
|
+
* undo/redo if the transformation is destructive (we don't get back
|
|
36748
|
+
* the original command by transforming it with the inverse).
|
|
36749
|
+
* To prevent these problems, we must rebase all subsequent local
|
|
36750
|
+
* revisions.
|
|
36751
|
+
*/
|
|
36752
|
+
this.revisions.rebase(this.pendingMessages[firstPendingRevisionId].nextRevisionId);
|
|
36753
|
+
}
|
|
36754
|
+
this.serverRevisionId = message.nextRevisionId;
|
|
36755
|
+
this.processedRevisions.add(message.nextRevisionId);
|
|
36756
|
+
this.sendPendingMessage();
|
|
36757
|
+
break;
|
|
36758
|
+
}
|
|
36661
36759
|
}
|
|
36662
36760
|
}
|
|
36663
36761
|
isAlreadyProcessed(message) {
|
|
@@ -36801,8 +36899,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36801
36899
|
this.getters = getters;
|
|
36802
36900
|
this.sheetId = sheetId;
|
|
36803
36901
|
this.boundaries = boundaries;
|
|
36804
|
-
|
|
36805
|
-
|
|
36902
|
+
if (sizeInGrid.width < 0 || sizeInGrid.height < 0) {
|
|
36903
|
+
throw new Error("Viewport size cannot be negative");
|
|
36904
|
+
}
|
|
36905
|
+
this.viewportWidth = sizeInGrid.height && sizeInGrid.width;
|
|
36906
|
+
this.viewportHeight = sizeInGrid.width && sizeInGrid.height;
|
|
36907
|
+
this.top = boundaries.top;
|
|
36908
|
+
this.bottom = boundaries.bottom;
|
|
36909
|
+
this.left = boundaries.left;
|
|
36910
|
+
this.right = boundaries.right;
|
|
36911
|
+
this.offsetX = offsets.x;
|
|
36912
|
+
this.offsetY = offsets.y;
|
|
36806
36913
|
this.offsetScrollbarX = offsets.x;
|
|
36807
36914
|
this.offsetScrollbarY = offsets.y;
|
|
36808
36915
|
this.canScrollVertically = options.canScrollVertically;
|
|
@@ -36991,6 +37098,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36991
37098
|
}
|
|
36992
37099
|
// PRIVATE
|
|
36993
37100
|
searchHeaderIndex(dimension, position, startIndex = 0, absolute = false) {
|
|
37101
|
+
if (this.viewportWidth <= 0 || this.viewportHeight <= 0) {
|
|
37102
|
+
return -1;
|
|
37103
|
+
}
|
|
36994
37104
|
let size = 0;
|
|
36995
37105
|
const sheetId = this.sheetId;
|
|
36996
37106
|
const headers = this.getters.getNumberHeaders(sheetId, dimension);
|
|
@@ -37029,7 +37139,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37029
37139
|
this.adjustViewportZoneY();
|
|
37030
37140
|
}
|
|
37031
37141
|
/** Corrects the viewport's horizontal offset based on the current structure
|
|
37032
|
-
* To make sure that at least
|
|
37142
|
+
* To make sure that at least one column is visible inside the viewport.
|
|
37033
37143
|
*/
|
|
37034
37144
|
adjustViewportOffsetX() {
|
|
37035
37145
|
if (this.canScrollHorizontally) {
|
|
@@ -37046,7 +37156,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37046
37156
|
this.adjustViewportZoneX();
|
|
37047
37157
|
}
|
|
37048
37158
|
/** Corrects the viewport's vertical offset based on the current structure
|
|
37049
|
-
* To make sure that at least
|
|
37159
|
+
* To make sure that at least one row is visible inside the viewport.
|
|
37050
37160
|
*/
|
|
37051
37161
|
adjustViewportOffsetY() {
|
|
37052
37162
|
if (this.canScrollVertically) {
|
|
@@ -37068,11 +37178,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37068
37178
|
const sheetId = this.sheetId;
|
|
37069
37179
|
this.left = this.searchHeaderIndex("COL", this.offsetScrollbarX, this.boundaries.left);
|
|
37070
37180
|
this.right = Math.min(this.boundaries.right, this.searchHeaderIndex("COL", this.viewportWidth, this.left));
|
|
37181
|
+
if (!this.viewportWidth) {
|
|
37182
|
+
return;
|
|
37183
|
+
}
|
|
37071
37184
|
if (this.left === -1) {
|
|
37072
37185
|
this.left = this.boundaries.left;
|
|
37073
37186
|
}
|
|
37074
37187
|
if (this.right === -1) {
|
|
37075
|
-
this.right = this.
|
|
37188
|
+
this.right = this.boundaries.right;
|
|
37076
37189
|
}
|
|
37077
37190
|
this.offsetX =
|
|
37078
37191
|
this.getters.getColDimensions(sheetId, this.left).start -
|
|
@@ -37084,11 +37197,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37084
37197
|
const sheetId = this.sheetId;
|
|
37085
37198
|
this.top = this.searchHeaderIndex("ROW", this.offsetScrollbarY, this.boundaries.top);
|
|
37086
37199
|
this.bottom = Math.min(this.boundaries.bottom, this.searchHeaderIndex("ROW", this.viewportHeight, this.top));
|
|
37200
|
+
if (!this.viewportHeight) {
|
|
37201
|
+
return;
|
|
37202
|
+
}
|
|
37087
37203
|
if (this.top === -1) {
|
|
37088
37204
|
this.top = this.boundaries.top;
|
|
37089
37205
|
}
|
|
37090
37206
|
if (this.bottom === -1) {
|
|
37091
|
-
this.bottom = this.
|
|
37207
|
+
this.bottom = this.boundaries.bottom;
|
|
37092
37208
|
}
|
|
37093
37209
|
this.offsetY =
|
|
37094
37210
|
this.getters.getRowDimensions(sheetId, this.top).start -
|
|
@@ -37340,12 +37456,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37340
37456
|
getSheetViewVisibleCols() {
|
|
37341
37457
|
const sheetId = this.getters.getActiveSheetId();
|
|
37342
37458
|
const viewports = this.getSubViewports(sheetId);
|
|
37343
|
-
return [...new Set(viewports.map((v) => range(v.left, v.right + 1)).flat())].filter((col) => !this.getters.isHeaderHidden(sheetId, "COL", col));
|
|
37459
|
+
return [...new Set(viewports.map((v) => range(v.left, v.right + 1)).flat())].filter((col) => col >= 0 && !this.getters.isHeaderHidden(sheetId, "COL", col));
|
|
37344
37460
|
}
|
|
37345
37461
|
getSheetViewVisibleRows() {
|
|
37346
37462
|
const sheetId = this.getters.getActiveSheetId();
|
|
37347
37463
|
const viewports = this.getSubViewports(sheetId);
|
|
37348
|
-
return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => !this.getters.isHeaderHidden(sheetId, "ROW", row));
|
|
37464
|
+
return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => row >= 0 && !this.getters.isHeaderHidden(sheetId, "ROW", row));
|
|
37349
37465
|
}
|
|
37350
37466
|
/**
|
|
37351
37467
|
* Return the main viewport maximum size relative to the client size.
|
|
@@ -37368,19 +37484,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37368
37484
|
maxOffsetY: Math.max(0, height - viewport.viewportHeight + 1),
|
|
37369
37485
|
};
|
|
37370
37486
|
}
|
|
37371
|
-
getColRowOffsetInViewport(dimension,
|
|
37372
|
-
|
|
37373
|
-
|
|
37374
|
-
const visibleRows = this.getters.getSheetViewVisibleRows();
|
|
37375
|
-
if (index < referenceIndex) {
|
|
37376
|
-
return -this.getColRowOffsetInViewport(dimension, index, referenceIndex);
|
|
37487
|
+
getColRowOffsetInViewport(dimension, referenceHeaderIndex, targetHeaderIndex) {
|
|
37488
|
+
if (targetHeaderIndex < referenceHeaderIndex) {
|
|
37489
|
+
return -this.getColRowOffsetInViewport(dimension, targetHeaderIndex, referenceHeaderIndex);
|
|
37377
37490
|
}
|
|
37491
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37492
|
+
const visibleHeaders = dimension === "COL"
|
|
37493
|
+
? this.getters.getSheetViewVisibleCols()
|
|
37494
|
+
: this.getters.getSheetViewVisibleRows();
|
|
37495
|
+
const startIndex = visibleHeaders.findIndex((header) => referenceHeaderIndex >= header);
|
|
37496
|
+
const endIndex = visibleHeaders.findIndex((header) => targetHeaderIndex <= header);
|
|
37497
|
+
const relevantIndexes = visibleHeaders.slice(startIndex, endIndex);
|
|
37378
37498
|
let offset = 0;
|
|
37379
|
-
const
|
|
37380
|
-
for (let i = referenceIndex; i < index; i++) {
|
|
37381
|
-
if (!visibleIndexes.includes(i)) {
|
|
37382
|
-
continue;
|
|
37383
|
-
}
|
|
37499
|
+
for (const i of relevantIndexes) {
|
|
37384
37500
|
offset +=
|
|
37385
37501
|
dimension === "COL"
|
|
37386
37502
|
? this.getters.getColSize(sheetId, i)
|
|
@@ -37430,7 +37546,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37430
37546
|
}
|
|
37431
37547
|
return { canEdgeScroll, direction, delay };
|
|
37432
37548
|
}
|
|
37433
|
-
getEdgeScrollRow(y, previousY,
|
|
37549
|
+
getEdgeScrollRow(y, previousY, startingY) {
|
|
37434
37550
|
let canEdgeScroll = false;
|
|
37435
37551
|
let direction = 0;
|
|
37436
37552
|
let delay = 0;
|
|
@@ -37451,7 +37567,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37451
37567
|
delay = scrollDelay(y - height);
|
|
37452
37568
|
direction = 1;
|
|
37453
37569
|
}
|
|
37454
|
-
else if (y < offsetCorrectionY &&
|
|
37570
|
+
else if (y < offsetCorrectionY && startingY >= offsetCorrectionY && currentOffsetY > 0) {
|
|
37455
37571
|
// 2
|
|
37456
37572
|
canEdgeScroll = true;
|
|
37457
37573
|
delay = scrollDelay(offsetCorrectionY - y);
|
|
@@ -37470,13 +37586,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37470
37586
|
*/
|
|
37471
37587
|
getVisibleRect(zone) {
|
|
37472
37588
|
const sheetId = this.getters.getActiveSheetId();
|
|
37473
|
-
|
|
37474
|
-
.map((viewport) => viewport.getVisibleRect(zone))
|
|
37475
|
-
.filter(isDefined$1);
|
|
37476
|
-
if (viewportRects.length === 0) {
|
|
37477
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37478
|
-
}
|
|
37479
|
-
return this.recomposeRect(viewportRects);
|
|
37589
|
+
return this.mapViewportsToRect(sheetId, (viewport) => viewport.getVisibleRect(zone));
|
|
37480
37590
|
}
|
|
37481
37591
|
/**
|
|
37482
37592
|
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
@@ -37484,13 +37594,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37484
37594
|
*/
|
|
37485
37595
|
getRect(zone) {
|
|
37486
37596
|
const sheetId = this.getters.getActiveSheetId();
|
|
37487
|
-
|
|
37488
|
-
.map((viewport) => viewport.getFullRect(zone))
|
|
37489
|
-
.filter(isDefined$1);
|
|
37490
|
-
if (viewportRects.length === 0) {
|
|
37491
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37492
|
-
}
|
|
37493
|
-
return this.recomposeRect(viewportRects);
|
|
37597
|
+
return this.mapViewportsToRect(sheetId, (viewport) => viewport.getFullRect(zone));
|
|
37494
37598
|
}
|
|
37495
37599
|
/**
|
|
37496
37600
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -37522,7 +37626,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37522
37626
|
}
|
|
37523
37627
|
checkPositiveDimension(cmd) {
|
|
37524
37628
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
37525
|
-
return
|
|
37629
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
37526
37630
|
}
|
|
37527
37631
|
return 0 /* CommandResult.Success */;
|
|
37528
37632
|
}
|
|
@@ -37532,7 +37636,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37532
37636
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
37533
37637
|
cmd.width === width &&
|
|
37534
37638
|
cmd.height === height) {
|
|
37535
|
-
return
|
|
37639
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
37536
37640
|
}
|
|
37537
37641
|
return 0 /* CommandResult.Success */;
|
|
37538
37642
|
}
|
|
@@ -37540,7 +37644,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37540
37644
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
37541
37645
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
37542
37646
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
37543
|
-
return
|
|
37647
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
37544
37648
|
}
|
|
37545
37649
|
return 0 /* CommandResult.Success */;
|
|
37546
37650
|
}
|
|
@@ -37559,12 +37663,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37559
37663
|
}
|
|
37560
37664
|
/** gets rid of deprecated sheetIds */
|
|
37561
37665
|
cleanViewports() {
|
|
37562
|
-
const
|
|
37563
|
-
for (
|
|
37564
|
-
|
|
37565
|
-
delete this.viewports[sheetId];
|
|
37566
|
-
}
|
|
37666
|
+
const newViewport = {};
|
|
37667
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
37668
|
+
newViewport[sheetId] = this.viewports[sheetId];
|
|
37567
37669
|
}
|
|
37670
|
+
this.viewports = newViewport;
|
|
37568
37671
|
}
|
|
37569
37672
|
resetSheetViews() {
|
|
37570
37673
|
this.cleanViewports();
|
|
@@ -37585,14 +37688,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37585
37688
|
this.recomputeViewports();
|
|
37586
37689
|
}
|
|
37587
37690
|
recomputeViewports() {
|
|
37588
|
-
for (
|
|
37691
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
37589
37692
|
this.resetViewports(sheetId);
|
|
37590
37693
|
}
|
|
37591
37694
|
}
|
|
37592
37695
|
setSheetViewOffset(offsetX, offsetY) {
|
|
37593
37696
|
const sheetId = this.getters.getActiveSheetId();
|
|
37594
37697
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
37595
|
-
|
|
37698
|
+
this.getSubViewports(sheetId).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
37596
37699
|
}
|
|
37597
37700
|
getViewportOffset(sheetId) {
|
|
37598
37701
|
var _a, _b;
|
|
@@ -37608,8 +37711,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37608
37711
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
37609
37712
|
const nCols = this.getters.getNumberCols(sheetId);
|
|
37610
37713
|
const nRows = this.getters.getNumberRows(sheetId);
|
|
37611
|
-
const colOffset = this.getters.getColRowOffset("COL", 0, xSplit, sheetId);
|
|
37612
|
-
const rowOffset = this.getters.getColRowOffset("ROW", 0, ySplit, sheetId);
|
|
37714
|
+
const colOffset = Math.min(this.getters.getColRowOffset("COL", 0, xSplit, sheetId), this.sheetViewWidth);
|
|
37715
|
+
const rowOffset = Math.min(this.getters.getColRowOffset("ROW", 0, ySplit, sheetId), this.sheetViewHeight);
|
|
37716
|
+
const unfrozenWidth = Math.max(this.sheetViewWidth - colOffset, 0);
|
|
37717
|
+
const unfrozenHeight = Math.max(this.sheetViewHeight - rowOffset, 0);
|
|
37613
37718
|
const { xRatio, yRatio } = this.getFrozenSheetViewRatio(sheetId);
|
|
37614
37719
|
const canScrollHorizontally = xRatio < 1.0;
|
|
37615
37720
|
const canScrollVertically = yRatio < 1.0;
|
|
@@ -37620,14 +37725,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37620
37725
|
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: 0, bottom: ySplit - 1 }, { width: colOffset, height: rowOffset }, { canScrollHorizontally: false, canScrollVertically: false }, { x: 0, y: 0 })) ||
|
|
37621
37726
|
undefined,
|
|
37622
37727
|
topRight: (ySplit &&
|
|
37623
|
-
new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: 0, bottom: ySplit - 1 }, { width:
|
|
37728
|
+
new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: 0, bottom: ySplit - 1 }, { width: unfrozenWidth, height: rowOffset }, { canScrollHorizontally, canScrollVertically: false }, { x: canScrollHorizontally ? previousOffset.x : 0, y: 0 })) ||
|
|
37624
37729
|
undefined,
|
|
37625
37730
|
bottomLeft: (xSplit &&
|
|
37626
|
-
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: ySplit, bottom: nRows - 1 }, { width: colOffset, height:
|
|
37731
|
+
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: ySplit, bottom: nRows - 1 }, { width: colOffset, height: unfrozenHeight }, { canScrollHorizontally: false, canScrollVertically }, { x: 0, y: canScrollVertically ? previousOffset.y : 0 })) ||
|
|
37627
37732
|
undefined,
|
|
37628
37733
|
bottomRight: new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: ySplit, bottom: nRows - 1 }, {
|
|
37629
|
-
width:
|
|
37630
|
-
height:
|
|
37734
|
+
width: unfrozenWidth,
|
|
37735
|
+
height: unfrozenHeight,
|
|
37631
37736
|
}, { canScrollHorizontally, canScrollVertically }, {
|
|
37632
37737
|
x: canScrollHorizontally ? previousOffset.x : 0,
|
|
37633
37738
|
y: canScrollVertically ? previousOffset.y : 0,
|
|
@@ -37639,7 +37744,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37639
37744
|
* Adjust the viewport such that the anchor position is visible
|
|
37640
37745
|
*/
|
|
37641
37746
|
refreshViewport(sheetId, anchorPosition) {
|
|
37642
|
-
|
|
37747
|
+
this.getSubViewports(sheetId).forEach((viewport) => {
|
|
37643
37748
|
viewport.adjustViewportZone();
|
|
37644
37749
|
viewport.adjustPosition(anchorPosition);
|
|
37645
37750
|
});
|
|
@@ -37690,16 +37795,30 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37690
37795
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
37691
37796
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
37692
37797
|
}
|
|
37693
|
-
|
|
37694
|
-
|
|
37695
|
-
|
|
37696
|
-
|
|
37697
|
-
|
|
37798
|
+
mapViewportsToRect(sheetId, rectCallBack) {
|
|
37799
|
+
let x = Infinity;
|
|
37800
|
+
let y = Infinity;
|
|
37801
|
+
let width = 0;
|
|
37802
|
+
let height = 0;
|
|
37803
|
+
let hasViewports = false;
|
|
37804
|
+
for (const viewport of this.getSubViewports(sheetId)) {
|
|
37805
|
+
const rect = rectCallBack(viewport);
|
|
37806
|
+
if (rect) {
|
|
37807
|
+
hasViewports = true;
|
|
37808
|
+
x = Math.min(x, rect.x);
|
|
37809
|
+
y = Math.min(y, rect.y);
|
|
37810
|
+
width = Math.max(width, rect.x + rect.width);
|
|
37811
|
+
height = Math.max(height, rect.y + rect.height);
|
|
37812
|
+
}
|
|
37813
|
+
}
|
|
37814
|
+
if (!hasViewports) {
|
|
37815
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37816
|
+
}
|
|
37698
37817
|
return {
|
|
37699
37818
|
x: x + this.gridOffsetX,
|
|
37700
37819
|
y: y + this.gridOffsetY,
|
|
37701
|
-
width,
|
|
37702
|
-
height,
|
|
37820
|
+
width: width - x,
|
|
37821
|
+
height: height - y,
|
|
37703
37822
|
};
|
|
37704
37823
|
}
|
|
37705
37824
|
}
|
|
@@ -37752,7 +37871,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37752
37871
|
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
37753
37872
|
for (let col = zone.left; col <= zone.right; col++) {
|
|
37754
37873
|
if (!this.getters.isInMerge(sheetId, col, row)) {
|
|
37755
|
-
return
|
|
37874
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37756
37875
|
}
|
|
37757
37876
|
}
|
|
37758
37877
|
}
|
|
@@ -37773,7 +37892,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37773
37892
|
];
|
|
37774
37893
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
37775
37894
|
})) {
|
|
37776
|
-
return
|
|
37895
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37777
37896
|
}
|
|
37778
37897
|
return 0 /* CommandResult.Success */;
|
|
37779
37898
|
}
|
|
@@ -38439,7 +38558,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
38439
38558
|
addSheet() {
|
|
38440
38559
|
const activeSheetId = this.env.model.getters.getActiveSheetId();
|
|
38441
38560
|
const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
|
|
38442
|
-
const sheetId = this.env.model.uuidGenerator.
|
|
38561
|
+
const sheetId = this.env.model.uuidGenerator.smallUuid();
|
|
38443
38562
|
const name = this.env.model.getters.getNextSheetName(this.env._t("Sheet"));
|
|
38444
38563
|
this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
|
|
38445
38564
|
this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
@@ -38928,7 +39047,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
38928
39047
|
};
|
|
38929
39048
|
function interactiveAddMerge(env, sheetId, target) {
|
|
38930
39049
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
38931
|
-
if (result.isCancelledBecause(
|
|
39050
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
38932
39051
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
38933
39052
|
}
|
|
38934
39053
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -40061,7 +40180,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40061
40180
|
}
|
|
40062
40181
|
/**
|
|
40063
40182
|
* Drop the operation and all following operations in every
|
|
40064
|
-
*
|
|
40183
|
+
* branches
|
|
40065
40184
|
*/
|
|
40066
40185
|
drop(operationId) {
|
|
40067
40186
|
for (const branch of this.branches) {
|
|
@@ -40358,9 +40477,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40358
40477
|
this.fastForward();
|
|
40359
40478
|
this.insert(redoId, this.buildEmpty(redoId), insertAfter);
|
|
40360
40479
|
}
|
|
40361
|
-
|
|
40480
|
+
rebase(operationId) {
|
|
40481
|
+
const operation = this.get(operationId);
|
|
40482
|
+
const execution = [...this.tree.execution(this.HEAD_BRANCH).startAfter(operationId)];
|
|
40362
40483
|
this.revertBefore(operationId);
|
|
40484
|
+
const baseId = this.HEAD_OPERATION.id;
|
|
40363
40485
|
this.tree.drop(operationId);
|
|
40486
|
+
this.insert(operationId, operation, baseId);
|
|
40487
|
+
for (const { operation } of execution) {
|
|
40488
|
+
this.insert(operation.id, operation.data, this.HEAD_OPERATION.id);
|
|
40489
|
+
}
|
|
40364
40490
|
}
|
|
40365
40491
|
/**
|
|
40366
40492
|
* Revert the state as it was *before* the given operation was executed.
|
|
@@ -40483,7 +40609,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40483
40609
|
this.session.on("new-local-state-update", this, this.onNewLocalStateUpdate);
|
|
40484
40610
|
this.session.on("revision-undone", this, ({ commands }) => this.selectiveUndo(commands));
|
|
40485
40611
|
this.session.on("revision-redone", this, ({ commands }) => this.selectiveRedo(commands));
|
|
40486
|
-
this.session.on("pending-revisions-dropped", this, ({ revisionIds }) => this.drop(revisionIds));
|
|
40487
40612
|
this.session.on("snapshot", this, () => {
|
|
40488
40613
|
this.undoStack = [];
|
|
40489
40614
|
this.redoStack = [];
|
|
@@ -40536,10 +40661,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40536
40661
|
canRedo() {
|
|
40537
40662
|
return this.redoStack.length > 0;
|
|
40538
40663
|
}
|
|
40539
|
-
drop(revisionIds) {
|
|
40540
|
-
this.undoStack = this.undoStack.filter((id) => !revisionIds.includes(id));
|
|
40541
|
-
this.redoStack = [];
|
|
40542
|
-
}
|
|
40543
40664
|
onNewLocalStateUpdate({ id }) {
|
|
40544
40665
|
this.undoStack.push(id);
|
|
40545
40666
|
this.redoStack = [];
|
|
@@ -41120,7 +41241,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
41120
41241
|
*/
|
|
41121
41242
|
moveAnchorCell(direction, step = 1) {
|
|
41122
41243
|
if (step !== "end" && step <= 0) {
|
|
41123
|
-
return new DispatchResult(
|
|
41244
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
41124
41245
|
}
|
|
41125
41246
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
41126
41247
|
return this.selectCell(col, row);
|
|
@@ -41166,7 +41287,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
41166
41287
|
*/
|
|
41167
41288
|
resizeAnchorZone(direction, step = 1) {
|
|
41168
41289
|
if (step !== "end" && step <= 0) {
|
|
41169
|
-
return new DispatchResult(
|
|
41290
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
41170
41291
|
}
|
|
41171
41292
|
const sheetId = this.getters.getActiveSheetId();
|
|
41172
41293
|
const anchor = this.anchor;
|
|
@@ -43112,10 +43233,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43112
43233
|
const command = { type, ...payload };
|
|
43113
43234
|
let status = this.status;
|
|
43114
43235
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
43115
|
-
return new DispatchResult(
|
|
43236
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
43116
43237
|
}
|
|
43117
43238
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
43118
|
-
return new DispatchResult(
|
|
43239
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
43119
43240
|
}
|
|
43120
43241
|
switch (status) {
|
|
43121
43242
|
case 0 /* Status.Ready */:
|
|
@@ -43317,7 +43438,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43317
43438
|
}
|
|
43318
43439
|
setupConfig(config) {
|
|
43319
43440
|
const client = config.client || {
|
|
43320
|
-
id: this.uuidGenerator.
|
|
43441
|
+
id: this.uuidGenerator.smallUuid(),
|
|
43321
43442
|
name: _lt("Anonymous").toString(),
|
|
43322
43443
|
};
|
|
43323
43444
|
const transportService = config.transportService || new LocalTransportService();
|
|
@@ -43567,9 +43688,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43567
43688
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43568
43689
|
|
|
43569
43690
|
|
|
43570
|
-
__info__.version = '16.0.
|
|
43571
|
-
__info__.date = '2025-
|
|
43572
|
-
__info__.hash = '
|
|
43691
|
+
__info__.version = '16.0.62';
|
|
43692
|
+
__info__.date = '2025-02-14T08:36:41.388Z';
|
|
43693
|
+
__info__.hash = '34f2802';
|
|
43573
43694
|
|
|
43574
43695
|
|
|
43575
43696
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|