@odoo/o-spreadsheet 16.1.28 → 16.1.33
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 +461 -361
- package/dist/o-spreadsheet.d.ts +99 -70
- package/dist/o-spreadsheet.esm.js +461 -361
- package/dist/o-spreadsheet.iife.js +461 -361
- package/dist/o-spreadsheet.iife.min.js +230 -230
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -306,15 +306,76 @@
|
|
|
306
306
|
// -----------------------------------------------------------------------------
|
|
307
307
|
// Date Type
|
|
308
308
|
// -----------------------------------------------------------------------------
|
|
309
|
+
/**
|
|
310
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
311
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
312
|
+
* and it is timezone-agnostic.
|
|
313
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
314
|
+
*/
|
|
315
|
+
class DateTime {
|
|
316
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
317
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
318
|
+
}
|
|
319
|
+
static fromTimestamp(timestamp) {
|
|
320
|
+
const date = new Date(timestamp);
|
|
321
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
322
|
+
}
|
|
323
|
+
static now() {
|
|
324
|
+
const now = new Date();
|
|
325
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
326
|
+
}
|
|
327
|
+
toString() {
|
|
328
|
+
return this.jsDate.toString();
|
|
329
|
+
}
|
|
330
|
+
getTime() {
|
|
331
|
+
return this.jsDate.getTime();
|
|
332
|
+
}
|
|
333
|
+
getFullYear() {
|
|
334
|
+
return this.jsDate.getUTCFullYear();
|
|
335
|
+
}
|
|
336
|
+
getMonth() {
|
|
337
|
+
return this.jsDate.getUTCMonth();
|
|
338
|
+
}
|
|
339
|
+
getDate() {
|
|
340
|
+
return this.jsDate.getUTCDate();
|
|
341
|
+
}
|
|
342
|
+
getDay() {
|
|
343
|
+
return this.jsDate.getUTCDay();
|
|
344
|
+
}
|
|
345
|
+
getHours() {
|
|
346
|
+
return this.jsDate.getUTCHours();
|
|
347
|
+
}
|
|
348
|
+
getMinutes() {
|
|
349
|
+
return this.jsDate.getUTCMinutes();
|
|
350
|
+
}
|
|
351
|
+
getSeconds() {
|
|
352
|
+
return this.jsDate.getUTCSeconds();
|
|
353
|
+
}
|
|
354
|
+
setFullYear(year) {
|
|
355
|
+
this.jsDate.setFullYear(year);
|
|
356
|
+
}
|
|
357
|
+
setDate(date) {
|
|
358
|
+
this.jsDate.setUTCDate(date);
|
|
359
|
+
}
|
|
360
|
+
setHours(hours) {
|
|
361
|
+
this.jsDate.setUTCHours(hours);
|
|
362
|
+
}
|
|
363
|
+
setMinutes(minutes) {
|
|
364
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
365
|
+
}
|
|
366
|
+
setSeconds(seconds) {
|
|
367
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
309
370
|
// -----------------------------------------------------------------------------
|
|
310
371
|
// Parsing
|
|
311
372
|
// -----------------------------------------------------------------------------
|
|
312
|
-
const INITIAL_1900_DAY = new
|
|
373
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
313
374
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
314
375
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
315
|
-
const CURRENT_YEAR =
|
|
316
|
-
const INITIAL_JS_DAY =
|
|
317
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
376
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
377
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
378
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
318
379
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
319
380
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
320
381
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -363,7 +424,7 @@
|
|
|
363
424
|
return {
|
|
364
425
|
value: date.value + time.value,
|
|
365
426
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
366
|
-
jsDate: new
|
|
427
|
+
jsDate: new DateTime(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
|
|
367
428
|
};
|
|
368
429
|
}
|
|
369
430
|
return date || time;
|
|
@@ -380,13 +441,13 @@
|
|
|
380
441
|
const day = Number(parts[dayIndex]);
|
|
381
442
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
382
443
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
383
|
-
const jsDate = new
|
|
444
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
384
445
|
const sep = str.match(/\/|-|\s/)[0];
|
|
385
446
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
386
447
|
// invalid date
|
|
387
448
|
return null;
|
|
388
449
|
}
|
|
389
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
450
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
390
451
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
391
452
|
if (parts[yearIndex]) {
|
|
392
453
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -446,7 +507,7 @@
|
|
|
446
507
|
if (hours >= 24) {
|
|
447
508
|
format = "hhhh:mm:ss";
|
|
448
509
|
}
|
|
449
|
-
const jsDate = new
|
|
510
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
450
511
|
return {
|
|
451
512
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
452
513
|
format: format,
|
|
@@ -460,7 +521,7 @@
|
|
|
460
521
|
// -----------------------------------------------------------------------------
|
|
461
522
|
function numberToJsDate(value) {
|
|
462
523
|
const truncValue = Math.trunc(value);
|
|
463
|
-
let date =
|
|
524
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
464
525
|
let time = value - truncValue;
|
|
465
526
|
time = time < 0 ? 1 + time : time;
|
|
466
527
|
const hours = Math.round(time * 24);
|
|
@@ -477,7 +538,7 @@
|
|
|
477
538
|
}
|
|
478
539
|
/** Return the number of days in the current month of the given date */
|
|
479
540
|
function getDaysInMonth(date) {
|
|
480
|
-
return new
|
|
541
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
481
542
|
}
|
|
482
543
|
function isLastDayOfMonth(date) {
|
|
483
544
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -495,7 +556,7 @@
|
|
|
495
556
|
const yStart = date.getFullYear();
|
|
496
557
|
const mStart = date.getMonth();
|
|
497
558
|
const dStart = date.getDate();
|
|
498
|
-
const jsDate = new
|
|
559
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
499
560
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
500
561
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
501
562
|
}
|
|
@@ -849,7 +910,7 @@
|
|
|
849
910
|
function isDateTime(str) {
|
|
850
911
|
return parseDateTime(str) !== null;
|
|
851
912
|
}
|
|
852
|
-
const MARKDOWN_LINK_REGEX = /^\[(
|
|
913
|
+
const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
|
|
853
914
|
//link must start with http or https
|
|
854
915
|
//https://stackoverflow.com/a/3809435/4760614
|
|
855
916
|
const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
|
|
@@ -1344,8 +1405,10 @@
|
|
|
1344
1405
|
const cellReference = new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/, "i");
|
|
1345
1406
|
// Same as above, but matches the exact string (nothing before or after)
|
|
1346
1407
|
const singleCellReference = new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/, "i");
|
|
1347
|
-
/** Reference of a column header (eg. A, AB) */
|
|
1348
|
-
const colHeader = new RegExp(
|
|
1408
|
+
/** Reference of a column header (eg. A, AB, $A) */
|
|
1409
|
+
const colHeader = new RegExp(/^\$?([A-Z]{1,3})+$/, "i");
|
|
1410
|
+
/** Reference of a row header (eg. 1, $1) */
|
|
1411
|
+
const rowHeader = new RegExp(/^\$?([0-9]{1,7})+$/, "i");
|
|
1349
1412
|
/** Reference of a column (eg. A, $CA, Sheet1!B) */
|
|
1350
1413
|
const colReference = new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/, "i");
|
|
1351
1414
|
/** Reference of a row (eg. 1, 59, Sheet1!9) */
|
|
@@ -1375,6 +1438,9 @@
|
|
|
1375
1438
|
function isColHeader(str) {
|
|
1376
1439
|
return colHeader.test(str);
|
|
1377
1440
|
}
|
|
1441
|
+
function isRowHeader(str) {
|
|
1442
|
+
return rowHeader.test(str);
|
|
1443
|
+
}
|
|
1378
1444
|
/**
|
|
1379
1445
|
* Return true if the given xc is the reference of a single cell,
|
|
1380
1446
|
* without any specified sheet (e.g. A1)
|
|
@@ -1873,7 +1939,7 @@
|
|
|
1873
1939
|
.map((p) => {
|
|
1874
1940
|
switch (p) {
|
|
1875
1941
|
case "hhhh":
|
|
1876
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
1942
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
1877
1943
|
return helapsedHours.toString();
|
|
1878
1944
|
case "hh":
|
|
1879
1945
|
return hours.toString().padStart(2, "0");
|
|
@@ -1936,27 +2002,30 @@
|
|
|
1936
2002
|
}
|
|
1937
2003
|
function createLargeNumberFormat(format, magnitude, postFix) {
|
|
1938
2004
|
const internalFormat = parseFormat(format || "#,##0");
|
|
1939
|
-
const largeNumberFormat =
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
format: {
|
|
1946
|
-
...formatPart.format,
|
|
1947
|
-
magnitude,
|
|
1948
|
-
decimalPart: undefined,
|
|
1949
|
-
},
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
type: "STRING",
|
|
1953
|
-
format: postFix,
|
|
1954
|
-
},
|
|
1955
|
-
];
|
|
2005
|
+
const largeNumberFormat = [];
|
|
2006
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
2007
|
+
const formatPart = internalFormat[i];
|
|
2008
|
+
if (formatPart.type !== "NUMBER") {
|
|
2009
|
+
largeNumberFormat.push(formatPart);
|
|
2010
|
+
continue;
|
|
1956
2011
|
}
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2012
|
+
largeNumberFormat.push({
|
|
2013
|
+
...formatPart,
|
|
2014
|
+
format: {
|
|
2015
|
+
...formatPart.format,
|
|
2016
|
+
magnitude,
|
|
2017
|
+
decimalPart: undefined,
|
|
2018
|
+
},
|
|
2019
|
+
});
|
|
2020
|
+
largeNumberFormat.push({
|
|
2021
|
+
type: "STRING",
|
|
2022
|
+
format: postFix,
|
|
2023
|
+
});
|
|
2024
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
2025
|
+
if ((nextFormatPart === null || nextFormatPart === void 0 ? void 0 : nextFormatPart.type) === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
2026
|
+
i++;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
1960
2029
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
1961
2030
|
}
|
|
1962
2031
|
function changeDecimalPlaces(format, step) {
|
|
@@ -2164,18 +2233,10 @@
|
|
|
2164
2233
|
if (isFullCol) {
|
|
2165
2234
|
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2166
2235
|
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2167
|
-
if (zone.left === zone.right) {
|
|
2168
|
-
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2169
|
-
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2170
|
-
}
|
|
2171
2236
|
}
|
|
2172
2237
|
if (isFullRow) {
|
|
2173
2238
|
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2174
2239
|
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2175
|
-
if (zone.top === zone.bottom) {
|
|
2176
|
-
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2177
|
-
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2178
|
-
}
|
|
2179
2240
|
}
|
|
2180
2241
|
return parts;
|
|
2181
2242
|
}
|
|
@@ -3609,64 +3670,65 @@
|
|
|
3609
3670
|
CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
|
|
3610
3671
|
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
3611
3672
|
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
3612
|
-
CommandResult[CommandResult["
|
|
3613
|
-
CommandResult[CommandResult["
|
|
3614
|
-
CommandResult[CommandResult["
|
|
3615
|
-
CommandResult[CommandResult["
|
|
3616
|
-
CommandResult[CommandResult["
|
|
3617
|
-
CommandResult[CommandResult["
|
|
3618
|
-
CommandResult[CommandResult["
|
|
3619
|
-
CommandResult[CommandResult["
|
|
3620
|
-
CommandResult[CommandResult["
|
|
3621
|
-
CommandResult[CommandResult["
|
|
3622
|
-
CommandResult[CommandResult["
|
|
3623
|
-
CommandResult[CommandResult["
|
|
3624
|
-
CommandResult[CommandResult["
|
|
3625
|
-
CommandResult[CommandResult["
|
|
3626
|
-
CommandResult[CommandResult["
|
|
3627
|
-
CommandResult[CommandResult["
|
|
3628
|
-
CommandResult[CommandResult["
|
|
3629
|
-
CommandResult[CommandResult["
|
|
3630
|
-
CommandResult[CommandResult["
|
|
3631
|
-
CommandResult[CommandResult["
|
|
3632
|
-
CommandResult[CommandResult["
|
|
3633
|
-
CommandResult[CommandResult["
|
|
3634
|
-
CommandResult[CommandResult["
|
|
3635
|
-
CommandResult[CommandResult["
|
|
3636
|
-
CommandResult[CommandResult["
|
|
3637
|
-
CommandResult[CommandResult["
|
|
3638
|
-
CommandResult[CommandResult["
|
|
3639
|
-
CommandResult[CommandResult["
|
|
3640
|
-
CommandResult[CommandResult["
|
|
3641
|
-
CommandResult[CommandResult["
|
|
3642
|
-
CommandResult[CommandResult["
|
|
3643
|
-
CommandResult[CommandResult["
|
|
3644
|
-
CommandResult[CommandResult["
|
|
3645
|
-
CommandResult[CommandResult["
|
|
3646
|
-
CommandResult[CommandResult["
|
|
3647
|
-
CommandResult[CommandResult["
|
|
3648
|
-
CommandResult[CommandResult["
|
|
3649
|
-
CommandResult[CommandResult["
|
|
3650
|
-
CommandResult[CommandResult["
|
|
3651
|
-
CommandResult[CommandResult["
|
|
3652
|
-
CommandResult[CommandResult["
|
|
3653
|
-
CommandResult[CommandResult["
|
|
3654
|
-
CommandResult[CommandResult["
|
|
3655
|
-
CommandResult[CommandResult["
|
|
3656
|
-
CommandResult[CommandResult["
|
|
3657
|
-
CommandResult[CommandResult["
|
|
3658
|
-
CommandResult[CommandResult["
|
|
3659
|
-
CommandResult[CommandResult["
|
|
3660
|
-
CommandResult[CommandResult["
|
|
3661
|
-
CommandResult[CommandResult["
|
|
3662
|
-
CommandResult[CommandResult["
|
|
3663
|
-
CommandResult[CommandResult["
|
|
3664
|
-
CommandResult[CommandResult["
|
|
3665
|
-
CommandResult[CommandResult["
|
|
3666
|
-
CommandResult[CommandResult["
|
|
3667
|
-
CommandResult[CommandResult["
|
|
3668
|
-
CommandResult[CommandResult["
|
|
3669
|
-
CommandResult[CommandResult["
|
|
3673
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
3674
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
3675
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
3676
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
3677
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
3678
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
3679
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
3680
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
3681
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
3682
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
3683
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
3684
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
3685
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
3686
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
3687
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
3688
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
3689
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
3690
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
3691
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
3692
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
3693
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
3694
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
3695
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
3696
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
3697
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
3698
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
3699
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
3700
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
3701
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
3702
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
3703
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
3704
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
3705
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
3706
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
3707
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
3708
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
3709
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
3710
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
3711
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
3712
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
3713
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
3714
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
3715
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
3716
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
3717
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
3718
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
3719
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
3720
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
3721
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
3722
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
3723
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
3724
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
3725
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
3726
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
3727
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
3728
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
3729
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
3730
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
3731
|
+
CommandResult[CommandResult["NoChanges"] = 89] = "NoChanges";
|
|
3670
3732
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
3671
3733
|
|
|
3672
3734
|
function isMatrix(x) {
|
|
@@ -3940,11 +4002,11 @@
|
|
|
3940
4002
|
if (definition.dataSets) {
|
|
3941
4003
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
3942
4004
|
if (invalidRanges) {
|
|
3943
|
-
return
|
|
4005
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
3944
4006
|
}
|
|
3945
4007
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
3946
4008
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
3947
|
-
return
|
|
4009
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
3948
4010
|
}
|
|
3949
4011
|
}
|
|
3950
4012
|
return 0 /* CommandResult.Success */;
|
|
@@ -3953,7 +4015,7 @@
|
|
|
3953
4015
|
if (definition.labelRange) {
|
|
3954
4016
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
3955
4017
|
if (invalidLabels) {
|
|
3956
|
-
return
|
|
4018
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
3957
4019
|
}
|
|
3958
4020
|
}
|
|
3959
4021
|
return 0 /* CommandResult.Success */;
|
|
@@ -4026,22 +4088,22 @@
|
|
|
4026
4088
|
const CfTerms = {
|
|
4027
4089
|
Errors: {
|
|
4028
4090
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
4029
|
-
[
|
|
4030
|
-
[
|
|
4031
|
-
[
|
|
4032
|
-
[
|
|
4033
|
-
[
|
|
4034
|
-
[
|
|
4035
|
-
[
|
|
4036
|
-
[
|
|
4037
|
-
[
|
|
4038
|
-
[
|
|
4039
|
-
[
|
|
4040
|
-
[
|
|
4041
|
-
[
|
|
4042
|
-
[
|
|
4043
|
-
[
|
|
4044
|
-
[
|
|
4091
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
4092
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
4093
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
4094
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
4095
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
4096
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
4097
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
4098
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
4099
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
4100
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
4101
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
4102
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
4103
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
4104
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
4105
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
4106
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
4045
4107
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
4046
4108
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
4047
4109
|
},
|
|
@@ -4069,20 +4131,20 @@
|
|
|
4069
4131
|
Errors: {
|
|
4070
4132
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
4071
4133
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
4072
|
-
[
|
|
4073
|
-
[
|
|
4134
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
4135
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
4074
4136
|
// SCORECARD CHART ERRORS
|
|
4075
|
-
[
|
|
4076
|
-
[
|
|
4137
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
4138
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
4077
4139
|
// GAUGE CHART ERRORS
|
|
4078
|
-
[
|
|
4079
|
-
[
|
|
4080
|
-
[
|
|
4081
|
-
[
|
|
4082
|
-
[
|
|
4083
|
-
[
|
|
4084
|
-
[
|
|
4085
|
-
[
|
|
4140
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
4141
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
4142
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
4143
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
4144
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
4145
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
4146
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
4147
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
4086
4148
|
},
|
|
4087
4149
|
};
|
|
4088
4150
|
const NumberFormatTerms = {
|
|
@@ -4454,7 +4516,7 @@
|
|
|
4454
4516
|
|
|
4455
4517
|
function isDataRangeValid(definition) {
|
|
4456
4518
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
4457
|
-
?
|
|
4519
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
4458
4520
|
: 0 /* CommandResult.Success */;
|
|
4459
4521
|
}
|
|
4460
4522
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -4486,7 +4548,7 @@
|
|
|
4486
4548
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
4487
4549
|
if (definition.sectionRule) {
|
|
4488
4550
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
4489
|
-
return
|
|
4551
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
4490
4552
|
}
|
|
4491
4553
|
}
|
|
4492
4554
|
return 0 /* CommandResult.Success */;
|
|
@@ -4495,9 +4557,9 @@
|
|
|
4495
4557
|
if (value === "") {
|
|
4496
4558
|
switch (valueName) {
|
|
4497
4559
|
case "rangeMin":
|
|
4498
|
-
return
|
|
4560
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
4499
4561
|
case "rangeMax":
|
|
4500
|
-
return
|
|
4562
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
4501
4563
|
}
|
|
4502
4564
|
}
|
|
4503
4565
|
return 0 /* CommandResult.Success */;
|
|
@@ -4506,13 +4568,13 @@
|
|
|
4506
4568
|
if (isNaN(value)) {
|
|
4507
4569
|
switch (valueName) {
|
|
4508
4570
|
case "rangeMin":
|
|
4509
|
-
return
|
|
4571
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
4510
4572
|
case "rangeMax":
|
|
4511
|
-
return
|
|
4573
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
4512
4574
|
case "lowerInflectionPointValue":
|
|
4513
|
-
return
|
|
4575
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
4514
4576
|
case "upperInflectionPointValue":
|
|
4515
|
-
return
|
|
4577
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
4516
4578
|
}
|
|
4517
4579
|
}
|
|
4518
4580
|
return 0 /* CommandResult.Success */;
|
|
@@ -5263,12 +5325,12 @@
|
|
|
5263
5325
|
|
|
5264
5326
|
function checkKeyValue(definition) {
|
|
5265
5327
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
5266
|
-
?
|
|
5328
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
5267
5329
|
: 0 /* CommandResult.Success */;
|
|
5268
5330
|
}
|
|
5269
5331
|
function checkBaseline(definition) {
|
|
5270
5332
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
5271
|
-
?
|
|
5333
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
5272
5334
|
: 0 /* CommandResult.Success */;
|
|
5273
5335
|
}
|
|
5274
5336
|
class ScorecardChart extends AbstractChart {
|
|
@@ -5702,6 +5764,7 @@
|
|
|
5702
5764
|
return node.description ? node.description : "";
|
|
5703
5765
|
}
|
|
5704
5766
|
|
|
5767
|
+
const macRegex = /Mac/i;
|
|
5705
5768
|
/**
|
|
5706
5769
|
* Return true if the event was triggered from
|
|
5707
5770
|
* a child element.
|
|
@@ -5719,6 +5782,17 @@
|
|
|
5719
5782
|
}
|
|
5720
5783
|
function getOpenedMenus() {
|
|
5721
5784
|
return Array.from(document.querySelectorAll(".o-spreadsheet .o-menu"));
|
|
5785
|
+
}
|
|
5786
|
+
function isMacOS() {
|
|
5787
|
+
return Boolean(macRegex.test(navigator.userAgent));
|
|
5788
|
+
}
|
|
5789
|
+
/**
|
|
5790
|
+
* @param {KeyboardEvent | MouseEvent} ev
|
|
5791
|
+
* @returns Returns true if the event was triggered with the "ctrl" modifier pressed.
|
|
5792
|
+
* On Mac, this is the "meta" or "command" key.
|
|
5793
|
+
*/
|
|
5794
|
+
function isCtrlKey(ev) {
|
|
5795
|
+
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
5722
5796
|
}
|
|
5723
5797
|
|
|
5724
5798
|
/**
|
|
@@ -6298,7 +6372,7 @@
|
|
|
6298
6372
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
6299
6373
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
6300
6374
|
}
|
|
6301
|
-
else if (result.reasons.includes(
|
|
6375
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
6302
6376
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
6303
6377
|
}
|
|
6304
6378
|
}
|
|
@@ -6585,7 +6659,7 @@
|
|
|
6585
6659
|
});
|
|
6586
6660
|
}
|
|
6587
6661
|
}
|
|
6588
|
-
if (result.isCancelledBecause(
|
|
6662
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
6589
6663
|
const { col, row } = anchor;
|
|
6590
6664
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
6591
6665
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -6599,13 +6673,13 @@
|
|
|
6599
6673
|
};
|
|
6600
6674
|
function interactiveAddFilter(env, sheetId, target) {
|
|
6601
6675
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
6602
|
-
if (result.isCancelledBecause(
|
|
6676
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
6603
6677
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
6604
6678
|
}
|
|
6605
|
-
else if (result.isCancelledBecause(
|
|
6679
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
6606
6680
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
6607
6681
|
}
|
|
6608
|
-
else if (result.isCancelledBecause(
|
|
6682
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
6609
6683
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
6610
6684
|
}
|
|
6611
6685
|
}
|
|
@@ -10879,7 +10953,7 @@
|
|
|
10879
10953
|
if (_year < 1900) {
|
|
10880
10954
|
_year += 1900;
|
|
10881
10955
|
}
|
|
10882
|
-
const jsDate = new
|
|
10956
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
10883
10957
|
const result = jsDateToRoundNumber(jsDate);
|
|
10884
10958
|
assert(() => result >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
10885
10959
|
return result;
|
|
@@ -10991,7 +11065,7 @@
|
|
|
10991
11065
|
const _months = Math.trunc(toNumber(months));
|
|
10992
11066
|
const yStart = _startDate.getFullYear();
|
|
10993
11067
|
const mStart = _startDate.getMonth();
|
|
10994
|
-
const jsDate = new
|
|
11068
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
10995
11069
|
return jsDateToRoundNumber(jsDate);
|
|
10996
11070
|
},
|
|
10997
11071
|
isExported: true,
|
|
@@ -11030,17 +11104,17 @@
|
|
|
11030
11104
|
// The first week of the year is the week that contains the first
|
|
11031
11105
|
// Thursday of the year.
|
|
11032
11106
|
let firstThursday = 1;
|
|
11033
|
-
while (new
|
|
11107
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
11034
11108
|
firstThursday += 1;
|
|
11035
11109
|
}
|
|
11036
|
-
const firstDayOfFirstWeek = new
|
|
11110
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
11037
11111
|
// The last week of the year is the week that contains the last Thursday of
|
|
11038
11112
|
// the year.
|
|
11039
11113
|
let lastThursday = 31;
|
|
11040
|
-
while (new
|
|
11114
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
11041
11115
|
lastThursday -= 1;
|
|
11042
11116
|
}
|
|
11043
|
-
const lastDayOfLastWeek = new
|
|
11117
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
11044
11118
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
11045
11119
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
11046
11120
|
let offsetYear;
|
|
@@ -11066,17 +11140,17 @@
|
|
|
11066
11140
|
case 1:
|
|
11067
11141
|
// firstDay is the 1st day of the 1st week of the year after
|
|
11068
11142
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
11069
|
-
firstDay = new
|
|
11143
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
11070
11144
|
break;
|
|
11071
11145
|
case -1:
|
|
11072
11146
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
11073
11147
|
// The first week of the previous year is the week that contains the
|
|
11074
11148
|
// first Thursday of the previous year.
|
|
11075
11149
|
let firstThursdayPreviousYear = 1;
|
|
11076
|
-
while (new
|
|
11150
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
11077
11151
|
firstThursdayPreviousYear += 1;
|
|
11078
11152
|
}
|
|
11079
|
-
firstDay = new
|
|
11153
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
11080
11154
|
break;
|
|
11081
11155
|
}
|
|
11082
11156
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -11215,8 +11289,8 @@
|
|
|
11215
11289
|
});
|
|
11216
11290
|
}
|
|
11217
11291
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
11218
|
-
const stopDate =
|
|
11219
|
-
let stepDate =
|
|
11292
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
11293
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
11220
11294
|
const timeStopDate = stopDate.getTime();
|
|
11221
11295
|
let timeStepDate = stepDate.getTime();
|
|
11222
11296
|
let netWorkingDay = 0;
|
|
@@ -11240,8 +11314,7 @@
|
|
|
11240
11314
|
returns: ["DATE"],
|
|
11241
11315
|
computeFormat: () => "m/d/yyyy hh:mm:ss",
|
|
11242
11316
|
compute: function () {
|
|
11243
|
-
let today =
|
|
11244
|
-
today.setMilliseconds(0);
|
|
11317
|
+
let today = DateTime.now();
|
|
11245
11318
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
11246
11319
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
11247
11320
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -11315,8 +11388,8 @@
|
|
|
11315
11388
|
returns: ["DATE"],
|
|
11316
11389
|
computeFormat: () => "m/d/yyyy",
|
|
11317
11390
|
compute: function () {
|
|
11318
|
-
const today =
|
|
11319
|
-
const jsDate = new
|
|
11391
|
+
const today = DateTime.now();
|
|
11392
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
11320
11393
|
return jsDateToRoundNumber(jsDate);
|
|
11321
11394
|
},
|
|
11322
11395
|
isExported: true,
|
|
@@ -11371,10 +11444,10 @@
|
|
|
11371
11444
|
}
|
|
11372
11445
|
const y = _date.getFullYear();
|
|
11373
11446
|
let dayStart = 1;
|
|
11374
|
-
let startDayOfFirstWeek = new
|
|
11447
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
11375
11448
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
11376
11449
|
dayStart += 1;
|
|
11377
|
-
startDayOfFirstWeek = new
|
|
11450
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
11378
11451
|
}
|
|
11379
11452
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
11380
11453
|
if (dif < 0) {
|
|
@@ -11428,7 +11501,7 @@
|
|
|
11428
11501
|
timesHoliday.add(holiday.getTime());
|
|
11429
11502
|
});
|
|
11430
11503
|
}
|
|
11431
|
-
let stepDate =
|
|
11504
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
11432
11505
|
let timeStepDate = stepDate.getTime();
|
|
11433
11506
|
const unitDay = Math.sign(_numDays);
|
|
11434
11507
|
let stepDay = Math.abs(_numDays);
|
|
@@ -11494,7 +11567,7 @@
|
|
|
11494
11567
|
const _startDate = toJsDate(date);
|
|
11495
11568
|
const yStart = _startDate.getFullYear();
|
|
11496
11569
|
const mStart = _startDate.getMonth();
|
|
11497
|
-
const jsDate = new
|
|
11570
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
11498
11571
|
return jsDateToRoundNumber(jsDate);
|
|
11499
11572
|
},
|
|
11500
11573
|
};
|
|
@@ -11538,7 +11611,7 @@
|
|
|
11538
11611
|
compute: function (date) {
|
|
11539
11612
|
const quarter = QUARTER.compute(date);
|
|
11540
11613
|
const year = YEAR.compute(date);
|
|
11541
|
-
const jsDate = new
|
|
11614
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
11542
11615
|
return jsDateToRoundNumber(jsDate);
|
|
11543
11616
|
},
|
|
11544
11617
|
};
|
|
@@ -11555,7 +11628,7 @@
|
|
|
11555
11628
|
compute: function (date) {
|
|
11556
11629
|
const quarter = QUARTER.compute(date);
|
|
11557
11630
|
const year = YEAR.compute(date);
|
|
11558
|
-
const jsDate = new
|
|
11631
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
11559
11632
|
return jsDateToRoundNumber(jsDate);
|
|
11560
11633
|
},
|
|
11561
11634
|
};
|
|
@@ -11571,7 +11644,7 @@
|
|
|
11571
11644
|
computeFormat: () => "m/d/yyyy",
|
|
11572
11645
|
compute: function (date) {
|
|
11573
11646
|
const year = YEAR.compute(date);
|
|
11574
|
-
const jsDate = new
|
|
11647
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
11575
11648
|
return jsDateToRoundNumber(jsDate);
|
|
11576
11649
|
},
|
|
11577
11650
|
};
|
|
@@ -11587,7 +11660,7 @@
|
|
|
11587
11660
|
computeFormat: () => "m/d/yyyy",
|
|
11588
11661
|
compute: function (date) {
|
|
11589
11662
|
const year = YEAR.compute(date);
|
|
11590
|
-
const jsDate = new
|
|
11663
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
11591
11664
|
return jsDateToRoundNumber(jsDate);
|
|
11592
11665
|
},
|
|
11593
11666
|
};
|
|
@@ -11721,7 +11794,7 @@
|
|
|
11721
11794
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity) {
|
|
11722
11795
|
const startDate = toJsDate(settlement);
|
|
11723
11796
|
const endDate = toJsDate(maturity);
|
|
11724
|
-
const startDatePlusOneYear =
|
|
11797
|
+
const startDatePlusOneYear = toJsDate(settlement);
|
|
11725
11798
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
11726
11799
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _lt("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
11727
11800
|
}
|
|
@@ -15647,7 +15720,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
15647
15720
|
SPACE: goTo(State.RightRef),
|
|
15648
15721
|
NUMBER: goTo(State.Found),
|
|
15649
15722
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
15650
|
-
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
|
|
15723
|
+
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
|
|
15651
15724
|
},
|
|
15652
15725
|
[State.RightColumnRef]: {
|
|
15653
15726
|
SPACE: goTo(State.RightColumnRef),
|
|
@@ -15658,6 +15731,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
15658
15731
|
SPACE: goTo(State.RightRowRef),
|
|
15659
15732
|
NUMBER: goTo(State.Found),
|
|
15660
15733
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
15734
|
+
SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
|
|
15661
15735
|
},
|
|
15662
15736
|
[State.Found]: {},
|
|
15663
15737
|
};
|
|
@@ -16167,6 +16241,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
16167
16241
|
return xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
16168
16242
|
case "colrow":
|
|
16169
16243
|
indexOfNumber = xc.search(/[0-9]/);
|
|
16244
|
+
if (indexOfNumber === -1 || indexOfNumber === 0) {
|
|
16245
|
+
// no row number (eg. A) or no column (eg. 1)
|
|
16246
|
+
return "$" + xc;
|
|
16247
|
+
}
|
|
16170
16248
|
xc = xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
16171
16249
|
return "$" + xc;
|
|
16172
16250
|
case "none":
|
|
@@ -16552,7 +16630,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
16552
16630
|
validateSelection(length, start, end) {
|
|
16553
16631
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
16554
16632
|
? 0 /* CommandResult.Success */
|
|
16555
|
-
:
|
|
16633
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
16556
16634
|
}
|
|
16557
16635
|
onColumnsRemoved(cmd) {
|
|
16558
16636
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -16866,9 +16944,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
16866
16944
|
*/
|
|
16867
16945
|
getReferencedRanges() {
|
|
16868
16946
|
const editionSheetId = this.getters.getEditionSheet();
|
|
16869
|
-
|
|
16947
|
+
const referenceRanges = this.currentTokens
|
|
16870
16948
|
.filter((token) => token.type === "REFERENCE")
|
|
16871
16949
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
16950
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
16872
16951
|
}
|
|
16873
16952
|
/**
|
|
16874
16953
|
* Function used to determine when composer selection can start.
|
|
@@ -16940,10 +17019,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
16940
17019
|
function updateSelectionWithArrowKeys(ev, selection) {
|
|
16941
17020
|
const direction = arrowMap[ev.key];
|
|
16942
17021
|
if (ev.shiftKey) {
|
|
16943
|
-
selection.resizeAnchorZone(direction, ev
|
|
17022
|
+
selection.resizeAnchorZone(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16944
17023
|
}
|
|
16945
17024
|
else {
|
|
16946
|
-
selection.moveAnchorCell(direction, ev
|
|
17025
|
+
selection.moveAnchorCell(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16947
17026
|
}
|
|
16948
17027
|
}
|
|
16949
17028
|
|
|
@@ -19306,7 +19385,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
19306
19385
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
19307
19386
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
19308
19387
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
19309
|
-
if (result.isCancelledBecause(
|
|
19388
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
19310
19389
|
env.raiseError(MergeErrorMessage);
|
|
19311
19390
|
}
|
|
19312
19391
|
}
|
|
@@ -20021,11 +20100,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20021
20100
|
}
|
|
20022
20101
|
get isDatasetInvalid() {
|
|
20023
20102
|
var _a;
|
|
20024
|
-
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20103
|
+
return !!((_a = this.state.datasetDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidDataSet */));
|
|
20025
20104
|
}
|
|
20026
20105
|
get isLabelInvalid() {
|
|
20027
20106
|
var _a;
|
|
20028
|
-
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20107
|
+
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */));
|
|
20029
20108
|
}
|
|
20030
20109
|
onUpdateDataSetsHaveTitle(ev) {
|
|
20031
20110
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -20398,7 +20477,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20398
20477
|
}
|
|
20399
20478
|
get isDataRangeInvalid() {
|
|
20400
20479
|
var _a;
|
|
20401
|
-
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20480
|
+
return !!((_a = this.state.dataRangeDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */));
|
|
20402
20481
|
}
|
|
20403
20482
|
onDataRangeChanged(ranges) {
|
|
20404
20483
|
this.dataRange = ranges[0];
|
|
@@ -20490,28 +20569,28 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20490
20569
|
}
|
|
20491
20570
|
isRangeMinInvalid() {
|
|
20492
20571
|
var _a, _b, _c;
|
|
20493
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20494
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
20495
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
20572
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */)) ||
|
|
20573
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */)) ||
|
|
20574
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
20496
20575
|
}
|
|
20497
20576
|
isRangeMaxInvalid() {
|
|
20498
20577
|
var _a, _b, _c;
|
|
20499
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20500
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
20501
|
-
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(
|
|
20578
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */)) ||
|
|
20579
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */)) ||
|
|
20580
|
+
((_c = this.state.sectionRuleDispatchResult) === null || _c === void 0 ? void 0 : _c.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */)));
|
|
20502
20581
|
}
|
|
20503
20582
|
// ---------------------------------------------------------------------------
|
|
20504
20583
|
// COLOR_SECTION_TEMPLATE
|
|
20505
20584
|
// ---------------------------------------------------------------------------
|
|
20506
20585
|
get isLowerInflectionPointInvalid() {
|
|
20507
20586
|
var _a, _b;
|
|
20508
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20509
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
20587
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */)) ||
|
|
20588
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
20510
20589
|
}
|
|
20511
20590
|
get isUpperInflectionPointInvalid() {
|
|
20512
20591
|
var _a, _b;
|
|
20513
|
-
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20514
|
-
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(
|
|
20592
|
+
return !!(((_a = this.state.sectionRuleDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */)) ||
|
|
20593
|
+
((_b = this.state.sectionRuleDispatchResult) === null || _b === void 0 ? void 0 : _b.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */)));
|
|
20515
20594
|
}
|
|
20516
20595
|
updateInflectionPointValue(attr, ev) {
|
|
20517
20596
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -20624,11 +20703,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20624
20703
|
}
|
|
20625
20704
|
get isKeyValueInvalid() {
|
|
20626
20705
|
var _a;
|
|
20627
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20706
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */));
|
|
20628
20707
|
}
|
|
20629
20708
|
get isBaselineInvalid() {
|
|
20630
20709
|
var _a;
|
|
20631
|
-
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(
|
|
20710
|
+
return !!((_a = this.state.keyValueDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */));
|
|
20632
20711
|
}
|
|
20633
20712
|
onKeyValueRangeChanged(ranges) {
|
|
20634
20713
|
this.keyValue = ranges[0];
|
|
@@ -21484,11 +21563,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21484
21563
|
****************************************************************************/
|
|
21485
21564
|
get isValue1Invalid() {
|
|
21486
21565
|
var _a;
|
|
21487
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
21566
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(52 /* CommandResult.FirstArgMissing */));
|
|
21488
21567
|
}
|
|
21489
21568
|
get isValue2Invalid() {
|
|
21490
21569
|
var _a;
|
|
21491
|
-
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(
|
|
21570
|
+
return !!((_a = this.state.errors) === null || _a === void 0 ? void 0 : _a.includes(53 /* CommandResult.SecondArgMissing */));
|
|
21492
21571
|
}
|
|
21493
21572
|
toggleStyle(tool) {
|
|
21494
21573
|
const style = this.state.rules.cellIs.style;
|
|
@@ -21505,17 +21584,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21505
21584
|
isValueInvalid(threshold) {
|
|
21506
21585
|
switch (threshold) {
|
|
21507
21586
|
case "minimum":
|
|
21508
|
-
return (this.state.errors.includes(
|
|
21509
|
-
this.state.errors.includes(
|
|
21510
|
-
this.state.errors.includes(
|
|
21511
|
-
this.state.errors.includes(
|
|
21587
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
21588
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
21589
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
21590
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
21512
21591
|
case "midpoint":
|
|
21513
|
-
return (this.state.errors.includes(
|
|
21514
|
-
this.state.errors.includes(
|
|
21515
|
-
this.state.errors.includes(
|
|
21592
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
21593
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
21594
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
21516
21595
|
case "maximum":
|
|
21517
|
-
return (this.state.errors.includes(
|
|
21518
|
-
this.state.errors.includes(
|
|
21596
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
21597
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
21519
21598
|
default:
|
|
21520
21599
|
return false;
|
|
21521
21600
|
}
|
|
@@ -21564,13 +21643,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21564
21643
|
isInflectionPointInvalid(inflectionPoint) {
|
|
21565
21644
|
switch (inflectionPoint) {
|
|
21566
21645
|
case "lowerInflectionPoint":
|
|
21567
|
-
return (this.state.errors.includes(
|
|
21568
|
-
this.state.errors.includes(
|
|
21569
|
-
this.state.errors.includes(
|
|
21646
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
21647
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
21648
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
21570
21649
|
case "upperInflectionPoint":
|
|
21571
|
-
return (this.state.errors.includes(
|
|
21572
|
-
this.state.errors.includes(
|
|
21573
|
-
this.state.errors.includes(
|
|
21650
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
21651
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
21652
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
21574
21653
|
default:
|
|
21575
21654
|
return true;
|
|
21576
21655
|
}
|
|
@@ -22600,7 +22679,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22600
22679
|
return;
|
|
22601
22680
|
}
|
|
22602
22681
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
22603
|
-
this.props.onCellClicked(col, row, {
|
|
22682
|
+
this.props.onCellClicked(col, row, {
|
|
22683
|
+
expandZone: ev.shiftKey,
|
|
22684
|
+
addZone: isCtrlKey(ev),
|
|
22685
|
+
});
|
|
22604
22686
|
}
|
|
22605
22687
|
onDoubleClick(ev) {
|
|
22606
22688
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
@@ -22688,6 +22770,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22688
22770
|
draggerShadowThickness: 0,
|
|
22689
22771
|
delta: 0,
|
|
22690
22772
|
base: 0,
|
|
22773
|
+
position: "before",
|
|
22691
22774
|
});
|
|
22692
22775
|
}
|
|
22693
22776
|
_computeHandleDisplay(ev) {
|
|
@@ -22813,11 +22896,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22813
22896
|
this.state.draggerLinePosition = dimensions.start;
|
|
22814
22897
|
this.state.draggerShadowPosition = dimensions.start;
|
|
22815
22898
|
this.state.base = elementIndex;
|
|
22899
|
+
this.state.position = "before";
|
|
22816
22900
|
}
|
|
22817
22901
|
else if (this._getSelectedZoneEnd() < elementIndex) {
|
|
22818
22902
|
this.state.draggerLinePosition = dimensions.end;
|
|
22819
22903
|
this.state.draggerShadowPosition = dimensions.end - this.state.draggerShadowThickness;
|
|
22820
|
-
this.state.base = elementIndex
|
|
22904
|
+
this.state.base = elementIndex;
|
|
22905
|
+
this.state.position = "after";
|
|
22821
22906
|
}
|
|
22822
22907
|
else {
|
|
22823
22908
|
this.state.draggerLinePosition = startDimensions.start;
|
|
@@ -22841,7 +22926,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22841
22926
|
this._increaseSelection(index);
|
|
22842
22927
|
}
|
|
22843
22928
|
else {
|
|
22844
|
-
this._selectElement(index, ev
|
|
22929
|
+
this._selectElement(index, isCtrlKey(ev));
|
|
22845
22930
|
}
|
|
22846
22931
|
this.lastSelectedElementIndex = index;
|
|
22847
22932
|
const mouseMoveSelect = (col, row) => {
|
|
@@ -22854,7 +22939,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22854
22939
|
const mouseUpSelect = () => {
|
|
22855
22940
|
this.state.isSelecting = false;
|
|
22856
22941
|
this.lastSelectedElementIndex = null;
|
|
22857
|
-
this.env.model.dispatch(ev
|
|
22942
|
+
this.env.model.dispatch(isCtrlKey(ev) ? "PREPARE_SELECTION_INPUT_EXPANSION" : "STOP_SELECTION_INPUT");
|
|
22858
22943
|
this._computeGrabDisplay(ev);
|
|
22859
22944
|
};
|
|
22860
22945
|
dragAndDropBeyondTheViewport(this.env, mouseMoveSelect, mouseUpSelect);
|
|
@@ -22998,13 +23083,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
22998
23083
|
dimension: "COL",
|
|
22999
23084
|
base: this.state.base,
|
|
23000
23085
|
elements,
|
|
23086
|
+
position: this.state.position,
|
|
23001
23087
|
});
|
|
23002
23088
|
if (!result.isSuccessful && result.reasons.includes(2 /* CommandResult.WillRemoveExistingMerge */)) {
|
|
23003
23089
|
this.env.raiseError(MergeErrorMessage);
|
|
23004
23090
|
}
|
|
23005
23091
|
}
|
|
23006
|
-
_selectElement(index,
|
|
23007
|
-
this.env.model.selection.selectColumn(index,
|
|
23092
|
+
_selectElement(index, addDistinctHeader) {
|
|
23093
|
+
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
23008
23094
|
}
|
|
23009
23095
|
_increaseSelection(index) {
|
|
23010
23096
|
this.env.model.selection.selectColumn(index, "updateAnchor");
|
|
@@ -23170,13 +23256,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
23170
23256
|
dimension: "ROW",
|
|
23171
23257
|
base: this.state.base,
|
|
23172
23258
|
elements,
|
|
23259
|
+
position: this.state.position,
|
|
23173
23260
|
});
|
|
23174
23261
|
if (!result.isSuccessful && result.reasons.includes(2 /* CommandResult.WillRemoveExistingMerge */)) {
|
|
23175
23262
|
this.env.raiseError(MergeErrorMessage);
|
|
23176
23263
|
}
|
|
23177
23264
|
}
|
|
23178
|
-
_selectElement(index,
|
|
23179
|
-
this.env.model.selection.selectRow(index,
|
|
23265
|
+
_selectElement(index, addDistinctHeader) {
|
|
23266
|
+
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
23180
23267
|
}
|
|
23181
23268
|
_increaseSelection(index) {
|
|
23182
23269
|
this.env.model.selection.selectRow(index, "updateAnchor");
|
|
@@ -23278,8 +23365,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
23278
23365
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
23279
23366
|
}
|
|
23280
23367
|
const onMouseWheel = (ev) => {
|
|
23281
|
-
const deltaX = normalize(ev.shiftKey ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
23282
|
-
const deltaY = normalize(ev.shiftKey ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
23368
|
+
const deltaX = normalize(ev.shiftKey && !isMacOS() ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
23369
|
+
const deltaY = normalize(ev.shiftKey && !isMacOS() ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
23283
23370
|
handler(deltaX, deltaY);
|
|
23284
23371
|
};
|
|
23285
23372
|
return onMouseWheel;
|
|
@@ -23923,8 +24010,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
23923
24010
|
// ---------------------------------------------------------------------------
|
|
23924
24011
|
// Zone selection with mouse
|
|
23925
24012
|
// ---------------------------------------------------------------------------
|
|
23926
|
-
onCellClicked(col, row, {
|
|
23927
|
-
if (
|
|
24013
|
+
onCellClicked(col, row, { addZone, expandZone }) {
|
|
24014
|
+
if (addZone) {
|
|
23928
24015
|
this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION");
|
|
23929
24016
|
}
|
|
23930
24017
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
@@ -23933,10 +24020,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
23933
24020
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
23934
24021
|
this.env.model.dispatch("STOP_EDITION");
|
|
23935
24022
|
}
|
|
23936
|
-
if (
|
|
24023
|
+
if (expandZone) {
|
|
23937
24024
|
this.env.model.selection.setAnchorCorner(col, row);
|
|
23938
24025
|
}
|
|
23939
|
-
else if (
|
|
24026
|
+
else if (addZone) {
|
|
23940
24027
|
this.env.model.selection.addCellToSelection(col, row);
|
|
23941
24028
|
}
|
|
23942
24029
|
else {
|
|
@@ -23998,9 +24085,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
23998
24085
|
return;
|
|
23999
24086
|
}
|
|
24000
24087
|
let keyDownString = "";
|
|
24001
|
-
if (ev
|
|
24002
|
-
keyDownString += "CTRL+";
|
|
24003
|
-
if (ev.metaKey)
|
|
24088
|
+
if (isCtrlKey(ev))
|
|
24004
24089
|
keyDownString += "CTRL+";
|
|
24005
24090
|
if (ev.altKey)
|
|
24006
24091
|
keyDownString += "ALT+";
|
|
@@ -28360,7 +28445,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28360
28445
|
const currentBorder = this.getCellBorder(cmd);
|
|
28361
28446
|
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);
|
|
28362
28447
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
28363
|
-
return
|
|
28448
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28364
28449
|
}
|
|
28365
28450
|
return 0 /* CommandResult.Success */;
|
|
28366
28451
|
}
|
|
@@ -28882,9 +28967,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28882
28967
|
checkUselessClearCell(cmd) {
|
|
28883
28968
|
const cell = this.getters.getCell(cmd);
|
|
28884
28969
|
if (!cell)
|
|
28885
|
-
return
|
|
28970
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28886
28971
|
if (!cell.content && !cell.style && !cell.format) {
|
|
28887
|
-
return
|
|
28972
|
+
return 89 /* CommandResult.NoChanges */;
|
|
28888
28973
|
}
|
|
28889
28974
|
return 0 /* CommandResult.Success */;
|
|
28890
28975
|
}
|
|
@@ -29093,13 +29178,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29093
29178
|
}
|
|
29094
29179
|
checkChartDuplicate(cmd) {
|
|
29095
29180
|
return this.getters.getFigureSheetId(cmd.id)
|
|
29096
|
-
?
|
|
29181
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
29097
29182
|
: 0 /* CommandResult.Success */;
|
|
29098
29183
|
}
|
|
29099
29184
|
checkChartExists(cmd) {
|
|
29100
29185
|
return this.getters.getFigureSheetId(cmd.id)
|
|
29101
29186
|
? 0 /* CommandResult.Success */
|
|
29102
|
-
:
|
|
29187
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
29103
29188
|
}
|
|
29104
29189
|
}
|
|
29105
29190
|
ChartPlugin.getters = [
|
|
@@ -29301,10 +29386,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29301
29386
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
29302
29387
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
29303
29388
|
if (ruleIndex === -1)
|
|
29304
|
-
return
|
|
29389
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
29305
29390
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
29306
29391
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
29307
|
-
return
|
|
29392
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
29308
29393
|
}
|
|
29309
29394
|
return 0 /* CommandResult.Success */;
|
|
29310
29395
|
}
|
|
@@ -29345,10 +29430,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29345
29430
|
const errors = [];
|
|
29346
29431
|
const isEmpty = (value) => value === undefined || value === "";
|
|
29347
29432
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
29348
|
-
errors.push(
|
|
29433
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
29349
29434
|
}
|
|
29350
29435
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
29351
|
-
errors.push(
|
|
29436
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
29352
29437
|
}
|
|
29353
29438
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
29354
29439
|
}
|
|
@@ -29360,15 +29445,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29360
29445
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
29361
29446
|
switch (thresholdName) {
|
|
29362
29447
|
case "min":
|
|
29363
|
-
return
|
|
29448
|
+
return 54 /* CommandResult.MinNaN */;
|
|
29364
29449
|
case "max":
|
|
29365
|
-
return
|
|
29450
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
29366
29451
|
case "mid":
|
|
29367
|
-
return
|
|
29452
|
+
return 55 /* CommandResult.MidNaN */;
|
|
29368
29453
|
case "upperInflectionPoint":
|
|
29369
|
-
return
|
|
29454
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
29370
29455
|
case "lowerInflectionPoint":
|
|
29371
|
-
return
|
|
29456
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
29372
29457
|
}
|
|
29373
29458
|
}
|
|
29374
29459
|
return 0 /* CommandResult.Success */;
|
|
@@ -29382,15 +29467,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29382
29467
|
catch (error) {
|
|
29383
29468
|
switch (thresholdName) {
|
|
29384
29469
|
case "min":
|
|
29385
|
-
return
|
|
29470
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
29386
29471
|
case "max":
|
|
29387
|
-
return
|
|
29472
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
29388
29473
|
case "mid":
|
|
29389
|
-
return
|
|
29474
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
29390
29475
|
case "upperInflectionPoint":
|
|
29391
|
-
return
|
|
29476
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
29392
29477
|
case "lowerInflectionPoint":
|
|
29393
|
-
return
|
|
29478
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
29394
29479
|
}
|
|
29395
29480
|
}
|
|
29396
29481
|
return 0 /* CommandResult.Success */;
|
|
@@ -29407,7 +29492,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29407
29492
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
29408
29493
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
29409
29494
|
Number(minValue) > Number(maxValue)) {
|
|
29410
|
-
return
|
|
29495
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
29411
29496
|
}
|
|
29412
29497
|
return 0 /* CommandResult.Success */;
|
|
29413
29498
|
}
|
|
@@ -29417,7 +29502,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29417
29502
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
29418
29503
|
rule.minimum.type === rule.maximum.type &&
|
|
29419
29504
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
29420
|
-
return
|
|
29505
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
29421
29506
|
}
|
|
29422
29507
|
return 0 /* CommandResult.Success */;
|
|
29423
29508
|
}
|
|
@@ -29429,7 +29514,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29429
29514
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
29430
29515
|
rule.midpoint.type === rule.maximum.type &&
|
|
29431
29516
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
29432
|
-
return
|
|
29517
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
29433
29518
|
}
|
|
29434
29519
|
return 0 /* CommandResult.Success */;
|
|
29435
29520
|
}
|
|
@@ -29441,7 +29526,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29441
29526
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
29442
29527
|
rule.minimum.type === rule.midpoint.type &&
|
|
29443
29528
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
29444
|
-
return
|
|
29529
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
29445
29530
|
}
|
|
29446
29531
|
return 0 /* CommandResult.Success */;
|
|
29447
29532
|
}
|
|
@@ -29542,13 +29627,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29542
29627
|
checkFigureExists(sheetId, figureId) {
|
|
29543
29628
|
var _a;
|
|
29544
29629
|
if (((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === undefined) {
|
|
29545
|
-
return
|
|
29630
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
29546
29631
|
}
|
|
29547
29632
|
return 0 /* CommandResult.Success */;
|
|
29548
29633
|
}
|
|
29549
29634
|
checkFigureDuplicate(figureId) {
|
|
29550
29635
|
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
29551
|
-
return
|
|
29636
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
29552
29637
|
}
|
|
29553
29638
|
return 0 /* CommandResult.Success */;
|
|
29554
29639
|
}
|
|
@@ -29650,12 +29735,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29650
29735
|
switch (cmd.type) {
|
|
29651
29736
|
case "CREATE_FILTER_TABLE":
|
|
29652
29737
|
if (!areZonesContinuous(...cmd.target)) {
|
|
29653
|
-
return
|
|
29738
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
29654
29739
|
}
|
|
29655
29740
|
const zone = union(...cmd.target);
|
|
29656
29741
|
const checkFilterOverlap = () => {
|
|
29657
29742
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
29658
|
-
return
|
|
29743
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
29659
29744
|
}
|
|
29660
29745
|
return 0 /* CommandResult.Success */;
|
|
29661
29746
|
};
|
|
@@ -29663,7 +29748,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29663
29748
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
29664
29749
|
for (let merge of mergesInTarget) {
|
|
29665
29750
|
if (overlap(zone, merge)) {
|
|
29666
|
-
return
|
|
29751
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29667
29752
|
}
|
|
29668
29753
|
}
|
|
29669
29754
|
return 0 /* CommandResult.Success */;
|
|
@@ -29673,7 +29758,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
29673
29758
|
for (let merge of cmd.target) {
|
|
29674
29759
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
29675
29760
|
if (overlap(filterTable.zone, merge)) {
|
|
29676
|
-
return
|
|
29761
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
29677
29762
|
}
|
|
29678
29763
|
}
|
|
29679
29764
|
}
|
|
@@ -30173,10 +30258,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30173
30258
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
30174
30259
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
30175
30260
|
if (hiddenElements.size >= elements) {
|
|
30176
|
-
return
|
|
30261
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
30177
30262
|
}
|
|
30178
30263
|
else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
30179
|
-
return
|
|
30264
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
30180
30265
|
}
|
|
30181
30266
|
else {
|
|
30182
30267
|
return 0 /* CommandResult.Success */;
|
|
@@ -30702,7 +30787,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30702
30787
|
for (const zone of target) {
|
|
30703
30788
|
for (const zone2 of target) {
|
|
30704
30789
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
30705
|
-
return
|
|
30790
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
30706
30791
|
}
|
|
30707
30792
|
}
|
|
30708
30793
|
}
|
|
@@ -30716,7 +30801,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30716
30801
|
for (const zone of target) {
|
|
30717
30802
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
30718
30803
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
30719
|
-
return
|
|
30804
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
30720
30805
|
}
|
|
30721
30806
|
}
|
|
30722
30807
|
return 0 /* CommandResult.Success */;
|
|
@@ -31248,9 +31333,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31248
31333
|
* Get a Xc string that represent a part of a range
|
|
31249
31334
|
*/
|
|
31250
31335
|
getRangePartString(range, part) {
|
|
31251
|
-
|
|
31336
|
+
var _a, _b;
|
|
31337
|
+
const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
|
|
31252
31338
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
31253
|
-
const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
|
|
31339
|
+
const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
|
|
31254
31340
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
31255
31341
|
let str = "";
|
|
31256
31342
|
if (range.isFullCol) {
|
|
@@ -31348,11 +31434,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31348
31434
|
const elements = cmd.dimension === "COL"
|
|
31349
31435
|
? this.getNumberCols(cmd.sheetId)
|
|
31350
31436
|
: this.getNumberRows(cmd.sheetId);
|
|
31351
|
-
if (cmd.base < 0 || cmd.base
|
|
31352
|
-
return
|
|
31437
|
+
if (cmd.base < 0 || cmd.base >= elements) {
|
|
31438
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31353
31439
|
}
|
|
31354
31440
|
else if (cmd.quantity <= 0) {
|
|
31355
|
-
return
|
|
31441
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
31356
31442
|
}
|
|
31357
31443
|
return 0 /* CommandResult.Success */;
|
|
31358
31444
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -31360,7 +31446,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31360
31446
|
? this.getNumberCols(cmd.sheetId)
|
|
31361
31447
|
: this.getNumberRows(cmd.sheetId);
|
|
31362
31448
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
31363
|
-
return
|
|
31449
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31364
31450
|
}
|
|
31365
31451
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
31366
31452
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -31804,18 +31890,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31804
31890
|
checkRowFreezeQuantity(cmd) {
|
|
31805
31891
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
31806
31892
|
? 0 /* CommandResult.Success */
|
|
31807
|
-
:
|
|
31893
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
31808
31894
|
}
|
|
31809
31895
|
checkColFreezeQuantity(cmd) {
|
|
31810
31896
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
31811
31897
|
? 0 /* CommandResult.Success */
|
|
31812
|
-
:
|
|
31898
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
31813
31899
|
}
|
|
31814
31900
|
checkRowFreezeOverlapMerge(cmd) {
|
|
31815
31901
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
31816
31902
|
for (let merge of merges) {
|
|
31817
31903
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
31818
|
-
return
|
|
31904
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31819
31905
|
}
|
|
31820
31906
|
}
|
|
31821
31907
|
return 0 /* CommandResult.Success */;
|
|
@@ -31824,7 +31910,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31824
31910
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
31825
31911
|
for (let merge of merges) {
|
|
31826
31912
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
31827
|
-
return
|
|
31913
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31828
31914
|
}
|
|
31829
31915
|
}
|
|
31830
31916
|
return 0 /* CommandResult.Success */;
|
|
@@ -32371,13 +32457,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32371
32457
|
// Getters
|
|
32372
32458
|
// ---------------------------------------------------------------------------
|
|
32373
32459
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
32374
|
-
|
|
32375
|
-
|
|
32376
|
-
|
|
32377
|
-
|
|
32378
|
-
|
|
32460
|
+
try {
|
|
32461
|
+
const compiledFormula = compile(formulaString);
|
|
32462
|
+
const params = this.getCompilationParameters((cell) => this.getEvaluatedCell(this.getters.getCellPosition(cell.id)));
|
|
32463
|
+
const ranges = [];
|
|
32464
|
+
for (let xc of compiledFormula.dependencies) {
|
|
32465
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
32466
|
+
}
|
|
32467
|
+
return compiledFormula.execute(ranges, ...params).value;
|
|
32468
|
+
}
|
|
32469
|
+
catch (error) {
|
|
32470
|
+
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
32379
32471
|
}
|
|
32380
|
-
return compiledFormula.execute(ranges, ...params).value;
|
|
32381
32472
|
}
|
|
32382
32473
|
/**
|
|
32383
32474
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -32556,10 +32647,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32556
32647
|
* that are actually present in the grid.
|
|
32557
32648
|
*/
|
|
32558
32649
|
function range(range) {
|
|
32650
|
+
assertRangeValid(range);
|
|
32559
32651
|
const sheetId = range.sheetId;
|
|
32560
|
-
if (!isZoneValid(range.zone)) {
|
|
32561
|
-
throw new InvalidReferenceError();
|
|
32562
|
-
}
|
|
32563
32652
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
32564
32653
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
32565
32654
|
const sheetZone = getters.getSheetZone(sheetId);
|
|
@@ -32594,23 +32683,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32594
32683
|
* The `compute` of the formula's function must process it completely
|
|
32595
32684
|
*/
|
|
32596
32685
|
function refFn(range, isMeta, functionName, paramNumber) {
|
|
32686
|
+
assertRangeValid(range);
|
|
32597
32687
|
if (isMeta) {
|
|
32598
32688
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
32599
32689
|
return { value: zoneToXc(range.zone) };
|
|
32600
32690
|
}
|
|
32601
|
-
if (!isZoneValid(range.zone)) {
|
|
32602
|
-
throw new InvalidReferenceError();
|
|
32603
|
-
}
|
|
32604
32691
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
32605
32692
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
32606
32693
|
throw new Error(paramNumber
|
|
32607
32694
|
? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
32608
32695
|
: _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
32609
32696
|
}
|
|
32697
|
+
return readCell(range);
|
|
32698
|
+
}
|
|
32699
|
+
function assertRangeValid(range) {
|
|
32700
|
+
if (!isZoneValid(range.zone)) {
|
|
32701
|
+
throw new InvalidReferenceError();
|
|
32702
|
+
}
|
|
32610
32703
|
if (range.invalidSheetName) {
|
|
32611
32704
|
throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
|
|
32612
32705
|
}
|
|
32613
|
-
return readCell(range);
|
|
32614
32706
|
}
|
|
32615
32707
|
return [refFn, range, evalContext];
|
|
32616
32708
|
}
|
|
@@ -32869,39 +32961,34 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32869
32961
|
this.computedIcons[sheetId] = {};
|
|
32870
32962
|
const computedStyle = this.computedStyles[sheetId];
|
|
32871
32963
|
for (let cf of this.getters.getConditionalFormats(sheetId).reverse()) {
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
|
|
32877
|
-
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
|
|
32882
|
-
|
|
32883
|
-
|
|
32884
|
-
|
|
32885
|
-
|
|
32886
|
-
|
|
32887
|
-
for (let
|
|
32888
|
-
|
|
32889
|
-
|
|
32890
|
-
|
|
32891
|
-
if (
|
|
32892
|
-
|
|
32893
|
-
|
|
32894
|
-
|
|
32895
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32896
|
-
}
|
|
32964
|
+
switch (cf.rule.type) {
|
|
32965
|
+
case "ColorScaleRule":
|
|
32966
|
+
for (let range of cf.ranges) {
|
|
32967
|
+
this.applyColorScale(range, cf.rule);
|
|
32968
|
+
}
|
|
32969
|
+
break;
|
|
32970
|
+
case "IconSetRule":
|
|
32971
|
+
for (let range of cf.ranges) {
|
|
32972
|
+
this.applyIcon(range, cf.rule);
|
|
32973
|
+
}
|
|
32974
|
+
break;
|
|
32975
|
+
default:
|
|
32976
|
+
for (let ref of cf.ranges) {
|
|
32977
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, ref).zone;
|
|
32978
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
32979
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
32980
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
32981
|
+
let cell = this.getters.getEvaluatedCell({ sheetId, col, row });
|
|
32982
|
+
if (pr && pr(cell, cf.rule)) {
|
|
32983
|
+
if (!computedStyle[col])
|
|
32984
|
+
computedStyle[col] = [];
|
|
32985
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
32986
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32897
32987
|
}
|
|
32898
32988
|
}
|
|
32899
32989
|
}
|
|
32900
|
-
|
|
32901
|
-
|
|
32902
|
-
}
|
|
32903
|
-
catch (_) {
|
|
32904
|
-
// we don't care about the errors within the evaluation of a rule
|
|
32990
|
+
}
|
|
32991
|
+
break;
|
|
32905
32992
|
}
|
|
32906
32993
|
}
|
|
32907
32994
|
}
|
|
@@ -32926,7 +33013,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32926
33013
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
32927
33014
|
case "formula":
|
|
32928
33015
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
32929
|
-
return
|
|
33016
|
+
return typeof value === "number" ? value : null;
|
|
32930
33017
|
default:
|
|
32931
33018
|
return null;
|
|
32932
33019
|
}
|
|
@@ -33114,7 +33201,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
33114
33201
|
switch (cmd.type) {
|
|
33115
33202
|
case "UPDATE_FILTER":
|
|
33116
33203
|
if (!this.getters.getFilterId(cmd)) {
|
|
33117
|
-
return
|
|
33204
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
33118
33205
|
}
|
|
33119
33206
|
break;
|
|
33120
33207
|
}
|
|
@@ -34060,7 +34147,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34060
34147
|
}
|
|
34061
34148
|
checkPositiveDimension(cmd) {
|
|
34062
34149
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
34063
|
-
return
|
|
34150
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
34064
34151
|
}
|
|
34065
34152
|
return 0 /* CommandResult.Success */;
|
|
34066
34153
|
}
|
|
@@ -34070,7 +34157,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34070
34157
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
34071
34158
|
cmd.width === width &&
|
|
34072
34159
|
cmd.height === height) {
|
|
34073
|
-
return
|
|
34160
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
34074
34161
|
}
|
|
34075
34162
|
return 0 /* CommandResult.Success */;
|
|
34076
34163
|
}
|
|
@@ -34078,7 +34165,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34078
34165
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
34079
34166
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
34080
34167
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
34081
|
-
return
|
|
34168
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
34082
34169
|
}
|
|
34083
34170
|
return 0 /* CommandResult.Success */;
|
|
34084
34171
|
}
|
|
@@ -34334,7 +34421,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34334
34421
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
34335
34422
|
return 0 /* CommandResult.Success */;
|
|
34336
34423
|
}
|
|
34337
|
-
return
|
|
34424
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
34338
34425
|
case "AUTOFILL_AUTO":
|
|
34339
34426
|
const zone = this.getters.getSelectedZone();
|
|
34340
34427
|
return zone.top === zone.bottom
|
|
@@ -34488,24 +34575,27 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34488
34575
|
* autofiller
|
|
34489
34576
|
*/
|
|
34490
34577
|
autofillAuto() {
|
|
34578
|
+
var _a, _b;
|
|
34491
34579
|
const zone = this.getters.getSelectedZone();
|
|
34492
34580
|
const sheetId = this.getters.getActiveSheetId();
|
|
34493
34581
|
let col = zone.left;
|
|
34494
34582
|
let row = zone.bottom;
|
|
34495
34583
|
if (col > 0) {
|
|
34496
|
-
let
|
|
34497
|
-
while (
|
|
34584
|
+
let leftPosition = { sheetId, col: col - 1, row };
|
|
34585
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
|
|
34586
|
+
((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content)) {
|
|
34498
34587
|
row += 1;
|
|
34499
|
-
|
|
34588
|
+
leftPosition = { sheetId, col: col - 1, row };
|
|
34500
34589
|
}
|
|
34501
34590
|
}
|
|
34502
34591
|
if (row === zone.bottom) {
|
|
34503
34592
|
col = zone.right;
|
|
34504
34593
|
if (col <= this.getters.getNumberCols(sheetId)) {
|
|
34505
|
-
let
|
|
34506
|
-
while (
|
|
34594
|
+
let rightPosition = { sheetId, col: col + 1, row };
|
|
34595
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
|
|
34596
|
+
((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content)) {
|
|
34507
34597
|
row += 1;
|
|
34508
|
-
|
|
34598
|
+
rightPosition = { sheetId, col: col + 1, row };
|
|
34509
34599
|
}
|
|
34510
34600
|
}
|
|
34511
34601
|
}
|
|
@@ -34933,7 +35023,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34933
35023
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
34934
35024
|
}
|
|
34935
35025
|
catch (error) {
|
|
34936
|
-
return
|
|
35026
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
34937
35027
|
}
|
|
34938
35028
|
return 0 /* CommandResult.Success */;
|
|
34939
35029
|
default:
|
|
@@ -36136,21 +36226,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36136
36226
|
// ---------------------------------------------------------------------------
|
|
36137
36227
|
// Command Handling
|
|
36138
36228
|
// ---------------------------------------------------------------------------
|
|
36139
|
-
allowDispatch(cmd) {
|
|
36140
|
-
switch (cmd.type) {
|
|
36141
|
-
case "ADD_EMPTY_RANGE":
|
|
36142
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
36143
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36144
|
-
}
|
|
36145
|
-
break;
|
|
36146
|
-
case "CHANGE_RANGE":
|
|
36147
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
36148
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36149
|
-
}
|
|
36150
|
-
break;
|
|
36151
|
-
}
|
|
36152
|
-
return 0 /* CommandResult.Success */;
|
|
36153
|
-
}
|
|
36154
36229
|
handleEvent(event) {
|
|
36155
36230
|
const xc = zoneToXc(event.anchor.zone);
|
|
36156
36231
|
const inputSheetId = this.activeSheet;
|
|
@@ -36362,6 +36437,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36362
36437
|
// ---------------------------------------------------------------------------
|
|
36363
36438
|
allowDispatch(cmd) {
|
|
36364
36439
|
var _a, _b;
|
|
36440
|
+
switch (cmd.type) {
|
|
36441
|
+
case "FOCUS_RANGE":
|
|
36442
|
+
case "CHANGE_RANGE":
|
|
36443
|
+
case "ADD_EMPTY_RANGE":
|
|
36444
|
+
case "REMOVE_RANGE":
|
|
36445
|
+
if (!this.inputs[cmd.id]) {
|
|
36446
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
36447
|
+
}
|
|
36448
|
+
}
|
|
36365
36449
|
switch (cmd.type) {
|
|
36366
36450
|
case "FOCUS_RANGE":
|
|
36367
36451
|
const index = (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.getIndex(cmd.rangeId);
|
|
@@ -36369,9 +36453,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36369
36453
|
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
36370
36454
|
}
|
|
36371
36455
|
break;
|
|
36372
|
-
|
|
36373
|
-
|
|
36374
|
-
|
|
36456
|
+
case "ADD_EMPTY_RANGE":
|
|
36457
|
+
const input = this.inputs[cmd.id];
|
|
36458
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
36459
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36460
|
+
}
|
|
36461
|
+
break;
|
|
36462
|
+
case "CHANGE_RANGE": {
|
|
36463
|
+
const input = this.inputs[cmd.id];
|
|
36464
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
36465
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
36466
|
+
}
|
|
36467
|
+
break;
|
|
36468
|
+
}
|
|
36375
36469
|
}
|
|
36376
36470
|
return 0 /* CommandResult.Success */;
|
|
36377
36471
|
}
|
|
@@ -37354,7 +37448,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37354
37448
|
/*Test the presence of single cells*/
|
|
37355
37449
|
const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
|
|
37356
37450
|
if (singleCells) {
|
|
37357
|
-
return
|
|
37451
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37358
37452
|
}
|
|
37359
37453
|
return 0 /* CommandResult.Success */;
|
|
37360
37454
|
}
|
|
@@ -37373,7 +37467,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
37373
37467
|
];
|
|
37374
37468
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
37375
37469
|
})) {
|
|
37376
|
-
return
|
|
37470
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
37377
37471
|
}
|
|
37378
37472
|
return 0 /* CommandResult.Success */;
|
|
37379
37473
|
}
|
|
@@ -38001,7 +38095,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
38001
38095
|
for (const zone of this.getPasteZones(target)) {
|
|
38002
38096
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
38003
38097
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
38004
|
-
return
|
|
38098
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
38005
38099
|
}
|
|
38006
38100
|
}
|
|
38007
38101
|
return 0 /* CommandResult.Success */;
|
|
@@ -38389,7 +38483,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
38389
38483
|
}
|
|
38390
38484
|
isPasteAllowed(target, option) {
|
|
38391
38485
|
if (target.length === 0) {
|
|
38392
|
-
return
|
|
38486
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
38393
38487
|
}
|
|
38394
38488
|
if ((option === null || option === void 0 ? void 0 : option.pasteOption) !== undefined) {
|
|
38395
38489
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -39237,7 +39331,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
39237
39331
|
sheetId: cmd.sheetId,
|
|
39238
39332
|
base: cmd.base,
|
|
39239
39333
|
quantity: thickness,
|
|
39240
|
-
position:
|
|
39334
|
+
position: cmd.position,
|
|
39241
39335
|
});
|
|
39242
39336
|
const isCol = cmd.dimension === "COL";
|
|
39243
39337
|
const start = cmd.elements[0];
|
|
@@ -39254,12 +39348,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
39254
39348
|
},
|
|
39255
39349
|
];
|
|
39256
39350
|
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
39351
|
+
const base = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
39257
39352
|
const pasteTarget = [
|
|
39258
39353
|
{
|
|
39259
|
-
left: isCol ?
|
|
39260
|
-
right: isCol ?
|
|
39261
|
-
top: !isCol ?
|
|
39262
|
-
bottom: !isCol ?
|
|
39354
|
+
left: isCol ? base : 0,
|
|
39355
|
+
right: isCol ? base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
39356
|
+
top: !isCol ? base : 0,
|
|
39357
|
+
bottom: !isCol ? base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
39263
39358
|
},
|
|
39264
39359
|
];
|
|
39265
39360
|
state.paste(pasteTarget, { selectTarget: true });
|
|
@@ -39296,6 +39391,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
39296
39391
|
doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) {
|
|
39297
39392
|
return 2 /* CommandResult.WillRemoveExistingMerge */;
|
|
39298
39393
|
}
|
|
39394
|
+
const headers = [cmd.base, ...cmd.elements];
|
|
39395
|
+
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
39396
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
39397
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
39398
|
+
}
|
|
39299
39399
|
return 0 /* CommandResult.Success */;
|
|
39300
39400
|
}
|
|
39301
39401
|
//-------------------------------------------
|
|
@@ -40102,7 +40202,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40102
40202
|
};
|
|
40103
40203
|
function interactiveAddMerge(env, sheetId, target) {
|
|
40104
40204
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
40105
|
-
if (result.isCancelledBecause(
|
|
40205
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
40106
40206
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
40107
40207
|
}
|
|
40108
40208
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -40849,7 +40949,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40849
40949
|
}
|
|
40850
40950
|
onKeydown(ev) {
|
|
40851
40951
|
let keyDownString = "";
|
|
40852
|
-
if (ev
|
|
40952
|
+
if (isCtrlKey(ev)) {
|
|
40853
40953
|
keyDownString += "CTRL+";
|
|
40854
40954
|
}
|
|
40855
40955
|
keyDownString += ev.key.toUpperCase();
|
|
@@ -41977,7 +42077,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
41977
42077
|
*/
|
|
41978
42078
|
moveAnchorCell(direction, step = 1) {
|
|
41979
42079
|
if (step !== "end" && step <= 0) {
|
|
41980
|
-
return new DispatchResult(
|
|
42080
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
41981
42081
|
}
|
|
41982
42082
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
41983
42083
|
return this.selectCell(col, row);
|
|
@@ -42023,7 +42123,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
42023
42123
|
*/
|
|
42024
42124
|
resizeAnchorZone(direction, step = 1) {
|
|
42025
42125
|
if (step !== "end" && step <= 0) {
|
|
42026
|
-
return new DispatchResult(
|
|
42126
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
42027
42127
|
}
|
|
42028
42128
|
const sheetId = this.getters.getActiveSheetId();
|
|
42029
42129
|
const anchor = this.anchor;
|
|
@@ -43983,10 +44083,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43983
44083
|
const command = { ...payload, type };
|
|
43984
44084
|
let status = this.status;
|
|
43985
44085
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
43986
|
-
return new DispatchResult(
|
|
44086
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
43987
44087
|
}
|
|
43988
44088
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
43989
|
-
return new DispatchResult(
|
|
44089
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
43990
44090
|
}
|
|
43991
44091
|
switch (status) {
|
|
43992
44092
|
case 0 /* Status.Ready */:
|
|
@@ -44476,9 +44576,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
44476
44576
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
44477
44577
|
|
|
44478
44578
|
|
|
44479
|
-
__info__.version = '16.1.
|
|
44480
|
-
__info__.date = '
|
|
44481
|
-
__info__.hash = '
|
|
44579
|
+
__info__.version = '16.1.33';
|
|
44580
|
+
__info__.date = '2024-01-29T13:49:43.259Z';
|
|
44581
|
+
__info__.hash = 'd3b27dd';
|
|
44482
44582
|
|
|
44483
44583
|
|
|
44484
44584
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|