@odoo/o-spreadsheet 16.3.18 → 16.3.24
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 +529 -430
- package/dist/o-spreadsheet.d.ts +108 -77
- package/dist/o-spreadsheet.esm.js +529 -430
- package/dist/o-spreadsheet.iife.js +529 -430
- package/dist/o-spreadsheet.iife.min.js +255 -262
- package/dist/o_spreadsheet.xml +5 -5
- package/package.json +1 -1
|
@@ -299,15 +299,80 @@
|
|
|
299
299
|
// -----------------------------------------------------------------------------
|
|
300
300
|
// Date Type
|
|
301
301
|
// -----------------------------------------------------------------------------
|
|
302
|
+
/**
|
|
303
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
304
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
305
|
+
* and it is timezone-agnostic.
|
|
306
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
307
|
+
*/
|
|
308
|
+
class DateTime {
|
|
309
|
+
jsDate;
|
|
310
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
311
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
312
|
+
}
|
|
313
|
+
static fromTimestamp(timestamp) {
|
|
314
|
+
const date = new Date(timestamp);
|
|
315
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
316
|
+
}
|
|
317
|
+
static now() {
|
|
318
|
+
const now = new Date();
|
|
319
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
320
|
+
}
|
|
321
|
+
toString() {
|
|
322
|
+
return this.jsDate.toString();
|
|
323
|
+
}
|
|
324
|
+
toLocaleDateString() {
|
|
325
|
+
return this.jsDate.toLocaleDateString();
|
|
326
|
+
}
|
|
327
|
+
getTime() {
|
|
328
|
+
return this.jsDate.getTime();
|
|
329
|
+
}
|
|
330
|
+
getFullYear() {
|
|
331
|
+
return this.jsDate.getUTCFullYear();
|
|
332
|
+
}
|
|
333
|
+
getMonth() {
|
|
334
|
+
return this.jsDate.getUTCMonth();
|
|
335
|
+
}
|
|
336
|
+
getDate() {
|
|
337
|
+
return this.jsDate.getUTCDate();
|
|
338
|
+
}
|
|
339
|
+
getDay() {
|
|
340
|
+
return this.jsDate.getUTCDay();
|
|
341
|
+
}
|
|
342
|
+
getHours() {
|
|
343
|
+
return this.jsDate.getUTCHours();
|
|
344
|
+
}
|
|
345
|
+
getMinutes() {
|
|
346
|
+
return this.jsDate.getUTCMinutes();
|
|
347
|
+
}
|
|
348
|
+
getSeconds() {
|
|
349
|
+
return this.jsDate.getUTCSeconds();
|
|
350
|
+
}
|
|
351
|
+
setFullYear(year) {
|
|
352
|
+
this.jsDate.setFullYear(year);
|
|
353
|
+
}
|
|
354
|
+
setDate(date) {
|
|
355
|
+
this.jsDate.setUTCDate(date);
|
|
356
|
+
}
|
|
357
|
+
setHours(hours) {
|
|
358
|
+
this.jsDate.setUTCHours(hours);
|
|
359
|
+
}
|
|
360
|
+
setMinutes(minutes) {
|
|
361
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
362
|
+
}
|
|
363
|
+
setSeconds(seconds) {
|
|
364
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
302
367
|
// -----------------------------------------------------------------------------
|
|
303
368
|
// Parsing
|
|
304
369
|
// -----------------------------------------------------------------------------
|
|
305
|
-
const INITIAL_1900_DAY = new
|
|
370
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
306
371
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
307
372
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
308
|
-
const CURRENT_YEAR =
|
|
309
|
-
const INITIAL_JS_DAY =
|
|
310
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
373
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
374
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
375
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
311
376
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
312
377
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
313
378
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -356,7 +421,7 @@
|
|
|
356
421
|
return {
|
|
357
422
|
value: date.value + time.value,
|
|
358
423
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
359
|
-
jsDate: new
|
|
424
|
+
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()),
|
|
360
425
|
};
|
|
361
426
|
}
|
|
362
427
|
return date || time;
|
|
@@ -373,13 +438,13 @@
|
|
|
373
438
|
const day = Number(parts[dayIndex]);
|
|
374
439
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
375
440
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
376
|
-
const jsDate = new
|
|
441
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
377
442
|
const sep = str.match(/\/|-|\s/)[0];
|
|
378
443
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
379
444
|
// invalid date
|
|
380
445
|
return null;
|
|
381
446
|
}
|
|
382
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
447
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
383
448
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
384
449
|
if (parts[yearIndex]) {
|
|
385
450
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -439,7 +504,7 @@
|
|
|
439
504
|
if (hours >= 24) {
|
|
440
505
|
format = "hhhh:mm:ss";
|
|
441
506
|
}
|
|
442
|
-
const jsDate = new
|
|
507
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
443
508
|
return {
|
|
444
509
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
445
510
|
format: format,
|
|
@@ -453,7 +518,7 @@
|
|
|
453
518
|
// -----------------------------------------------------------------------------
|
|
454
519
|
function numberToJsDate(value) {
|
|
455
520
|
const truncValue = Math.trunc(value);
|
|
456
|
-
let date =
|
|
521
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
457
522
|
let time = value - truncValue;
|
|
458
523
|
time = time < 0 ? 1 + time : time;
|
|
459
524
|
const hours = Math.round(time * 24);
|
|
@@ -470,7 +535,7 @@
|
|
|
470
535
|
}
|
|
471
536
|
/** Return the number of days in the current month of the given date */
|
|
472
537
|
function getDaysInMonth(date) {
|
|
473
|
-
return new
|
|
538
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
474
539
|
}
|
|
475
540
|
function isLastDayOfMonth(date) {
|
|
476
541
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -488,7 +553,7 @@
|
|
|
488
553
|
const yStart = date.getFullYear();
|
|
489
554
|
const mStart = date.getMonth();
|
|
490
555
|
const dStart = date.getDate();
|
|
491
|
-
const jsDate = new
|
|
556
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
492
557
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
493
558
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
494
559
|
}
|
|
@@ -648,13 +713,6 @@
|
|
|
648
713
|
}
|
|
649
714
|
|
|
650
715
|
//------------------------------------------------------------------------------
|
|
651
|
-
/**
|
|
652
|
-
* Stringify an object, like JSON.stringify, except that the first level of keys
|
|
653
|
-
* is ordered.
|
|
654
|
-
*/
|
|
655
|
-
function stringify(obj) {
|
|
656
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
657
|
-
}
|
|
658
716
|
/**
|
|
659
717
|
* Remove quotes from a quoted string
|
|
660
718
|
* ```js
|
|
@@ -884,7 +942,7 @@
|
|
|
884
942
|
function isDateTime(str) {
|
|
885
943
|
return parseDateTime(str) !== null;
|
|
886
944
|
}
|
|
887
|
-
const MARKDOWN_LINK_REGEX = /^\[(
|
|
945
|
+
const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
|
|
888
946
|
//link must start with http or https
|
|
889
947
|
//https://stackoverflow.com/a/3809435/4760614
|
|
890
948
|
const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
|
|
@@ -953,7 +1011,7 @@
|
|
|
953
1011
|
*/
|
|
954
1012
|
function getItemId(item, itemsDic) {
|
|
955
1013
|
for (let [key, value] of Object.entries(itemsDic)) {
|
|
956
|
-
if (
|
|
1014
|
+
if (deepEquals(value, item)) {
|
|
957
1015
|
return parseInt(key, 10);
|
|
958
1016
|
}
|
|
959
1017
|
}
|
|
@@ -1953,7 +2011,7 @@
|
|
|
1953
2011
|
.map((p) => {
|
|
1954
2012
|
switch (p) {
|
|
1955
2013
|
case "hhhh":
|
|
1956
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
2014
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
1957
2015
|
return helapsedHours.toString();
|
|
1958
2016
|
case "hh":
|
|
1959
2017
|
return hours.toString().padStart(2, "0");
|
|
@@ -2016,27 +2074,30 @@
|
|
|
2016
2074
|
}
|
|
2017
2075
|
function createLargeNumberFormat(format, magnitude, postFix) {
|
|
2018
2076
|
const internalFormat = parseFormat(format || "#,##0");
|
|
2019
|
-
const largeNumberFormat =
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
format: {
|
|
2026
|
-
...formatPart.format,
|
|
2027
|
-
magnitude,
|
|
2028
|
-
decimalPart: undefined,
|
|
2029
|
-
},
|
|
2030
|
-
},
|
|
2031
|
-
{
|
|
2032
|
-
type: "STRING",
|
|
2033
|
-
format: postFix,
|
|
2034
|
-
},
|
|
2035
|
-
];
|
|
2077
|
+
const largeNumberFormat = [];
|
|
2078
|
+
for (let i = 0; i < internalFormat.length; i++) {
|
|
2079
|
+
const formatPart = internalFormat[i];
|
|
2080
|
+
if (formatPart.type !== "NUMBER") {
|
|
2081
|
+
largeNumberFormat.push(formatPart);
|
|
2082
|
+
continue;
|
|
2036
2083
|
}
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2084
|
+
largeNumberFormat.push({
|
|
2085
|
+
...formatPart,
|
|
2086
|
+
format: {
|
|
2087
|
+
...formatPart.format,
|
|
2088
|
+
magnitude,
|
|
2089
|
+
decimalPart: undefined,
|
|
2090
|
+
},
|
|
2091
|
+
});
|
|
2092
|
+
largeNumberFormat.push({
|
|
2093
|
+
type: "STRING",
|
|
2094
|
+
format: postFix,
|
|
2095
|
+
});
|
|
2096
|
+
const nextFormatPart = internalFormat[i + 1];
|
|
2097
|
+
if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
|
|
2098
|
+
i++;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2040
2101
|
return convertInternalFormatToFormat(largeNumberFormat);
|
|
2041
2102
|
}
|
|
2042
2103
|
function changeDecimalPlaces(format, step) {
|
|
@@ -2200,8 +2261,10 @@
|
|
|
2200
2261
|
const cellReference = new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/, "i");
|
|
2201
2262
|
// Same as above, but matches the exact string (nothing before or after)
|
|
2202
2263
|
const singleCellReference = new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/, "i");
|
|
2203
|
-
/** Reference of a column header (eg. A, AB) */
|
|
2204
|
-
const colHeader = new RegExp(
|
|
2264
|
+
/** Reference of a column header (eg. A, AB, $A) */
|
|
2265
|
+
const colHeader = new RegExp(/^\$?([A-Z]{1,3})+$/, "i");
|
|
2266
|
+
/** Reference of a row header (eg. 1, $1) */
|
|
2267
|
+
const rowHeader = new RegExp(/^\$?([0-9]{1,7})+$/, "i");
|
|
2205
2268
|
/** Reference of a column (eg. A, $CA, Sheet1!B) */
|
|
2206
2269
|
const colReference = new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/, "i");
|
|
2207
2270
|
/** Reference of a row (eg. 1, 59, Sheet1!9) */
|
|
@@ -2231,6 +2294,9 @@
|
|
|
2231
2294
|
function isColHeader(str) {
|
|
2232
2295
|
return colHeader.test(str);
|
|
2233
2296
|
}
|
|
2297
|
+
function isRowHeader(str) {
|
|
2298
|
+
return rowHeader.test(str);
|
|
2299
|
+
}
|
|
2234
2300
|
/**
|
|
2235
2301
|
* Return true if the given xc is the reference of a single cell,
|
|
2236
2302
|
* without any specified sheet (e.g. A1)
|
|
@@ -2297,18 +2363,10 @@
|
|
|
2297
2363
|
if (isFullCol) {
|
|
2298
2364
|
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2299
2365
|
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2300
|
-
if (zone.left === zone.right) {
|
|
2301
|
-
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2302
|
-
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2303
|
-
}
|
|
2304
2366
|
}
|
|
2305
2367
|
if (isFullRow) {
|
|
2306
2368
|
parts[0].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2307
2369
|
parts[1].colFixed = parts[0].colFixed || parts[1].colFixed;
|
|
2308
|
-
if (zone.top === zone.bottom) {
|
|
2309
|
-
parts[0].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2310
|
-
parts[1].rowFixed = parts[0].rowFixed || parts[1].rowFixed;
|
|
2311
|
-
}
|
|
2312
2370
|
}
|
|
2313
2371
|
return parts;
|
|
2314
2372
|
}
|
|
@@ -4381,69 +4439,70 @@
|
|
|
4381
4439
|
CommandResult[CommandResult["InvalidFigureId"] = 28] = "InvalidFigureId";
|
|
4382
4440
|
CommandResult[CommandResult["InputAlreadyFocused"] = 29] = "InputAlreadyFocused";
|
|
4383
4441
|
CommandResult[CommandResult["MaximumRangesReached"] = 30] = "MaximumRangesReached";
|
|
4384
|
-
CommandResult[CommandResult["
|
|
4385
|
-
CommandResult[CommandResult["
|
|
4386
|
-
CommandResult[CommandResult["
|
|
4387
|
-
CommandResult[CommandResult["
|
|
4388
|
-
CommandResult[CommandResult["
|
|
4389
|
-
CommandResult[CommandResult["
|
|
4390
|
-
CommandResult[CommandResult["
|
|
4391
|
-
CommandResult[CommandResult["
|
|
4392
|
-
CommandResult[CommandResult["
|
|
4393
|
-
CommandResult[CommandResult["
|
|
4394
|
-
CommandResult[CommandResult["
|
|
4395
|
-
CommandResult[CommandResult["
|
|
4396
|
-
CommandResult[CommandResult["
|
|
4397
|
-
CommandResult[CommandResult["
|
|
4398
|
-
CommandResult[CommandResult["
|
|
4399
|
-
CommandResult[CommandResult["
|
|
4400
|
-
CommandResult[CommandResult["
|
|
4401
|
-
CommandResult[CommandResult["
|
|
4402
|
-
CommandResult[CommandResult["
|
|
4403
|
-
CommandResult[CommandResult["
|
|
4404
|
-
CommandResult[CommandResult["
|
|
4405
|
-
CommandResult[CommandResult["
|
|
4406
|
-
CommandResult[CommandResult["
|
|
4407
|
-
CommandResult[CommandResult["
|
|
4408
|
-
CommandResult[CommandResult["
|
|
4409
|
-
CommandResult[CommandResult["
|
|
4410
|
-
CommandResult[CommandResult["
|
|
4411
|
-
CommandResult[CommandResult["
|
|
4412
|
-
CommandResult[CommandResult["
|
|
4413
|
-
CommandResult[CommandResult["
|
|
4414
|
-
CommandResult[CommandResult["
|
|
4415
|
-
CommandResult[CommandResult["
|
|
4416
|
-
CommandResult[CommandResult["
|
|
4417
|
-
CommandResult[CommandResult["
|
|
4418
|
-
CommandResult[CommandResult["
|
|
4419
|
-
CommandResult[CommandResult["
|
|
4420
|
-
CommandResult[CommandResult["
|
|
4421
|
-
CommandResult[CommandResult["
|
|
4422
|
-
CommandResult[CommandResult["
|
|
4423
|
-
CommandResult[CommandResult["
|
|
4424
|
-
CommandResult[CommandResult["
|
|
4425
|
-
CommandResult[CommandResult["
|
|
4426
|
-
CommandResult[CommandResult["
|
|
4427
|
-
CommandResult[CommandResult["
|
|
4428
|
-
CommandResult[CommandResult["
|
|
4429
|
-
CommandResult[CommandResult["
|
|
4430
|
-
CommandResult[CommandResult["
|
|
4431
|
-
CommandResult[CommandResult["
|
|
4432
|
-
CommandResult[CommandResult["
|
|
4433
|
-
CommandResult[CommandResult["
|
|
4434
|
-
CommandResult[CommandResult["
|
|
4435
|
-
CommandResult[CommandResult["
|
|
4436
|
-
CommandResult[CommandResult["
|
|
4437
|
-
CommandResult[CommandResult["
|
|
4438
|
-
CommandResult[CommandResult["
|
|
4439
|
-
CommandResult[CommandResult["
|
|
4440
|
-
CommandResult[CommandResult["
|
|
4441
|
-
CommandResult[CommandResult["
|
|
4442
|
-
CommandResult[CommandResult["
|
|
4443
|
-
CommandResult[CommandResult["
|
|
4444
|
-
CommandResult[CommandResult["
|
|
4445
|
-
CommandResult[CommandResult["
|
|
4446
|
-
CommandResult[CommandResult["
|
|
4442
|
+
CommandResult[CommandResult["InvalidInputId"] = 31] = "InvalidInputId";
|
|
4443
|
+
CommandResult[CommandResult["InvalidChartDefinition"] = 32] = "InvalidChartDefinition";
|
|
4444
|
+
CommandResult[CommandResult["InvalidDataSet"] = 33] = "InvalidDataSet";
|
|
4445
|
+
CommandResult[CommandResult["InvalidLabelRange"] = 34] = "InvalidLabelRange";
|
|
4446
|
+
CommandResult[CommandResult["InvalidScorecardKeyValue"] = 35] = "InvalidScorecardKeyValue";
|
|
4447
|
+
CommandResult[CommandResult["InvalidScorecardBaseline"] = 36] = "InvalidScorecardBaseline";
|
|
4448
|
+
CommandResult[CommandResult["InvalidGaugeDataRange"] = 37] = "InvalidGaugeDataRange";
|
|
4449
|
+
CommandResult[CommandResult["EmptyGaugeRangeMin"] = 38] = "EmptyGaugeRangeMin";
|
|
4450
|
+
CommandResult[CommandResult["GaugeRangeMinNaN"] = 39] = "GaugeRangeMinNaN";
|
|
4451
|
+
CommandResult[CommandResult["EmptyGaugeRangeMax"] = 40] = "EmptyGaugeRangeMax";
|
|
4452
|
+
CommandResult[CommandResult["GaugeRangeMaxNaN"] = 41] = "GaugeRangeMaxNaN";
|
|
4453
|
+
CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 42] = "GaugeRangeMinBiggerThanRangeMax";
|
|
4454
|
+
CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 43] = "GaugeLowerInflectionPointNaN";
|
|
4455
|
+
CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 44] = "GaugeUpperInflectionPointNaN";
|
|
4456
|
+
CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 45] = "GaugeLowerBiggerThanUpper";
|
|
4457
|
+
CommandResult[CommandResult["InvalidAutofillSelection"] = 46] = "InvalidAutofillSelection";
|
|
4458
|
+
CommandResult[CommandResult["WrongComposerSelection"] = 47] = "WrongComposerSelection";
|
|
4459
|
+
CommandResult[CommandResult["MinBiggerThanMax"] = 48] = "MinBiggerThanMax";
|
|
4460
|
+
CommandResult[CommandResult["LowerBiggerThanUpper"] = 49] = "LowerBiggerThanUpper";
|
|
4461
|
+
CommandResult[CommandResult["MidBiggerThanMax"] = 50] = "MidBiggerThanMax";
|
|
4462
|
+
CommandResult[CommandResult["MinBiggerThanMid"] = 51] = "MinBiggerThanMid";
|
|
4463
|
+
CommandResult[CommandResult["FirstArgMissing"] = 52] = "FirstArgMissing";
|
|
4464
|
+
CommandResult[CommandResult["SecondArgMissing"] = 53] = "SecondArgMissing";
|
|
4465
|
+
CommandResult[CommandResult["MinNaN"] = 54] = "MinNaN";
|
|
4466
|
+
CommandResult[CommandResult["MidNaN"] = 55] = "MidNaN";
|
|
4467
|
+
CommandResult[CommandResult["MaxNaN"] = 56] = "MaxNaN";
|
|
4468
|
+
CommandResult[CommandResult["ValueUpperInflectionNaN"] = 57] = "ValueUpperInflectionNaN";
|
|
4469
|
+
CommandResult[CommandResult["ValueLowerInflectionNaN"] = 58] = "ValueLowerInflectionNaN";
|
|
4470
|
+
CommandResult[CommandResult["MinInvalidFormula"] = 59] = "MinInvalidFormula";
|
|
4471
|
+
CommandResult[CommandResult["MidInvalidFormula"] = 60] = "MidInvalidFormula";
|
|
4472
|
+
CommandResult[CommandResult["MaxInvalidFormula"] = 61] = "MaxInvalidFormula";
|
|
4473
|
+
CommandResult[CommandResult["ValueUpperInvalidFormula"] = 62] = "ValueUpperInvalidFormula";
|
|
4474
|
+
CommandResult[CommandResult["ValueLowerInvalidFormula"] = 63] = "ValueLowerInvalidFormula";
|
|
4475
|
+
CommandResult[CommandResult["InvalidSortZone"] = 64] = "InvalidSortZone";
|
|
4476
|
+
CommandResult[CommandResult["WaitingSessionConfirmation"] = 65] = "WaitingSessionConfirmation";
|
|
4477
|
+
CommandResult[CommandResult["MergeOverlap"] = 66] = "MergeOverlap";
|
|
4478
|
+
CommandResult[CommandResult["TooManyHiddenElements"] = 67] = "TooManyHiddenElements";
|
|
4479
|
+
CommandResult[CommandResult["Readonly"] = 68] = "Readonly";
|
|
4480
|
+
CommandResult[CommandResult["InvalidViewportSize"] = 69] = "InvalidViewportSize";
|
|
4481
|
+
CommandResult[CommandResult["InvalidScrollingDirection"] = 70] = "InvalidScrollingDirection";
|
|
4482
|
+
CommandResult[CommandResult["FigureDoesNotExist"] = 71] = "FigureDoesNotExist";
|
|
4483
|
+
CommandResult[CommandResult["InvalidConditionalFormatId"] = 72] = "InvalidConditionalFormatId";
|
|
4484
|
+
CommandResult[CommandResult["InvalidCellPopover"] = 73] = "InvalidCellPopover";
|
|
4485
|
+
CommandResult[CommandResult["EmptyTarget"] = 74] = "EmptyTarget";
|
|
4486
|
+
CommandResult[CommandResult["InvalidFreezeQuantity"] = 75] = "InvalidFreezeQuantity";
|
|
4487
|
+
CommandResult[CommandResult["FrozenPaneOverlap"] = 76] = "FrozenPaneOverlap";
|
|
4488
|
+
CommandResult[CommandResult["ValuesNotChanged"] = 77] = "ValuesNotChanged";
|
|
4489
|
+
CommandResult[CommandResult["InvalidFilterZone"] = 78] = "InvalidFilterZone";
|
|
4490
|
+
CommandResult[CommandResult["FilterOverlap"] = 79] = "FilterOverlap";
|
|
4491
|
+
CommandResult[CommandResult["FilterNotFound"] = 80] = "FilterNotFound";
|
|
4492
|
+
CommandResult[CommandResult["MergeInFilter"] = 81] = "MergeInFilter";
|
|
4493
|
+
CommandResult[CommandResult["NonContinuousTargets"] = 82] = "NonContinuousTargets";
|
|
4494
|
+
CommandResult[CommandResult["DuplicatedFigureId"] = 83] = "DuplicatedFigureId";
|
|
4495
|
+
CommandResult[CommandResult["InvalidSelectionStep"] = 84] = "InvalidSelectionStep";
|
|
4496
|
+
CommandResult[CommandResult["DuplicatedChartId"] = 85] = "DuplicatedChartId";
|
|
4497
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 86] = "ChartDoesNotExist";
|
|
4498
|
+
CommandResult[CommandResult["InvalidHeaderIndex"] = 87] = "InvalidHeaderIndex";
|
|
4499
|
+
CommandResult[CommandResult["InvalidQuantity"] = 88] = "InvalidQuantity";
|
|
4500
|
+
CommandResult[CommandResult["MoreThanOneColumnSelected"] = 89] = "MoreThanOneColumnSelected";
|
|
4501
|
+
CommandResult[CommandResult["EmptySplitSeparator"] = 90] = "EmptySplitSeparator";
|
|
4502
|
+
CommandResult[CommandResult["SplitWillOverwriteContent"] = 91] = "SplitWillOverwriteContent";
|
|
4503
|
+
CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 92] = "NoSplitSeparatorInSelection";
|
|
4504
|
+
CommandResult[CommandResult["NoActiveSheet"] = 93] = "NoActiveSheet";
|
|
4505
|
+
CommandResult[CommandResult["NoChanges"] = 94] = "NoChanges";
|
|
4447
4506
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
4448
4507
|
|
|
4449
4508
|
const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
|
|
@@ -5168,6 +5227,7 @@
|
|
|
5168
5227
|
},
|
|
5169
5228
|
};
|
|
5170
5229
|
|
|
5230
|
+
const macRegex = /Mac/i;
|
|
5171
5231
|
/**
|
|
5172
5232
|
* Return true if the event was triggered from
|
|
5173
5233
|
* a child element.
|
|
@@ -5213,6 +5273,17 @@
|
|
|
5213
5273
|
}
|
|
5214
5274
|
function getOpenedMenus() {
|
|
5215
5275
|
return Array.from(document.querySelectorAll(".o-spreadsheet .o-menu"));
|
|
5276
|
+
}
|
|
5277
|
+
function isMacOS() {
|
|
5278
|
+
return Boolean(macRegex.test(navigator.userAgent));
|
|
5279
|
+
}
|
|
5280
|
+
/**
|
|
5281
|
+
* @param {KeyboardEvent | MouseEvent} ev
|
|
5282
|
+
* @returns Returns true if the event was triggered with the "ctrl" modifier pressed.
|
|
5283
|
+
* On Mac, this is the "meta" or "command" key.
|
|
5284
|
+
*/
|
|
5285
|
+
function isCtrlKey(ev) {
|
|
5286
|
+
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
5216
5287
|
}
|
|
5217
5288
|
|
|
5218
5289
|
/**
|
|
@@ -6391,14 +6462,8 @@
|
|
|
6391
6462
|
: undefined));
|
|
6392
6463
|
}
|
|
6393
6464
|
}
|
|
6394
|
-
else if (zone.left === zone.right && zone.top === zone.bottom) {
|
|
6395
|
-
// A single cell. If it's only the title, the dataset is not added.
|
|
6396
|
-
if (!dataSetsHaveTitle) {
|
|
6397
|
-
dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
|
|
6398
|
-
}
|
|
6399
|
-
}
|
|
6400
6465
|
else {
|
|
6401
|
-
/* 1 row or 1 column */
|
|
6466
|
+
/* 1 cell, 1 row or 1 column */
|
|
6402
6467
|
dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
|
|
6403
6468
|
? {
|
|
6404
6469
|
top: zone.top,
|
|
@@ -6447,8 +6512,10 @@
|
|
|
6447
6512
|
}
|
|
6448
6513
|
const dataRange = ds.dataRange.clone({ zone: dataZone });
|
|
6449
6514
|
return {
|
|
6450
|
-
label: ds.labelCell
|
|
6451
|
-
|
|
6515
|
+
label: ds.labelCell
|
|
6516
|
+
? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
|
|
6517
|
+
: undefined,
|
|
6518
|
+
range: getters.getRangeString(dataRange, "forceSheetReference", true),
|
|
6452
6519
|
};
|
|
6453
6520
|
}
|
|
6454
6521
|
function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
|
|
@@ -6461,7 +6528,7 @@
|
|
|
6461
6528
|
zone.top = zone.top + 1;
|
|
6462
6529
|
}
|
|
6463
6530
|
const range = labelRange.clone({ zone });
|
|
6464
|
-
return getters.getRangeString(range, "forceSheetReference");
|
|
6531
|
+
return getters.getRangeString(range, "forceSheetReference", true);
|
|
6465
6532
|
}
|
|
6466
6533
|
/**
|
|
6467
6534
|
* Transform a chart definition which supports dataSets (dataSets and LabelRange)
|
|
@@ -6527,11 +6594,11 @@
|
|
|
6527
6594
|
if (definition.dataSets) {
|
|
6528
6595
|
const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
|
|
6529
6596
|
if (invalidRanges) {
|
|
6530
|
-
return
|
|
6597
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6531
6598
|
}
|
|
6532
6599
|
const zones = definition.dataSets.map(toUnboundedZone);
|
|
6533
6600
|
if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
|
|
6534
|
-
return
|
|
6601
|
+
return 33 /* CommandResult.InvalidDataSet */;
|
|
6535
6602
|
}
|
|
6536
6603
|
}
|
|
6537
6604
|
return 0 /* CommandResult.Success */;
|
|
@@ -6540,7 +6607,7 @@
|
|
|
6540
6607
|
if (definition.labelRange) {
|
|
6541
6608
|
const invalidLabels = !rangeReference.test(definition.labelRange || "");
|
|
6542
6609
|
if (invalidLabels) {
|
|
6543
|
-
return
|
|
6610
|
+
return 34 /* CommandResult.InvalidLabelRange */;
|
|
6544
6611
|
}
|
|
6545
6612
|
}
|
|
6546
6613
|
return 0 /* CommandResult.Success */;
|
|
@@ -6627,22 +6694,22 @@
|
|
|
6627
6694
|
const CfTerms = {
|
|
6628
6695
|
Errors: {
|
|
6629
6696
|
[25 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
|
|
6630
|
-
[
|
|
6631
|
-
[
|
|
6632
|
-
[
|
|
6633
|
-
[
|
|
6634
|
-
[
|
|
6635
|
-
[
|
|
6636
|
-
[
|
|
6637
|
-
[
|
|
6638
|
-
[
|
|
6639
|
-
[
|
|
6640
|
-
[
|
|
6641
|
-
[
|
|
6642
|
-
[
|
|
6643
|
-
[
|
|
6644
|
-
[
|
|
6645
|
-
[
|
|
6697
|
+
[52 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
|
|
6698
|
+
[53 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
|
|
6699
|
+
[54 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
|
|
6700
|
+
[55 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
|
|
6701
|
+
[56 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
|
|
6702
|
+
[57 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
|
|
6703
|
+
[58 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
|
|
6704
|
+
[48 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
|
|
6705
|
+
[51 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
|
|
6706
|
+
[50 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
|
|
6707
|
+
[49 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
|
|
6708
|
+
[59 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
|
|
6709
|
+
[61 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
|
|
6710
|
+
[60 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
|
|
6711
|
+
[62 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
|
|
6712
|
+
[63 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
|
|
6646
6713
|
[24 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
|
|
6647
6714
|
Unexpected: _lt("The rule is invalid for an unknown reason"),
|
|
6648
6715
|
},
|
|
@@ -6670,20 +6737,20 @@
|
|
|
6670
6737
|
Errors: {
|
|
6671
6738
|
Unexpected: _lt("The chart definition is invalid for an unknown reason"),
|
|
6672
6739
|
// BASIC CHART ERRORS (LINE | BAR | PIE)
|
|
6673
|
-
[
|
|
6674
|
-
[
|
|
6740
|
+
[33 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
|
|
6741
|
+
[34 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
|
|
6675
6742
|
// SCORECARD CHART ERRORS
|
|
6676
|
-
[
|
|
6677
|
-
[
|
|
6743
|
+
[35 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
|
|
6744
|
+
[36 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
|
|
6678
6745
|
// GAUGE CHART ERRORS
|
|
6679
|
-
[
|
|
6680
|
-
[
|
|
6681
|
-
[
|
|
6682
|
-
[
|
|
6683
|
-
[
|
|
6684
|
-
[
|
|
6685
|
-
[
|
|
6686
|
-
[
|
|
6746
|
+
[37 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
|
|
6747
|
+
[38 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
|
|
6748
|
+
[39 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
|
|
6749
|
+
[40 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
|
|
6750
|
+
[41 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
|
|
6751
|
+
[42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
|
|
6752
|
+
[43 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
|
|
6753
|
+
[44 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
|
|
6687
6754
|
},
|
|
6688
6755
|
};
|
|
6689
6756
|
const CustomCurrencyTerms = {
|
|
@@ -6693,9 +6760,9 @@
|
|
|
6693
6760
|
const SplitToColumnsTerms = {
|
|
6694
6761
|
Errors: {
|
|
6695
6762
|
Unexpected: _lt("Cannot split the selection for an unknown reason"),
|
|
6696
|
-
[
|
|
6697
|
-
[
|
|
6698
|
-
[
|
|
6763
|
+
[92 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
|
|
6764
|
+
[89 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
|
|
6765
|
+
[91 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
|
|
6699
6766
|
},
|
|
6700
6767
|
};
|
|
6701
6768
|
|
|
@@ -6998,7 +7065,7 @@
|
|
|
6998
7065
|
return undefined;
|
|
6999
7066
|
const dataSets = this.dataSets
|
|
7000
7067
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7001
|
-
.filter((ds) => ds.range !== ""
|
|
7068
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7002
7069
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7003
7070
|
return {
|
|
7004
7071
|
...this.getDefinition(),
|
|
@@ -7099,7 +7166,7 @@
|
|
|
7099
7166
|
|
|
7100
7167
|
function isDataRangeValid(definition) {
|
|
7101
7168
|
return definition.dataRange && !rangeReference.test(definition.dataRange)
|
|
7102
|
-
?
|
|
7169
|
+
? 37 /* CommandResult.InvalidGaugeDataRange */
|
|
7103
7170
|
: 0 /* CommandResult.Success */;
|
|
7104
7171
|
}
|
|
7105
7172
|
function checkRangeLimits(check, batchValidations) {
|
|
@@ -7131,7 +7198,7 @@
|
|
|
7131
7198
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7132
7199
|
if (definition.sectionRule) {
|
|
7133
7200
|
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
|
|
7134
|
-
return
|
|
7201
|
+
return 42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
|
|
7135
7202
|
}
|
|
7136
7203
|
}
|
|
7137
7204
|
return 0 /* CommandResult.Success */;
|
|
@@ -7140,9 +7207,9 @@
|
|
|
7140
7207
|
if (value === "") {
|
|
7141
7208
|
switch (valueName) {
|
|
7142
7209
|
case "rangeMin":
|
|
7143
|
-
return
|
|
7210
|
+
return 38 /* CommandResult.EmptyGaugeRangeMin */;
|
|
7144
7211
|
case "rangeMax":
|
|
7145
|
-
return
|
|
7212
|
+
return 40 /* CommandResult.EmptyGaugeRangeMax */;
|
|
7146
7213
|
}
|
|
7147
7214
|
}
|
|
7148
7215
|
return 0 /* CommandResult.Success */;
|
|
@@ -7151,13 +7218,13 @@
|
|
|
7151
7218
|
if (isNaN(value)) {
|
|
7152
7219
|
switch (valueName) {
|
|
7153
7220
|
case "rangeMin":
|
|
7154
|
-
return
|
|
7221
|
+
return 39 /* CommandResult.GaugeRangeMinNaN */;
|
|
7155
7222
|
case "rangeMax":
|
|
7156
|
-
return
|
|
7223
|
+
return 41 /* CommandResult.GaugeRangeMaxNaN */;
|
|
7157
7224
|
case "lowerInflectionPointValue":
|
|
7158
|
-
return
|
|
7225
|
+
return 43 /* CommandResult.GaugeLowerInflectionPointNaN */;
|
|
7159
7226
|
case "upperInflectionPointValue":
|
|
7160
|
-
return
|
|
7227
|
+
return 44 /* CommandResult.GaugeUpperInflectionPointNaN */;
|
|
7161
7228
|
}
|
|
7162
7229
|
}
|
|
7163
7230
|
return 0 /* CommandResult.Success */;
|
|
@@ -7582,7 +7649,7 @@
|
|
|
7582
7649
|
return undefined;
|
|
7583
7650
|
const dataSets = this.dataSets
|
|
7584
7651
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7585
|
-
.filter((ds) => ds.range !== ""
|
|
7652
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7586
7653
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7587
7654
|
return {
|
|
7588
7655
|
...this.getDefinition(),
|
|
@@ -7867,7 +7934,7 @@
|
|
|
7867
7934
|
return undefined;
|
|
7868
7935
|
const dataSets = this.dataSets
|
|
7869
7936
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
7870
|
-
.filter((ds) => ds.range !== ""
|
|
7937
|
+
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
7871
7938
|
const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
|
|
7872
7939
|
return {
|
|
7873
7940
|
...this.getDefinition(),
|
|
@@ -7947,12 +8014,12 @@
|
|
|
7947
8014
|
|
|
7948
8015
|
function checkKeyValue(definition) {
|
|
7949
8016
|
return definition.keyValue && !rangeReference.test(definition.keyValue)
|
|
7950
|
-
?
|
|
8017
|
+
? 35 /* CommandResult.InvalidScorecardKeyValue */
|
|
7951
8018
|
: 0 /* CommandResult.Success */;
|
|
7952
8019
|
}
|
|
7953
8020
|
function checkBaseline(definition) {
|
|
7954
8021
|
return definition.baseline && !rangeReference.test(definition.baseline)
|
|
7955
|
-
?
|
|
8022
|
+
? 36 /* CommandResult.InvalidScorecardBaseline */
|
|
7956
8023
|
: 0 /* CommandResult.Success */;
|
|
7957
8024
|
}
|
|
7958
8025
|
class ScorecardChart extends AbstractChart {
|
|
@@ -8458,7 +8525,7 @@
|
|
|
8458
8525
|
};
|
|
8459
8526
|
function interactiveAddMerge(env, sheetId, target) {
|
|
8460
8527
|
const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
|
|
8461
|
-
if (result.isCancelledBecause(
|
|
8528
|
+
if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
8462
8529
|
env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
8463
8530
|
}
|
|
8464
8531
|
else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
|
|
@@ -8708,7 +8775,7 @@
|
|
|
8708
8775
|
});
|
|
8709
8776
|
}
|
|
8710
8777
|
}
|
|
8711
|
-
if (result.isCancelledBecause(
|
|
8778
|
+
if (result.isCancelledBecause(64 /* CommandResult.InvalidSortZone */)) {
|
|
8712
8779
|
const { col, row } = anchor;
|
|
8713
8780
|
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
8714
8781
|
env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
@@ -8731,13 +8798,13 @@
|
|
|
8731
8798
|
};
|
|
8732
8799
|
function interactiveAddFilter(env, sheetId, target) {
|
|
8733
8800
|
const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
|
|
8734
|
-
if (result.isCancelledBecause(
|
|
8801
|
+
if (result.isCancelledBecause(79 /* CommandResult.FilterOverlap */)) {
|
|
8735
8802
|
env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
8736
8803
|
}
|
|
8737
|
-
else if (result.isCancelledBecause(
|
|
8804
|
+
else if (result.isCancelledBecause(81 /* CommandResult.MergeInFilter */)) {
|
|
8738
8805
|
env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
8739
8806
|
}
|
|
8740
|
-
else if (result.isCancelledBecause(
|
|
8807
|
+
else if (result.isCancelledBecause(82 /* CommandResult.NonContinuousTargets */)) {
|
|
8741
8808
|
env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
8742
8809
|
}
|
|
8743
8810
|
}
|
|
@@ -8759,7 +8826,7 @@
|
|
|
8759
8826
|
else if (result.reasons.includes(22 /* CommandResult.WrongFigurePasteOption */)) {
|
|
8760
8827
|
env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
8761
8828
|
}
|
|
8762
|
-
else if (result.reasons.includes(
|
|
8829
|
+
else if (result.reasons.includes(76 /* CommandResult.FrozenPaneOverlap */)) {
|
|
8763
8830
|
env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
8764
8831
|
}
|
|
8765
8832
|
}
|
|
@@ -9599,6 +9666,9 @@
|
|
|
9599
9666
|
function makeArg(str, description) {
|
|
9600
9667
|
let parts = str.match(ARG_REGEXP);
|
|
9601
9668
|
let name = parts[1].trim();
|
|
9669
|
+
if (!name) {
|
|
9670
|
+
throw new Error(`Function argument definition is missing a name: '${str}'.`);
|
|
9671
|
+
}
|
|
9602
9672
|
let types = [];
|
|
9603
9673
|
let isOptional = false;
|
|
9604
9674
|
let isRepeating = false;
|
|
@@ -12052,7 +12122,7 @@
|
|
|
12052
12122
|
if (_year < 1900) {
|
|
12053
12123
|
_year += 1900;
|
|
12054
12124
|
}
|
|
12055
|
-
const jsDate = new
|
|
12125
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
12056
12126
|
const result = jsDateToRoundNumber(jsDate);
|
|
12057
12127
|
assert(() => result >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
12058
12128
|
return result;
|
|
@@ -12095,7 +12165,7 @@
|
|
|
12095
12165
|
// See: https://support.microsoft.com/en-us/office/datedif-function-25dba1a4-2812-480b-84dd-8b32a451b35c
|
|
12096
12166
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
12097
12167
|
if (days < 0) {
|
|
12098
|
-
const monthBeforeEndMonth = new
|
|
12168
|
+
const monthBeforeEndMonth = new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1);
|
|
12099
12169
|
const daysInMonthBeforeEndMonth = getDaysInMonth(monthBeforeEndMonth);
|
|
12100
12170
|
days = daysInMonthBeforeEndMonth - Math.abs(days);
|
|
12101
12171
|
}
|
|
@@ -12104,7 +12174,7 @@
|
|
|
12104
12174
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) {
|
|
12105
12175
|
return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
12106
12176
|
}
|
|
12107
|
-
const endDateWithinOneYear = new
|
|
12177
|
+
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
12108
12178
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
12109
12179
|
if (days < 0) {
|
|
12110
12180
|
endDateWithinOneYear.setFullYear(jsStartDate.getFullYear() + 1);
|
|
@@ -12217,7 +12287,7 @@
|
|
|
12217
12287
|
const _months = Math.trunc(toNumber(months));
|
|
12218
12288
|
const yStart = _startDate.getFullYear();
|
|
12219
12289
|
const mStart = _startDate.getMonth();
|
|
12220
|
-
const jsDate = new
|
|
12290
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
12221
12291
|
return jsDateToRoundNumber(jsDate);
|
|
12222
12292
|
},
|
|
12223
12293
|
isExported: true,
|
|
@@ -12254,17 +12324,17 @@
|
|
|
12254
12324
|
// The first week of the year is the week that contains the first
|
|
12255
12325
|
// Thursday of the year.
|
|
12256
12326
|
let firstThursday = 1;
|
|
12257
|
-
while (new
|
|
12327
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
12258
12328
|
firstThursday += 1;
|
|
12259
12329
|
}
|
|
12260
|
-
const firstDayOfFirstWeek = new
|
|
12330
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
12261
12331
|
// The last week of the year is the week that contains the last Thursday of
|
|
12262
12332
|
// the year.
|
|
12263
12333
|
let lastThursday = 31;
|
|
12264
|
-
while (new
|
|
12334
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
12265
12335
|
lastThursday -= 1;
|
|
12266
12336
|
}
|
|
12267
|
-
const lastDayOfLastWeek = new
|
|
12337
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
12268
12338
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
12269
12339
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
12270
12340
|
let offsetYear;
|
|
@@ -12290,17 +12360,17 @@
|
|
|
12290
12360
|
case 1:
|
|
12291
12361
|
// firstDay is the 1st day of the 1st week of the year after
|
|
12292
12362
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
12293
|
-
firstDay = new
|
|
12363
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
12294
12364
|
break;
|
|
12295
12365
|
case -1:
|
|
12296
12366
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
12297
12367
|
// The first week of the previous year is the week that contains the
|
|
12298
12368
|
// first Thursday of the previous year.
|
|
12299
12369
|
let firstThursdayPreviousYear = 1;
|
|
12300
|
-
while (new
|
|
12370
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
12301
12371
|
firstThursdayPreviousYear += 1;
|
|
12302
12372
|
}
|
|
12303
|
-
firstDay = new
|
|
12373
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
12304
12374
|
break;
|
|
12305
12375
|
}
|
|
12306
12376
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -12435,8 +12505,8 @@
|
|
|
12435
12505
|
});
|
|
12436
12506
|
}
|
|
12437
12507
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
12438
|
-
const stopDate =
|
|
12439
|
-
let stepDate =
|
|
12508
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
12509
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
12440
12510
|
const timeStopDate = stopDate.getTime();
|
|
12441
12511
|
let timeStepDate = stepDate.getTime();
|
|
12442
12512
|
let netWorkingDay = 0;
|
|
@@ -12460,8 +12530,7 @@
|
|
|
12460
12530
|
returns: ["DATE"],
|
|
12461
12531
|
computeFormat: () => "m/d/yyyy hh:mm:ss",
|
|
12462
12532
|
compute: function () {
|
|
12463
|
-
let today =
|
|
12464
|
-
today.setMilliseconds(0);
|
|
12533
|
+
let today = DateTime.now();
|
|
12465
12534
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
12466
12535
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
12467
12536
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -12531,8 +12600,8 @@
|
|
|
12531
12600
|
returns: ["DATE"],
|
|
12532
12601
|
computeFormat: () => "m/d/yyyy",
|
|
12533
12602
|
compute: function () {
|
|
12534
|
-
const today =
|
|
12535
|
-
const jsDate = new
|
|
12603
|
+
const today = DateTime.now();
|
|
12604
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
12536
12605
|
return jsDateToRoundNumber(jsDate);
|
|
12537
12606
|
},
|
|
12538
12607
|
isExported: true,
|
|
@@ -12587,10 +12656,10 @@
|
|
|
12587
12656
|
}
|
|
12588
12657
|
const y = _date.getFullYear();
|
|
12589
12658
|
let dayStart = 1;
|
|
12590
|
-
let startDayOfFirstWeek = new
|
|
12659
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
12591
12660
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
12592
12661
|
dayStart += 1;
|
|
12593
|
-
startDayOfFirstWeek = new
|
|
12662
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
12594
12663
|
}
|
|
12595
12664
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
12596
12665
|
if (dif < 0) {
|
|
@@ -12644,7 +12713,7 @@
|
|
|
12644
12713
|
timesHoliday.add(holiday.getTime());
|
|
12645
12714
|
});
|
|
12646
12715
|
}
|
|
12647
|
-
let stepDate =
|
|
12716
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
12648
12717
|
let timeStepDate = stepDate.getTime();
|
|
12649
12718
|
const unitDay = Math.sign(_numDays);
|
|
12650
12719
|
let stepDay = Math.abs(_numDays);
|
|
@@ -12706,7 +12775,7 @@
|
|
|
12706
12775
|
const _startDate = toJsDate(date);
|
|
12707
12776
|
const yStart = _startDate.getFullYear();
|
|
12708
12777
|
const mStart = _startDate.getMonth();
|
|
12709
|
-
const jsDate = new
|
|
12778
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
12710
12779
|
return jsDateToRoundNumber(jsDate);
|
|
12711
12780
|
},
|
|
12712
12781
|
};
|
|
@@ -12744,7 +12813,7 @@
|
|
|
12744
12813
|
compute: function (date) {
|
|
12745
12814
|
const quarter = QUARTER.compute(date);
|
|
12746
12815
|
const year = YEAR.compute(date);
|
|
12747
|
-
const jsDate = new
|
|
12816
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
12748
12817
|
return jsDateToRoundNumber(jsDate);
|
|
12749
12818
|
},
|
|
12750
12819
|
};
|
|
@@ -12759,7 +12828,7 @@
|
|
|
12759
12828
|
compute: function (date) {
|
|
12760
12829
|
const quarter = QUARTER.compute(date);
|
|
12761
12830
|
const year = YEAR.compute(date);
|
|
12762
|
-
const jsDate = new
|
|
12831
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
12763
12832
|
return jsDateToRoundNumber(jsDate);
|
|
12764
12833
|
},
|
|
12765
12834
|
};
|
|
@@ -12773,7 +12842,7 @@
|
|
|
12773
12842
|
computeFormat: () => "m/d/yyyy",
|
|
12774
12843
|
compute: function (date) {
|
|
12775
12844
|
const year = YEAR.compute(date);
|
|
12776
|
-
const jsDate = new
|
|
12845
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
12777
12846
|
return jsDateToRoundNumber(jsDate);
|
|
12778
12847
|
},
|
|
12779
12848
|
};
|
|
@@ -12787,7 +12856,7 @@
|
|
|
12787
12856
|
computeFormat: () => "m/d/yyyy",
|
|
12788
12857
|
compute: function (date) {
|
|
12789
12858
|
const year = YEAR.compute(date);
|
|
12790
|
-
const jsDate = new
|
|
12859
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
12791
12860
|
return jsDateToRoundNumber(jsDate);
|
|
12792
12861
|
},
|
|
12793
12862
|
};
|
|
@@ -12835,8 +12904,8 @@
|
|
|
12835
12904
|
const DELTA = {
|
|
12836
12905
|
description: _lt("Compare two numeric values, returning 1 if they're equal."),
|
|
12837
12906
|
args: [
|
|
12838
|
-
arg(" (number)", _lt("The first number to compare.")),
|
|
12839
|
-
arg(` (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
|
|
12907
|
+
arg("number1 (number)", _lt("The first number to compare.")),
|
|
12908
|
+
arg(`number2 (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
|
|
12840
12909
|
],
|
|
12841
12910
|
returns: ["NUMBER"],
|
|
12842
12911
|
compute: function (number1, number2 = DEFAULT_DELTA_ARG) {
|
|
@@ -12922,7 +12991,7 @@
|
|
|
12922
12991
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity) {
|
|
12923
12992
|
const startDate = toJsDate(settlement);
|
|
12924
12993
|
const endDate = toJsDate(maturity);
|
|
12925
|
-
const startDatePlusOneYear =
|
|
12994
|
+
const startDatePlusOneYear = toJsDate(settlement);
|
|
12926
12995
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
12927
12996
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _lt("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
12928
12997
|
}
|
|
@@ -13057,7 +13126,7 @@
|
|
|
13057
13126
|
arg("salvage (number)", _lt("The value of the asset at the end of depreciation.")),
|
|
13058
13127
|
arg("period (number)", _lt("The single period within life for which to calculate depreciation.")),
|
|
13059
13128
|
arg("rate (number)", _lt("The deprecation rate.")),
|
|
13060
|
-
arg(" (number, optional)", _lt("An indicator of what day count method to use.")),
|
|
13129
|
+
arg("day_count_convention (number, optional)", _lt("An indicator of what day count method to use.")),
|
|
13061
13130
|
],
|
|
13062
13131
|
returns: ["NUMBER"],
|
|
13063
13132
|
compute: function (cost, purchaseDate, firstPeriodEnd, salvage, period, rate, dayCountConvention = DEFAULT_DAY_COUNT_CONVENTION) {
|
|
@@ -16040,8 +16109,8 @@
|
|
|
16040
16109
|
description: _lt("A segment of a string."),
|
|
16041
16110
|
args: [
|
|
16042
16111
|
arg("text (string)", _lt("The string to extract a segment from.")),
|
|
16043
|
-
arg(" (number)", _lt("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
16044
|
-
arg(" (number)", _lt("The length of the segment to extract.")),
|
|
16112
|
+
arg("starting_at (number)", _lt("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
16113
|
+
arg("extract_length (number)", _lt("The length of the segment to extract.")),
|
|
16045
16114
|
],
|
|
16046
16115
|
returns: ["STRING"],
|
|
16047
16116
|
compute: function (text, starting_at, extract_length) {
|
|
@@ -16915,7 +16984,7 @@
|
|
|
16915
16984
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
16916
16985
|
const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
|
|
16917
16986
|
const result = env.model.dispatch(cmd, { sheetId, quantity: base });
|
|
16918
|
-
if (result.isCancelledBecause(
|
|
16987
|
+
if (result.isCancelledBecause(66 /* CommandResult.MergeOverlap */)) {
|
|
16919
16988
|
env.raiseError(MergeErrorMessage);
|
|
16920
16989
|
}
|
|
16921
16990
|
}
|
|
@@ -17710,10 +17779,10 @@
|
|
|
17710
17779
|
function updateSelectionWithArrowKeys(ev, selection) {
|
|
17711
17780
|
const direction = arrowMap[ev.key];
|
|
17712
17781
|
if (ev.shiftKey) {
|
|
17713
|
-
selection.resizeAnchorZone(direction, ev
|
|
17782
|
+
selection.resizeAnchorZone(direction, isCtrlKey(ev) ? "end" : 1);
|
|
17714
17783
|
}
|
|
17715
17784
|
else {
|
|
17716
|
-
selection.moveAnchorCell(direction, ev
|
|
17785
|
+
selection.moveAnchorCell(direction, isCtrlKey(ev) ? "end" : 1);
|
|
17717
17786
|
}
|
|
17718
17787
|
}
|
|
17719
17788
|
|
|
@@ -17938,10 +18007,10 @@
|
|
|
17938
18007
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
17939
18008
|
}
|
|
17940
18009
|
get isDatasetInvalid() {
|
|
17941
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
18010
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidDataSet */);
|
|
17942
18011
|
}
|
|
17943
18012
|
get isLabelInvalid() {
|
|
17944
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
18013
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidLabelRange */);
|
|
17945
18014
|
}
|
|
17946
18015
|
onUpdateDataSetsHaveTitle(ev) {
|
|
17947
18016
|
this.props.updateChart(this.props.figureId, {
|
|
@@ -18383,7 +18452,7 @@
|
|
|
18383
18452
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18384
18453
|
}
|
|
18385
18454
|
get isDataRangeInvalid() {
|
|
18386
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
18455
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidGaugeDataRange */);
|
|
18387
18456
|
}
|
|
18388
18457
|
onDataRangeChanged(ranges) {
|
|
18389
18458
|
this.dataRange = ranges[0];
|
|
@@ -18457,25 +18526,25 @@
|
|
|
18457
18526
|
});
|
|
18458
18527
|
}
|
|
18459
18528
|
isRangeMinInvalid() {
|
|
18460
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18461
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18462
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18529
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(38 /* CommandResult.EmptyGaugeRangeMin */) ||
|
|
18530
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.GaugeRangeMinNaN */) ||
|
|
18531
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
|
|
18463
18532
|
}
|
|
18464
18533
|
isRangeMaxInvalid() {
|
|
18465
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18466
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18467
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18534
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMax */) ||
|
|
18535
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMaxNaN */) ||
|
|
18536
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
|
|
18468
18537
|
}
|
|
18469
18538
|
// ---------------------------------------------------------------------------
|
|
18470
18539
|
// COLOR_SECTION_TEMPLATE
|
|
18471
18540
|
// ---------------------------------------------------------------------------
|
|
18472
18541
|
get isLowerInflectionPointInvalid() {
|
|
18473
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18474
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18542
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
|
|
18543
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
|
|
18475
18544
|
}
|
|
18476
18545
|
get isUpperInflectionPointInvalid() {
|
|
18477
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18478
|
-
this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
18546
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
|
|
18547
|
+
this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerBiggerThanUpper */));
|
|
18479
18548
|
}
|
|
18480
18549
|
updateInflectionPointValue(attr, ev) {
|
|
18481
18550
|
const sectionRule = deepCopy(this.props.definition.sectionRule);
|
|
@@ -18583,10 +18652,10 @@
|
|
|
18583
18652
|
return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18584
18653
|
}
|
|
18585
18654
|
get isKeyValueInvalid() {
|
|
18586
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
18655
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidScorecardKeyValue */);
|
|
18587
18656
|
}
|
|
18588
18657
|
get isBaselineInvalid() {
|
|
18589
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
18658
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardBaseline */);
|
|
18590
18659
|
}
|
|
18591
18660
|
onKeyValueRangeChanged(ranges) {
|
|
18592
18661
|
this.keyValue = ranges[0];
|
|
@@ -19446,10 +19515,10 @@
|
|
|
19446
19515
|
* Cell Is Rule
|
|
19447
19516
|
****************************************************************************/
|
|
19448
19517
|
get isValue1Invalid() {
|
|
19449
|
-
return !!this.state.errors?.includes(
|
|
19518
|
+
return !!this.state.errors?.includes(52 /* CommandResult.FirstArgMissing */);
|
|
19450
19519
|
}
|
|
19451
19520
|
get isValue2Invalid() {
|
|
19452
|
-
return !!this.state.errors?.includes(
|
|
19521
|
+
return !!this.state.errors?.includes(53 /* CommandResult.SecondArgMissing */);
|
|
19453
19522
|
}
|
|
19454
19523
|
toggleStyle(tool) {
|
|
19455
19524
|
const style = this.state.rules.cellIs.style;
|
|
@@ -19466,17 +19535,17 @@
|
|
|
19466
19535
|
isValueInvalid(threshold) {
|
|
19467
19536
|
switch (threshold) {
|
|
19468
19537
|
case "minimum":
|
|
19469
|
-
return (this.state.errors.includes(
|
|
19470
|
-
this.state.errors.includes(
|
|
19471
|
-
this.state.errors.includes(
|
|
19472
|
-
this.state.errors.includes(
|
|
19538
|
+
return (this.state.errors.includes(59 /* CommandResult.MinInvalidFormula */) ||
|
|
19539
|
+
this.state.errors.includes(51 /* CommandResult.MinBiggerThanMid */) ||
|
|
19540
|
+
this.state.errors.includes(48 /* CommandResult.MinBiggerThanMax */) ||
|
|
19541
|
+
this.state.errors.includes(54 /* CommandResult.MinNaN */));
|
|
19473
19542
|
case "midpoint":
|
|
19474
|
-
return (this.state.errors.includes(
|
|
19475
|
-
this.state.errors.includes(
|
|
19476
|
-
this.state.errors.includes(
|
|
19543
|
+
return (this.state.errors.includes(60 /* CommandResult.MidInvalidFormula */) ||
|
|
19544
|
+
this.state.errors.includes(55 /* CommandResult.MidNaN */) ||
|
|
19545
|
+
this.state.errors.includes(50 /* CommandResult.MidBiggerThanMax */));
|
|
19477
19546
|
case "maximum":
|
|
19478
|
-
return (this.state.errors.includes(
|
|
19479
|
-
this.state.errors.includes(
|
|
19547
|
+
return (this.state.errors.includes(61 /* CommandResult.MaxInvalidFormula */) ||
|
|
19548
|
+
this.state.errors.includes(56 /* CommandResult.MaxNaN */));
|
|
19480
19549
|
default:
|
|
19481
19550
|
return false;
|
|
19482
19551
|
}
|
|
@@ -19524,13 +19593,13 @@
|
|
|
19524
19593
|
isInflectionPointInvalid(inflectionPoint) {
|
|
19525
19594
|
switch (inflectionPoint) {
|
|
19526
19595
|
case "lowerInflectionPoint":
|
|
19527
|
-
return (this.state.errors.includes(
|
|
19528
|
-
this.state.errors.includes(
|
|
19529
|
-
this.state.errors.includes(
|
|
19596
|
+
return (this.state.errors.includes(58 /* CommandResult.ValueLowerInflectionNaN */) ||
|
|
19597
|
+
this.state.errors.includes(63 /* CommandResult.ValueLowerInvalidFormula */) ||
|
|
19598
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
19530
19599
|
case "upperInflectionPoint":
|
|
19531
|
-
return (this.state.errors.includes(
|
|
19532
|
-
this.state.errors.includes(
|
|
19533
|
-
this.state.errors.includes(
|
|
19600
|
+
return (this.state.errors.includes(57 /* CommandResult.ValueUpperInflectionNaN */) ||
|
|
19601
|
+
this.state.errors.includes(62 /* CommandResult.ValueUpperInvalidFormula */) ||
|
|
19602
|
+
this.state.errors.includes(49 /* CommandResult.LowerBiggerThanUpper */));
|
|
19534
19603
|
default:
|
|
19535
19604
|
return true;
|
|
19536
19605
|
}
|
|
@@ -19841,7 +19910,7 @@
|
|
|
19841
19910
|
};
|
|
19842
19911
|
function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
19843
19912
|
let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
|
|
19844
|
-
if (result.isCancelledBecause(
|
|
19913
|
+
if (result.isCancelledBecause(91 /* CommandResult.SplitWillOverwriteContent */)) {
|
|
19845
19914
|
env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
19846
19915
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
19847
19916
|
separator,
|
|
@@ -19904,8 +19973,8 @@
|
|
|
19904
19973
|
const errors = new Set();
|
|
19905
19974
|
for (const reason of cancelledReasons) {
|
|
19906
19975
|
switch (reason) {
|
|
19907
|
-
case
|
|
19908
|
-
case
|
|
19976
|
+
case 91 /* CommandResult.SplitWillOverwriteContent */:
|
|
19977
|
+
case 90 /* CommandResult.EmptySplitSeparator */:
|
|
19909
19978
|
break;
|
|
19910
19979
|
default:
|
|
19911
19980
|
errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
@@ -19920,8 +19989,8 @@
|
|
|
19920
19989
|
addNewColumns: this.state.addNewColumns,
|
|
19921
19990
|
force: false,
|
|
19922
19991
|
}).reasons;
|
|
19923
|
-
if (cancelledReasons.includes(
|
|
19924
|
-
warnings.push(SplitToColumnsTerms.Errors[
|
|
19992
|
+
if (cancelledReasons.includes(91 /* CommandResult.SplitWillOverwriteContent */)) {
|
|
19993
|
+
warnings.push(SplitToColumnsTerms.Errors[91 /* CommandResult.SplitWillOverwriteContent */]);
|
|
19925
19994
|
}
|
|
19926
19995
|
return warnings;
|
|
19927
19996
|
}
|
|
@@ -22410,7 +22479,10 @@
|
|
|
22410
22479
|
return;
|
|
22411
22480
|
}
|
|
22412
22481
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
22413
|
-
this.props.onCellClicked(col, row, {
|
|
22482
|
+
this.props.onCellClicked(col, row, {
|
|
22483
|
+
expandZone: ev.shiftKey,
|
|
22484
|
+
addZone: isCtrlKey(ev),
|
|
22485
|
+
});
|
|
22414
22486
|
}
|
|
22415
22487
|
onDoubleClick(ev) {
|
|
22416
22488
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
@@ -22483,6 +22555,7 @@
|
|
|
22483
22555
|
draggerShadowThickness: 0,
|
|
22484
22556
|
delta: 0,
|
|
22485
22557
|
base: 0,
|
|
22558
|
+
position: "before",
|
|
22486
22559
|
});
|
|
22487
22560
|
_computeHandleDisplay(ev) {
|
|
22488
22561
|
const position = this._getEvOffset(ev);
|
|
@@ -22607,11 +22680,13 @@
|
|
|
22607
22680
|
this.state.draggerLinePosition = dimensions.start;
|
|
22608
22681
|
this.state.draggerShadowPosition = dimensions.start;
|
|
22609
22682
|
this.state.base = elementIndex;
|
|
22683
|
+
this.state.position = "before";
|
|
22610
22684
|
}
|
|
22611
22685
|
else if (this._getSelectedZoneEnd() < elementIndex) {
|
|
22612
22686
|
this.state.draggerLinePosition = dimensions.end;
|
|
22613
22687
|
this.state.draggerShadowPosition = dimensions.end - this.state.draggerShadowThickness;
|
|
22614
|
-
this.state.base = elementIndex
|
|
22688
|
+
this.state.base = elementIndex;
|
|
22689
|
+
this.state.position = "after";
|
|
22615
22690
|
}
|
|
22616
22691
|
else {
|
|
22617
22692
|
this.state.draggerLinePosition = startDimensions.start;
|
|
@@ -22635,7 +22710,7 @@
|
|
|
22635
22710
|
this._increaseSelection(index);
|
|
22636
22711
|
}
|
|
22637
22712
|
else {
|
|
22638
|
-
this._selectElement(index, ev
|
|
22713
|
+
this._selectElement(index, isCtrlKey(ev));
|
|
22639
22714
|
}
|
|
22640
22715
|
this.lastSelectedElementIndex = index;
|
|
22641
22716
|
const mouseMoveSelect = (col, row) => {
|
|
@@ -22648,7 +22723,7 @@
|
|
|
22648
22723
|
const mouseUpSelect = () => {
|
|
22649
22724
|
this.state.isSelecting = false;
|
|
22650
22725
|
this.lastSelectedElementIndex = null;
|
|
22651
|
-
this.env.model.dispatch(ev
|
|
22726
|
+
this.env.model.dispatch(isCtrlKey(ev) ? "PREPARE_SELECTION_INPUT_EXPANSION" : "STOP_SELECTION_INPUT");
|
|
22652
22727
|
this._computeGrabDisplay(ev);
|
|
22653
22728
|
};
|
|
22654
22729
|
dragAndDropBeyondTheViewport(this.env, mouseMoveSelect, mouseUpSelect);
|
|
@@ -22794,13 +22869,14 @@
|
|
|
22794
22869
|
dimension: "COL",
|
|
22795
22870
|
base: this.state.base,
|
|
22796
22871
|
elements,
|
|
22872
|
+
position: this.state.position,
|
|
22797
22873
|
});
|
|
22798
22874
|
if (!result.isSuccessful && result.reasons.includes(2 /* CommandResult.WillRemoveExistingMerge */)) {
|
|
22799
22875
|
this.env.raiseError(MergeErrorMessage);
|
|
22800
22876
|
}
|
|
22801
22877
|
}
|
|
22802
|
-
_selectElement(index,
|
|
22803
|
-
this.env.model.selection.selectColumn(index,
|
|
22878
|
+
_selectElement(index, addDistinctHeader) {
|
|
22879
|
+
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
22804
22880
|
}
|
|
22805
22881
|
_increaseSelection(index) {
|
|
22806
22882
|
this.env.model.selection.selectColumn(index, "updateAnchor");
|
|
@@ -22967,13 +23043,14 @@
|
|
|
22967
23043
|
dimension: "ROW",
|
|
22968
23044
|
base: this.state.base,
|
|
22969
23045
|
elements,
|
|
23046
|
+
position: this.state.position,
|
|
22970
23047
|
});
|
|
22971
23048
|
if (!result.isSuccessful && result.reasons.includes(2 /* CommandResult.WillRemoveExistingMerge */)) {
|
|
22972
23049
|
this.env.raiseError(MergeErrorMessage);
|
|
22973
23050
|
}
|
|
22974
23051
|
}
|
|
22975
|
-
_selectElement(index,
|
|
22976
|
-
this.env.model.selection.selectRow(index,
|
|
23052
|
+
_selectElement(index, addDistinctHeader) {
|
|
23053
|
+
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
22977
23054
|
}
|
|
22978
23055
|
_increaseSelection(index) {
|
|
22979
23056
|
this.env.model.selection.selectRow(index, "updateAnchor");
|
|
@@ -23074,8 +23151,8 @@
|
|
|
23074
23151
|
return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
|
|
23075
23152
|
}
|
|
23076
23153
|
const onMouseWheel = (ev) => {
|
|
23077
|
-
const deltaX = normalize(ev.shiftKey ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
23078
|
-
const deltaY = normalize(ev.shiftKey ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
23154
|
+
const deltaX = normalize(ev.shiftKey && !isMacOS() ? ev.deltaY : ev.deltaX, ev.deltaMode);
|
|
23155
|
+
const deltaY = normalize(ev.shiftKey && !isMacOS() ? ev.deltaX : ev.deltaY, ev.deltaMode);
|
|
23079
23156
|
handler(deltaX, deltaY);
|
|
23080
23157
|
};
|
|
23081
23158
|
return onMouseWheel;
|
|
@@ -23777,8 +23854,8 @@
|
|
|
23777
23854
|
// ---------------------------------------------------------------------------
|
|
23778
23855
|
// Zone selection with mouse
|
|
23779
23856
|
// ---------------------------------------------------------------------------
|
|
23780
|
-
onCellClicked(col, row, {
|
|
23781
|
-
if (
|
|
23857
|
+
onCellClicked(col, row, { addZone, expandZone }) {
|
|
23858
|
+
if (addZone) {
|
|
23782
23859
|
this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION");
|
|
23783
23860
|
}
|
|
23784
23861
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
@@ -23787,10 +23864,10 @@
|
|
|
23787
23864
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
23788
23865
|
this.env.model.dispatch("STOP_EDITION");
|
|
23789
23866
|
}
|
|
23790
|
-
if (
|
|
23867
|
+
if (expandZone) {
|
|
23791
23868
|
this.env.model.selection.setAnchorCorner(col, row);
|
|
23792
23869
|
}
|
|
23793
|
-
else if (
|
|
23870
|
+
else if (addZone) {
|
|
23794
23871
|
this.env.model.selection.addCellToSelection(col, row);
|
|
23795
23872
|
}
|
|
23796
23873
|
else {
|
|
@@ -23852,9 +23929,7 @@
|
|
|
23852
23929
|
return;
|
|
23853
23930
|
}
|
|
23854
23931
|
let keyDownString = "";
|
|
23855
|
-
if (ev
|
|
23856
|
-
keyDownString += "CTRL+";
|
|
23857
|
-
if (ev.metaKey)
|
|
23932
|
+
if (isCtrlKey(ev))
|
|
23858
23933
|
keyDownString += "CTRL+";
|
|
23859
23934
|
if (ev.altKey)
|
|
23860
23935
|
keyDownString += "ALT+";
|
|
@@ -25762,7 +25837,7 @@
|
|
|
25762
25837
|
SPACE: goTo(State.RightRef),
|
|
25763
25838
|
NUMBER: goTo(State.Found),
|
|
25764
25839
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
25765
|
-
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
|
|
25840
|
+
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
|
|
25766
25841
|
},
|
|
25767
25842
|
[State.RightColumnRef]: {
|
|
25768
25843
|
SPACE: goTo(State.RightColumnRef),
|
|
@@ -25773,6 +25848,7 @@
|
|
|
25773
25848
|
SPACE: goTo(State.RightRowRef),
|
|
25774
25849
|
NUMBER: goTo(State.Found),
|
|
25775
25850
|
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
25851
|
+
SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
|
|
25776
25852
|
},
|
|
25777
25853
|
[State.Found]: {},
|
|
25778
25854
|
};
|
|
@@ -29440,7 +29516,7 @@
|
|
|
29440
29516
|
const currentBorder = this.getCellBorder(cmd);
|
|
29441
29517
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
29442
29518
|
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
29443
|
-
return
|
|
29519
|
+
return 94 /* CommandResult.NoChanges */;
|
|
29444
29520
|
}
|
|
29445
29521
|
return 0 /* CommandResult.Success */;
|
|
29446
29522
|
}
|
|
@@ -29480,7 +29556,7 @@
|
|
|
29480
29556
|
*/
|
|
29481
29557
|
function getBorderId(border) {
|
|
29482
29558
|
for (let [key, value] of Object.entries(borders)) {
|
|
29483
|
-
if (
|
|
29559
|
+
if (deepEquals(value, border)) {
|
|
29484
29560
|
return parseInt(key, 10);
|
|
29485
29561
|
}
|
|
29486
29562
|
}
|
|
@@ -29685,6 +29761,10 @@
|
|
|
29685
29761
|
format: cell.format ? getItemId(cell.format, formats) : undefined,
|
|
29686
29762
|
content: cell.content || undefined,
|
|
29687
29763
|
};
|
|
29764
|
+
// if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
|
|
29765
|
+
if (cell.isFormula && cell.dependencies.length) {
|
|
29766
|
+
cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
|
|
29767
|
+
}
|
|
29688
29768
|
}
|
|
29689
29769
|
_sheet.cells = cells;
|
|
29690
29770
|
}
|
|
@@ -29719,13 +29799,13 @@
|
|
|
29719
29799
|
/*
|
|
29720
29800
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
29721
29801
|
*/
|
|
29722
|
-
buildFormulaContent(sheetId, cell, dependencies) {
|
|
29802
|
+
buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
|
|
29723
29803
|
const ranges = dependencies || cell.dependencies;
|
|
29724
29804
|
let rangeIndex = 0;
|
|
29725
29805
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
29726
29806
|
if (token.type === "REFERENCE") {
|
|
29727
29807
|
const range = ranges[rangeIndex++];
|
|
29728
|
-
return this.getters.getRangeString(range, sheetId);
|
|
29808
|
+
return this.getters.getRangeString(range, sheetId, useFixedZone);
|
|
29729
29809
|
}
|
|
29730
29810
|
return token.value;
|
|
29731
29811
|
}));
|
|
@@ -29962,9 +30042,9 @@
|
|
|
29962
30042
|
checkUselessClearCell(cmd) {
|
|
29963
30043
|
const cell = this.getters.getCell(cmd);
|
|
29964
30044
|
if (!cell)
|
|
29965
|
-
return
|
|
30045
|
+
return 94 /* CommandResult.NoChanges */;
|
|
29966
30046
|
if (!cell.content && !cell.style && !cell.format) {
|
|
29967
|
-
return
|
|
30047
|
+
return 94 /* CommandResult.NoChanges */;
|
|
29968
30048
|
}
|
|
29969
30049
|
return 0 /* CommandResult.Success */;
|
|
29970
30050
|
}
|
|
@@ -30164,13 +30244,13 @@
|
|
|
30164
30244
|
}
|
|
30165
30245
|
checkChartDuplicate(cmd) {
|
|
30166
30246
|
return this.getters.getFigureSheetId(cmd.id)
|
|
30167
|
-
?
|
|
30247
|
+
? 85 /* CommandResult.DuplicatedChartId */
|
|
30168
30248
|
: 0 /* CommandResult.Success */;
|
|
30169
30249
|
}
|
|
30170
30250
|
checkChartExists(cmd) {
|
|
30171
30251
|
return this.getters.getFigureSheetId(cmd.id)
|
|
30172
30252
|
? 0 /* CommandResult.Success */
|
|
30173
|
-
:
|
|
30253
|
+
: 86 /* CommandResult.ChartDoesNotExist */;
|
|
30174
30254
|
}
|
|
30175
30255
|
}
|
|
30176
30256
|
|
|
@@ -30275,7 +30355,13 @@
|
|
|
30275
30355
|
}
|
|
30276
30356
|
}
|
|
30277
30357
|
exportForExcel(data) {
|
|
30278
|
-
|
|
30358
|
+
if (data.sheets) {
|
|
30359
|
+
for (let sheet of data.sheets) {
|
|
30360
|
+
if (this.cfRules[sheet.id]) {
|
|
30361
|
+
sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
|
|
30362
|
+
}
|
|
30363
|
+
}
|
|
30364
|
+
}
|
|
30279
30365
|
}
|
|
30280
30366
|
// ---------------------------------------------------------------------------
|
|
30281
30367
|
// Getters
|
|
@@ -30324,11 +30410,11 @@
|
|
|
30324
30410
|
// ---------------------------------------------------------------------------
|
|
30325
30411
|
// Private
|
|
30326
30412
|
// ---------------------------------------------------------------------------
|
|
30327
|
-
mapToConditionalFormat(sheetId, cf) {
|
|
30413
|
+
mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
|
|
30328
30414
|
return {
|
|
30329
30415
|
...cf,
|
|
30330
30416
|
ranges: cf.ranges.map((range) => {
|
|
30331
|
-
return this.getters.getRangeString(range, sheetId);
|
|
30417
|
+
return this.getters.getRangeString(range, sheetId, options.useFixedReference);
|
|
30332
30418
|
}),
|
|
30333
30419
|
};
|
|
30334
30420
|
}
|
|
@@ -30361,10 +30447,10 @@
|
|
|
30361
30447
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
30362
30448
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
30363
30449
|
if (ruleIndex === -1)
|
|
30364
|
-
return
|
|
30450
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
30365
30451
|
const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
|
|
30366
30452
|
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
|
|
30367
|
-
return
|
|
30453
|
+
return 72 /* CommandResult.InvalidConditionalFormatId */;
|
|
30368
30454
|
}
|
|
30369
30455
|
return 0 /* CommandResult.Success */;
|
|
30370
30456
|
}
|
|
@@ -30405,10 +30491,10 @@
|
|
|
30405
30491
|
const errors = [];
|
|
30406
30492
|
const isEmpty = (value) => value === undefined || value === "";
|
|
30407
30493
|
if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
|
|
30408
|
-
errors.push(
|
|
30494
|
+
errors.push(52 /* CommandResult.FirstArgMissing */);
|
|
30409
30495
|
}
|
|
30410
30496
|
if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
|
|
30411
|
-
errors.push(
|
|
30497
|
+
errors.push(53 /* CommandResult.SecondArgMissing */);
|
|
30412
30498
|
}
|
|
30413
30499
|
return errors.length ? errors : 0 /* CommandResult.Success */;
|
|
30414
30500
|
}
|
|
@@ -30420,15 +30506,15 @@
|
|
|
30420
30506
|
(threshold.value === "" || isNaN(threshold.value))) {
|
|
30421
30507
|
switch (thresholdName) {
|
|
30422
30508
|
case "min":
|
|
30423
|
-
return
|
|
30509
|
+
return 54 /* CommandResult.MinNaN */;
|
|
30424
30510
|
case "max":
|
|
30425
|
-
return
|
|
30511
|
+
return 56 /* CommandResult.MaxNaN */;
|
|
30426
30512
|
case "mid":
|
|
30427
|
-
return
|
|
30513
|
+
return 55 /* CommandResult.MidNaN */;
|
|
30428
30514
|
case "upperInflectionPoint":
|
|
30429
|
-
return
|
|
30515
|
+
return 57 /* CommandResult.ValueUpperInflectionNaN */;
|
|
30430
30516
|
case "lowerInflectionPoint":
|
|
30431
|
-
return
|
|
30517
|
+
return 58 /* CommandResult.ValueLowerInflectionNaN */;
|
|
30432
30518
|
}
|
|
30433
30519
|
}
|
|
30434
30520
|
return 0 /* CommandResult.Success */;
|
|
@@ -30442,15 +30528,15 @@
|
|
|
30442
30528
|
catch (error) {
|
|
30443
30529
|
switch (thresholdName) {
|
|
30444
30530
|
case "min":
|
|
30445
|
-
return
|
|
30531
|
+
return 59 /* CommandResult.MinInvalidFormula */;
|
|
30446
30532
|
case "max":
|
|
30447
|
-
return
|
|
30533
|
+
return 61 /* CommandResult.MaxInvalidFormula */;
|
|
30448
30534
|
case "mid":
|
|
30449
|
-
return
|
|
30535
|
+
return 60 /* CommandResult.MidInvalidFormula */;
|
|
30450
30536
|
case "upperInflectionPoint":
|
|
30451
|
-
return
|
|
30537
|
+
return 62 /* CommandResult.ValueUpperInvalidFormula */;
|
|
30452
30538
|
case "lowerInflectionPoint":
|
|
30453
|
-
return
|
|
30539
|
+
return 63 /* CommandResult.ValueLowerInvalidFormula */;
|
|
30454
30540
|
}
|
|
30455
30541
|
}
|
|
30456
30542
|
return 0 /* CommandResult.Success */;
|
|
@@ -30467,7 +30553,7 @@
|
|
|
30467
30553
|
if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
|
|
30468
30554
|
rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
|
|
30469
30555
|
Number(minValue) > Number(maxValue)) {
|
|
30470
|
-
return
|
|
30556
|
+
return 49 /* CommandResult.LowerBiggerThanUpper */;
|
|
30471
30557
|
}
|
|
30472
30558
|
return 0 /* CommandResult.Success */;
|
|
30473
30559
|
}
|
|
@@ -30477,7 +30563,7 @@
|
|
|
30477
30563
|
if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
|
|
30478
30564
|
rule.minimum.type === rule.maximum.type &&
|
|
30479
30565
|
stringToNumber(minValue) >= stringToNumber(maxValue)) {
|
|
30480
|
-
return
|
|
30566
|
+
return 48 /* CommandResult.MinBiggerThanMax */;
|
|
30481
30567
|
}
|
|
30482
30568
|
return 0 /* CommandResult.Success */;
|
|
30483
30569
|
}
|
|
@@ -30488,7 +30574,7 @@
|
|
|
30488
30574
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
30489
30575
|
rule.midpoint.type === rule.maximum.type &&
|
|
30490
30576
|
stringToNumber(midValue) >= stringToNumber(maxValue)) {
|
|
30491
|
-
return
|
|
30577
|
+
return 50 /* CommandResult.MidBiggerThanMax */;
|
|
30492
30578
|
}
|
|
30493
30579
|
return 0 /* CommandResult.Success */;
|
|
30494
30580
|
}
|
|
@@ -30499,7 +30585,7 @@
|
|
|
30499
30585
|
["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
|
|
30500
30586
|
rule.minimum.type === rule.midpoint.type &&
|
|
30501
30587
|
stringToNumber(minValue) >= stringToNumber(midValue)) {
|
|
30502
|
-
return
|
|
30588
|
+
return 51 /* CommandResult.MinBiggerThanMid */;
|
|
30503
30589
|
}
|
|
30504
30590
|
return 0 /* CommandResult.Success */;
|
|
30505
30591
|
}
|
|
@@ -30629,13 +30715,13 @@
|
|
|
30629
30715
|
}
|
|
30630
30716
|
checkFigureExists(sheetId, figureId) {
|
|
30631
30717
|
if (this.figures[sheetId]?.[figureId] === undefined) {
|
|
30632
|
-
return
|
|
30718
|
+
return 71 /* CommandResult.FigureDoesNotExist */;
|
|
30633
30719
|
}
|
|
30634
30720
|
return 0 /* CommandResult.Success */;
|
|
30635
30721
|
}
|
|
30636
30722
|
checkFigureDuplicate(figureId) {
|
|
30637
30723
|
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
|
|
30638
|
-
return
|
|
30724
|
+
return 83 /* CommandResult.DuplicatedFigureId */;
|
|
30639
30725
|
}
|
|
30640
30726
|
return 0 /* CommandResult.Success */;
|
|
30641
30727
|
}
|
|
@@ -30745,12 +30831,12 @@
|
|
|
30745
30831
|
switch (cmd.type) {
|
|
30746
30832
|
case "CREATE_FILTER_TABLE":
|
|
30747
30833
|
if (!areZonesContinuous(...cmd.target)) {
|
|
30748
|
-
return
|
|
30834
|
+
return 82 /* CommandResult.NonContinuousTargets */;
|
|
30749
30835
|
}
|
|
30750
30836
|
const zone = union(...cmd.target);
|
|
30751
30837
|
const checkFilterOverlap = () => {
|
|
30752
30838
|
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
|
|
30753
|
-
return
|
|
30839
|
+
return 79 /* CommandResult.FilterOverlap */;
|
|
30754
30840
|
}
|
|
30755
30841
|
return 0 /* CommandResult.Success */;
|
|
30756
30842
|
};
|
|
@@ -30758,7 +30844,7 @@
|
|
|
30758
30844
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
30759
30845
|
for (let merge of mergesInTarget) {
|
|
30760
30846
|
if (overlap(zone, merge)) {
|
|
30761
|
-
return
|
|
30847
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
30762
30848
|
}
|
|
30763
30849
|
}
|
|
30764
30850
|
return 0 /* CommandResult.Success */;
|
|
@@ -30768,7 +30854,7 @@
|
|
|
30768
30854
|
for (let merge of cmd.target) {
|
|
30769
30855
|
for (let filterTable of this.getFilterTables(cmd.sheetId)) {
|
|
30770
30856
|
if (overlap(filterTable.zone, merge)) {
|
|
30771
|
-
return
|
|
30857
|
+
return 81 /* CommandResult.MergeInFilter */;
|
|
30772
30858
|
}
|
|
30773
30859
|
}
|
|
30774
30860
|
}
|
|
@@ -31253,10 +31339,10 @@
|
|
|
31253
31339
|
: this.getters.getNumberRows(cmd.sheetId);
|
|
31254
31340
|
const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
|
|
31255
31341
|
if (hiddenElements.size >= elements) {
|
|
31256
|
-
return
|
|
31342
|
+
return 67 /* CommandResult.TooManyHiddenElements */;
|
|
31257
31343
|
}
|
|
31258
31344
|
else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
31259
|
-
return
|
|
31345
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
31260
31346
|
}
|
|
31261
31347
|
else {
|
|
31262
31348
|
return 0 /* CommandResult.Success */;
|
|
@@ -31799,7 +31885,7 @@
|
|
|
31799
31885
|
for (const zone of target) {
|
|
31800
31886
|
for (const zone2 of target) {
|
|
31801
31887
|
if (zone !== zone2 && overlap(zone, zone2)) {
|
|
31802
|
-
return
|
|
31888
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
31803
31889
|
}
|
|
31804
31890
|
}
|
|
31805
31891
|
}
|
|
@@ -31813,7 +31899,7 @@
|
|
|
31813
31899
|
for (const zone of target) {
|
|
31814
31900
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
31815
31901
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
31816
|
-
return
|
|
31902
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
31817
31903
|
}
|
|
31818
31904
|
}
|
|
31819
31905
|
return 0 /* CommandResult.Success */;
|
|
@@ -32271,8 +32357,9 @@
|
|
|
32271
32357
|
*
|
|
32272
32358
|
* @param range the range (received from getRangeFromXC or getRangeFromZone)
|
|
32273
32359
|
* @param forSheetId the id of the sheet where the range string is supposed to be used.
|
|
32360
|
+
* @param [useFixedZone=false] if true, the range will be returned with fixed row and column
|
|
32274
32361
|
*/
|
|
32275
|
-
getRangeString(range, forSheetId) {
|
|
32362
|
+
getRangeString(range, forSheetId, useFixedZone = false) {
|
|
32276
32363
|
if (!range) {
|
|
32277
32364
|
return INCORRECT_RANGE_STRING;
|
|
32278
32365
|
}
|
|
@@ -32299,7 +32386,7 @@
|
|
|
32299
32386
|
if (prefixSheet && !sheetName) {
|
|
32300
32387
|
return INCORRECT_RANGE_STRING;
|
|
32301
32388
|
}
|
|
32302
|
-
let rangeString = this.getRangePartString(rangeImpl, 0);
|
|
32389
|
+
let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
|
|
32303
32390
|
if (rangeImpl.parts && rangeImpl.parts.length === 2) {
|
|
32304
32391
|
// this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
|
|
32305
32392
|
if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
|
|
@@ -32309,7 +32396,7 @@
|
|
|
32309
32396
|
rangeImpl.parts[1].rowFixed ||
|
|
32310
32397
|
rangeImpl.parts[1].colFixed) {
|
|
32311
32398
|
rangeString += ":";
|
|
32312
|
-
rangeString += this.getRangePartString(rangeImpl, 1);
|
|
32399
|
+
rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
|
|
32313
32400
|
}
|
|
32314
32401
|
}
|
|
32315
32402
|
return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
|
|
@@ -32339,13 +32426,13 @@
|
|
|
32339
32426
|
/**
|
|
32340
32427
|
* Get a Xc string that represent a part of a range
|
|
32341
32428
|
*/
|
|
32342
|
-
getRangePartString(range, part) {
|
|
32343
|
-
const colFixed = range.parts && range.parts[part]
|
|
32429
|
+
getRangePartString(range, part, useFixedZone = false) {
|
|
32430
|
+
const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
|
|
32344
32431
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
32345
|
-
const rowFixed = range.parts && range.parts[part]
|
|
32432
|
+
const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
|
|
32346
32433
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
32347
32434
|
let str = "";
|
|
32348
|
-
if (range.isFullCol) {
|
|
32435
|
+
if (range.isFullCol && !useFixedZone) {
|
|
32349
32436
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
32350
32437
|
str = colFixed + col + rowFixed + row;
|
|
32351
32438
|
}
|
|
@@ -32353,7 +32440,7 @@
|
|
|
32353
32440
|
str = colFixed + col;
|
|
32354
32441
|
}
|
|
32355
32442
|
}
|
|
32356
|
-
else if (range.isFullRow) {
|
|
32443
|
+
else if (range.isFullRow && !useFixedZone) {
|
|
32357
32444
|
if (part === 0 && range.unboundedZone.hasHeader) {
|
|
32358
32445
|
str = colFixed + col + rowFixed + row;
|
|
32359
32446
|
}
|
|
@@ -32448,11 +32535,11 @@
|
|
|
32448
32535
|
const elements = cmd.dimension === "COL"
|
|
32449
32536
|
? this.getNumberCols(cmd.sheetId)
|
|
32450
32537
|
: this.getNumberRows(cmd.sheetId);
|
|
32451
|
-
if (cmd.base < 0 || cmd.base
|
|
32452
|
-
return
|
|
32538
|
+
if (cmd.base < 0 || cmd.base >= elements) {
|
|
32539
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
32453
32540
|
}
|
|
32454
32541
|
else if (cmd.quantity <= 0) {
|
|
32455
|
-
return
|
|
32542
|
+
return 88 /* CommandResult.InvalidQuantity */;
|
|
32456
32543
|
}
|
|
32457
32544
|
return 0 /* CommandResult.Success */;
|
|
32458
32545
|
case "REMOVE_COLUMNS_ROWS": {
|
|
@@ -32460,7 +32547,7 @@
|
|
|
32460
32547
|
? this.getNumberCols(cmd.sheetId)
|
|
32461
32548
|
: this.getNumberRows(cmd.sheetId);
|
|
32462
32549
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
32463
|
-
return
|
|
32550
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
32464
32551
|
}
|
|
32465
32552
|
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
32466
32553
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
@@ -32926,18 +33013,18 @@
|
|
|
32926
33013
|
checkRowFreezeQuantity(cmd) {
|
|
32927
33014
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
|
|
32928
33015
|
? 0 /* CommandResult.Success */
|
|
32929
|
-
:
|
|
33016
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
32930
33017
|
}
|
|
32931
33018
|
checkColFreezeQuantity(cmd) {
|
|
32932
33019
|
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
|
|
32933
33020
|
? 0 /* CommandResult.Success */
|
|
32934
|
-
:
|
|
33021
|
+
: 75 /* CommandResult.InvalidFreezeQuantity */;
|
|
32935
33022
|
}
|
|
32936
33023
|
checkRowFreezeOverlapMerge(cmd) {
|
|
32937
33024
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
32938
33025
|
for (let merge of merges) {
|
|
32939
33026
|
if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
|
|
32940
|
-
return
|
|
33027
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
32941
33028
|
}
|
|
32942
33029
|
}
|
|
32943
33030
|
return 0 /* CommandResult.Success */;
|
|
@@ -32946,7 +33033,7 @@
|
|
|
32946
33033
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
32947
33034
|
for (let merge of merges) {
|
|
32948
33035
|
if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
|
|
32949
|
-
return
|
|
33036
|
+
return 66 /* CommandResult.MergeOverlap */;
|
|
32950
33037
|
}
|
|
32951
33038
|
}
|
|
32952
33039
|
return 0 /* CommandResult.Success */;
|
|
@@ -33481,13 +33568,18 @@
|
|
|
33481
33568
|
// Getters
|
|
33482
33569
|
// ---------------------------------------------------------------------------
|
|
33483
33570
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
33484
|
-
|
|
33485
|
-
|
|
33486
|
-
|
|
33487
|
-
|
|
33488
|
-
|
|
33571
|
+
try {
|
|
33572
|
+
const compiledFormula = compile(formulaString);
|
|
33573
|
+
const params = this.getCompilationParameters((cell) => this.getEvaluatedCell(this.getters.getCellPosition(cell.id)));
|
|
33574
|
+
const ranges = [];
|
|
33575
|
+
for (let xc of compiledFormula.dependencies) {
|
|
33576
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
33577
|
+
}
|
|
33578
|
+
return compiledFormula.execute(ranges, ...params).value;
|
|
33579
|
+
}
|
|
33580
|
+
catch (error) {
|
|
33581
|
+
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
33489
33582
|
}
|
|
33490
|
-
return compiledFormula.execute(ranges, ...params).value;
|
|
33491
33583
|
}
|
|
33492
33584
|
/**
|
|
33493
33585
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -33672,10 +33764,8 @@
|
|
|
33672
33764
|
* that are actually present in the grid.
|
|
33673
33765
|
*/
|
|
33674
33766
|
function range(range) {
|
|
33767
|
+
assertRangeValid(range);
|
|
33675
33768
|
const sheetId = range.sheetId;
|
|
33676
|
-
if (!isZoneValid(range.zone)) {
|
|
33677
|
-
throw new InvalidReferenceError();
|
|
33678
|
-
}
|
|
33679
33769
|
// Performance issue: Avoid fetching data on positions that are out of the spreadsheet
|
|
33680
33770
|
// e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
|
|
33681
33771
|
const sheetZone = getters.getSheetZone(sheetId);
|
|
@@ -33710,23 +33800,26 @@
|
|
|
33710
33800
|
* The `compute` of the formula's function must process it completely
|
|
33711
33801
|
*/
|
|
33712
33802
|
function refFn(range, isMeta, functionName, paramNumber) {
|
|
33803
|
+
assertRangeValid(range);
|
|
33713
33804
|
if (isMeta) {
|
|
33714
33805
|
// Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
|
|
33715
33806
|
return { value: zoneToXc(range.zone) };
|
|
33716
33807
|
}
|
|
33717
|
-
if (!isZoneValid(range.zone)) {
|
|
33718
|
-
throw new InvalidReferenceError();
|
|
33719
|
-
}
|
|
33720
33808
|
// if the formula definition could have accepted a range, we would pass through the _range function and not here
|
|
33721
33809
|
if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
|
|
33722
33810
|
throw new Error(paramNumber
|
|
33723
33811
|
? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
|
|
33724
33812
|
: _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
|
|
33725
33813
|
}
|
|
33814
|
+
return readCell(range);
|
|
33815
|
+
}
|
|
33816
|
+
function assertRangeValid(range) {
|
|
33817
|
+
if (!isZoneValid(range.zone)) {
|
|
33818
|
+
throw new InvalidReferenceError();
|
|
33819
|
+
}
|
|
33726
33820
|
if (range.invalidSheetName) {
|
|
33727
33821
|
throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
|
|
33728
33822
|
}
|
|
33729
|
-
return readCell(range);
|
|
33730
33823
|
}
|
|
33731
33824
|
return [refFn, range, evalContext];
|
|
33732
33825
|
}
|
|
@@ -33912,39 +34005,34 @@
|
|
|
33912
34005
|
this.computedIcons[sheetId] = {};
|
|
33913
34006
|
const computedStyle = this.computedStyles[sheetId];
|
|
33914
34007
|
for (let cf of this.getters.getConditionalFormats(sheetId).reverse()) {
|
|
33915
|
-
|
|
33916
|
-
|
|
33917
|
-
|
|
33918
|
-
|
|
33919
|
-
|
|
33920
|
-
|
|
33921
|
-
|
|
33922
|
-
|
|
33923
|
-
|
|
33924
|
-
|
|
33925
|
-
|
|
33926
|
-
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
|
|
33930
|
-
for (let
|
|
33931
|
-
|
|
33932
|
-
|
|
33933
|
-
|
|
33934
|
-
if (
|
|
33935
|
-
|
|
33936
|
-
|
|
33937
|
-
|
|
33938
|
-
computedStyle[col][row] = Object.assign(computedStyle[col]?.[row] || {}, cf.rule.style);
|
|
33939
|
-
}
|
|
34008
|
+
switch (cf.rule.type) {
|
|
34009
|
+
case "ColorScaleRule":
|
|
34010
|
+
for (let range of cf.ranges) {
|
|
34011
|
+
this.applyColorScale(range, cf.rule);
|
|
34012
|
+
}
|
|
34013
|
+
break;
|
|
34014
|
+
case "IconSetRule":
|
|
34015
|
+
for (let range of cf.ranges) {
|
|
34016
|
+
this.applyIcon(range, cf.rule);
|
|
34017
|
+
}
|
|
34018
|
+
break;
|
|
34019
|
+
default:
|
|
34020
|
+
for (let ref of cf.ranges) {
|
|
34021
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, ref).zone;
|
|
34022
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
34023
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
34024
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
34025
|
+
let cell = this.getters.getEvaluatedCell({ sheetId, col, row });
|
|
34026
|
+
if (pr && pr(cell, cf.rule)) {
|
|
34027
|
+
if (!computedStyle[col])
|
|
34028
|
+
computedStyle[col] = [];
|
|
34029
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
34030
|
+
computedStyle[col][row] = Object.assign(computedStyle[col]?.[row] || {}, cf.rule.style);
|
|
33940
34031
|
}
|
|
33941
34032
|
}
|
|
33942
34033
|
}
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
}
|
|
33946
|
-
catch (_) {
|
|
33947
|
-
// we don't care about the errors within the evaluation of a rule
|
|
34034
|
+
}
|
|
34035
|
+
break;
|
|
33948
34036
|
}
|
|
33949
34037
|
}
|
|
33950
34038
|
}
|
|
@@ -33969,7 +34057,7 @@
|
|
|
33969
34057
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
33970
34058
|
case "formula":
|
|
33971
34059
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
33972
|
-
return
|
|
34060
|
+
return typeof value === "number" ? value : null;
|
|
33973
34061
|
default:
|
|
33974
34062
|
return null;
|
|
33975
34063
|
}
|
|
@@ -34216,7 +34304,7 @@
|
|
|
34216
34304
|
switch (cmd.type) {
|
|
34217
34305
|
case "UPDATE_FILTER":
|
|
34218
34306
|
if (!this.getters.getFilterId(cmd)) {
|
|
34219
|
-
return
|
|
34307
|
+
return 80 /* CommandResult.FilterNotFound */;
|
|
34220
34308
|
}
|
|
34221
34309
|
break;
|
|
34222
34310
|
}
|
|
@@ -35186,7 +35274,7 @@
|
|
|
35186
35274
|
}
|
|
35187
35275
|
checkPositiveDimension(cmd) {
|
|
35188
35276
|
if (cmd.width < 0 || cmd.height < 0) {
|
|
35189
|
-
return
|
|
35277
|
+
return 69 /* CommandResult.InvalidViewportSize */;
|
|
35190
35278
|
}
|
|
35191
35279
|
return 0 /* CommandResult.Success */;
|
|
35192
35280
|
}
|
|
@@ -35196,7 +35284,7 @@
|
|
|
35196
35284
|
cmd.gridOffsetY === this.gridOffsetY &&
|
|
35197
35285
|
cmd.width === width &&
|
|
35198
35286
|
cmd.height === height) {
|
|
35199
|
-
return
|
|
35287
|
+
return 77 /* CommandResult.ValuesNotChanged */;
|
|
35200
35288
|
}
|
|
35201
35289
|
return 0 /* CommandResult.Success */;
|
|
35202
35290
|
}
|
|
@@ -35204,7 +35292,7 @@
|
|
|
35204
35292
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
35205
35293
|
if ((!pane.canScrollHorizontally && offsetX > 0) ||
|
|
35206
35294
|
(!pane.canScrollVertically && offsetY > 0)) {
|
|
35207
|
-
return
|
|
35295
|
+
return 70 /* CommandResult.InvalidScrollingDirection */;
|
|
35208
35296
|
}
|
|
35209
35297
|
return 0 /* CommandResult.Success */;
|
|
35210
35298
|
}
|
|
@@ -35459,7 +35547,7 @@
|
|
|
35459
35547
|
if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
|
|
35460
35548
|
return 0 /* CommandResult.Success */;
|
|
35461
35549
|
}
|
|
35462
|
-
return
|
|
35550
|
+
return 46 /* CommandResult.InvalidAutofillSelection */;
|
|
35463
35551
|
case "AUTOFILL_AUTO":
|
|
35464
35552
|
const zone = this.getters.getSelectedZone();
|
|
35465
35553
|
return zone.top === zone.bottom
|
|
@@ -35618,19 +35706,21 @@
|
|
|
35618
35706
|
let col = zone.left;
|
|
35619
35707
|
let row = zone.bottom;
|
|
35620
35708
|
if (col > 0) {
|
|
35621
|
-
let
|
|
35622
|
-
while (
|
|
35709
|
+
let leftPosition = { sheetId, col: col - 1, row };
|
|
35710
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
|
|
35711
|
+
this.getters.getCell(leftPosition)?.content) {
|
|
35623
35712
|
row += 1;
|
|
35624
|
-
|
|
35713
|
+
leftPosition = { sheetId, col: col - 1, row };
|
|
35625
35714
|
}
|
|
35626
35715
|
}
|
|
35627
35716
|
if (row === zone.bottom) {
|
|
35628
35717
|
col = zone.right;
|
|
35629
35718
|
if (col <= this.getters.getNumberCols(sheetId)) {
|
|
35630
|
-
let
|
|
35631
|
-
while (
|
|
35719
|
+
let rightPosition = { sheetId, col: col + 1, row };
|
|
35720
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
|
|
35721
|
+
this.getters.getCell(rightPosition)?.content) {
|
|
35632
35722
|
row += 1;
|
|
35633
|
-
|
|
35723
|
+
rightPosition = { sheetId, col: col + 1, row };
|
|
35634
35724
|
}
|
|
35635
35725
|
}
|
|
35636
35726
|
}
|
|
@@ -36061,7 +36151,7 @@
|
|
|
36061
36151
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
36062
36152
|
}
|
|
36063
36153
|
catch (error) {
|
|
36064
|
-
return
|
|
36154
|
+
return 73 /* CommandResult.InvalidCellPopover */;
|
|
36065
36155
|
}
|
|
36066
36156
|
return 0 /* CommandResult.Success */;
|
|
36067
36157
|
default:
|
|
@@ -38197,21 +38287,6 @@
|
|
|
38197
38287
|
// ---------------------------------------------------------------------------
|
|
38198
38288
|
// Command Handling
|
|
38199
38289
|
// ---------------------------------------------------------------------------
|
|
38200
|
-
allowDispatch(cmd) {
|
|
38201
|
-
switch (cmd.type) {
|
|
38202
|
-
case "ADD_EMPTY_RANGE":
|
|
38203
|
-
if (this.inputHasSingleRange && this.ranges.length === 1) {
|
|
38204
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38205
|
-
}
|
|
38206
|
-
break;
|
|
38207
|
-
case "CHANGE_RANGE":
|
|
38208
|
-
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
38209
|
-
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38210
|
-
}
|
|
38211
|
-
break;
|
|
38212
|
-
}
|
|
38213
|
-
return 0 /* CommandResult.Success */;
|
|
38214
|
-
}
|
|
38215
38290
|
handleEvent(event) {
|
|
38216
38291
|
const xc = zoneToXc(event.anchor.zone);
|
|
38217
38292
|
const inputSheetId = this.activeSheet;
|
|
@@ -38427,6 +38502,15 @@
|
|
|
38427
38502
|
// Command Handling
|
|
38428
38503
|
// ---------------------------------------------------------------------------
|
|
38429
38504
|
allowDispatch(cmd) {
|
|
38505
|
+
switch (cmd.type) {
|
|
38506
|
+
case "FOCUS_RANGE":
|
|
38507
|
+
case "CHANGE_RANGE":
|
|
38508
|
+
case "ADD_EMPTY_RANGE":
|
|
38509
|
+
case "REMOVE_RANGE":
|
|
38510
|
+
if (!this.inputs[cmd.id]) {
|
|
38511
|
+
return 31 /* CommandResult.InvalidInputId */;
|
|
38512
|
+
}
|
|
38513
|
+
}
|
|
38430
38514
|
switch (cmd.type) {
|
|
38431
38515
|
case "FOCUS_RANGE":
|
|
38432
38516
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
@@ -38434,9 +38518,19 @@
|
|
|
38434
38518
|
return 29 /* CommandResult.InputAlreadyFocused */;
|
|
38435
38519
|
}
|
|
38436
38520
|
break;
|
|
38437
|
-
|
|
38438
|
-
|
|
38439
|
-
|
|
38521
|
+
case "ADD_EMPTY_RANGE":
|
|
38522
|
+
const input = this.inputs[cmd.id];
|
|
38523
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) {
|
|
38524
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38525
|
+
}
|
|
38526
|
+
break;
|
|
38527
|
+
case "CHANGE_RANGE": {
|
|
38528
|
+
const input = this.inputs[cmd.id];
|
|
38529
|
+
if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
38530
|
+
return 30 /* CommandResult.MaximumRangesReached */;
|
|
38531
|
+
}
|
|
38532
|
+
break;
|
|
38533
|
+
}
|
|
38440
38534
|
}
|
|
38441
38535
|
return 0 /* CommandResult.Success */;
|
|
38442
38536
|
}
|
|
@@ -38560,7 +38654,7 @@
|
|
|
38560
38654
|
/*Test the presence of single cells*/
|
|
38561
38655
|
const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
|
|
38562
38656
|
if (singleCells) {
|
|
38563
|
-
return
|
|
38657
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
38564
38658
|
}
|
|
38565
38659
|
return 0 /* CommandResult.Success */;
|
|
38566
38660
|
}
|
|
@@ -38579,7 +38673,7 @@
|
|
|
38579
38673
|
];
|
|
38580
38674
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
38581
38675
|
})) {
|
|
38582
|
-
return
|
|
38676
|
+
return 64 /* CommandResult.InvalidSortZone */;
|
|
38583
38677
|
}
|
|
38584
38678
|
return 0 /* CommandResult.Success */;
|
|
38585
38679
|
}
|
|
@@ -39082,7 +39176,7 @@
|
|
|
39082
39176
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
39083
39177
|
const zones = this.getters.getCommandZones(cmd);
|
|
39084
39178
|
if (!sheetId && zones.length > 0) {
|
|
39085
|
-
return
|
|
39179
|
+
return 93 /* CommandResult.NoActiveSheet */;
|
|
39086
39180
|
}
|
|
39087
39181
|
if (sheetId && zones.length > 0) {
|
|
39088
39182
|
return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
@@ -39564,13 +39658,13 @@
|
|
|
39564
39658
|
}
|
|
39565
39659
|
checkSingleColSelected() {
|
|
39566
39660
|
if (!this.getters.isSingleColSelected()) {
|
|
39567
|
-
return
|
|
39661
|
+
return 89 /* CommandResult.MoreThanOneColumnSelected */;
|
|
39568
39662
|
}
|
|
39569
39663
|
return 0 /* CommandResult.Success */;
|
|
39570
39664
|
}
|
|
39571
39665
|
checkNonEmptySelector(cmd) {
|
|
39572
39666
|
if (cmd.separator === "") {
|
|
39573
|
-
return
|
|
39667
|
+
return 90 /* CommandResult.EmptySplitSeparator */;
|
|
39574
39668
|
}
|
|
39575
39669
|
return 0 /* CommandResult.Success */;
|
|
39576
39670
|
}
|
|
@@ -39581,7 +39675,7 @@
|
|
|
39581
39675
|
const selection = this.getters.getSelectedZones()[0];
|
|
39582
39676
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
39583
39677
|
if (this.willSplittedColsOverwriteContent(selection, splitted)) {
|
|
39584
|
-
return
|
|
39678
|
+
return 91 /* CommandResult.SplitWillOverwriteContent */;
|
|
39585
39679
|
}
|
|
39586
39680
|
return 0 /* CommandResult.Success */;
|
|
39587
39681
|
}
|
|
@@ -39592,7 +39686,7 @@
|
|
|
39592
39686
|
return 0 /* CommandResult.Success */;
|
|
39593
39687
|
}
|
|
39594
39688
|
}
|
|
39595
|
-
return
|
|
39689
|
+
return 92 /* CommandResult.NoSplitSeparatorInSelection */;
|
|
39596
39690
|
}
|
|
39597
39691
|
}
|
|
39598
39692
|
|
|
@@ -39739,7 +39833,7 @@
|
|
|
39739
39833
|
for (const zone of this.getPasteZones(target)) {
|
|
39740
39834
|
if ((zone.left < xSplit && zone.right >= xSplit) ||
|
|
39741
39835
|
(zone.top < ySplit && zone.bottom >= ySplit)) {
|
|
39742
|
-
return
|
|
39836
|
+
return 76 /* CommandResult.FrozenPaneOverlap */;
|
|
39743
39837
|
}
|
|
39744
39838
|
}
|
|
39745
39839
|
return 0 /* CommandResult.Success */;
|
|
@@ -40133,7 +40227,7 @@
|
|
|
40133
40227
|
}
|
|
40134
40228
|
isPasteAllowed(target, option) {
|
|
40135
40229
|
if (target.length === 0) {
|
|
40136
|
-
return
|
|
40230
|
+
return 74 /* CommandResult.EmptyTarget */;
|
|
40137
40231
|
}
|
|
40138
40232
|
if (option?.pasteOption !== undefined) {
|
|
40139
40233
|
return 22 /* CommandResult.WrongFigurePasteOption */;
|
|
@@ -40578,6 +40672,10 @@
|
|
|
40578
40672
|
return xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
40579
40673
|
case "colrow":
|
|
40580
40674
|
indexOfNumber = xc.search(/[0-9]/);
|
|
40675
|
+
if (indexOfNumber === -1 || indexOfNumber === 0) {
|
|
40676
|
+
// no row number (eg. A) or no column (eg. 1)
|
|
40677
|
+
return "$" + xc;
|
|
40678
|
+
}
|
|
40581
40679
|
xc = xc.slice(0, indexOfNumber) + "$" + xc.slice(indexOfNumber);
|
|
40582
40680
|
return "$" + xc;
|
|
40583
40681
|
case "none":
|
|
@@ -40870,7 +40968,7 @@
|
|
|
40870
40968
|
validateSelection(length, start, end) {
|
|
40871
40969
|
return start >= 0 && start <= length && end >= 0 && end <= length
|
|
40872
40970
|
? 0 /* CommandResult.Success */
|
|
40873
|
-
:
|
|
40971
|
+
: 47 /* CommandResult.WrongComposerSelection */;
|
|
40874
40972
|
}
|
|
40875
40973
|
onColumnsRemoved(cmd) {
|
|
40876
40974
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -41181,9 +41279,10 @@
|
|
|
41181
41279
|
*/
|
|
41182
41280
|
getReferencedRanges() {
|
|
41183
41281
|
const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
|
|
41184
|
-
|
|
41282
|
+
const referenceRanges = this.currentTokens
|
|
41185
41283
|
.filter((token) => token.type === "REFERENCE")
|
|
41186
41284
|
.map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
|
|
41285
|
+
return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
|
|
41187
41286
|
}
|
|
41188
41287
|
/**
|
|
41189
41288
|
* Function used to determine when composer selection can start.
|
|
@@ -41759,7 +41858,7 @@
|
|
|
41759
41858
|
sheetId: cmd.sheetId,
|
|
41760
41859
|
base: cmd.base,
|
|
41761
41860
|
quantity: thickness,
|
|
41762
|
-
position:
|
|
41861
|
+
position: cmd.position,
|
|
41763
41862
|
});
|
|
41764
41863
|
const isCol = cmd.dimension === "COL";
|
|
41765
41864
|
const start = cmd.elements[0];
|
|
@@ -41776,12 +41875,13 @@
|
|
|
41776
41875
|
},
|
|
41777
41876
|
];
|
|
41778
41877
|
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
41878
|
+
const base = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
41779
41879
|
const pasteTarget = [
|
|
41780
41880
|
{
|
|
41781
|
-
left: isCol ?
|
|
41782
|
-
right: isCol ?
|
|
41783
|
-
top: !isCol ?
|
|
41784
|
-
bottom: !isCol ?
|
|
41881
|
+
left: isCol ? base : 0,
|
|
41882
|
+
right: isCol ? base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
41883
|
+
top: !isCol ? base : 0,
|
|
41884
|
+
bottom: !isCol ? base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
41785
41885
|
},
|
|
41786
41886
|
];
|
|
41787
41887
|
state.paste(pasteTarget, { selectTarget: true });
|
|
@@ -41818,6 +41918,11 @@
|
|
|
41818
41918
|
doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) {
|
|
41819
41919
|
return 2 /* CommandResult.WillRemoveExistingMerge */;
|
|
41820
41920
|
}
|
|
41921
|
+
const headers = [cmd.base, ...cmd.elements];
|
|
41922
|
+
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
41923
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
|
|
41924
|
+
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
41925
|
+
}
|
|
41821
41926
|
return 0 /* CommandResult.Success */;
|
|
41822
41927
|
}
|
|
41823
41928
|
//-------------------------------------------
|
|
@@ -44099,7 +44204,7 @@
|
|
|
44099
44204
|
}
|
|
44100
44205
|
onKeydown(ev) {
|
|
44101
44206
|
let keyDownString = "";
|
|
44102
|
-
if (ev
|
|
44207
|
+
if (isCtrlKey(ev)) {
|
|
44103
44208
|
keyDownString += "CTRL+";
|
|
44104
44209
|
}
|
|
44105
44210
|
keyDownString += ev.key.toUpperCase();
|
|
@@ -45165,7 +45270,7 @@
|
|
|
45165
45270
|
*/
|
|
45166
45271
|
moveAnchorCell(direction, step = 1) {
|
|
45167
45272
|
if (step !== "end" && step <= 0) {
|
|
45168
|
-
return new DispatchResult(
|
|
45273
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
45169
45274
|
}
|
|
45170
45275
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
45171
45276
|
return this.selectCell(col, row);
|
|
@@ -45211,7 +45316,7 @@
|
|
|
45211
45316
|
*/
|
|
45212
45317
|
resizeAnchorZone(direction, step = 1) {
|
|
45213
45318
|
if (step !== "end" && step <= 0) {
|
|
45214
|
-
return new DispatchResult(
|
|
45319
|
+
return new DispatchResult(84 /* CommandResult.InvalidSelectionStep */);
|
|
45215
45320
|
}
|
|
45216
45321
|
const sheetId = this.getters.getActiveSheetId();
|
|
45217
45322
|
const anchor = this.anchor;
|
|
@@ -46038,12 +46143,7 @@
|
|
|
46038
46143
|
attrs.push(["t", "str"]);
|
|
46039
46144
|
cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
|
|
46040
46145
|
}
|
|
46041
|
-
node = escapeXml /*xml*/
|
|
46042
|
-
<f>
|
|
46043
|
-
${XlsxFormula}
|
|
46044
|
-
</f>
|
|
46045
|
-
${cycle}
|
|
46046
|
-
`;
|
|
46146
|
+
node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
|
|
46047
46147
|
return { attrs, node };
|
|
46048
46148
|
}
|
|
46049
46149
|
else {
|
|
@@ -46865,11 +46965,10 @@
|
|
|
46865
46965
|
({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
|
|
46866
46966
|
}
|
|
46867
46967
|
attributes.push(...additionalAttrs);
|
|
46868
|
-
|
|
46869
|
-
|
|
46870
|
-
|
|
46871
|
-
|
|
46872
|
-
`);
|
|
46968
|
+
// prettier-ignore
|
|
46969
|
+
cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
|
|
46970
|
+
${cellNode}
|
|
46971
|
+
</c>`);
|
|
46873
46972
|
}
|
|
46874
46973
|
}
|
|
46875
46974
|
if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
|
|
@@ -47554,10 +47653,10 @@
|
|
|
47554
47653
|
const command = createCommand(type, payload);
|
|
47555
47654
|
let status = this.status;
|
|
47556
47655
|
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
|
|
47557
|
-
return new DispatchResult(
|
|
47656
|
+
return new DispatchResult(68 /* CommandResult.Readonly */);
|
|
47558
47657
|
}
|
|
47559
47658
|
if (!this.session.canApplyOptimisticUpdate()) {
|
|
47560
|
-
return new DispatchResult(
|
|
47659
|
+
return new DispatchResult(65 /* CommandResult.WaitingSessionConfirmation */);
|
|
47561
47660
|
}
|
|
47562
47661
|
switch (status) {
|
|
47563
47662
|
case 0 /* Status.Ready */:
|
|
@@ -47838,9 +47937,9 @@
|
|
|
47838
47937
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47839
47938
|
|
|
47840
47939
|
|
|
47841
|
-
__info__.version = '16.3.
|
|
47842
|
-
__info__.date = '
|
|
47843
|
-
__info__.hash = '
|
|
47940
|
+
__info__.version = '16.3.24';
|
|
47941
|
+
__info__.date = '2024-02-02T13:45:48.440Z';
|
|
47942
|
+
__info__.hash = '0bf5f45';
|
|
47844
47943
|
|
|
47845
47944
|
|
|
47846
47945
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|