@odoo/o-spreadsheet 17.0.98 → 17.0.100
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 +655 -724
- package/dist/o-spreadsheet.esm.js +655 -724
- package/dist/o-spreadsheet.iife.js +655 -724
- package/dist/o-spreadsheet.iife.min.js +271 -271
- package/dist/o_spreadsheet.xml +5 -4
- package/package.json +17 -17
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2026-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.100
|
|
6
|
+
* @date 2026-06-06T06:18:41.503Z
|
|
7
|
+
* @hash 55a7453
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, useChildSubEnv, useComponent, useEffect, useExternalListener, useRef, useState, useSubEnv, xml } from "@odoo/owl";
|
|
@@ -16,7 +16,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
16
16
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17
17
|
var __getProtoOf = Object.getPrototypeOf;
|
|
18
18
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
20
20
|
var __exportAll = (all, no_symbols) => {
|
|
21
21
|
let target = {};
|
|
22
22
|
for (var name in all) {
|
|
@@ -87,6 +87,7 @@ const _t = function(s, ...values) {
|
|
|
87
87
|
return sprintf(_translate(s), ...values);
|
|
88
88
|
};
|
|
89
89
|
var LazyTranslatedString = class extends String {
|
|
90
|
+
values;
|
|
90
91
|
constructor(str, values) {
|
|
91
92
|
super(str);
|
|
92
93
|
this.values = values;
|
|
@@ -102,53 +103,46 @@ var LazyTranslatedString = class extends String {
|
|
|
102
103
|
|
|
103
104
|
//#endregion
|
|
104
105
|
//#region src/types/errors.ts
|
|
105
|
-
let CellErrorType = /* @__PURE__ */ function(CellErrorType) {
|
|
106
|
-
CellErrorType["NotAvailable"] = "#N/A";
|
|
107
|
-
CellErrorType["InvalidReference"] = "#REF";
|
|
108
|
-
CellErrorType["BadExpression"] = "#BAD_EXPR";
|
|
109
|
-
CellErrorType["CircularDependency"] = "#CYCLE";
|
|
110
|
-
CellErrorType["UnknownFunction"] = "#NAME?";
|
|
111
|
-
CellErrorType["GenericError"] = "#ERROR";
|
|
112
|
-
return CellErrorType;
|
|
113
|
-
}({});
|
|
114
106
|
let CellErrorLevel = /* @__PURE__ */ function(CellErrorLevel) {
|
|
115
107
|
CellErrorLevel[CellErrorLevel["silent"] = 0] = "silent";
|
|
116
108
|
CellErrorLevel[CellErrorLevel["error"] = 1] = "error";
|
|
117
109
|
return CellErrorLevel;
|
|
118
110
|
}({});
|
|
119
111
|
var EvaluationError = class extends Error {
|
|
120
|
-
|
|
112
|
+
errorType;
|
|
113
|
+
logLevel;
|
|
114
|
+
constructor(errorType, message, logLevel = 1) {
|
|
121
115
|
super(message);
|
|
122
116
|
this.errorType = errorType;
|
|
123
117
|
this.logLevel = logLevel;
|
|
124
118
|
}
|
|
125
119
|
get isVerbose() {
|
|
126
|
-
return this.logLevel >
|
|
120
|
+
return this.logLevel > 0;
|
|
127
121
|
}
|
|
128
122
|
};
|
|
129
123
|
var BadExpressionError = class extends EvaluationError {
|
|
130
124
|
constructor(errorMessage) {
|
|
131
|
-
super(
|
|
125
|
+
super("#BAD_EXPR", errorMessage);
|
|
132
126
|
}
|
|
133
127
|
};
|
|
134
128
|
var CircularDependencyError = class extends EvaluationError {
|
|
135
129
|
constructor() {
|
|
136
|
-
super(
|
|
130
|
+
super("#CYCLE", _t("Circular reference"));
|
|
137
131
|
}
|
|
138
132
|
};
|
|
139
133
|
var InvalidReferenceError = class extends EvaluationError {
|
|
140
134
|
constructor() {
|
|
141
|
-
super(
|
|
135
|
+
super("#REF", _t("Invalid reference"));
|
|
142
136
|
}
|
|
143
137
|
};
|
|
144
138
|
var NotAvailableError = class extends EvaluationError {
|
|
145
139
|
constructor(errorMessage = void 0) {
|
|
146
|
-
super(
|
|
140
|
+
super("#N/A", errorMessage || _t("Data not available"), errorMessage ? 1 : 0);
|
|
147
141
|
}
|
|
148
142
|
};
|
|
149
143
|
var UnknownFunctionError = class extends EvaluationError {
|
|
150
144
|
constructor(fctName) {
|
|
151
|
-
super(
|
|
145
|
+
super("#NAME?", _t("Unknown function: \"%s\"", fctName));
|
|
152
146
|
}
|
|
153
147
|
};
|
|
154
148
|
|
|
@@ -295,7 +289,7 @@ const DEFAULT_FILTER_BORDER_DESC = {
|
|
|
295
289
|
style: "thin",
|
|
296
290
|
color: FILTERS_COLOR
|
|
297
291
|
};
|
|
298
|
-
const INCORRECT_RANGE_STRING =
|
|
292
|
+
const INCORRECT_RANGE_STRING = "#REF";
|
|
299
293
|
const DEFAULT_REVISION_ID = "START_REVISION";
|
|
300
294
|
const DEFAULT_GAUGE_LOWER_COLOR = "#cc0000";
|
|
301
295
|
const DEFAULT_GAUGE_MIDDLE_COLOR = "#f1c232";
|
|
@@ -315,22 +309,6 @@ const FORBIDDEN_SHEET_CHARS = [
|
|
|
315
309
|
];
|
|
316
310
|
const FORBIDDEN_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
317
311
|
const DEFAULT_ERROR_MESSAGE = _t("Invalid expression");
|
|
318
|
-
let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
|
|
319
|
-
ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
|
|
320
|
-
ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
|
|
321
|
-
ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
|
|
322
|
-
ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
|
|
323
|
-
ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
|
|
324
|
-
ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
|
|
325
|
-
ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
|
|
326
|
-
ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
|
|
327
|
-
ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
|
|
328
|
-
ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
|
|
329
|
-
ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
|
|
330
|
-
ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
|
|
331
|
-
ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
|
|
332
|
-
return ComponentsImportance;
|
|
333
|
-
}({});
|
|
334
312
|
let DEFAULT_SHEETVIEW_SIZE = 0;
|
|
335
313
|
function getDefaultSheetViewSize() {
|
|
336
314
|
return DEFAULT_SHEETVIEW_SIZE;
|
|
@@ -1663,25 +1641,6 @@ function percentile(values, percent, isInclusive) {
|
|
|
1663
1641
|
return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
|
|
1664
1642
|
}
|
|
1665
1643
|
|
|
1666
|
-
//#endregion
|
|
1667
|
-
//#region src/types/cells.ts
|
|
1668
|
-
let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
1669
|
-
CellValueType["boolean"] = "boolean";
|
|
1670
|
-
CellValueType["number"] = "number";
|
|
1671
|
-
CellValueType["text"] = "text";
|
|
1672
|
-
CellValueType["empty"] = "empty";
|
|
1673
|
-
CellValueType["error"] = "error";
|
|
1674
|
-
return CellValueType;
|
|
1675
|
-
}({});
|
|
1676
|
-
|
|
1677
|
-
//#endregion
|
|
1678
|
-
//#region src/types/clipboard.ts
|
|
1679
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
1680
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
1681
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
1682
|
-
return ClipboardMIMEType;
|
|
1683
|
-
}({});
|
|
1684
|
-
|
|
1685
1644
|
//#endregion
|
|
1686
1645
|
//#region src/types/commands.ts
|
|
1687
1646
|
function isSheetDependent(cmd) {
|
|
@@ -1810,7 +1769,7 @@ var DispatchResult = class {
|
|
|
1810
1769
|
constructor(results = []) {
|
|
1811
1770
|
if (!Array.isArray(results)) results = [results];
|
|
1812
1771
|
results = [...new Set(results)];
|
|
1813
|
-
this.reasons = results.filter((result) => result !==
|
|
1772
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
1814
1773
|
}
|
|
1815
1774
|
/**
|
|
1816
1775
|
* Static helper which returns a successful DispatchResult
|
|
@@ -1981,27 +1940,6 @@ const borderStyles = [
|
|
|
1981
1940
|
function isMatrix(x) {
|
|
1982
1941
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
1983
1942
|
}
|
|
1984
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
1985
|
-
DIRECTION["UP"] = "up";
|
|
1986
|
-
DIRECTION["DOWN"] = "down";
|
|
1987
|
-
DIRECTION["LEFT"] = "left";
|
|
1988
|
-
DIRECTION["RIGHT"] = "right";
|
|
1989
|
-
return DIRECTION;
|
|
1990
|
-
}({});
|
|
1991
|
-
|
|
1992
|
-
//#endregion
|
|
1993
|
-
//#region src/types/rendering.ts
|
|
1994
|
-
let LAYERS = /* @__PURE__ */ function(LAYERS) {
|
|
1995
|
-
LAYERS[LAYERS["Background"] = 0] = "Background";
|
|
1996
|
-
LAYERS[LAYERS["Highlights"] = 1] = "Highlights";
|
|
1997
|
-
LAYERS[LAYERS["Clipboard"] = 2] = "Clipboard";
|
|
1998
|
-
LAYERS[LAYERS["Search"] = 3] = "Search";
|
|
1999
|
-
LAYERS[LAYERS["Chart"] = 4] = "Chart";
|
|
2000
|
-
LAYERS[LAYERS["Autofill"] = 5] = "Autofill";
|
|
2001
|
-
LAYERS[LAYERS["Selection"] = 6] = "Selection";
|
|
2002
|
-
LAYERS[LAYERS["Headers"] = 7] = "Headers";
|
|
2003
|
-
return LAYERS;
|
|
2004
|
-
}({});
|
|
2005
1943
|
|
|
2006
1944
|
//#endregion
|
|
2007
1945
|
//#region src/functions/helpers.ts
|
|
@@ -2012,7 +1950,7 @@ const SORT_TYPES_ORDER = [
|
|
|
2012
1950
|
"undefined"
|
|
2013
1951
|
];
|
|
2014
1952
|
function assert(condition, message) {
|
|
2015
|
-
if (!condition()) throw new EvaluationError(
|
|
1953
|
+
if (!condition()) throw new EvaluationError("#ERROR", message);
|
|
2016
1954
|
}
|
|
2017
1955
|
const expectNumberValueError = (value) => _t("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.", value);
|
|
2018
1956
|
const expectNumberRangeError = (lowerBound, upperBound, value) => _t("The function [[FUNCTION_NAME]] expects a number value between %s and %s inclusive, but receives %s.", lowerBound.toString(), upperBound.toString(), value.toString());
|
|
@@ -3559,6 +3497,7 @@ function getZonesRows(zones) {
|
|
|
3559
3497
|
//#endregion
|
|
3560
3498
|
//#region src/helpers/range.ts
|
|
3561
3499
|
var RangeImpl = class RangeImpl {
|
|
3500
|
+
getSheetSize;
|
|
3562
3501
|
_zone;
|
|
3563
3502
|
parts;
|
|
3564
3503
|
invalidXc;
|
|
@@ -4005,12 +3944,12 @@ function _createEvaluatedCell(value, localeFormat) {
|
|
|
4005
3944
|
}
|
|
4006
3945
|
return textCell((value || "").toString(), localeFormat);
|
|
4007
3946
|
} catch (error) {
|
|
4008
|
-
return errorCell(new EvaluationError(
|
|
3947
|
+
return errorCell(new EvaluationError("#ERROR", error.message || DEFAULT_ERROR_MESSAGE));
|
|
4009
3948
|
}
|
|
4010
3949
|
}
|
|
4011
3950
|
function textCell(value, localeFormat) {
|
|
4012
3951
|
return {
|
|
4013
|
-
type:
|
|
3952
|
+
type: "text",
|
|
4014
3953
|
value,
|
|
4015
3954
|
format: localeFormat.format,
|
|
4016
3955
|
isAutoSummable: true,
|
|
@@ -4020,7 +3959,7 @@ function textCell(value, localeFormat) {
|
|
|
4020
3959
|
}
|
|
4021
3960
|
function numberCell(value, localeFormat) {
|
|
4022
3961
|
return {
|
|
4023
|
-
type:
|
|
3962
|
+
type: "number",
|
|
4024
3963
|
value: value || 0,
|
|
4025
3964
|
format: localeFormat.format,
|
|
4026
3965
|
isAutoSummable: true,
|
|
@@ -4029,7 +3968,7 @@ function numberCell(value, localeFormat) {
|
|
|
4029
3968
|
};
|
|
4030
3969
|
}
|
|
4031
3970
|
const EMPTY_EVALUATED_CELL = {
|
|
4032
|
-
type:
|
|
3971
|
+
type: "empty",
|
|
4033
3972
|
value: "",
|
|
4034
3973
|
format: void 0,
|
|
4035
3974
|
isAutoSummable: true,
|
|
@@ -4039,7 +3978,7 @@ const EMPTY_EVALUATED_CELL = {
|
|
|
4039
3978
|
function emptyCell(localeFormat) {
|
|
4040
3979
|
if (localeFormat.format === void 0) return EMPTY_EVALUATED_CELL;
|
|
4041
3980
|
return {
|
|
4042
|
-
type:
|
|
3981
|
+
type: "empty",
|
|
4043
3982
|
value: "",
|
|
4044
3983
|
format: localeFormat.format,
|
|
4045
3984
|
isAutoSummable: true,
|
|
@@ -4050,7 +3989,7 @@ function emptyCell(localeFormat) {
|
|
|
4050
3989
|
function dateTimeCell(value, localeFormat) {
|
|
4051
3990
|
const formattedValue = formatValue(value, localeFormat);
|
|
4052
3991
|
return {
|
|
4053
|
-
type:
|
|
3992
|
+
type: "number",
|
|
4054
3993
|
value,
|
|
4055
3994
|
format: localeFormat.format,
|
|
4056
3995
|
isAutoSummable: false,
|
|
@@ -4061,7 +4000,7 @@ function dateTimeCell(value, localeFormat) {
|
|
|
4061
4000
|
function booleanCell(value, localeFormat) {
|
|
4062
4001
|
const formattedValue = value ? "TRUE" : "FALSE";
|
|
4063
4002
|
return {
|
|
4064
|
-
type:
|
|
4003
|
+
type: "boolean",
|
|
4065
4004
|
value,
|
|
4066
4005
|
format: localeFormat.format,
|
|
4067
4006
|
isAutoSummable: false,
|
|
@@ -4071,7 +4010,7 @@ function booleanCell(value, localeFormat) {
|
|
|
4071
4010
|
}
|
|
4072
4011
|
function errorCell(error) {
|
|
4073
4012
|
return {
|
|
4074
|
-
type:
|
|
4013
|
+
type: "error",
|
|
4075
4014
|
value: error.errorType,
|
|
4076
4015
|
error,
|
|
4077
4016
|
isAutoSummable: false,
|
|
@@ -4115,7 +4054,7 @@ function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
|
4115
4054
|
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
4116
4055
|
}
|
|
4117
4056
|
} catch {
|
|
4118
|
-
content =
|
|
4057
|
+
content = "#ERROR";
|
|
4119
4058
|
}
|
|
4120
4059
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4121
4060
|
}
|
|
@@ -4687,16 +4626,16 @@ function chartFontColor(backgroundColor) {
|
|
|
4687
4626
|
}
|
|
4688
4627
|
function checkDataset(definition) {
|
|
4689
4628
|
if (definition.dataSets) {
|
|
4690
|
-
if (definition.dataSets.find((range) => !rangeReference.test(range)) !== void 0) return
|
|
4691
|
-
if (definition.dataSets.map(toUnboundedZone).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
4629
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range)) !== void 0) return "InvalidDataSet";
|
|
4630
|
+
if (definition.dataSets.map(toUnboundedZone).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
4692
4631
|
}
|
|
4693
|
-
return
|
|
4632
|
+
return "Success";
|
|
4694
4633
|
}
|
|
4695
4634
|
function checkLabelRange(definition) {
|
|
4696
4635
|
if (definition.labelRange) {
|
|
4697
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
4636
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
4698
4637
|
}
|
|
4699
|
-
return
|
|
4638
|
+
return "Success";
|
|
4700
4639
|
}
|
|
4701
4640
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
4702
4641
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -4708,7 +4647,7 @@ function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
|
4708
4647
|
}
|
|
4709
4648
|
function getBaselineText(baseline, keyValue, baselineMode, locale) {
|
|
4710
4649
|
if (!baseline) return "";
|
|
4711
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
4650
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") return baseline.formattedValue;
|
|
4712
4651
|
else {
|
|
4713
4652
|
let diff = keyValue.value - baseline.value;
|
|
4714
4653
|
if (baselineMode === "percentage" && diff !== 0) diff = diff / baseline.value * 100;
|
|
@@ -4721,13 +4660,13 @@ function getBaselineText(baseline, keyValue, baselineMode, locale) {
|
|
|
4721
4660
|
}
|
|
4722
4661
|
}
|
|
4723
4662
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
4724
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
4663
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
4725
4664
|
const diff = keyValue.value - baseline.value;
|
|
4726
4665
|
if (diff > 0) return colorUp;
|
|
4727
4666
|
else if (diff < 0) return colorDown;
|
|
4728
4667
|
}
|
|
4729
4668
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
4730
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
4669
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
4731
4670
|
const diff = keyValue.value - baseline.value;
|
|
4732
4671
|
if (diff > 0) return "up";
|
|
4733
4672
|
else if (diff < 0) return "down";
|
|
@@ -4746,10 +4685,10 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
|
|
|
4746
4685
|
//#endregion
|
|
4747
4686
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
4748
4687
|
function checkKeyValue(definition) {
|
|
4749
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
4688
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
4750
4689
|
}
|
|
4751
4690
|
function checkBaseline(definition) {
|
|
4752
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
4691
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
4753
4692
|
}
|
|
4754
4693
|
const arrowDownPath = new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
|
|
4755
4694
|
const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
|
|
@@ -4959,6 +4898,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
4959
4898
|
}, runtime).computeDesign();
|
|
4960
4899
|
}
|
|
4961
4900
|
var ScorecardChartConfigBuilder = class {
|
|
4901
|
+
runtime;
|
|
4962
4902
|
context;
|
|
4963
4903
|
width;
|
|
4964
4904
|
height;
|
|
@@ -5104,6 +5044,7 @@ var ScorecardChartConfigBuilder = class {
|
|
|
5104
5044
|
}
|
|
5105
5045
|
};
|
|
5106
5046
|
var ScorecardScalableElement = class {
|
|
5047
|
+
style;
|
|
5107
5048
|
constructor(style = {}) {
|
|
5108
5049
|
this.style = style;
|
|
5109
5050
|
}
|
|
@@ -5221,19 +5162,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
5221
5162
|
let x = 0;
|
|
5222
5163
|
let y = 0;
|
|
5223
5164
|
switch (direction) {
|
|
5224
|
-
case
|
|
5165
|
+
case "up":
|
|
5225
5166
|
x = 0;
|
|
5226
5167
|
y = -rule.current;
|
|
5227
5168
|
break;
|
|
5228
|
-
case
|
|
5169
|
+
case "down":
|
|
5229
5170
|
x = 0;
|
|
5230
5171
|
y = rule.current;
|
|
5231
5172
|
break;
|
|
5232
|
-
case
|
|
5173
|
+
case "left":
|
|
5233
5174
|
x = -rule.current;
|
|
5234
5175
|
y = 0;
|
|
5235
5176
|
break;
|
|
5236
|
-
case
|
|
5177
|
+
case "right":
|
|
5237
5178
|
x = rule.current;
|
|
5238
5179
|
y = 0;
|
|
5239
5180
|
break;
|
|
@@ -5307,12 +5248,12 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5307
5248
|
},
|
|
5308
5249
|
sequence: 10
|
|
5309
5250
|
}).add("increment_alphanumeric_value", {
|
|
5310
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5251
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
5311
5252
|
generateRule: (cell, cells, direction) => {
|
|
5312
5253
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
5313
5254
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
5314
5255
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
5315
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
5256
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === cell.value.toString().match(stringPrefixRegExp)[0]).map((cell) => parseInt(cell.value.toString().match(numberPostfixRegExp)[0]));
|
|
5316
5257
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
5317
5258
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
5318
5259
|
return {
|
|
@@ -5325,7 +5266,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5325
5266
|
},
|
|
5326
5267
|
sequence: 15
|
|
5327
5268
|
}).add("copy_text", {
|
|
5328
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5269
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "text",
|
|
5329
5270
|
generateRule: () => {
|
|
5330
5271
|
return { type: "COPY_MODIFIER" };
|
|
5331
5272
|
},
|
|
@@ -5341,16 +5282,16 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5341
5282
|
},
|
|
5342
5283
|
sequence: 30
|
|
5343
5284
|
}).add("increment_number", {
|
|
5344
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5285
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "number",
|
|
5345
5286
|
generateRule: (cell, cells, direction) => {
|
|
5346
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
5287
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number").map((cell) => Number(cell.value));
|
|
5347
5288
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
5348
5289
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
5349
5290
|
const evaluation = evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE });
|
|
5350
5291
|
return {
|
|
5351
5292
|
type: "INCREMENT_MODIFIER",
|
|
5352
5293
|
increment,
|
|
5353
|
-
current: evaluation.type ===
|
|
5294
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
5354
5295
|
};
|
|
5355
5296
|
},
|
|
5356
5297
|
sequence: 40
|
|
@@ -5504,7 +5445,7 @@ ErrorToolTip.props = {
|
|
|
5504
5445
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
5505
5446
|
const cell = getters.getEvaluatedCell(position);
|
|
5506
5447
|
const errors = [];
|
|
5507
|
-
if (cell.type ===
|
|
5448
|
+
if (cell.type === "error" && cell.error.isVerbose) errors.push({
|
|
5508
5449
|
title: _t("Error"),
|
|
5509
5450
|
message: cell.error.message
|
|
5510
5451
|
});
|
|
@@ -6028,7 +5969,7 @@ function zoneToRect(zone) {
|
|
|
6028
5969
|
css`
|
|
6029
5970
|
.o-popover {
|
|
6030
5971
|
position: absolute;
|
|
6031
|
-
z-index: ${
|
|
5972
|
+
z-index: ${35};
|
|
6032
5973
|
overflow: auto;
|
|
6033
5974
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
6034
5975
|
width: fit-content;
|
|
@@ -6043,7 +5984,7 @@ var Popover = class extends Component {
|
|
|
6043
5984
|
onMouseWheel: () => {},
|
|
6044
5985
|
onPopoverMoved: () => {},
|
|
6045
5986
|
onPopoverHidden: () => {},
|
|
6046
|
-
zIndex:
|
|
5987
|
+
zIndex: 35
|
|
6047
5988
|
};
|
|
6048
5989
|
popoverRef = useRef("popover");
|
|
6049
5990
|
currentPosition = void 0;
|
|
@@ -6129,6 +6070,10 @@ Popover.props = {
|
|
|
6129
6070
|
slots: Object
|
|
6130
6071
|
};
|
|
6131
6072
|
var PopoverPositionContext = class {
|
|
6073
|
+
anchorRect;
|
|
6074
|
+
containerRect;
|
|
6075
|
+
propsMaxSize;
|
|
6076
|
+
spreadsheetOffset;
|
|
6132
6077
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
6133
6078
|
this.anchorRect = anchorRect;
|
|
6134
6079
|
this.containerRect = containerRect;
|
|
@@ -6746,7 +6691,8 @@ var TokenizingChars = class {
|
|
|
6746
6691
|
}
|
|
6747
6692
|
shift() {
|
|
6748
6693
|
const current = this.current;
|
|
6749
|
-
|
|
6694
|
+
const next = this.text[++this.currentIndex];
|
|
6695
|
+
this.current = next;
|
|
6750
6696
|
return current;
|
|
6751
6697
|
}
|
|
6752
6698
|
advanceBy(length) {
|
|
@@ -7289,10 +7235,10 @@ const PasteInteractiveContent = {
|
|
|
7289
7235
|
};
|
|
7290
7236
|
function handlePasteResult(env, result) {
|
|
7291
7237
|
if (!result.isSuccessful) {
|
|
7292
|
-
if (result.reasons.includes(
|
|
7293
|
-
else if (result.reasons.includes(
|
|
7294
|
-
else if (result.reasons.includes(
|
|
7295
|
-
else if (result.reasons.includes(
|
|
7238
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
7239
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
7240
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
7241
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
7296
7242
|
}
|
|
7297
7243
|
}
|
|
7298
7244
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -7313,24 +7259,24 @@ function interactivePasteFromOS(env, target, text, pasteOption) {
|
|
|
7313
7259
|
//#region src/components/translations_terms.ts
|
|
7314
7260
|
const CfTerms = {
|
|
7315
7261
|
Errors: {
|
|
7316
|
-
[
|
|
7317
|
-
[
|
|
7318
|
-
[
|
|
7319
|
-
[
|
|
7320
|
-
[
|
|
7321
|
-
[
|
|
7322
|
-
[
|
|
7323
|
-
[
|
|
7324
|
-
[
|
|
7325
|
-
[
|
|
7326
|
-
[
|
|
7327
|
-
[
|
|
7328
|
-
[
|
|
7329
|
-
[
|
|
7330
|
-
[
|
|
7331
|
-
[
|
|
7332
|
-
[
|
|
7333
|
-
[
|
|
7262
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
7263
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
7264
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
7265
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
7266
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
7267
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
7268
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
7269
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
7270
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
7271
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
7272
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
7273
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
7274
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
7275
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
7276
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
7277
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
7278
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
7279
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
7334
7280
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
7335
7281
|
},
|
|
7336
7282
|
ColorScale: _t("Color scale"),
|
|
@@ -7356,34 +7302,34 @@ const ChartTerms = {
|
|
|
7356
7302
|
Series: _t("Series"),
|
|
7357
7303
|
Errors: {
|
|
7358
7304
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
7359
|
-
[
|
|
7360
|
-
[
|
|
7361
|
-
[
|
|
7362
|
-
[
|
|
7363
|
-
[
|
|
7364
|
-
[
|
|
7365
|
-
[
|
|
7366
|
-
[
|
|
7367
|
-
[
|
|
7368
|
-
[
|
|
7369
|
-
[
|
|
7370
|
-
[
|
|
7305
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
7306
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
7307
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
7308
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
7309
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
7310
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
7311
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
7312
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
7313
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
7314
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
7315
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
7316
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
7371
7317
|
}
|
|
7372
7318
|
};
|
|
7373
7319
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
7374
7320
|
const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
|
|
7375
7321
|
const SplitToColumnsTerms = { Errors: {
|
|
7376
7322
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
7377
|
-
[
|
|
7378
|
-
[
|
|
7379
|
-
[
|
|
7323
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
7324
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
7325
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
7380
7326
|
} };
|
|
7381
7327
|
const RemoveDuplicateTerms = { Errors: {
|
|
7382
7328
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
7383
|
-
[
|
|
7384
|
-
[
|
|
7385
|
-
[
|
|
7386
|
-
[
|
|
7329
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
7330
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
7331
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
7332
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
7387
7333
|
} };
|
|
7388
7334
|
const DVTerms = {
|
|
7389
7335
|
DateIs: {
|
|
@@ -7797,47 +7743,47 @@ function createBarChartRuntime(chart, getters) {
|
|
|
7797
7743
|
//#endregion
|
|
7798
7744
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
7799
7745
|
function isDataRangeValid(definition) {
|
|
7800
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
7746
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
7801
7747
|
}
|
|
7802
7748
|
function checkRangeLimits(check, batchValidations) {
|
|
7803
7749
|
return batchValidations((definition) => {
|
|
7804
7750
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
7805
|
-
return
|
|
7751
|
+
return "Success";
|
|
7806
7752
|
}, (definition) => {
|
|
7807
7753
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
7808
|
-
return
|
|
7754
|
+
return "Success";
|
|
7809
7755
|
});
|
|
7810
7756
|
}
|
|
7811
7757
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
7812
7758
|
return batchValidations((definition) => {
|
|
7813
7759
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
7814
|
-
return
|
|
7760
|
+
return "Success";
|
|
7815
7761
|
}, (definition) => {
|
|
7816
7762
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
7817
|
-
return
|
|
7763
|
+
return "Success";
|
|
7818
7764
|
});
|
|
7819
7765
|
}
|
|
7820
7766
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7821
7767
|
if (definition.sectionRule) {
|
|
7822
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
7768
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
7823
7769
|
}
|
|
7824
|
-
return
|
|
7770
|
+
return "Success";
|
|
7825
7771
|
}
|
|
7826
7772
|
function checkEmpty(value, valueName) {
|
|
7827
7773
|
if (value === "") switch (valueName) {
|
|
7828
|
-
case "rangeMin": return
|
|
7829
|
-
case "rangeMax": return
|
|
7774
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
7775
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
7830
7776
|
}
|
|
7831
|
-
return
|
|
7777
|
+
return "Success";
|
|
7832
7778
|
}
|
|
7833
7779
|
function checkNaN(value, valueName) {
|
|
7834
7780
|
if (isNaN(value)) switch (valueName) {
|
|
7835
|
-
case "rangeMin": return
|
|
7836
|
-
case "rangeMax": return
|
|
7837
|
-
case "lowerInflectionPointValue": return
|
|
7838
|
-
case "upperInflectionPointValue": return
|
|
7781
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
7782
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
7783
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
7784
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
7839
7785
|
}
|
|
7840
|
-
return
|
|
7786
|
+
return "Success";
|
|
7841
7787
|
}
|
|
7842
7788
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
7843
7789
|
dataRange;
|
|
@@ -7996,7 +7942,7 @@ function createGaugeChartRuntime(chart, getters) {
|
|
|
7996
7942
|
col: dataRange.zone.left,
|
|
7997
7943
|
row: dataRange.zone.top
|
|
7998
7944
|
});
|
|
7999
|
-
if (cell.type ===
|
|
7945
|
+
if (cell.type === "number") {
|
|
8000
7946
|
needleValue = clip(cell.value, minNeedleValue - deltaBeyondRangeLimit, maxNeedleValue + deltaBeyondRangeLimit);
|
|
8001
7947
|
cellFormatter = () => getters.getRangeFormattedValues(dataRange)[0];
|
|
8002
7948
|
displayValue = true;
|
|
@@ -8904,7 +8850,7 @@ function inverseUnhideColumnsRows(cmd) {
|
|
|
8904
8850
|
function interactiveCut(env) {
|
|
8905
8851
|
const result = env.model.dispatch("CUT");
|
|
8906
8852
|
if (!result.isSuccessful) {
|
|
8907
|
-
if (result.isCancelledBecause(
|
|
8853
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
8908
8854
|
}
|
|
8909
8855
|
}
|
|
8910
8856
|
|
|
@@ -8919,8 +8865,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
8919
8865
|
sheetId,
|
|
8920
8866
|
target
|
|
8921
8867
|
});
|
|
8922
|
-
if (result.isCancelledBecause(
|
|
8923
|
-
else if (result.isCancelledBecause(
|
|
8868
|
+
if (result.isCancelledBecause("MergeInFilter")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
8869
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
8924
8870
|
env.model.dispatch("ADD_MERGE", {
|
|
8925
8871
|
sheetId,
|
|
8926
8872
|
target,
|
|
@@ -9022,9 +8968,9 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
9022
8968
|
...dataSetZone,
|
|
9023
8969
|
bottom: dataSetZone.top
|
|
9024
8970
|
});
|
|
9025
|
-
const dataSetsHaveTitle = !!cellsInFirstRow.find((cell) => cell.type !==
|
|
8971
|
+
const dataSetsHaveTitle = !!cellsInFirstRow.find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
9026
8972
|
if (dataSetsHaveTitle) {
|
|
9027
|
-
const texts = cellsInFirstRow.filter((cell) => cell.type !==
|
|
8973
|
+
const texts = cellsInFirstRow.filter((cell) => cell.type !== "error" && cell.type !== "empty").map((cell) => cell.formattedValue);
|
|
9028
8974
|
const lastElement = texts.splice(-1)[0];
|
|
9029
8975
|
title = texts.join(", ");
|
|
9030
8976
|
if (lastElement) title += (title ? " " + _t("and") + " " : "") + lastElement;
|
|
@@ -9334,7 +9280,7 @@ async function paste$1(env, pasteOption) {
|
|
|
9334
9280
|
const target = env.model.getters.getSelectedZones();
|
|
9335
9281
|
if (osClipboard && osClipboard.content !== spreadsheetClipboard) interactivePasteFromOS(env, target, osClipboard.content, pasteOption);
|
|
9336
9282
|
else interactivePaste(env, target, pasteOption);
|
|
9337
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "onlyValue") await env.clipboard.write({ [
|
|
9283
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "onlyValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
9338
9284
|
break;
|
|
9339
9285
|
case "notImplemented":
|
|
9340
9286
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -12658,15 +12604,15 @@ const DATEDIF = {
|
|
|
12658
12604
|
const jsEndDate = numberToJsDate(_endDate);
|
|
12659
12605
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
12660
12606
|
switch (_unit) {
|
|
12661
|
-
case
|
|
12662
|
-
case
|
|
12663
|
-
case
|
|
12664
|
-
case
|
|
12665
|
-
case
|
|
12607
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
12608
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
12609
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
12610
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
12611
|
+
case "MD":
|
|
12666
12612
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
12667
12613
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
12668
12614
|
return days;
|
|
12669
|
-
case
|
|
12615
|
+
case "YD": {
|
|
12670
12616
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
12671
12617
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
12672
12618
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -13199,18 +13145,18 @@ const DELTA = {
|
|
|
13199
13145
|
//#endregion
|
|
13200
13146
|
//#region src/helpers/sort.ts
|
|
13201
13147
|
const SORT_TYPES = [
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13148
|
+
"number",
|
|
13149
|
+
"error",
|
|
13150
|
+
"text",
|
|
13151
|
+
"boolean"
|
|
13206
13152
|
];
|
|
13207
13153
|
function cellsSortingCriterion(sortingOrder) {
|
|
13208
13154
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
13209
13155
|
return (left, right) => {
|
|
13210
|
-
if (left.type ===
|
|
13211
|
-
else if (right.type ===
|
|
13156
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
13157
|
+
else if (right.type === "empty") return -1;
|
|
13212
13158
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
13213
|
-
if (typeOrder === 0) if (left.type ===
|
|
13159
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
13214
13160
|
else typeOrder = left.value - right.value;
|
|
13215
13161
|
return inverse * typeOrder;
|
|
13216
13162
|
};
|
|
@@ -13221,9 +13167,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
13221
13167
|
type: cell.type,
|
|
13222
13168
|
value: cell.value
|
|
13223
13169
|
}));
|
|
13224
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
13170
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
13225
13171
|
...cell,
|
|
13226
|
-
type:
|
|
13172
|
+
type: "number",
|
|
13227
13173
|
value: 0
|
|
13228
13174
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
13229
13175
|
}
|
|
@@ -13285,7 +13231,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
13285
13231
|
});
|
|
13286
13232
|
});
|
|
13287
13233
|
}
|
|
13288
|
-
if (result.isCancelledBecause(
|
|
13234
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
13289
13235
|
const { col, row } = anchor;
|
|
13290
13236
|
env.model.selection.selectZone({
|
|
13291
13237
|
cell: {
|
|
@@ -13338,11 +13284,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
13338
13284
|
const right = sortColumn[b];
|
|
13339
13285
|
const leftCell = {
|
|
13340
13286
|
value: left,
|
|
13341
|
-
type: left === null ?
|
|
13287
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
13342
13288
|
};
|
|
13343
13289
|
const rightCell = {
|
|
13344
13290
|
value: right,
|
|
13345
|
-
type: right === null ?
|
|
13291
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
13346
13292
|
};
|
|
13347
13293
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
13348
13294
|
if (result !== 0) return result;
|
|
@@ -15255,7 +15201,7 @@ const ISERR = {
|
|
|
15255
15201
|
value();
|
|
15256
15202
|
return false;
|
|
15257
15203
|
} catch (e) {
|
|
15258
|
-
return e?.errorType !==
|
|
15204
|
+
return e?.errorType !== "#N/A";
|
|
15259
15205
|
}
|
|
15260
15206
|
},
|
|
15261
15207
|
isExported: true
|
|
@@ -15296,7 +15242,7 @@ const ISNA = {
|
|
|
15296
15242
|
value();
|
|
15297
15243
|
return false;
|
|
15298
15244
|
} catch (e) {
|
|
15299
|
-
return e?.errorType ===
|
|
15245
|
+
return e?.errorType === "#N/A";
|
|
15300
15246
|
}
|
|
15301
15247
|
},
|
|
15302
15248
|
isExported: true
|
|
@@ -15445,7 +15391,7 @@ const IFNA = {
|
|
|
15445
15391
|
try {
|
|
15446
15392
|
result = value();
|
|
15447
15393
|
} catch (e) {
|
|
15448
|
-
if (e.errorType ===
|
|
15394
|
+
if (e.errorType === "#N/A") result = valueIfError();
|
|
15449
15395
|
else result = value();
|
|
15450
15396
|
}
|
|
15451
15397
|
if (result === void 0) return { value: "" };
|
|
@@ -16396,7 +16342,7 @@ function addInputHandling(descr, computeFunction) {
|
|
|
16396
16342
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
16397
16343
|
const arg = args[i];
|
|
16398
16344
|
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
16399
|
-
if (arg.length !== 1 || arg[0].length !== 1) throw new EvaluationError(
|
|
16345
|
+
if (arg.length !== 1 || arg[0].length !== 1) throw new EvaluationError("#ERROR", _t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be a single value or a single cell reference, not a range.", argDefinition.name));
|
|
16400
16346
|
args[i] = arg[0][0];
|
|
16401
16347
|
}
|
|
16402
16348
|
}
|
|
@@ -16772,9 +16718,9 @@ function interactiveAddFilter(env, sheetId, target) {
|
|
|
16772
16718
|
target,
|
|
16773
16719
|
sheetId
|
|
16774
16720
|
});
|
|
16775
|
-
if (result.isCancelledBecause(
|
|
16776
|
-
else if (result.isCancelledBecause(
|
|
16777
|
-
else if (result.isCancelledBecause(
|
|
16721
|
+
if (result.isCancelledBecause("FilterOverlap")) env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
16722
|
+
else if (result.isCancelledBecause("MergeInFilter")) env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
16723
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
16778
16724
|
}
|
|
16779
16725
|
|
|
16780
16726
|
//#endregion
|
|
@@ -16785,7 +16731,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
16785
16731
|
if (env.model.dispatch(cmd, {
|
|
16786
16732
|
sheetId,
|
|
16787
16733
|
quantity: base
|
|
16788
|
-
}).isCancelledBecause(
|
|
16734
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
16789
16735
|
}
|
|
16790
16736
|
|
|
16791
16737
|
//#endregion
|
|
@@ -18332,10 +18278,10 @@ var LineBarPieConfigPanel = class extends Component {
|
|
|
18332
18278
|
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18333
18279
|
}
|
|
18334
18280
|
get isDatasetInvalid() {
|
|
18335
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
18281
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
18336
18282
|
}
|
|
18337
18283
|
get isLabelInvalid() {
|
|
18338
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
18284
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
18339
18285
|
}
|
|
18340
18286
|
onUpdateDataSetsHaveTitle(ev) {
|
|
18341
18287
|
this.props.updateChart(this.props.figureId, { dataSetsHaveTitle: ev.target.checked });
|
|
@@ -19023,7 +18969,7 @@ var GaugeChartConfigPanel = class extends Component {
|
|
|
19023
18969
|
return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
19024
18970
|
}
|
|
19025
18971
|
get isDataRangeInvalid() {
|
|
19026
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
18972
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
19027
18973
|
}
|
|
19028
18974
|
onDataRangeChanged(ranges) {
|
|
19029
18975
|
this.dataRange = ranges[0];
|
|
@@ -19103,16 +19049,16 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
19103
19049
|
this.props.updateChart(this.props.figureId, { title: this.state.title });
|
|
19104
19050
|
}
|
|
19105
19051
|
isRangeMinInvalid() {
|
|
19106
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19052
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
19107
19053
|
}
|
|
19108
19054
|
isRangeMaxInvalid() {
|
|
19109
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19055
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
19110
19056
|
}
|
|
19111
19057
|
get isLowerInflectionPointInvalid() {
|
|
19112
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19058
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
19113
19059
|
}
|
|
19114
19060
|
get isUpperInflectionPointInvalid() {
|
|
19115
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19061
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
19116
19062
|
}
|
|
19117
19063
|
updateSectionColor(target, color) {
|
|
19118
19064
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -19189,10 +19135,10 @@ var ScorecardChartConfigPanel = class extends Component {
|
|
|
19189
19135
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
19190
19136
|
}
|
|
19191
19137
|
get isKeyValueInvalid() {
|
|
19192
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
19138
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
19193
19139
|
}
|
|
19194
19140
|
get isBaselineInvalid() {
|
|
19195
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
19141
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
19196
19142
|
}
|
|
19197
19143
|
onKeyValueRangeChanged(ranges) {
|
|
19198
19144
|
this.keyValue = ranges[0];
|
|
@@ -19491,7 +19437,7 @@ const ICON_SETS = {
|
|
|
19491
19437
|
css`
|
|
19492
19438
|
.o-icon-picker {
|
|
19493
19439
|
position: absolute;
|
|
19494
|
-
z-index: ${
|
|
19440
|
+
z-index: ${25};
|
|
19495
19441
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
19496
19442
|
background-color: white;
|
|
19497
19443
|
padding: 2px 1px;
|
|
@@ -19741,6 +19687,7 @@ var DOMDndHelper = class {
|
|
|
19741
19687
|
}
|
|
19742
19688
|
};
|
|
19743
19689
|
var ContainerWrapper = class {
|
|
19690
|
+
el;
|
|
19744
19691
|
constructor(el) {
|
|
19745
19692
|
this.el = el;
|
|
19746
19693
|
}
|
|
@@ -20098,11 +20045,12 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20098
20045
|
colorNumberString = colorNumberString;
|
|
20099
20046
|
state;
|
|
20100
20047
|
setup() {
|
|
20048
|
+
const cf = this.props.editedCf || {
|
|
20049
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
20050
|
+
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
20051
|
+
};
|
|
20101
20052
|
this.state = useState({
|
|
20102
|
-
currentCF:
|
|
20103
|
-
id: this.env.model.uuidGenerator.smallUuid(),
|
|
20104
|
-
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
20105
|
-
},
|
|
20053
|
+
currentCF: cf,
|
|
20106
20054
|
currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
|
|
20107
20055
|
errors: [],
|
|
20108
20056
|
rules: this.getDefaultRules()
|
|
@@ -20121,7 +20069,7 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20121
20069
|
useExternalListener(window, "click", this.closeMenus);
|
|
20122
20070
|
}
|
|
20123
20071
|
get isRangeValid() {
|
|
20124
|
-
return this.state.errors.includes(
|
|
20072
|
+
return this.state.errors.includes("EmptyRange");
|
|
20125
20073
|
}
|
|
20126
20074
|
errorMessage(error) {
|
|
20127
20075
|
return CfTerms.Errors[error] || CfTerms.Errors.Unexpected;
|
|
@@ -20129,7 +20077,7 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20129
20077
|
saveConditionalFormat() {
|
|
20130
20078
|
if (this.state.currentCF) {
|
|
20131
20079
|
if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
20132
|
-
this.state.errors = [
|
|
20080
|
+
this.state.errors = ["InvalidRange"];
|
|
20133
20081
|
return;
|
|
20134
20082
|
}
|
|
20135
20083
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -20219,10 +20167,10 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20219
20167
|
* Cell Is Rule
|
|
20220
20168
|
****************************************************************************/
|
|
20221
20169
|
get isValue1Invalid() {
|
|
20222
|
-
return !!this.state.errors?.includes(
|
|
20170
|
+
return !!this.state.errors?.includes("FirstArgMissing");
|
|
20223
20171
|
}
|
|
20224
20172
|
get isValue2Invalid() {
|
|
20225
|
-
return !!this.state.errors?.includes(
|
|
20173
|
+
return !!this.state.errors?.includes("SecondArgMissing");
|
|
20226
20174
|
}
|
|
20227
20175
|
toggleStyle(tool) {
|
|
20228
20176
|
const style = this.state.rules.cellIs.style;
|
|
@@ -20251,9 +20199,9 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20251
20199
|
****************************************************************************/
|
|
20252
20200
|
isValueInvalid(threshold) {
|
|
20253
20201
|
switch (threshold) {
|
|
20254
|
-
case "minimum": return this.state.errors.includes(
|
|
20255
|
-
case "midpoint": return this.state.errors.includes(
|
|
20256
|
-
case "maximum": return this.state.errors.includes(
|
|
20202
|
+
case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
|
|
20203
|
+
case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
|
|
20204
|
+
case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
|
|
20257
20205
|
default: return false;
|
|
20258
20206
|
}
|
|
20259
20207
|
}
|
|
@@ -20290,8 +20238,8 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
20290
20238
|
****************************************************************************/
|
|
20291
20239
|
isInflectionPointInvalid(inflectionPoint) {
|
|
20292
20240
|
switch (inflectionPoint) {
|
|
20293
|
-
case "lowerInflectionPoint": return this.state.errors.includes(
|
|
20294
|
-
case "upperInflectionPoint": return this.state.errors.includes(
|
|
20241
|
+
case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
20242
|
+
case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
20295
20243
|
default: return true;
|
|
20296
20244
|
}
|
|
20297
20245
|
}
|
|
@@ -20460,13 +20408,14 @@ var CustomCurrencyPanel = class extends Component {
|
|
|
20460
20408
|
if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
|
|
20461
20409
|
currenciesRegistry.add(index.toString(), currency);
|
|
20462
20410
|
});
|
|
20463
|
-
|
|
20411
|
+
const emptyCurrency = {
|
|
20464
20412
|
name: _t(CustomCurrencyTerms.Custom),
|
|
20465
20413
|
code: "",
|
|
20466
20414
|
symbol: "",
|
|
20467
20415
|
decimalPlaces: 2,
|
|
20468
20416
|
position: "after"
|
|
20469
|
-
}
|
|
20417
|
+
};
|
|
20418
|
+
this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
|
|
20470
20419
|
}
|
|
20471
20420
|
updateSelectCurrency(ev) {
|
|
20472
20421
|
const target = ev.target;
|
|
@@ -20814,7 +20763,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
20814
20763
|
separator,
|
|
20815
20764
|
addNewColumns
|
|
20816
20765
|
});
|
|
20817
|
-
if (result.isCancelledBecause(
|
|
20766
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
20818
20767
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
20819
20768
|
separator,
|
|
20820
20769
|
addNewColumns,
|
|
@@ -21239,13 +21188,13 @@ dataValidationEvaluatorRegistry.add("customFormula", {
|
|
|
21239
21188
|
getPreview: (criterion) => _t("Custom formula %s", criterion.values[0])
|
|
21240
21189
|
});
|
|
21241
21190
|
function getNumberCriterionlocalizedValues(criterion, locale) {
|
|
21242
|
-
return criterion.values.map((value) => value !== void 0 ? localizeContent(value, locale) :
|
|
21191
|
+
return criterion.values.map((value) => value !== void 0 ? localizeContent(value, locale) : "#REF");
|
|
21243
21192
|
}
|
|
21244
21193
|
function getDateCriterionLocalizedValues(criterion, locale) {
|
|
21245
21194
|
return getDateNumberCriterionValues(criterion, DEFAULT_LOCALE).map((value) => value !== void 0 ? formatValue(value, {
|
|
21246
21195
|
locale,
|
|
21247
21196
|
format: locale.dateFormat
|
|
21248
|
-
}) :
|
|
21197
|
+
}) : "#REF");
|
|
21249
21198
|
}
|
|
21250
21199
|
function checkValueIsDate(value) {
|
|
21251
21200
|
return valueToDateNumber(value, DEFAULT_LOCALE) !== void 0;
|
|
@@ -21269,7 +21218,7 @@ function getDateCriterionFormattedValues(criterion, getters) {
|
|
|
21269
21218
|
//#endregion
|
|
21270
21219
|
//#region src/helpers/ui/stop_edition_interactive.ts
|
|
21271
21220
|
function interactiveStopEdition(env) {
|
|
21272
|
-
if (env.model.dispatch("STOP_EDITION").isCancelledBecause(
|
|
21221
|
+
if (env.model.dispatch("STOP_EDITION").isCancelledBecause("BlockingValidationRule")) {
|
|
21273
21222
|
const editedCell = env.model.getters.getCurrentEditedCell();
|
|
21274
21223
|
const cellXc = toXC(editedCell.col, editedCell.row);
|
|
21275
21224
|
const rule = env.model.getters.getValidationRuleForCell(editedCell);
|
|
@@ -21346,8 +21295,8 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
21346
21295
|
}).reasons;
|
|
21347
21296
|
const errors = /* @__PURE__ */ new Set();
|
|
21348
21297
|
for (const reason of cancelledReasons) switch (reason) {
|
|
21349
|
-
case
|
|
21350
|
-
case
|
|
21298
|
+
case "SplitWillOverwriteContent":
|
|
21299
|
+
case "EmptySplitSeparator": break;
|
|
21351
21300
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
21352
21301
|
}
|
|
21353
21302
|
return Array.from(errors);
|
|
@@ -21358,7 +21307,7 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
21358
21307
|
separator: this.separatorValue,
|
|
21359
21308
|
addNewColumns: this.state.addNewColumns,
|
|
21360
21309
|
force: false
|
|
21361
|
-
}).reasons.includes(
|
|
21310
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
21362
21311
|
return warnings;
|
|
21363
21312
|
}
|
|
21364
21313
|
get separatorValue() {
|
|
@@ -22083,7 +22032,7 @@ css`
|
|
|
22083
22032
|
box-sizing: content-box;
|
|
22084
22033
|
|
|
22085
22034
|
.o-fig-anchor {
|
|
22086
|
-
z-index: ${
|
|
22035
|
+
z-index: ${1e3};
|
|
22087
22036
|
position: absolute;
|
|
22088
22037
|
width: ${ANCHOR_SIZE}px;
|
|
22089
22038
|
height: ${ANCHOR_SIZE}px;
|
|
@@ -22171,7 +22120,7 @@ var FigureComponent = class extends Component {
|
|
|
22171
22120
|
top: `${y}px`,
|
|
22172
22121
|
width: `${width}px`,
|
|
22173
22122
|
height: `${height}px`,
|
|
22174
|
-
"z-index": String(
|
|
22123
|
+
"z-index": String(10 + (this.isSelected ? 1 : 0))
|
|
22175
22124
|
});
|
|
22176
22125
|
}
|
|
22177
22126
|
getResizerPosition(resizer) {
|
|
@@ -22318,7 +22267,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
22318
22267
|
end: group.end
|
|
22319
22268
|
});
|
|
22320
22269
|
if (!result.isSuccessful) {
|
|
22321
|
-
if (result.isCancelledBecause(
|
|
22270
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
22322
22271
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
22323
22272
|
env.raiseError(errorMessage);
|
|
22324
22273
|
}
|
|
@@ -23480,7 +23429,7 @@ const COMPOSER_BORDER_WIDTH = 3 * .4 * window.devicePixelRatio || 1;
|
|
|
23480
23429
|
const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
|
|
23481
23430
|
css`
|
|
23482
23431
|
div.o-grid-composer {
|
|
23483
|
-
z-index: ${
|
|
23432
|
+
z-index: ${20};
|
|
23484
23433
|
box-sizing: border-box;
|
|
23485
23434
|
position: absolute;
|
|
23486
23435
|
border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
|
|
@@ -23491,7 +23440,7 @@ css`
|
|
|
23491
23440
|
|
|
23492
23441
|
div.o-cell-reference {
|
|
23493
23442
|
position: absolute;
|
|
23494
|
-
z-index: ${
|
|
23443
|
+
z-index: ${20};
|
|
23495
23444
|
background: ${SELECTION_BORDER_COLOR};
|
|
23496
23445
|
color: white;
|
|
23497
23446
|
font-size: 12px;
|
|
@@ -24147,7 +24096,7 @@ function getAxis(fig, axisType) {
|
|
|
24147
24096
|
css`
|
|
24148
24097
|
.o-figure-snap-line {
|
|
24149
24098
|
position: relative;
|
|
24150
|
-
z-index: ${
|
|
24099
|
+
z-index: ${1001};
|
|
24151
24100
|
&.vertical {
|
|
24152
24101
|
width: 0px;
|
|
24153
24102
|
border-left: 1px dashed black;
|
|
@@ -24810,7 +24759,7 @@ GridOverlay.props = {
|
|
|
24810
24759
|
var GridPopover = class extends Component {
|
|
24811
24760
|
static template = "o-spreadsheet-GridPopover";
|
|
24812
24761
|
static components = { Popover };
|
|
24813
|
-
zIndex =
|
|
24762
|
+
zIndex = 19;
|
|
24814
24763
|
get cellPopover() {
|
|
24815
24764
|
const popover = this.env.model.getters.getCellPopover(this.props.hoveredCell);
|
|
24816
24765
|
if (!popover.isOpen) return { isOpen: false };
|
|
@@ -25058,7 +25007,7 @@ css`
|
|
|
25058
25007
|
top: calc(${26}px / 2 - ${14}px / 2);
|
|
25059
25008
|
}
|
|
25060
25009
|
.o-unhide:hover {
|
|
25061
|
-
z-index: ${
|
|
25010
|
+
z-index: ${0 + 1};
|
|
25062
25011
|
background-color: lightgrey;
|
|
25063
25012
|
}
|
|
25064
25013
|
.o-unhide > svg {
|
|
@@ -25134,7 +25083,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
25134
25083
|
elements,
|
|
25135
25084
|
position: this.state.position
|
|
25136
25085
|
});
|
|
25137
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
25086
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
25138
25087
|
}
|
|
25139
25088
|
_selectElement(index, addDistinctHeader) {
|
|
25140
25089
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -25228,7 +25177,7 @@ css`
|
|
|
25228
25177
|
top: calc(${14}px / 2 - ${18}px / 2);
|
|
25229
25178
|
}
|
|
25230
25179
|
.o-unhide:hover {
|
|
25231
|
-
z-index: ${
|
|
25180
|
+
z-index: ${0 + 1};
|
|
25232
25181
|
background-color: lightgrey;
|
|
25233
25182
|
}
|
|
25234
25183
|
}
|
|
@@ -25300,7 +25249,7 @@ var RowResizer = class extends AbstractResizer {
|
|
|
25300
25249
|
elements,
|
|
25301
25250
|
position: this.state.position
|
|
25302
25251
|
});
|
|
25303
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
25252
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
25304
25253
|
}
|
|
25305
25254
|
_selectElement(index, addDistinctHeader) {
|
|
25306
25255
|
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -25524,7 +25473,7 @@ Corner.props = {
|
|
|
25524
25473
|
//#region src/components/highlight/highlight/highlight.ts
|
|
25525
25474
|
css`
|
|
25526
25475
|
.o-highlight {
|
|
25527
|
-
z-index: ${
|
|
25476
|
+
z-index: ${5};
|
|
25528
25477
|
}
|
|
25529
25478
|
`;
|
|
25530
25479
|
var Highlight = class extends Component {
|
|
@@ -25645,7 +25594,7 @@ css`
|
|
|
25645
25594
|
.o-scrollbar {
|
|
25646
25595
|
position: absolute;
|
|
25647
25596
|
overflow: auto;
|
|
25648
|
-
z-index: ${
|
|
25597
|
+
z-index: ${15};
|
|
25649
25598
|
background-color: ${BACKGROUND_GRAY_COLOR};
|
|
25650
25599
|
|
|
25651
25600
|
&.corner {
|
|
@@ -25886,12 +25835,12 @@ var Grid = class extends Component {
|
|
|
25886
25835
|
}
|
|
25887
25836
|
keyDownMapping = {
|
|
25888
25837
|
ENTER: () => {
|
|
25889
|
-
this.env.model.getters.getActiveCell().type ===
|
|
25838
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.props.onGridComposerCellFocused() : this.props.onComposerContentFocused();
|
|
25890
25839
|
},
|
|
25891
25840
|
TAB: () => this.env.model.selection.moveAnchorCell("right", 1),
|
|
25892
25841
|
"SHIFT+TAB": () => this.env.model.selection.moveAnchorCell("left", 1),
|
|
25893
25842
|
F2: () => {
|
|
25894
|
-
this.env.model.getters.getActiveCell().type ===
|
|
25843
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.props.onGridComposerCellFocused() : this.props.onComposerContentFocused();
|
|
25895
25844
|
},
|
|
25896
25845
|
DELETE: () => {
|
|
25897
25846
|
this.env.model.dispatch("DELETE_CONTENT", {
|
|
@@ -26123,7 +26072,7 @@ var Grid = class extends Component {
|
|
|
26123
26072
|
sheetId,
|
|
26124
26073
|
col,
|
|
26125
26074
|
row
|
|
26126
|
-
}).type ===
|
|
26075
|
+
}).type === "empty") this.props.onGridComposerCellFocused();
|
|
26127
26076
|
else this.props.onComposerContentFocused();
|
|
26128
26077
|
}
|
|
26129
26078
|
closeOpenedPopover() {
|
|
@@ -26209,15 +26158,15 @@ var Grid = class extends Component {
|
|
|
26209
26158
|
this.displayWarningCopyPasteNotSupported();
|
|
26210
26159
|
return;
|
|
26211
26160
|
}
|
|
26212
|
-
if (clipboardData.types.indexOf(
|
|
26161
|
+
if (clipboardData.types.indexOf("text/plain") > -1) {
|
|
26213
26162
|
ev.preventDefault();
|
|
26214
|
-
const content = clipboardData.getData(
|
|
26163
|
+
const content = clipboardData.getData("text/plain");
|
|
26215
26164
|
const target = this.env.model.getters.getSelectedZones();
|
|
26216
26165
|
const clipboardString = this.env.model.getters.getClipboardTextContent();
|
|
26217
26166
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
26218
26167
|
if (clipboardString === content) interactivePaste(this.env, target);
|
|
26219
26168
|
else interactivePasteFromOS(this.env, target, content);
|
|
26220
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
26169
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
26221
26170
|
}
|
|
26222
26171
|
}
|
|
26223
26172
|
displayWarningCopyPasteNotSupported() {
|
|
@@ -26367,6 +26316,7 @@ Grid.props = {
|
|
|
26367
26316
|
* Represent a raw XML string
|
|
26368
26317
|
*/
|
|
26369
26318
|
var XMLString = class {
|
|
26319
|
+
xmlString;
|
|
26370
26320
|
/**
|
|
26371
26321
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
26372
26322
|
*/
|
|
@@ -26479,6 +26429,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
26479
26429
|
ROUNDDOWN: [{
|
|
26480
26430
|
type: "NUMBER",
|
|
26481
26431
|
value: 0
|
|
26432
|
+
}],
|
|
26433
|
+
IFERROR: [{
|
|
26434
|
+
type: "NUMBER",
|
|
26435
|
+
value: 0
|
|
26482
26436
|
}]
|
|
26483
26437
|
};
|
|
26484
26438
|
/**
|
|
@@ -26644,6 +26598,7 @@ const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
|
26644
26598
|
//#endregion
|
|
26645
26599
|
//#region src/formulas/code_builder.ts
|
|
26646
26600
|
var FunctionCodeBuilder = class {
|
|
26601
|
+
scope;
|
|
26647
26602
|
code = "";
|
|
26648
26603
|
constructor(scope = new Scope()) {
|
|
26649
26604
|
this.scope = scope;
|
|
@@ -26659,6 +26614,8 @@ var FunctionCodeBuilder = class {
|
|
|
26659
26614
|
}
|
|
26660
26615
|
};
|
|
26661
26616
|
var FunctionCodeImpl = class {
|
|
26617
|
+
scope;
|
|
26618
|
+
returnExpression;
|
|
26662
26619
|
code;
|
|
26663
26620
|
constructor(scope, code, returnExpression) {
|
|
26664
26621
|
this.scope = scope;
|
|
@@ -26719,46 +26676,6 @@ function indentCode(code) {
|
|
|
26719
26676
|
|
|
26720
26677
|
//#endregion
|
|
26721
26678
|
//#region src/formulas/range_tokenizer.ts
|
|
26722
|
-
var State = /* @__PURE__ */ function(State) {
|
|
26723
|
-
/**
|
|
26724
|
-
* Initial state.
|
|
26725
|
-
* Expecting any reference for the left part of a range
|
|
26726
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
26727
|
-
*/
|
|
26728
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
26729
|
-
/**
|
|
26730
|
-
* Expecting any reference for the right part of a range
|
|
26731
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
26732
|
-
*/
|
|
26733
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
26734
|
-
/**
|
|
26735
|
-
* Expecting the separator without any constraint on the right part
|
|
26736
|
-
*/
|
|
26737
|
-
State[State["Separator"] = 2] = "Separator";
|
|
26738
|
-
/**
|
|
26739
|
-
* Expecting the separator for a full column range
|
|
26740
|
-
*/
|
|
26741
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
26742
|
-
/**
|
|
26743
|
-
* Expecting the separator for a full row range
|
|
26744
|
-
*/
|
|
26745
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
26746
|
-
/**
|
|
26747
|
-
* Expecting the right part of a full column range
|
|
26748
|
-
* e.g. "1", "A1"
|
|
26749
|
-
*/
|
|
26750
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
26751
|
-
/**
|
|
26752
|
-
* Expecting the right part of a full row range
|
|
26753
|
-
* e.g. "A", "A1"
|
|
26754
|
-
*/
|
|
26755
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
26756
|
-
/**
|
|
26757
|
-
* Final state. A range has been matched
|
|
26758
|
-
*/
|
|
26759
|
-
State[State["Found"] = 7] = "Found";
|
|
26760
|
-
return State;
|
|
26761
|
-
}(State || {});
|
|
26762
26679
|
const goTo = (state, guard = () => true) => [{
|
|
26763
26680
|
goTo: state,
|
|
26764
26681
|
guard
|
|
@@ -26768,41 +26685,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
26768
26685
|
guard
|
|
26769
26686
|
});
|
|
26770
26687
|
const machine = {
|
|
26771
|
-
[
|
|
26772
|
-
REFERENCE: goTo(
|
|
26773
|
-
NUMBER: goTo(
|
|
26774
|
-
SYMBOL: [goToMulti(
|
|
26688
|
+
[0]: {
|
|
26689
|
+
REFERENCE: goTo(2),
|
|
26690
|
+
NUMBER: goTo(4),
|
|
26691
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
26775
26692
|
},
|
|
26776
|
-
[
|
|
26777
|
-
SPACE: goTo(
|
|
26778
|
-
OPERATOR: goTo(
|
|
26693
|
+
[3]: {
|
|
26694
|
+
SPACE: goTo(3),
|
|
26695
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
26779
26696
|
},
|
|
26780
|
-
[
|
|
26781
|
-
SPACE: goTo(
|
|
26782
|
-
OPERATOR: goTo(
|
|
26697
|
+
[4]: {
|
|
26698
|
+
SPACE: goTo(4),
|
|
26699
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
26783
26700
|
},
|
|
26784
|
-
[
|
|
26785
|
-
SPACE: goTo(
|
|
26786
|
-
OPERATOR: goTo(
|
|
26701
|
+
[2]: {
|
|
26702
|
+
SPACE: goTo(2),
|
|
26703
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
26787
26704
|
},
|
|
26788
|
-
[
|
|
26789
|
-
SPACE: goTo(
|
|
26790
|
-
NUMBER: goTo(
|
|
26791
|
-
REFERENCE: goTo(
|
|
26792
|
-
SYMBOL: goTo(
|
|
26705
|
+
[1]: {
|
|
26706
|
+
SPACE: goTo(1),
|
|
26707
|
+
NUMBER: goTo(7),
|
|
26708
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
26709
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
26793
26710
|
},
|
|
26794
|
-
[
|
|
26795
|
-
SPACE: goTo(
|
|
26796
|
-
SYMBOL: goTo(
|
|
26797
|
-
REFERENCE: goTo(
|
|
26711
|
+
[5]: {
|
|
26712
|
+
SPACE: goTo(5),
|
|
26713
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
26714
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
26798
26715
|
},
|
|
26799
|
-
[
|
|
26800
|
-
SPACE: goTo(
|
|
26801
|
-
NUMBER: goTo(
|
|
26802
|
-
REFERENCE: goTo(
|
|
26803
|
-
SYMBOL: goTo(
|
|
26716
|
+
[6]: {
|
|
26717
|
+
SPACE: goTo(6),
|
|
26718
|
+
NUMBER: goTo(7),
|
|
26719
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
26720
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
26804
26721
|
},
|
|
26805
|
-
[
|
|
26722
|
+
[7]: {}
|
|
26806
26723
|
};
|
|
26807
26724
|
/**
|
|
26808
26725
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -26812,7 +26729,7 @@ const machine = {
|
|
|
26812
26729
|
*/
|
|
26813
26730
|
function matchReference(tokens) {
|
|
26814
26731
|
let head = 0;
|
|
26815
|
-
let transitions = machine[
|
|
26732
|
+
let transitions = machine[0];
|
|
26816
26733
|
let matchedTokens = "";
|
|
26817
26734
|
while (transitions !== void 0) {
|
|
26818
26735
|
const token = tokens[head++];
|
|
@@ -26821,7 +26738,7 @@ function matchReference(tokens) {
|
|
|
26821
26738
|
const nextState = transition ? transition.goTo : void 0;
|
|
26822
26739
|
switch (nextState) {
|
|
26823
26740
|
case void 0: return null;
|
|
26824
|
-
case
|
|
26741
|
+
case 7:
|
|
26825
26742
|
matchedTokens += token.value;
|
|
26826
26743
|
tokens.splice(0, head);
|
|
26827
26744
|
return {
|
|
@@ -26899,7 +26816,7 @@ function parseOperand(tokens) {
|
|
|
26899
26816
|
};
|
|
26900
26817
|
case "INVALID_REFERENCE": return {
|
|
26901
26818
|
type: "REFERENCE",
|
|
26902
|
-
value:
|
|
26819
|
+
value: "#REF"
|
|
26903
26820
|
};
|
|
26904
26821
|
case "REFERENCE":
|
|
26905
26822
|
if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
|
|
@@ -27414,26 +27331,6 @@ function isExportableToExcel(tokens) {
|
|
|
27414
27331
|
|
|
27415
27332
|
//#endregion
|
|
27416
27333
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
27417
|
-
/**
|
|
27418
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
27419
|
-
*/
|
|
27420
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
27421
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
27422
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
27423
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
27424
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
27425
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
27426
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
27427
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
27428
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
27429
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
27430
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
27431
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
27432
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
27433
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
27434
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
27435
|
-
return WarningTypes;
|
|
27436
|
-
}({});
|
|
27437
27334
|
var XLSXImportWarningManager = class {
|
|
27438
27335
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
27439
27336
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -27945,7 +27842,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
27945
27842
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
27946
27843
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
27947
27844
|
} catch (e) {}
|
|
27948
|
-
warningManager.generateNotSupportedWarning(
|
|
27845
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
27949
27846
|
}
|
|
27950
27847
|
function isFormatSupported(format) {
|
|
27951
27848
|
try {
|
|
@@ -28029,20 +27926,20 @@ function convertFormats(data, warningManager) {
|
|
|
28029
27926
|
return arrayToObject(formats, 1);
|
|
28030
27927
|
}
|
|
28031
27928
|
function addStyleWarnings(font, fill, warningManager) {
|
|
28032
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
28033
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
27929
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
27930
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
28034
27931
|
}
|
|
28035
27932
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
28036
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
27933
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
28037
27934
|
}
|
|
28038
27935
|
function addBorderWarnings(border, warningManager) {
|
|
28039
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
27936
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
28040
27937
|
}
|
|
28041
27938
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
28042
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
27939
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
28043
27940
|
}
|
|
28044
27941
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
28045
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
27942
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
28046
27943
|
}
|
|
28047
27944
|
|
|
28048
27945
|
//#endregion
|
|
@@ -28182,7 +28079,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
28182
28079
|
lower: icons.upper
|
|
28183
28080
|
};
|
|
28184
28081
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
28185
|
-
warningManager.generateNotSupportedWarning(
|
|
28082
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
28186
28083
|
switch (key) {
|
|
28187
28084
|
case "upper":
|
|
28188
28085
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -28223,13 +28120,13 @@ function prefixFormula(formula) {
|
|
|
28223
28120
|
return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
|
|
28224
28121
|
}
|
|
28225
28122
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
28226
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
28227
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
28123
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
28124
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
28228
28125
|
if (cf.cfRules[0].dxfId) {
|
|
28229
28126
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
28230
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
28231
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
28232
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
28127
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
28128
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
28129
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
28233
28130
|
}
|
|
28234
28131
|
}
|
|
28235
28132
|
|
|
@@ -28727,7 +28624,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
28727
28624
|
}
|
|
28728
28625
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
28729
28626
|
const label = link.display || cellValue;
|
|
28730
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
28627
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
28731
28628
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
28732
28629
|
}
|
|
28733
28630
|
function getSheetDims(sheet) {
|
|
@@ -30850,7 +30747,7 @@ var BasePlugin = class {
|
|
|
30850
30747
|
* There should not be any side effects in this method.
|
|
30851
30748
|
*/
|
|
30852
30749
|
allowDispatch(command) {
|
|
30853
|
-
return
|
|
30750
|
+
return "Success";
|
|
30854
30751
|
}
|
|
30855
30752
|
/**
|
|
30856
30753
|
* This method is useful when a plugin need to perform some action before a
|
|
@@ -30886,10 +30783,10 @@ var BasePlugin = class {
|
|
|
30886
30783
|
for (const validation of validations) {
|
|
30887
30784
|
let results = validation.call(this, toValidate);
|
|
30888
30785
|
if (!Array.isArray(results)) results = [results];
|
|
30889
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
30786
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
30890
30787
|
if (cancelledReasons.length) return cancelledReasons;
|
|
30891
30788
|
}
|
|
30892
|
-
return
|
|
30789
|
+
return "Success";
|
|
30893
30790
|
};
|
|
30894
30791
|
}
|
|
30895
30792
|
checkValidations(command, ...validations) {
|
|
@@ -30948,7 +30845,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
30948
30845
|
allowDispatch(cmd) {
|
|
30949
30846
|
switch (cmd.type) {
|
|
30950
30847
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
30951
|
-
default: return
|
|
30848
|
+
default: return "Success";
|
|
30952
30849
|
}
|
|
30953
30850
|
}
|
|
30954
30851
|
handle(cmd) {
|
|
@@ -31320,8 +31217,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
31320
31217
|
checkBordersUnchanged(cmd) {
|
|
31321
31218
|
const currentBorder = this.getCellBorder(cmd);
|
|
31322
31219
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
31323
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
31324
|
-
return
|
|
31220
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
31221
|
+
return "Success";
|
|
31325
31222
|
}
|
|
31326
31223
|
import(data) {
|
|
31327
31224
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const xc in sheet.cells) {
|
|
@@ -31388,8 +31285,8 @@ var CellPlugin = class extends CorePlugin {
|
|
|
31388
31285
|
switch (cmd.type) {
|
|
31389
31286
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
31390
31287
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
31391
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
31392
|
-
default: return
|
|
31288
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
31289
|
+
default: return "Success";
|
|
31393
31290
|
}
|
|
31394
31291
|
}
|
|
31395
31292
|
handle(cmd) {
|
|
@@ -31755,25 +31652,30 @@ var CellPlugin = class extends CorePlugin {
|
|
|
31755
31652
|
}
|
|
31756
31653
|
checkCellOutOfSheet(cmd) {
|
|
31757
31654
|
const { sheetId, col, row } = cmd;
|
|
31758
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
31759
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
31655
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
31656
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
31760
31657
|
}
|
|
31761
31658
|
checkUselessClearCell(cmd) {
|
|
31762
31659
|
const cell = this.getters.getCell(cmd);
|
|
31763
|
-
if (!cell) return
|
|
31764
|
-
if (!cell.content && !cell.style && !cell.format) return
|
|
31765
|
-
return
|
|
31660
|
+
if (!cell) return "NoChanges";
|
|
31661
|
+
if (!cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
31662
|
+
return "Success";
|
|
31766
31663
|
}
|
|
31767
31664
|
checkUselessUpdateCell(cmd) {
|
|
31768
31665
|
const cell = this.getters.getCell(cmd);
|
|
31769
31666
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
31770
31667
|
const hasStyle = "style" in cmd;
|
|
31771
31668
|
const hasFormat = "format" in cmd;
|
|
31772
|
-
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
31773
|
-
return
|
|
31669
|
+
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
31670
|
+
return "Success";
|
|
31774
31671
|
}
|
|
31775
31672
|
};
|
|
31776
31673
|
var FormulaCellWithDependencies = class {
|
|
31674
|
+
id;
|
|
31675
|
+
format;
|
|
31676
|
+
style;
|
|
31677
|
+
sheetId;
|
|
31678
|
+
getRangeString;
|
|
31777
31679
|
isFormula = true;
|
|
31778
31680
|
compiledFormula;
|
|
31779
31681
|
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
@@ -31808,6 +31710,10 @@ var FormulaCellWithDependencies = class {
|
|
|
31808
31710
|
}
|
|
31809
31711
|
};
|
|
31810
31712
|
var RangeReferenceToken = class {
|
|
31713
|
+
ranges;
|
|
31714
|
+
rangeIndex;
|
|
31715
|
+
sheetId;
|
|
31716
|
+
getRangeString;
|
|
31811
31717
|
type = "REFERENCE";
|
|
31812
31718
|
constructor(ranges, rangeIndex, sheetId, getRangeString) {
|
|
31813
31719
|
this.ranges = ranges;
|
|
@@ -31842,7 +31748,7 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
31842
31748
|
switch (cmd.type) {
|
|
31843
31749
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
31844
31750
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
31845
|
-
default: return
|
|
31751
|
+
default: return "Success";
|
|
31846
31752
|
}
|
|
31847
31753
|
}
|
|
31848
31754
|
handle(cmd) {
|
|
@@ -31961,10 +31867,10 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
31961
31867
|
if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
31962
31868
|
}
|
|
31963
31869
|
checkChartDuplicate(cmd) {
|
|
31964
|
-
return this.getters.getFigureSheetId(cmd.id) ?
|
|
31870
|
+
return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
|
|
31965
31871
|
}
|
|
31966
31872
|
checkChartExists(cmd) {
|
|
31967
|
-
return this.isChartDefined(cmd.id) ?
|
|
31873
|
+
return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
|
|
31968
31874
|
}
|
|
31969
31875
|
};
|
|
31970
31876
|
|
|
@@ -32291,7 +32197,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32291
32197
|
case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
|
|
32292
32198
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
32293
32199
|
}
|
|
32294
|
-
return
|
|
32200
|
+
return "Success";
|
|
32295
32201
|
}
|
|
32296
32202
|
handle(cmd) {
|
|
32297
32203
|
switch (cmd.type) {
|
|
@@ -32405,21 +32311,21 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32405
32311
|
this.history.update("cfRules", sheet, currentCF);
|
|
32406
32312
|
}
|
|
32407
32313
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
32408
|
-
if (!this.cfRules[sheetId]) return
|
|
32314
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
32409
32315
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
32410
|
-
if (ruleIndex === -1) return
|
|
32316
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
32411
32317
|
const cfIndex2 = ruleIndex - delta;
|
|
32412
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
32413
|
-
return
|
|
32318
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
32319
|
+
return "Success";
|
|
32414
32320
|
}
|
|
32415
32321
|
checkEmptyRange(cmd) {
|
|
32416
|
-
return cmd.ranges.length ?
|
|
32322
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
32417
32323
|
}
|
|
32418
32324
|
checkCFRule(cmd) {
|
|
32419
32325
|
const rule = cmd.cf.rule;
|
|
32420
32326
|
switch (rule.type) {
|
|
32421
32327
|
case "CellIsRule":
|
|
32422
|
-
if (!CellIsOperators[rule.operator]) return
|
|
32328
|
+
if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
|
|
32423
32329
|
return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
|
|
32424
32330
|
"BeginsWith",
|
|
32425
32331
|
"ContainsText",
|
|
@@ -32433,7 +32339,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32433
32339
|
case "ColorScaleRule": return this.checkValidations(rule, this.chainValidations(this.checkThresholds(this.checkFormulaCompilation)), this.chainValidations(this.checkThresholds(this.checkNaN), this.batchValidations(this.checkMinBiggerThanMax, this.checkMinBiggerThanMid, this.checkMidBiggerThanMax)));
|
|
32434
32340
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
32435
32341
|
}
|
|
32436
|
-
return
|
|
32342
|
+
return "InvalidConditionalFormatType";
|
|
32437
32343
|
}
|
|
32438
32344
|
checkOperatorArgsNumber(expectedNumber, operators) {
|
|
32439
32345
|
if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
@@ -32441,11 +32347,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32441
32347
|
if (operators.includes(rule.operator)) {
|
|
32442
32348
|
const errors = [];
|
|
32443
32349
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
32444
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
32445
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
32446
|
-
return errors.length ? errors :
|
|
32350
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
32351
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
32352
|
+
return errors.length ? errors : "Success";
|
|
32447
32353
|
}
|
|
32448
|
-
return
|
|
32354
|
+
return "Success";
|
|
32449
32355
|
};
|
|
32450
32356
|
}
|
|
32451
32357
|
checkNaN(threshold, thresholdName) {
|
|
@@ -32454,31 +32360,31 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32454
32360
|
"percentage",
|
|
32455
32361
|
"percentile"
|
|
32456
32362
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
32457
|
-
case "min": return
|
|
32458
|
-
case "max": return
|
|
32459
|
-
case "mid": return
|
|
32460
|
-
case "upperInflectionPoint": return
|
|
32461
|
-
case "lowerInflectionPoint": return
|
|
32363
|
+
case "min": return "MinNaN";
|
|
32364
|
+
case "max": return "MaxNaN";
|
|
32365
|
+
case "mid": return "MidNaN";
|
|
32366
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
32367
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
32462
32368
|
}
|
|
32463
|
-
return
|
|
32369
|
+
return "Success";
|
|
32464
32370
|
}
|
|
32465
32371
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
32466
|
-
if (threshold.type !== "formula") return
|
|
32372
|
+
if (threshold.type !== "formula") return "Success";
|
|
32467
32373
|
try {
|
|
32468
32374
|
compile(threshold.value || "");
|
|
32469
32375
|
} catch (error) {
|
|
32470
32376
|
switch (thresholdName) {
|
|
32471
|
-
case "min": return
|
|
32472
|
-
case "max": return
|
|
32473
|
-
case "mid": return
|
|
32474
|
-
case "upperInflectionPoint": return
|
|
32475
|
-
case "lowerInflectionPoint": return
|
|
32377
|
+
case "min": return "MinInvalidFormula";
|
|
32378
|
+
case "max": return "MaxInvalidFormula";
|
|
32379
|
+
case "mid": return "MidInvalidFormula";
|
|
32380
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
32381
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
32476
32382
|
}
|
|
32477
32383
|
}
|
|
32478
|
-
return
|
|
32384
|
+
return "Success";
|
|
32479
32385
|
}
|
|
32480
32386
|
checkThresholds(check) {
|
|
32481
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
32387
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
32482
32388
|
}
|
|
32483
32389
|
checkInflectionPoints(check) {
|
|
32484
32390
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -32490,8 +32396,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32490
32396
|
"number",
|
|
32491
32397
|
"percentage",
|
|
32492
32398
|
"percentile"
|
|
32493
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
32494
|
-
return
|
|
32399
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
32400
|
+
return "Success";
|
|
32495
32401
|
}
|
|
32496
32402
|
checkMinBiggerThanMax(rule) {
|
|
32497
32403
|
const minValue = rule.minimum.value;
|
|
@@ -32500,8 +32406,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32500
32406
|
"number",
|
|
32501
32407
|
"percentage",
|
|
32502
32408
|
"percentile"
|
|
32503
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
32504
|
-
return
|
|
32409
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
32410
|
+
return "Success";
|
|
32505
32411
|
}
|
|
32506
32412
|
checkMidBiggerThanMax(rule) {
|
|
32507
32413
|
const midValue = rule.midpoint?.value;
|
|
@@ -32510,8 +32416,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32510
32416
|
"number",
|
|
32511
32417
|
"percentage",
|
|
32512
32418
|
"percentile"
|
|
32513
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
32514
|
-
return
|
|
32419
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
32420
|
+
return "Success";
|
|
32515
32421
|
}
|
|
32516
32422
|
checkMinBiggerThanMid(rule) {
|
|
32517
32423
|
const minValue = rule.minimum.value;
|
|
@@ -32520,8 +32426,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32520
32426
|
"number",
|
|
32521
32427
|
"percentage",
|
|
32522
32428
|
"percentile"
|
|
32523
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
32524
|
-
return
|
|
32429
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
32430
|
+
return "Success";
|
|
32525
32431
|
}
|
|
32526
32432
|
removeConditionalFormatting(id, sheet) {
|
|
32527
32433
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -32584,14 +32490,14 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32584
32490
|
allowDispatch(cmd) {
|
|
32585
32491
|
switch (cmd.type) {
|
|
32586
32492
|
case "ADD_DATA_VALIDATION_RULE":
|
|
32587
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
32493
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
32588
32494
|
return this.checkValidations(cmd, this.chainValidations(this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
32589
32495
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
32590
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
32591
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
32496
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
32497
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
32592
32498
|
break;
|
|
32593
32499
|
}
|
|
32594
|
-
return
|
|
32500
|
+
return "Success";
|
|
32595
32501
|
}
|
|
32596
32502
|
handle(cmd) {
|
|
32597
32503
|
switch (cmd.type) {
|
|
@@ -32702,13 +32608,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32702
32608
|
}
|
|
32703
32609
|
}
|
|
32704
32610
|
checkCriterionTypeIsValid(cmd) {
|
|
32705
|
-
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
32611
|
+
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
32706
32612
|
}
|
|
32707
32613
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
32708
32614
|
const criterion = cmd.rule.criterion;
|
|
32709
32615
|
const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
32710
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
32711
|
-
return
|
|
32616
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
32617
|
+
return "Success";
|
|
32712
32618
|
}
|
|
32713
32619
|
checkCriterionValuesAreValid(cmd) {
|
|
32714
32620
|
const criterion = cmd.rule.criterion;
|
|
@@ -32717,8 +32623,8 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32717
32623
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
|
|
32718
32624
|
else if (evaluator.allowedValues === "onlyFormulas") return true;
|
|
32719
32625
|
else return !evaluator.isCriterionValueValid(value);
|
|
32720
|
-
})) return
|
|
32721
|
-
return
|
|
32626
|
+
})) return "InvalidDataValidationCriterionValue";
|
|
32627
|
+
return "Success";
|
|
32722
32628
|
}
|
|
32723
32629
|
};
|
|
32724
32630
|
|
|
@@ -32737,7 +32643,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
32737
32643
|
case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
|
|
32738
32644
|
case "UPDATE_FIGURE":
|
|
32739
32645
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
32740
|
-
default: return
|
|
32646
|
+
default: return "Success";
|
|
32741
32647
|
}
|
|
32742
32648
|
}
|
|
32743
32649
|
beforeHandle(cmd) {
|
|
@@ -32831,12 +32737,12 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
32831
32737
|
this.history.update("figures", sheetId, id, void 0);
|
|
32832
32738
|
}
|
|
32833
32739
|
checkFigureExists(sheetId, figureId) {
|
|
32834
|
-
if (this.figures[sheetId]?.[figureId] === void 0) return
|
|
32835
|
-
return
|
|
32740
|
+
if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
|
|
32741
|
+
return "Success";
|
|
32836
32742
|
}
|
|
32837
32743
|
checkFigureDuplicate(figureId) {
|
|
32838
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return
|
|
32839
|
-
return
|
|
32744
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
|
|
32745
|
+
return "Success";
|
|
32840
32746
|
}
|
|
32841
32747
|
getFigures(sheetId) {
|
|
32842
32748
|
const figures = [];
|
|
@@ -32944,23 +32850,23 @@ var FiltersPlugin = class extends CorePlugin {
|
|
|
32944
32850
|
allowDispatch(cmd) {
|
|
32945
32851
|
switch (cmd.type) {
|
|
32946
32852
|
case "CREATE_FILTER_TABLE":
|
|
32947
|
-
if (!areZonesContinuous(...cmd.target)) return
|
|
32853
|
+
if (!areZonesContinuous(...cmd.target)) return "NonContinuousTargets";
|
|
32948
32854
|
const zone = union(...cmd.target);
|
|
32949
32855
|
const checkFilterOverlap = () => {
|
|
32950
|
-
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) return
|
|
32951
|
-
return
|
|
32856
|
+
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) return "FilterOverlap";
|
|
32857
|
+
return "Success";
|
|
32952
32858
|
};
|
|
32953
32859
|
const checkMergeInFilter = () => {
|
|
32954
32860
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
32955
|
-
for (const merge of mergesInTarget) if (overlap(zone, merge)) return
|
|
32956
|
-
return
|
|
32861
|
+
for (const merge of mergesInTarget) if (overlap(zone, merge)) return "MergeInFilter";
|
|
32862
|
+
return "Success";
|
|
32957
32863
|
};
|
|
32958
32864
|
return this.checkValidations(cmd, checkFilterOverlap, checkMergeInFilter);
|
|
32959
32865
|
case "ADD_MERGE":
|
|
32960
|
-
for (const merge of cmd.target) for (const filterTable of this.getFilterTables(cmd.sheetId)) if (overlap(filterTable.zone, merge)) return
|
|
32866
|
+
for (const merge of cmd.target) for (const filterTable of this.getFilterTables(cmd.sheetId)) if (overlap(filterTable.zone, merge)) return "MergeInFilter";
|
|
32961
32867
|
break;
|
|
32962
32868
|
}
|
|
32963
|
-
return
|
|
32869
|
+
return "Success";
|
|
32964
32870
|
}
|
|
32965
32871
|
handle(cmd) {
|
|
32966
32872
|
switch (cmd.type) {
|
|
@@ -33254,19 +33160,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
33254
33160
|
allowDispatch(cmd) {
|
|
33255
33161
|
switch (cmd.type) {
|
|
33256
33162
|
case "HIDE_COLUMNS_ROWS": {
|
|
33257
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
33163
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
33258
33164
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
33259
33165
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
33260
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
33261
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
33262
|
-
else return
|
|
33166
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
33167
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
33168
|
+
else return "Success";
|
|
33263
33169
|
}
|
|
33264
33170
|
case "REMOVE_COLUMNS_ROWS":
|
|
33265
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
33266
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
33267
|
-
return
|
|
33171
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
33172
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
33173
|
+
return "Success";
|
|
33268
33174
|
}
|
|
33269
|
-
return
|
|
33175
|
+
return "Success";
|
|
33270
33176
|
}
|
|
33271
33177
|
handle(cmd) {
|
|
33272
33178
|
switch (cmd.type) {
|
|
@@ -33394,9 +33300,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
33394
33300
|
allowDispatch(cmd) {
|
|
33395
33301
|
switch (cmd.type) {
|
|
33396
33302
|
case "CREATE_IMAGE":
|
|
33397
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
33398
|
-
return
|
|
33399
|
-
default: return
|
|
33303
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
33304
|
+
return "Success";
|
|
33305
|
+
default: return "Success";
|
|
33400
33306
|
}
|
|
33401
33307
|
}
|
|
33402
33308
|
handle(cmd) {
|
|
@@ -33538,7 +33444,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33538
33444
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
33539
33445
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
33540
33446
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
33541
|
-
default: return
|
|
33447
|
+
default: return "Success";
|
|
33542
33448
|
}
|
|
33543
33449
|
}
|
|
33544
33450
|
handle(cmd) {
|
|
@@ -33728,18 +33634,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33728
33634
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
33729
33635
|
}
|
|
33730
33636
|
checkDestructiveMerge({ sheetId, target }) {
|
|
33731
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
33732
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
33637
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
33638
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
33733
33639
|
}
|
|
33734
33640
|
checkOverlap({ target }) {
|
|
33735
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
33736
|
-
return
|
|
33641
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
33642
|
+
return "Success";
|
|
33737
33643
|
}
|
|
33738
33644
|
checkFrozenPanes({ sheetId, target }) {
|
|
33739
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
33645
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
33740
33646
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
33741
|
-
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
33742
|
-
return
|
|
33647
|
+
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
33648
|
+
return "Success";
|
|
33743
33649
|
}
|
|
33744
33650
|
/**
|
|
33745
33651
|
* The content of a merged cell should always be empty.
|
|
@@ -33747,10 +33653,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33747
33653
|
*/
|
|
33748
33654
|
checkMergedContentUpdate(cmd) {
|
|
33749
33655
|
const { col, row, content } = cmd;
|
|
33750
|
-
if (content === void 0) return
|
|
33656
|
+
if (content === void 0) return "Success";
|
|
33751
33657
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
33752
|
-
if (mainCol === col && mainRow === row) return
|
|
33753
|
-
return
|
|
33658
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
33659
|
+
return "CellIsMerged";
|
|
33754
33660
|
}
|
|
33755
33661
|
checkMergeExists(cmd) {
|
|
33756
33662
|
const { sheetId, target } = cmd;
|
|
@@ -33761,9 +33667,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33761
33667
|
col: left,
|
|
33762
33668
|
row: top
|
|
33763
33669
|
});
|
|
33764
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
33670
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
33765
33671
|
}
|
|
33766
|
-
return
|
|
33672
|
+
return "Success";
|
|
33767
33673
|
}
|
|
33768
33674
|
/**
|
|
33769
33675
|
* Merge the current selection. Note that:
|
|
@@ -33909,8 +33815,8 @@ var RangeAdapter = class {
|
|
|
33909
33815
|
"getRangeFromZone"
|
|
33910
33816
|
];
|
|
33911
33817
|
allowDispatch(cmd) {
|
|
33912
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
33913
|
-
return
|
|
33818
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
33819
|
+
return "Success";
|
|
33914
33820
|
}
|
|
33915
33821
|
beforeHandle(command) {}
|
|
33916
33822
|
handle(cmd) {
|
|
@@ -34269,39 +34175,39 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34269
34175
|
cellPosition = {};
|
|
34270
34176
|
allowDispatch(cmd) {
|
|
34271
34177
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
34272
|
-
if (genericChecks !==
|
|
34178
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
34273
34179
|
switch (cmd.type) {
|
|
34274
34180
|
case "HIDE_SHEET":
|
|
34275
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
34276
|
-
return
|
|
34181
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
34182
|
+
return "Success";
|
|
34277
34183
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
34278
34184
|
case "DUPLICATE_SHEET":
|
|
34279
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
34280
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
34281
|
-
return
|
|
34185
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
34186
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
34187
|
+
return "Success";
|
|
34282
34188
|
case "MOVE_SHEET": try {
|
|
34283
34189
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
34284
34190
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
34285
|
-
return
|
|
34191
|
+
return "Success";
|
|
34286
34192
|
} catch (e) {
|
|
34287
|
-
return
|
|
34193
|
+
return "WrongSheetMove";
|
|
34288
34194
|
}
|
|
34289
34195
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
34290
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
34196
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
34291
34197
|
case "ADD_COLUMNS_ROWS":
|
|
34292
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
34293
|
-
else if (cmd.quantity <= 0) return
|
|
34294
|
-
return
|
|
34198
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
34199
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
34200
|
+
return "Success";
|
|
34295
34201
|
case "REMOVE_COLUMNS_ROWS": {
|
|
34296
34202
|
const min = largeMin(cmd.elements);
|
|
34297
34203
|
const max = largeMax(cmd.elements);
|
|
34298
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
34299
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
34300
|
-
else return
|
|
34204
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
34205
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
34206
|
+
else return "Success";
|
|
34301
34207
|
}
|
|
34302
34208
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
34303
34209
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
34304
|
-
default: return
|
|
34210
|
+
default: return "Success";
|
|
34305
34211
|
}
|
|
34306
34212
|
}
|
|
34307
34213
|
handle(cmd) {
|
|
@@ -34565,12 +34471,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34565
34471
|
* not outside the sheet.
|
|
34566
34472
|
*/
|
|
34567
34473
|
checkZonesExistInSheet(sheetId, zones) {
|
|
34568
|
-
if (!zones.every(isZoneValid)) return
|
|
34474
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
34569
34475
|
if (zones.length) {
|
|
34570
34476
|
const sheetZone = this.getSheetZone(sheetId);
|
|
34571
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
34477
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
34572
34478
|
}
|
|
34573
|
-
return
|
|
34479
|
+
return "Success";
|
|
34574
34480
|
}
|
|
34575
34481
|
updateCellPosition(cmd) {
|
|
34576
34482
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -34652,36 +34558,36 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34652
34558
|
}
|
|
34653
34559
|
checkSheetName(cmd) {
|
|
34654
34560
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
34655
|
-
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return
|
|
34561
|
+
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
|
|
34656
34562
|
const { orderedSheetIds, sheets } = this;
|
|
34657
34563
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
34658
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
34659
|
-
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) return
|
|
34660
|
-
return
|
|
34564
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
34565
|
+
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
34566
|
+
return "Success";
|
|
34661
34567
|
}
|
|
34662
34568
|
checkSheetPosition(cmd) {
|
|
34663
34569
|
const { orderedSheetIds } = this;
|
|
34664
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
34665
|
-
return
|
|
34570
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
34571
|
+
return "Success";
|
|
34666
34572
|
}
|
|
34667
34573
|
checkRowFreezeQuantity(cmd) {
|
|
34668
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
34574
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
34669
34575
|
}
|
|
34670
34576
|
checkColFreezeQuantity(cmd) {
|
|
34671
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
34577
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
34672
34578
|
}
|
|
34673
34579
|
checkRowFreezeOverlapMerge(cmd) {
|
|
34674
34580
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
34675
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
34676
|
-
return
|
|
34581
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
34582
|
+
return "Success";
|
|
34677
34583
|
}
|
|
34678
34584
|
checkColFreezeOverlapMerge(cmd) {
|
|
34679
34585
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
34680
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
34681
|
-
return
|
|
34586
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
34587
|
+
return "Success";
|
|
34682
34588
|
}
|
|
34683
34589
|
isRenameAllowed(cmd) {
|
|
34684
|
-
if (!(cmd.name && cmd.name.trim().toLowerCase())) return
|
|
34590
|
+
if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
|
|
34685
34591
|
return this.checkSheetName(cmd);
|
|
34686
34592
|
}
|
|
34687
34593
|
renameSheet(sheet, name) {
|
|
@@ -34903,17 +34809,17 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34903
34809
|
* sheet.
|
|
34904
34810
|
*/
|
|
34905
34811
|
checkSheetExists(cmd) {
|
|
34906
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
34907
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
34908
|
-
return
|
|
34812
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
34813
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
34814
|
+
return "Success";
|
|
34909
34815
|
}
|
|
34910
34816
|
/**
|
|
34911
34817
|
* Check if zones in the command are well formed and
|
|
34912
34818
|
* not outside the sheet.
|
|
34913
34819
|
*/
|
|
34914
34820
|
checkZonesAreInSheet(cmd) {
|
|
34915
|
-
if (!("sheetId" in cmd)) return
|
|
34916
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
34821
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
34822
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
34917
34823
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
34918
34824
|
}
|
|
34919
34825
|
};
|
|
@@ -34936,28 +34842,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
34936
34842
|
switch (cmd.type) {
|
|
34937
34843
|
case "GROUP_HEADERS": {
|
|
34938
34844
|
const { start, end, sheetId } = cmd;
|
|
34939
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
34940
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
34941
|
-
if (start > end) return
|
|
34942
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
34845
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
34846
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
34847
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
34848
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
34943
34849
|
break;
|
|
34944
34850
|
}
|
|
34945
34851
|
case "UNGROUP_HEADERS": {
|
|
34946
34852
|
const { start, end, sheetId } = cmd;
|
|
34947
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
34948
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
34949
|
-
if (start > end) return
|
|
34853
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
34854
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
34855
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
34950
34856
|
break;
|
|
34951
34857
|
}
|
|
34952
34858
|
case "UNFOLD_HEADER_GROUP":
|
|
34953
34859
|
case "FOLD_HEADER_GROUP":
|
|
34954
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
34860
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
34955
34861
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
34956
|
-
if (!group) return
|
|
34957
|
-
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return
|
|
34862
|
+
if (!group) return "UnknownHeaderGroup";
|
|
34863
|
+
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return "NotEnoughElements";
|
|
34958
34864
|
break;
|
|
34959
34865
|
}
|
|
34960
|
-
return
|
|
34866
|
+
return "Success";
|
|
34961
34867
|
}
|
|
34962
34868
|
handle(cmd) {
|
|
34963
34869
|
switch (cmd.type) {
|
|
@@ -35240,9 +35146,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
35240
35146
|
locale = DEFAULT_LOCALE;
|
|
35241
35147
|
allowDispatch(cmd) {
|
|
35242
35148
|
switch (cmd.type) {
|
|
35243
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
35149
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
35244
35150
|
}
|
|
35245
|
-
return
|
|
35151
|
+
return "Success";
|
|
35246
35152
|
}
|
|
35247
35153
|
handle(cmd) {
|
|
35248
35154
|
switch (cmd.type) {
|
|
@@ -35315,6 +35221,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
35315
35221
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
35316
35222
|
}
|
|
35317
35223
|
var CompilationParametersBuilder = class {
|
|
35224
|
+
getters;
|
|
35225
|
+
computeCell;
|
|
35318
35226
|
evalContext;
|
|
35319
35227
|
rangeCache = {};
|
|
35320
35228
|
constructor(context, getters, computeCell) {
|
|
@@ -35358,12 +35266,12 @@ var CompilationParametersBuilder = class {
|
|
|
35358
35266
|
value: null,
|
|
35359
35267
|
format: this.getters.getCell(position)?.format
|
|
35360
35268
|
};
|
|
35361
|
-
if (evaluatedCell.type ===
|
|
35269
|
+
if (evaluatedCell.type === "error") throw evaluatedCell.error;
|
|
35362
35270
|
return evaluatedCell;
|
|
35363
35271
|
}
|
|
35364
35272
|
getEvaluatedCellIfNotEmpty(position) {
|
|
35365
35273
|
const evaluatedCell = this.computeCell(position);
|
|
35366
|
-
if (evaluatedCell.type ===
|
|
35274
|
+
if (evaluatedCell.type === "empty") {
|
|
35367
35275
|
const cell = this.getters.getCell(position);
|
|
35368
35276
|
if (!cell || !cell.isFormula && cell.content === "") return;
|
|
35369
35277
|
}
|
|
@@ -35402,7 +35310,7 @@ var CompilationParametersBuilder = class {
|
|
|
35402
35310
|
col,
|
|
35403
35311
|
row
|
|
35404
35312
|
});
|
|
35405
|
-
if (evaluatedCell?.type ===
|
|
35313
|
+
if (evaluatedCell?.type === "error") {
|
|
35406
35314
|
this.rangeCache[cacheKey] = evaluatedCell.error;
|
|
35407
35315
|
throw evaluatedCell.error;
|
|
35408
35316
|
}
|
|
@@ -35798,6 +35706,7 @@ var ZoneRBush = class extends import_rbush_min.default {
|
|
|
35798
35706
|
* It uses an R-Tree data structure to efficiently find dependent cells.
|
|
35799
35707
|
*/
|
|
35800
35708
|
var FormulaDependencyGraph = class {
|
|
35709
|
+
encoder;
|
|
35801
35710
|
dependencies = /* @__PURE__ */ new Map();
|
|
35802
35711
|
rTree;
|
|
35803
35712
|
constructor(encoder, data = []) {
|
|
@@ -35934,6 +35843,7 @@ const EMPTY_ARRAY = [];
|
|
|
35934
35843
|
//#region src/plugins/ui_core_views/cell_evaluation/evaluator.ts
|
|
35935
35844
|
const MAX_ITERATION = 30;
|
|
35936
35845
|
var Evaluator = class {
|
|
35846
|
+
context;
|
|
35937
35847
|
getters;
|
|
35938
35848
|
compilationParams;
|
|
35939
35849
|
encoder = new PositionBitsEncoder();
|
|
@@ -36095,7 +36005,7 @@ var Evaluator = class {
|
|
|
36095
36005
|
return evaluatedCell;
|
|
36096
36006
|
}
|
|
36097
36007
|
handleError(e) {
|
|
36098
|
-
if (!(e instanceof EvaluationError)) e = new EvaluationError(
|
|
36008
|
+
if (!(e instanceof EvaluationError)) e = new EvaluationError("#ERROR", e.message);
|
|
36099
36009
|
const __lastFnCalled = this.compilationParams[2].__lastFnCalled || "";
|
|
36100
36010
|
e.message = e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled);
|
|
36101
36011
|
return errorCell(e);
|
|
@@ -36196,7 +36106,7 @@ var Evaluator = class {
|
|
|
36196
36106
|
col: i + col,
|
|
36197
36107
|
row: j + row
|
|
36198
36108
|
};
|
|
36199
|
-
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !==
|
|
36109
|
+
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
36200
36110
|
this.blockedArrayFormulas.add(formulaPositionId);
|
|
36201
36111
|
throw new Error(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
|
|
36202
36112
|
}
|
|
@@ -36450,7 +36360,7 @@ var EvaluationPlugin = class extends UIPlugin {
|
|
|
36450
36360
|
sheetId,
|
|
36451
36361
|
col,
|
|
36452
36362
|
row
|
|
36453
|
-
})).every((cell) => cell.type ===
|
|
36363
|
+
})).every((cell) => cell.type === "empty");
|
|
36454
36364
|
}
|
|
36455
36365
|
exportForExcel(data) {
|
|
36456
36366
|
for (const sheet of data.sheets) sheet.formulaSpillRanges = {};
|
|
@@ -36861,7 +36771,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
36861
36771
|
return computedIcons;
|
|
36862
36772
|
}
|
|
36863
36773
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
36864
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type ===
|
|
36774
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
36865
36775
|
switch (threshold.type) {
|
|
36866
36776
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
36867
36777
|
case "number": return Number(threshold.value);
|
|
@@ -36892,7 +36802,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
36892
36802
|
col,
|
|
36893
36803
|
row
|
|
36894
36804
|
});
|
|
36895
|
-
if (cell.type !==
|
|
36805
|
+
if (cell.type !== "number") continue;
|
|
36896
36806
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
36897
36807
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
36898
36808
|
computedIcons[col][row] = icon;
|
|
@@ -36933,7 +36843,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
36933
36843
|
col,
|
|
36934
36844
|
row
|
|
36935
36845
|
});
|
|
36936
|
-
if (cell.type ===
|
|
36846
|
+
if (cell.type === "number") {
|
|
36937
36847
|
const value = clip(cell.value, minValue, maxValue);
|
|
36938
36848
|
let color;
|
|
36939
36849
|
if (colorCellArgs.length === 2 && midValue) color = value <= midValue ? this.colorCell(value, colorCellArgs[0].minValue, colorCellArgs[0].minColor, colorCellArgs[0].colorDiffUnit) : this.colorCell(value, colorCellArgs[1].minValue, colorCellArgs[1].minColor, colorCellArgs[1].colorDiffUnit);
|
|
@@ -36967,7 +36877,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
36967
36877
|
*/
|
|
36968
36878
|
rulePredicate = { CellIsRule: (target, rule) => {
|
|
36969
36879
|
const cell = this.getters.getEvaluatedCell(target);
|
|
36970
|
-
if (cell.type ===
|
|
36880
|
+
if (cell.type === "error") return false;
|
|
36971
36881
|
const [value0, value1] = rule.values.map((val) => {
|
|
36972
36882
|
if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
36973
36883
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
@@ -37074,7 +36984,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
37074
36984
|
if (!validationResults[col]) validationResults[col] = [];
|
|
37075
36985
|
validationResults[col][row] = lazy(() => {
|
|
37076
36986
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
37077
|
-
if (evaluatedCell.type ===
|
|
36987
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
37078
36988
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
37079
36989
|
});
|
|
37080
36990
|
}
|
|
@@ -37114,7 +37024,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
37114
37024
|
const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
|
|
37115
37025
|
return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
|
|
37116
37026
|
} catch (e) {
|
|
37117
|
-
return e instanceof EvaluationError ? e.errorType :
|
|
37027
|
+
return e instanceof EvaluationError ? e.errorType : "#ERROR";
|
|
37118
37028
|
}
|
|
37119
37029
|
});
|
|
37120
37030
|
}
|
|
@@ -37315,7 +37225,7 @@ var AutofillGenerator = class {
|
|
|
37315
37225
|
*
|
|
37316
37226
|
*/
|
|
37317
37227
|
var AutofillPlugin = class extends UIPlugin {
|
|
37318
|
-
static layers = [
|
|
37228
|
+
static layers = [5];
|
|
37319
37229
|
static getters = ["getAutofillTooltip"];
|
|
37320
37230
|
autofillZone;
|
|
37321
37231
|
steps;
|
|
@@ -37328,13 +37238,13 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37328
37238
|
const sheetId = this.getters.getActiveSheetId();
|
|
37329
37239
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
37330
37240
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
37331
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
37332
|
-
return
|
|
37241
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
37242
|
+
return "InvalidAutofillSelection";
|
|
37333
37243
|
case "AUTOFILL_AUTO":
|
|
37334
37244
|
const zone = this.getters.getSelectedZone();
|
|
37335
|
-
return zone.top === zone.bottom ?
|
|
37245
|
+
return zone.top === zone.bottom ? "Success" : "CancelledForUnknownReason";
|
|
37336
37246
|
}
|
|
37337
|
-
return
|
|
37247
|
+
return "Success";
|
|
37338
37248
|
}
|
|
37339
37249
|
handle(cmd) {
|
|
37340
37250
|
switch (cmd.type) {
|
|
@@ -37366,7 +37276,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37366
37276
|
const target = this.autofillZone;
|
|
37367
37277
|
const autofillCellsData = [];
|
|
37368
37278
|
switch (this.direction) {
|
|
37369
|
-
case
|
|
37279
|
+
case "down":
|
|
37370
37280
|
for (let col = source.left; col <= source.right; col++) {
|
|
37371
37281
|
const xcs = [];
|
|
37372
37282
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -37374,7 +37284,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37374
37284
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37375
37285
|
}
|
|
37376
37286
|
break;
|
|
37377
|
-
case
|
|
37287
|
+
case "up":
|
|
37378
37288
|
for (let col = source.left; col <= source.right; col++) {
|
|
37379
37289
|
const xcs = [];
|
|
37380
37290
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -37382,7 +37292,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37382
37292
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37383
37293
|
}
|
|
37384
37294
|
break;
|
|
37385
|
-
case
|
|
37295
|
+
case "left":
|
|
37386
37296
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
37387
37297
|
const xcs = [];
|
|
37388
37298
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -37390,7 +37300,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37390
37300
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37391
37301
|
}
|
|
37392
37302
|
break;
|
|
37393
|
-
case
|
|
37303
|
+
case "right":
|
|
37394
37304
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
37395
37305
|
const xcs = [];
|
|
37396
37306
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -37516,19 +37426,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37516
37426
|
}
|
|
37517
37427
|
this.direction = this.getDirection(col, row);
|
|
37518
37428
|
switch (this.direction) {
|
|
37519
|
-
case
|
|
37429
|
+
case "up":
|
|
37520
37430
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
37521
37431
|
this.steps = source.top - row;
|
|
37522
37432
|
break;
|
|
37523
|
-
case
|
|
37433
|
+
case "down":
|
|
37524
37434
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
37525
37435
|
this.steps = row - source.bottom;
|
|
37526
37436
|
break;
|
|
37527
|
-
case
|
|
37437
|
+
case "left":
|
|
37528
37438
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
37529
37439
|
this.steps = source.left - col;
|
|
37530
37440
|
break;
|
|
37531
|
-
case
|
|
37441
|
+
case "right":
|
|
37532
37442
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
37533
37443
|
this.steps = col - source.right;
|
|
37534
37444
|
break;
|
|
@@ -37660,19 +37570,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37660
37570
|
const position = {
|
|
37661
37571
|
up: {
|
|
37662
37572
|
number: source.top - row,
|
|
37663
|
-
value:
|
|
37573
|
+
value: "up"
|
|
37664
37574
|
},
|
|
37665
37575
|
down: {
|
|
37666
37576
|
number: row - source.bottom,
|
|
37667
|
-
value:
|
|
37577
|
+
value: "down"
|
|
37668
37578
|
},
|
|
37669
37579
|
left: {
|
|
37670
37580
|
number: source.left - col,
|
|
37671
|
-
value:
|
|
37581
|
+
value: "left"
|
|
37672
37582
|
},
|
|
37673
37583
|
right: {
|
|
37674
37584
|
number: col - source.right,
|
|
37675
|
-
value:
|
|
37585
|
+
value: "right"
|
|
37676
37586
|
}
|
|
37677
37587
|
};
|
|
37678
37588
|
if (Object.values(position).map((x) => x.number > 0 ? 1 : 0).reduce((acc, value) => acc + value) === 1) return Object.values(position).find((x) => x.number > 0 ? 1 : 0).value;
|
|
@@ -37875,7 +37785,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
37875
37785
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
37876
37786
|
}
|
|
37877
37787
|
isNumber(cell) {
|
|
37878
|
-
return cell.type ===
|
|
37788
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
37879
37789
|
}
|
|
37880
37790
|
isZoneValid(zone) {
|
|
37881
37791
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -38043,10 +37953,10 @@ var CellPopoverPlugin = class extends UIPlugin {
|
|
|
38043
37953
|
try {
|
|
38044
37954
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
38045
37955
|
} catch (error) {
|
|
38046
|
-
return
|
|
37956
|
+
return "InvalidCellPopover";
|
|
38047
37957
|
}
|
|
38048
|
-
return
|
|
38049
|
-
default: return
|
|
37958
|
+
return "Success";
|
|
37959
|
+
default: return "Success";
|
|
38050
37960
|
}
|
|
38051
37961
|
}
|
|
38052
37962
|
handle(cmd) {
|
|
@@ -38456,6 +38366,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
38456
38366
|
//#endregion
|
|
38457
38367
|
//#region src/collaborative/revisions.ts
|
|
38458
38368
|
var Revision = class {
|
|
38369
|
+
rootCommand;
|
|
38370
|
+
timestamp;
|
|
38459
38371
|
id;
|
|
38460
38372
|
clientId;
|
|
38461
38373
|
_commands = [];
|
|
@@ -38492,6 +38404,9 @@ var Revision = class {
|
|
|
38492
38404
|
//#region src/collaborative/session.ts
|
|
38493
38405
|
var ClientDisconnectedError = class extends Error {};
|
|
38494
38406
|
var Session = class extends EventBus {
|
|
38407
|
+
revisions;
|
|
38408
|
+
transportService;
|
|
38409
|
+
serverRevisionId;
|
|
38495
38410
|
/**
|
|
38496
38411
|
* Positions of the others client.
|
|
38497
38412
|
*/
|
|
@@ -38867,7 +38782,7 @@ var CollaborativePlugin = class extends UIPlugin {
|
|
|
38867
38782
|
"getConnectedClients",
|
|
38868
38783
|
"isFullySynchronized"
|
|
38869
38784
|
];
|
|
38870
|
-
static layers = [
|
|
38785
|
+
static layers = [6];
|
|
38871
38786
|
availableColors = new Set(colors);
|
|
38872
38787
|
colors = {};
|
|
38873
38788
|
session;
|
|
@@ -38949,6 +38864,9 @@ var CollaborativePlugin = class extends UIPlugin {
|
|
|
38949
38864
|
//#region src/helpers/clipboard/clipboard_abstract_cell_state.ts
|
|
38950
38865
|
/** Abstract state of the clipboard when copying/cutting content that is pasted in cells of the sheet */
|
|
38951
38866
|
var ClipboardCellsAbstractState = class {
|
|
38867
|
+
getters;
|
|
38868
|
+
dispatch;
|
|
38869
|
+
selection;
|
|
38952
38870
|
operation;
|
|
38953
38871
|
sheetId;
|
|
38954
38872
|
constructor(operation, getters, dispatch, selection) {
|
|
@@ -38959,10 +38877,10 @@ var ClipboardCellsAbstractState = class {
|
|
|
38959
38877
|
this.sheetId = getters.getActiveSheetId();
|
|
38960
38878
|
}
|
|
38961
38879
|
isCutAllowed(target) {
|
|
38962
|
-
return
|
|
38880
|
+
return "Success";
|
|
38963
38881
|
}
|
|
38964
38882
|
isPasteAllowed(target, clipboardOption) {
|
|
38965
|
-
return
|
|
38883
|
+
return "Success";
|
|
38966
38884
|
}
|
|
38967
38885
|
/**
|
|
38968
38886
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -39070,23 +38988,23 @@ var ClipboardCellsState = class extends ClipboardCellsAbstractState {
|
|
|
39070
38988
|
this.copiedTables = tables;
|
|
39071
38989
|
}
|
|
39072
38990
|
isCutAllowed(target) {
|
|
39073
|
-
if (target.length !== 1) return
|
|
39074
|
-
return
|
|
38991
|
+
if (target.length !== 1) return "WrongCutSelection";
|
|
38992
|
+
return "Success";
|
|
39075
38993
|
}
|
|
39076
38994
|
isPasteAllowed(target, clipboardOption) {
|
|
39077
38995
|
const sheetId = this.getters.getActiveSheetId();
|
|
39078
|
-
if (this.operation === "CUT" && clipboardOption?.pasteOption !== void 0) return
|
|
38996
|
+
if (this.operation === "CUT" && clipboardOption?.pasteOption !== void 0) return "WrongPasteOption";
|
|
39079
38997
|
if (target.length > 1) {
|
|
39080
|
-
if (this.cells.length > 1 || this.cells[0].length > 1) return
|
|
38998
|
+
if (this.cells.length > 1 || this.cells[0].length > 1) return "WrongPasteSelection";
|
|
39081
38999
|
}
|
|
39082
39000
|
const clipboardHeight = this.cells.length;
|
|
39083
39001
|
const clipboardWidth = this.cells[0].length;
|
|
39084
39002
|
for (const zone of this.getPasteZones(target)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
39085
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
39003
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
39086
39004
|
}
|
|
39087
39005
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
39088
|
-
for (const zone of this.getPasteZones(target)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
39089
|
-
return
|
|
39006
|
+
for (const zone of this.getPasteZones(target)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
39007
|
+
return "Success";
|
|
39090
39008
|
}
|
|
39091
39009
|
/**
|
|
39092
39010
|
* Paste the clipboard content in the given target
|
|
@@ -39317,8 +39235,8 @@ var ClipboardCellsState = class extends ClipboardCellsAbstractState {
|
|
|
39317
39235
|
}
|
|
39318
39236
|
getClipboardContent() {
|
|
39319
39237
|
return {
|
|
39320
|
-
[
|
|
39321
|
-
[
|
|
39238
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
39239
|
+
["text/html"]: this.getHTMLContent()
|
|
39322
39240
|
};
|
|
39323
39241
|
}
|
|
39324
39242
|
getPlainTextContent() {
|
|
@@ -39511,7 +39429,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39511
39429
|
switch (cmd.type) {
|
|
39512
39430
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
39513
39431
|
}
|
|
39514
|
-
return
|
|
39432
|
+
return "Success";
|
|
39515
39433
|
}
|
|
39516
39434
|
handle(cmd) {
|
|
39517
39435
|
switch (cmd.type) {
|
|
@@ -39588,34 +39506,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39588
39506
|
});
|
|
39589
39507
|
}
|
|
39590
39508
|
checkSingleRangeSelected() {
|
|
39591
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
39592
|
-
return
|
|
39509
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
39510
|
+
return "Success";
|
|
39593
39511
|
}
|
|
39594
39512
|
checkNoMergeInZone() {
|
|
39595
39513
|
const sheetId = this.getters.getActiveSheetId();
|
|
39596
39514
|
const zone = this.getters.getSelectedZone();
|
|
39597
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
39598
|
-
return
|
|
39515
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
39516
|
+
return "Success";
|
|
39599
39517
|
}
|
|
39600
39518
|
checkRangeContainsValues(cmd) {
|
|
39601
39519
|
const sheetId = this.getters.getActiveSheetId();
|
|
39602
39520
|
const zone = this.getters.getSelectedZone();
|
|
39603
39521
|
if (cmd.hasHeader) zone.top += 1;
|
|
39604
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
39605
|
-
return
|
|
39522
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
39523
|
+
return "Success";
|
|
39606
39524
|
}
|
|
39607
39525
|
checkNoColumnProvided(cmd) {
|
|
39608
|
-
if (cmd.columns.length === 0) return
|
|
39609
|
-
return
|
|
39526
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
39527
|
+
return "Success";
|
|
39610
39528
|
}
|
|
39611
39529
|
checkColumnsIncludedInZone(cmd) {
|
|
39612
39530
|
const zone = this.getters.getSelectedZone();
|
|
39613
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
39614
|
-
return
|
|
39531
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
39532
|
+
return "Success";
|
|
39615
39533
|
}
|
|
39616
39534
|
checkColumnsAreUnique(cmd) {
|
|
39617
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
39618
|
-
return
|
|
39535
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
39536
|
+
return "Success";
|
|
39619
39537
|
}
|
|
39620
39538
|
trimWhitespace() {
|
|
39621
39539
|
const zones = this.getters.getSelectedZones();
|
|
@@ -39652,12 +39570,6 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39652
39570
|
//#region src/plugins/ui_feature/find_and_replace.ts
|
|
39653
39571
|
const BORDER_COLOR = "#8B008B";
|
|
39654
39572
|
const BACKGROUND_COLOR = "#8B008B33";
|
|
39655
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
39656
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
39657
|
-
Direction[Direction["current"] = 0] = "current";
|
|
39658
|
-
Direction[Direction["next"] = 1] = "next";
|
|
39659
|
-
return Direction;
|
|
39660
|
-
}(Direction || {});
|
|
39661
39573
|
/**
|
|
39662
39574
|
* Find and Replace Plugin
|
|
39663
39575
|
*
|
|
@@ -39668,7 +39580,7 @@ var Direction = /* @__PURE__ */ function(Direction) {
|
|
|
39668
39580
|
* the search with a new value.
|
|
39669
39581
|
*/
|
|
39670
39582
|
var FindAndReplacePlugin = class extends UIPlugin {
|
|
39671
|
-
static layers = [
|
|
39583
|
+
static layers = [3];
|
|
39672
39584
|
static getters = ["getSearchMatches", "getCurrentSelectedMatchIndex"];
|
|
39673
39585
|
searchMatches = [];
|
|
39674
39586
|
selectedMatchIndex = null;
|
|
@@ -39689,10 +39601,10 @@ var FindAndReplacePlugin = class extends UIPlugin {
|
|
|
39689
39601
|
this.clearSearch();
|
|
39690
39602
|
break;
|
|
39691
39603
|
case "SELECT_SEARCH_PREVIOUS_MATCH":
|
|
39692
|
-
this.selectNextCell(
|
|
39604
|
+
this.selectNextCell(-1);
|
|
39693
39605
|
break;
|
|
39694
39606
|
case "SELECT_SEARCH_NEXT_MATCH":
|
|
39695
|
-
this.selectNextCell(
|
|
39607
|
+
this.selectNextCell(1);
|
|
39696
39608
|
break;
|
|
39697
39609
|
case "REPLACE_SEARCH":
|
|
39698
39610
|
this.replace(cmd.replaceWith);
|
|
@@ -39744,8 +39656,9 @@ var FindAndReplacePlugin = class extends UIPlugin {
|
|
|
39744
39656
|
* refresh the matches according to the current search options
|
|
39745
39657
|
*/
|
|
39746
39658
|
refreshSearch() {
|
|
39747
|
-
|
|
39748
|
-
this.
|
|
39659
|
+
const matches = this.findMatches();
|
|
39660
|
+
this.searchMatches = matches;
|
|
39661
|
+
this.selectNextCell(0);
|
|
39749
39662
|
}
|
|
39750
39663
|
/**
|
|
39751
39664
|
* Updates the regex based on the current searchOptions and
|
|
@@ -39946,7 +39859,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
39946
39859
|
getCellNumberFormat(position) {
|
|
39947
39860
|
for (const pos of [position]) {
|
|
39948
39861
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
39949
|
-
if (cell.type ===
|
|
39862
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
39950
39863
|
}
|
|
39951
39864
|
}
|
|
39952
39865
|
};
|
|
@@ -40013,7 +39926,7 @@ var HeaderVisibilityUIPlugin = class extends UIPlugin {
|
|
|
40013
39926
|
* HighlightPlugin
|
|
40014
39927
|
*/
|
|
40015
39928
|
var HighlightPlugin = class extends UIPlugin {
|
|
40016
|
-
static layers = [
|
|
39929
|
+
static layers = [1];
|
|
40017
39930
|
static getters = ["getHighlights"];
|
|
40018
39931
|
getHighlights() {
|
|
40019
39932
|
return this.prepareHighlights(this.getters.getComposerHighlights().concat(this.getters.getSelectionInputHighlights()));
|
|
@@ -40057,7 +39970,7 @@ var HighlightPlugin = class extends UIPlugin {
|
|
|
40057
39970
|
//#endregion
|
|
40058
39971
|
//#region src/plugins/ui_feature/renderer.ts
|
|
40059
39972
|
var RendererPlugin = class extends UIPlugin {
|
|
40060
|
-
static layers = [
|
|
39973
|
+
static layers = [0, 7];
|
|
40061
39974
|
static getters = ["getColDimensionsInViewport", "getRowDimensionsInViewport"];
|
|
40062
39975
|
boxes = [];
|
|
40063
39976
|
/**
|
|
@@ -40099,7 +40012,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40099
40012
|
}
|
|
40100
40013
|
drawGrid(renderingContext, layer) {
|
|
40101
40014
|
switch (layer) {
|
|
40102
|
-
case
|
|
40015
|
+
case 0:
|
|
40103
40016
|
this.drawGlobalBackground(renderingContext);
|
|
40104
40017
|
for (const { zone, rect } of this.getters.getAllActiveViewportsZonesAndRect()) {
|
|
40105
40018
|
const { ctx } = renderingContext;
|
|
@@ -40118,7 +40031,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40118
40031
|
}
|
|
40119
40032
|
this.drawFrozenPanes(renderingContext);
|
|
40120
40033
|
break;
|
|
40121
|
-
case
|
|
40034
|
+
case 7:
|
|
40122
40035
|
if (!this.getters.isDashboard()) {
|
|
40123
40036
|
this.drawHeaders(renderingContext);
|
|
40124
40037
|
this.drawFrozenPanesHeaders(renderingContext);
|
|
@@ -40466,7 +40379,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40466
40379
|
const nextCellBorder = this.getters.getCellBorderWithFilterBorder(position);
|
|
40467
40380
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
40468
40381
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
40469
|
-
if (nextCell.type !==
|
|
40382
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
|
|
40470
40383
|
col++;
|
|
40471
40384
|
}
|
|
40472
40385
|
return col;
|
|
@@ -40484,7 +40397,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40484
40397
|
const previousCellBorder = this.getters.getCellBorderWithFilterBorder(position);
|
|
40485
40398
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
40486
40399
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
40487
|
-
if (previousCell.type !==
|
|
40400
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
|
|
40488
40401
|
col--;
|
|
40489
40402
|
}
|
|
40490
40403
|
return col;
|
|
@@ -40493,7 +40406,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40493
40406
|
if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
|
|
40494
40407
|
const { align } = this.getters.getCellStyle(position);
|
|
40495
40408
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
40496
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
40409
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
40497
40410
|
return align || evaluatedCell.defaultAlign;
|
|
40498
40411
|
}
|
|
40499
40412
|
createZoneBox(sheetId, zone, viewport) {
|
|
@@ -40517,9 +40430,9 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40517
40430
|
border: this.getters.getCellBorderWithFilterBorder(position) || void 0,
|
|
40518
40431
|
style: this.getters.getCellComputedStyle(position),
|
|
40519
40432
|
verticalAlign,
|
|
40520
|
-
isError: cell.type ===
|
|
40433
|
+
isError: cell.type === "error" && cell.error.isVerbose || this.getters.isDataValidationInvalid(position)
|
|
40521
40434
|
};
|
|
40522
|
-
if (cell.type ===
|
|
40435
|
+
if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
|
|
40523
40436
|
/** Icon CF */
|
|
40524
40437
|
const cfIcon = this.getters.getConditionalIcon(position);
|
|
40525
40438
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
@@ -40681,7 +40594,8 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40681
40594
|
* This plugin handles this internal state.
|
|
40682
40595
|
*/
|
|
40683
40596
|
var SelectionInputPlugin = class extends UIPlugin {
|
|
40684
|
-
|
|
40597
|
+
inputHasSingleRange;
|
|
40598
|
+
static layers = [1];
|
|
40685
40599
|
static getters = [];
|
|
40686
40600
|
ranges = [];
|
|
40687
40601
|
focusedRangeIndex = null;
|
|
@@ -40892,7 +40806,8 @@ var SelectionInputPlugin = class extends UIPlugin {
|
|
|
40892
40806
|
* This plugin handles this internal state.
|
|
40893
40807
|
*/
|
|
40894
40808
|
var SelectionInputsManagerPlugin = class extends UIPlugin {
|
|
40895
|
-
|
|
40809
|
+
config;
|
|
40810
|
+
static layers = [1];
|
|
40896
40811
|
static getters = [
|
|
40897
40812
|
"getSelectionInput",
|
|
40898
40813
|
"getSelectionInputValue",
|
|
@@ -40913,26 +40828,26 @@ var SelectionInputsManagerPlugin = class extends UIPlugin {
|
|
|
40913
40828
|
case "FOCUS_RANGE":
|
|
40914
40829
|
case "CHANGE_RANGE":
|
|
40915
40830
|
case "ADD_EMPTY_RANGE":
|
|
40916
|
-
case "REMOVE_RANGE": if (!this.inputs[cmd.id]) return
|
|
40831
|
+
case "REMOVE_RANGE": if (!this.inputs[cmd.id]) return "InvalidInputId";
|
|
40917
40832
|
}
|
|
40918
40833
|
switch (cmd.type) {
|
|
40919
40834
|
case "FOCUS_RANGE":
|
|
40920
40835
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
40921
|
-
if (this.focusedInputId === cmd.id && this.currentInput?.focusedRangeIndex === index) return
|
|
40836
|
+
if (this.focusedInputId === cmd.id && this.currentInput?.focusedRangeIndex === index) return "InputAlreadyFocused";
|
|
40922
40837
|
break;
|
|
40923
40838
|
case "ADD_RANGE":
|
|
40924
40839
|
case "ADD_EMPTY_RANGE":
|
|
40925
40840
|
const input = this.inputs[cmd.id];
|
|
40926
|
-
if (input.inputHasSingleRange && input.ranges.length === 1) return
|
|
40841
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) return "MaximumRangesReached";
|
|
40927
40842
|
break;
|
|
40928
40843
|
case "REMOVE_RANGE":
|
|
40929
|
-
if (this.inputs[cmd.id].ranges.length === 1) return
|
|
40844
|
+
if (this.inputs[cmd.id].ranges.length === 1) return "MinimumRangesReached";
|
|
40930
40845
|
break;
|
|
40931
40846
|
case "CHANGE_RANGE":
|
|
40932
|
-
if (this.inputs[cmd.id].inputHasSingleRange && cmd.value.split(",").length > 1) return
|
|
40847
|
+
if (this.inputs[cmd.id].inputHasSingleRange && cmd.value.split(",").length > 1) return "MaximumRangesReached";
|
|
40933
40848
|
break;
|
|
40934
40849
|
}
|
|
40935
|
-
return
|
|
40850
|
+
return "Success";
|
|
40936
40851
|
}
|
|
40937
40852
|
handle(cmd) {
|
|
40938
40853
|
switch (cmd.type) {
|
|
@@ -41051,7 +40966,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41051
40966
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
41052
40967
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
41053
40968
|
}
|
|
41054
|
-
return
|
|
40969
|
+
return "Success";
|
|
41055
40970
|
}
|
|
41056
40971
|
handle(cmd) {
|
|
41057
40972
|
switch (cmd.type) {
|
|
@@ -41061,24 +40976,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41061
40976
|
}
|
|
41062
40977
|
}
|
|
41063
40978
|
checkMerge({ sheetId, zone }) {
|
|
41064
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
40979
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
41065
40980
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
41066
40981
|
sheetId,
|
|
41067
40982
|
col,
|
|
41068
40983
|
row
|
|
41069
|
-
}))) return
|
|
41070
|
-
return
|
|
40984
|
+
}))) return "InvalidSortZone";
|
|
40985
|
+
return "Success";
|
|
41071
40986
|
}
|
|
41072
40987
|
checkMergeSizes({ sheetId, zone }) {
|
|
41073
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
40988
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
41074
40989
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
41075
40990
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
41076
40991
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
41077
40992
|
if (!merges.every((merge) => {
|
|
41078
40993
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
41079
40994
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
41080
|
-
})) return
|
|
41081
|
-
return
|
|
40995
|
+
})) return "InvalidSortZone";
|
|
40996
|
+
return "Success";
|
|
41082
40997
|
}
|
|
41083
40998
|
/**
|
|
41084
40999
|
* safe-version of expandZone to make sure we don't get out of the grid
|
|
@@ -41234,9 +41149,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41234
41149
|
col,
|
|
41235
41150
|
row
|
|
41236
41151
|
}).type));
|
|
41237
|
-
if (cells[0][0] ===
|
|
41238
|
-
if (cells.some((item) => item[0] ===
|
|
41239
|
-
else if (cells.some((item) => item[1] !==
|
|
41152
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
41153
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
41154
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
41240
41155
|
else return false;
|
|
41241
41156
|
}
|
|
41242
41157
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -41419,8 +41334,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
41419
41334
|
* sheet.
|
|
41420
41335
|
*/
|
|
41421
41336
|
checkSheetExists(cmd) {
|
|
41422
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
41423
|
-
return
|
|
41337
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
41338
|
+
return "Success";
|
|
41424
41339
|
}
|
|
41425
41340
|
/**
|
|
41426
41341
|
* Check if zones in the command are well formed and
|
|
@@ -41428,11 +41343,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
41428
41343
|
*/
|
|
41429
41344
|
checkZonesAreInSheet(cmd) {
|
|
41430
41345
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
41431
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
41346
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
41432
41347
|
const zones = this.getters.getCommandZones(cmd);
|
|
41433
|
-
if (!sheetId && zones.length > 0) return
|
|
41348
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
41434
41349
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
41435
|
-
return
|
|
41350
|
+
return "Success";
|
|
41436
41351
|
}
|
|
41437
41352
|
autoResizeRows(sheetId, rows) {
|
|
41438
41353
|
const rowSizes = [];
|
|
@@ -41705,13 +41620,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
41705
41620
|
allowDispatch(cmd) {
|
|
41706
41621
|
switch (cmd.type) {
|
|
41707
41622
|
case "REQUEST_UNDO":
|
|
41708
|
-
if (!this.canUndo()) return
|
|
41623
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
41709
41624
|
break;
|
|
41710
41625
|
case "REQUEST_REDO":
|
|
41711
|
-
if (!this.canRedo()) return
|
|
41626
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
41712
41627
|
break;
|
|
41713
41628
|
}
|
|
41714
|
-
return
|
|
41629
|
+
return "Success";
|
|
41715
41630
|
}
|
|
41716
41631
|
handle(cmd) {
|
|
41717
41632
|
switch (cmd.type) {
|
|
@@ -41773,7 +41688,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41773
41688
|
switch (cmd.type) {
|
|
41774
41689
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
41775
41690
|
}
|
|
41776
|
-
return
|
|
41691
|
+
return "Success";
|
|
41777
41692
|
}
|
|
41778
41693
|
handle(cmd) {
|
|
41779
41694
|
switch (cmd.type) {
|
|
@@ -41784,7 +41699,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41784
41699
|
}
|
|
41785
41700
|
getAutomaticSeparator() {
|
|
41786
41701
|
const cells = this.getters.getSelectedCells();
|
|
41787
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
41702
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
41788
41703
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
41789
41704
|
if (separator) return separator;
|
|
41790
41705
|
}
|
|
@@ -41920,24 +41835,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41920
41835
|
});
|
|
41921
41836
|
}
|
|
41922
41837
|
checkSingleColSelected() {
|
|
41923
|
-
if (!this.getters.isSingleColSelected()) return
|
|
41924
|
-
return
|
|
41838
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
41839
|
+
return "Success";
|
|
41925
41840
|
}
|
|
41926
41841
|
checkNonEmptySelector(cmd) {
|
|
41927
|
-
if (cmd.separator === "") return
|
|
41928
|
-
return
|
|
41842
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
41843
|
+
return "Success";
|
|
41929
41844
|
}
|
|
41930
41845
|
checkNotOverwritingContent(cmd) {
|
|
41931
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
41846
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
41932
41847
|
const selection = this.getters.getSelectedZones()[0];
|
|
41933
41848
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
41934
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
41935
|
-
return
|
|
41849
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
41850
|
+
return "Success";
|
|
41936
41851
|
}
|
|
41937
41852
|
checkSeparatorInSelection({ separator }) {
|
|
41938
41853
|
const cells = this.getters.getSelectedCells();
|
|
41939
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
41940
|
-
return
|
|
41854
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
41855
|
+
return "NoSplitSeparatorInSelection";
|
|
41941
41856
|
}
|
|
41942
41857
|
};
|
|
41943
41858
|
|
|
@@ -41945,6 +41860,9 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41945
41860
|
//#region src/helpers/clipboard/clipboard_figure_state.ts
|
|
41946
41861
|
/** State of the clipboard when copying/cutting figures */
|
|
41947
41862
|
var ClipboardFigureState = class {
|
|
41863
|
+
operation;
|
|
41864
|
+
getters;
|
|
41865
|
+
dispatch;
|
|
41948
41866
|
sheetId;
|
|
41949
41867
|
copiedFigure;
|
|
41950
41868
|
copiedFigureContent;
|
|
@@ -41969,12 +41887,12 @@ var ClipboardFigureState = class {
|
|
|
41969
41887
|
}
|
|
41970
41888
|
}
|
|
41971
41889
|
isCutAllowed(target) {
|
|
41972
|
-
return
|
|
41890
|
+
return "Success";
|
|
41973
41891
|
}
|
|
41974
41892
|
isPasteAllowed(target, option) {
|
|
41975
|
-
if (target.length === 0) return
|
|
41976
|
-
if (option?.pasteOption !== void 0) return
|
|
41977
|
-
return
|
|
41893
|
+
if (target.length === 0) return "EmptyTarget";
|
|
41894
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
41895
|
+
return "Success";
|
|
41978
41896
|
}
|
|
41979
41897
|
/**
|
|
41980
41898
|
* Paste the clipboard content in the given target
|
|
@@ -42004,7 +41922,7 @@ var ClipboardFigureState = class {
|
|
|
42004
41922
|
this.dispatch("SELECT_FIGURE", { id: newId });
|
|
42005
41923
|
}
|
|
42006
41924
|
getClipboardContent() {
|
|
42007
|
-
return { [
|
|
41925
|
+
return { ["text/plain"]: " " };
|
|
42008
41926
|
}
|
|
42009
41927
|
isColRowDirtyingClipboard(position, dimension) {
|
|
42010
41928
|
return false;
|
|
@@ -42012,6 +41930,8 @@ var ClipboardFigureState = class {
|
|
|
42012
41930
|
drawClipboard(renderingContext) {}
|
|
42013
41931
|
};
|
|
42014
41932
|
var ClipboardFigureChart = class {
|
|
41933
|
+
dispatch;
|
|
41934
|
+
sheetId;
|
|
42015
41935
|
copiedChart;
|
|
42016
41936
|
constructor(dispatch, getters, sheetId, copiedFigureId) {
|
|
42017
41937
|
this.dispatch = dispatch;
|
|
@@ -42032,11 +41952,14 @@ var ClipboardFigureChart = class {
|
|
|
42032
41952
|
}
|
|
42033
41953
|
};
|
|
42034
41954
|
var ClipboardFigureImage = class {
|
|
41955
|
+
dispatch;
|
|
41956
|
+
sheetId;
|
|
42035
41957
|
copiedImage;
|
|
42036
41958
|
constructor(dispatch, getters, sheetId, copiedFigureId) {
|
|
42037
41959
|
this.dispatch = dispatch;
|
|
42038
41960
|
this.sheetId = sheetId;
|
|
42039
|
-
|
|
41961
|
+
const image = getters.getImage(copiedFigureId);
|
|
41962
|
+
this.copiedImage = deepCopy(image);
|
|
42040
41963
|
}
|
|
42041
41964
|
paste(sheetId, figureId, position, size) {
|
|
42042
41965
|
const copy = deepCopy(this.copiedImage);
|
|
@@ -42062,8 +41985,8 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42062
41985
|
isPasteAllowed(target, clipboardOption) {
|
|
42063
41986
|
const sheetId = this.getters.getActiveSheetId();
|
|
42064
41987
|
const pasteZone = this.getPasteZone(target);
|
|
42065
|
-
if (this.getters.doesIntersectMerge(sheetId, pasteZone)) return
|
|
42066
|
-
return
|
|
41988
|
+
if (this.getters.doesIntersectMerge(sheetId, pasteZone)) return "WillRemoveExistingMerge";
|
|
41989
|
+
return "Success";
|
|
42067
41990
|
}
|
|
42068
41991
|
paste(target, clipboardOption) {
|
|
42069
41992
|
if (clipboardOption?.pasteOption === "onlyFormat") return;
|
|
@@ -42095,7 +42018,7 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42095
42018
|
}, { scrollIntoView: false });
|
|
42096
42019
|
}
|
|
42097
42020
|
getClipboardContent() {
|
|
42098
|
-
return { [
|
|
42021
|
+
return { ["text/plain"]: this.values.map((values) => values.join(" ")).join("\n") };
|
|
42099
42022
|
}
|
|
42100
42023
|
getPasteZone(target) {
|
|
42101
42024
|
const height = this.values.length;
|
|
@@ -42119,7 +42042,7 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42119
42042
|
* application, and with the OS clipboard as well.
|
|
42120
42043
|
*/
|
|
42121
42044
|
var ClipboardPlugin = class extends UIPlugin {
|
|
42122
|
-
static layers = [
|
|
42045
|
+
static layers = [2];
|
|
42123
42046
|
static getters = [
|
|
42124
42047
|
"getClipboardContent",
|
|
42125
42048
|
"getClipboardTextContent",
|
|
@@ -42137,18 +42060,18 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42137
42060
|
const zones = this.getters.getSelectedZones();
|
|
42138
42061
|
return this.getClipboardState(zones, cmd.type).isCutAllowed(zones);
|
|
42139
42062
|
case "PASTE":
|
|
42140
|
-
if (!this.state) return
|
|
42063
|
+
if (!this.state) return "EmptyClipboard";
|
|
42141
42064
|
const pasteOption = cmd.pasteOption || (this.paintFormatStatus !== "inactive" ? "onlyFormat" : void 0);
|
|
42142
42065
|
return this.state.isPasteAllowed(cmd.target, { pasteOption });
|
|
42143
42066
|
case "PASTE_FROM_OS_CLIPBOARD": return new ClipboardOsState(cmd.text, this.getters, this.dispatch, this.selection).isPasteAllowed(cmd.target, { pasteOption: cmd.pasteOption });
|
|
42144
42067
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
42145
42068
|
const zones = this.getters.getSelectedZones();
|
|
42146
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
42069
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
42147
42070
|
break;
|
|
42148
42071
|
}
|
|
42149
42072
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
42150
42073
|
const zones = this.getters.getSelectedZones();
|
|
42151
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
42074
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
42152
42075
|
break;
|
|
42153
42076
|
}
|
|
42154
42077
|
case "INSERT_CELL": {
|
|
@@ -42159,9 +42082,9 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42159
42082
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
42160
42083
|
return this.getClipboardStateForCopyCells(cut, "CUT", "shiftCells").isPasteAllowed(paste);
|
|
42161
42084
|
}
|
|
42162
|
-
case "ACTIVATE_PAINT_FORMAT": if (this.paintFormatStatus !== "inactive") return
|
|
42085
|
+
case "ACTIVATE_PAINT_FORMAT": if (this.paintFormatStatus !== "inactive") return "AlreadyInPaintingFormatMode";
|
|
42163
42086
|
}
|
|
42164
|
-
return
|
|
42087
|
+
return "Success";
|
|
42165
42088
|
}
|
|
42166
42089
|
handle(cmd) {
|
|
42167
42090
|
switch (cmd.type) {
|
|
@@ -42298,10 +42221,10 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42298
42221
|
* considered as a copy content.
|
|
42299
42222
|
*/
|
|
42300
42223
|
getClipboardContent() {
|
|
42301
|
-
return this.state?.getClipboardContent() || { [
|
|
42224
|
+
return this.state?.getClipboardContent() || { ["text/plain"]: " " };
|
|
42302
42225
|
}
|
|
42303
42226
|
getClipboardTextContent() {
|
|
42304
|
-
return this.state?.getClipboardContent()[
|
|
42227
|
+
return this.state?.getClipboardContent()["text/plain"] || " ";
|
|
42305
42228
|
}
|
|
42306
42229
|
isCutOperation() {
|
|
42307
42230
|
return this.state ? this.state.operation === "CUT" : false;
|
|
@@ -42496,10 +42419,10 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
42496
42419
|
}
|
|
42497
42420
|
break;
|
|
42498
42421
|
case "STOP_EDITION":
|
|
42499
|
-
if (this.mode === "inactive") return
|
|
42422
|
+
if (this.mode === "inactive") return "Success";
|
|
42500
42423
|
return this.checkDataValidation(cmd);
|
|
42501
42424
|
}
|
|
42502
|
-
return
|
|
42425
|
+
return "Success";
|
|
42503
42426
|
}
|
|
42504
42427
|
handleEvent(event) {
|
|
42505
42428
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -42682,7 +42605,7 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
42682
42605
|
});
|
|
42683
42606
|
}
|
|
42684
42607
|
validateSelection(length, start, end) {
|
|
42685
|
-
return start >= 0 && start <= length && end >= 0 && end <= length ?
|
|
42608
|
+
return start >= 0 && start <= length && end >= 0 && end <= length ? "Success" : "WrongComposerSelection";
|
|
42686
42609
|
}
|
|
42687
42610
|
onColumnsRemoved(cmd) {
|
|
42688
42611
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -42838,11 +42761,11 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
42838
42761
|
if (cell?.isFormula) return localizeFormula(cell.content, locale);
|
|
42839
42762
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
42840
42763
|
switch (type) {
|
|
42841
|
-
case
|
|
42842
|
-
case
|
|
42843
|
-
case
|
|
42844
|
-
case
|
|
42845
|
-
case
|
|
42764
|
+
case "text":
|
|
42765
|
+
case "empty": return value;
|
|
42766
|
+
case "boolean": return formattedValue;
|
|
42767
|
+
case "error": return cell?.content || "";
|
|
42768
|
+
case "number":
|
|
42846
42769
|
if (format && isDateTimeFormat(format)) {
|
|
42847
42770
|
if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
|
|
42848
42771
|
return formatValue(value, {
|
|
@@ -43064,12 +42987,12 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
43064
42987
|
try {
|
|
43065
42988
|
const content = this.getCurrentCanonicalContent();
|
|
43066
42989
|
const cellValue = content.startsWith("=") ? this.getters.evaluateFormula(this.sheetId, content) : parseLiteral(content, this.getters.getLocale());
|
|
43067
|
-
if (isMatrix(cellValue)) return
|
|
42990
|
+
if (isMatrix(cellValue)) return "Success";
|
|
43068
42991
|
const validationResult = this.getters.getValidationResultForCellValue(cellValue, cellPosition);
|
|
43069
|
-
if (!validationResult.isValid && validationResult.rule.isBlocking) return
|
|
43070
|
-
return
|
|
42992
|
+
if (!validationResult.isValid && validationResult.rule.isBlocking) return "BlockingValidationRule";
|
|
42993
|
+
return "Success";
|
|
43071
42994
|
} catch (e) {
|
|
43072
|
-
return this.getters.getValidationRuleForCell(cellPosition)?.isBlocking ?
|
|
42995
|
+
return this.getters.getValidationRuleForCell(cellPosition)?.isBlocking ? "BlockingValidationRule" : "Success";
|
|
43073
42996
|
}
|
|
43074
42997
|
}
|
|
43075
42998
|
};
|
|
@@ -43089,10 +43012,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
43089
43012
|
allowDispatch(cmd) {
|
|
43090
43013
|
switch (cmd.type) {
|
|
43091
43014
|
case "UPDATE_FILTER":
|
|
43092
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
43015
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
43093
43016
|
break;
|
|
43094
43017
|
}
|
|
43095
|
-
return
|
|
43018
|
+
return "Success";
|
|
43096
43019
|
}
|
|
43097
43020
|
handle(cmd) {
|
|
43098
43021
|
switch (cmd.type) {
|
|
@@ -43293,41 +43216,41 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
43293
43216
|
const selectionStatisticFunctions = [
|
|
43294
43217
|
{
|
|
43295
43218
|
name: _t("Sum"),
|
|
43296
|
-
types: [
|
|
43219
|
+
types: ["number"],
|
|
43297
43220
|
compute: (values, locale) => SUM.compute.bind({ locale })([values])
|
|
43298
43221
|
},
|
|
43299
43222
|
{
|
|
43300
43223
|
name: _t("Avg"),
|
|
43301
|
-
types: [
|
|
43224
|
+
types: ["number"],
|
|
43302
43225
|
compute: (values, locale) => AVERAGE.compute.bind({ locale })([values])
|
|
43303
43226
|
},
|
|
43304
43227
|
{
|
|
43305
43228
|
name: _t("Min"),
|
|
43306
|
-
types: [
|
|
43229
|
+
types: ["number"],
|
|
43307
43230
|
compute: (values, locale) => MIN.compute.bind({ locale })([values])
|
|
43308
43231
|
},
|
|
43309
43232
|
{
|
|
43310
43233
|
name: _t("Max"),
|
|
43311
|
-
types: [
|
|
43234
|
+
types: ["number"],
|
|
43312
43235
|
compute: (values, locale) => MAX.compute.bind({ locale })([values])
|
|
43313
43236
|
},
|
|
43314
43237
|
{
|
|
43315
43238
|
name: _t("Count"),
|
|
43316
43239
|
types: [
|
|
43317
|
-
|
|
43318
|
-
|
|
43319
|
-
|
|
43320
|
-
|
|
43240
|
+
"number",
|
|
43241
|
+
"text",
|
|
43242
|
+
"boolean",
|
|
43243
|
+
"error"
|
|
43321
43244
|
],
|
|
43322
43245
|
compute: (values, locale) => COUNTA.compute.bind({ locale })([values])
|
|
43323
43246
|
},
|
|
43324
43247
|
{
|
|
43325
43248
|
name: _t("Count Numbers"),
|
|
43326
43249
|
types: [
|
|
43327
|
-
|
|
43328
|
-
|
|
43329
|
-
|
|
43330
|
-
|
|
43250
|
+
"number",
|
|
43251
|
+
"text",
|
|
43252
|
+
"boolean",
|
|
43253
|
+
"error"
|
|
43331
43254
|
],
|
|
43332
43255
|
compute: (values, locale) => COUNT.compute.bind({ locale })([values])
|
|
43333
43256
|
}
|
|
@@ -43336,7 +43259,7 @@ const selectionStatisticFunctions = [
|
|
|
43336
43259
|
* SelectionPlugin
|
|
43337
43260
|
*/
|
|
43338
43261
|
var GridSelectionPlugin = class extends UIPlugin {
|
|
43339
|
-
static layers = [
|
|
43262
|
+
static layers = [6];
|
|
43340
43263
|
static getters = [
|
|
43341
43264
|
"getActiveSheet",
|
|
43342
43265
|
"getActiveSheetId",
|
|
@@ -43393,11 +43316,11 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43393
43316
|
this.getters.getSheet(cmd.sheetIdTo);
|
|
43394
43317
|
break;
|
|
43395
43318
|
} catch (error) {
|
|
43396
|
-
return
|
|
43319
|
+
return "InvalidSheetId";
|
|
43397
43320
|
}
|
|
43398
43321
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
43399
43322
|
}
|
|
43400
|
-
return
|
|
43323
|
+
return "Success";
|
|
43401
43324
|
}
|
|
43402
43325
|
handleEvent(event) {
|
|
43403
43326
|
const anchor = event.anchor;
|
|
@@ -43612,7 +43535,7 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43612
43535
|
col,
|
|
43613
43536
|
row
|
|
43614
43537
|
});
|
|
43615
|
-
if (evaluatedCell.type !==
|
|
43538
|
+
if (evaluatedCell.type !== "empty") cells.add(evaluatedCell);
|
|
43616
43539
|
}
|
|
43617
43540
|
const cellsTypes = /* @__PURE__ */ new Set();
|
|
43618
43541
|
const cellsValues = [];
|
|
@@ -43640,7 +43563,7 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43640
43563
|
col,
|
|
43641
43564
|
row
|
|
43642
43565
|
});
|
|
43643
|
-
if (cell.type ===
|
|
43566
|
+
if (cell.type === "number") {
|
|
43644
43567
|
n++;
|
|
43645
43568
|
aggregate += cell.value;
|
|
43646
43569
|
}
|
|
@@ -43737,7 +43660,8 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43737
43660
|
}, [zone]);
|
|
43738
43661
|
}
|
|
43739
43662
|
setActiveSheet(id) {
|
|
43740
|
-
|
|
43663
|
+
const sheet = this.getters.getSheet(id);
|
|
43664
|
+
this.activeSheet = sheet;
|
|
43741
43665
|
}
|
|
43742
43666
|
activateNextSheet(direction) {
|
|
43743
43667
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -43856,11 +43780,11 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43856
43780
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
43857
43781
|
const id = cmd.sheetId;
|
|
43858
43782
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
43859
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
43783
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
43860
43784
|
const headers = [cmd.base, ...cmd.elements];
|
|
43861
43785
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
43862
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
43863
|
-
return
|
|
43786
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
43787
|
+
return "Success";
|
|
43864
43788
|
}
|
|
43865
43789
|
fallbackToVisibleSheet() {
|
|
43866
43790
|
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
@@ -43941,6 +43865,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43941
43865
|
//#endregion
|
|
43942
43866
|
//#region src/helpers/internal_viewport.ts
|
|
43943
43867
|
var InternalViewport = class {
|
|
43868
|
+
getters;
|
|
43869
|
+
sheetId;
|
|
43870
|
+
boundaries;
|
|
43944
43871
|
top;
|
|
43945
43872
|
bottom;
|
|
43946
43873
|
left;
|
|
@@ -44291,7 +44218,7 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
44291
44218
|
switch (cmd.type) {
|
|
44292
44219
|
case "SET_VIEWPORT_OFFSET": return this.checkScrollingDirection(cmd);
|
|
44293
44220
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
44294
|
-
default: return
|
|
44221
|
+
default: return "Success";
|
|
44295
44222
|
}
|
|
44296
44223
|
}
|
|
44297
44224
|
handleEvent(event) {
|
|
@@ -44672,18 +44599,18 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
44672
44599
|
return Object.values(this.viewports[sheetId]).filter(isDefined$1);
|
|
44673
44600
|
}
|
|
44674
44601
|
checkPositiveDimension(cmd) {
|
|
44675
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
44676
|
-
return
|
|
44602
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
44603
|
+
return "Success";
|
|
44677
44604
|
}
|
|
44678
44605
|
checkValuesAreDifferent(cmd) {
|
|
44679
44606
|
const { height, width } = this.getSheetViewDimension();
|
|
44680
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
44681
|
-
return
|
|
44607
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
44608
|
+
return "Success";
|
|
44682
44609
|
}
|
|
44683
44610
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
44684
44611
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
44685
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
44686
|
-
return
|
|
44612
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
44613
|
+
return "Success";
|
|
44687
44614
|
}
|
|
44688
44615
|
getMainViewport(sheetId) {
|
|
44689
44616
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -45277,9 +45204,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
45277
45204
|
sheetId,
|
|
45278
45205
|
name
|
|
45279
45206
|
});
|
|
45280
|
-
if (result.reasons.includes(
|
|
45281
|
-
else if (result.reasons.includes(
|
|
45282
|
-
else if (result.reasons.includes(
|
|
45207
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
45208
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
45209
|
+
else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEET_CHARS.join(" ")), errorCallback);
|
|
45283
45210
|
}
|
|
45284
45211
|
|
|
45285
45212
|
//#endregion
|
|
@@ -45778,7 +45705,8 @@ var SpreadsheetDashboard = class extends Component {
|
|
|
45778
45705
|
canvasPosition;
|
|
45779
45706
|
hoveredCell;
|
|
45780
45707
|
setup() {
|
|
45781
|
-
|
|
45708
|
+
const gridRef = useRef("grid");
|
|
45709
|
+
this.canvasPosition = useAbsoluteBoundingRect(gridRef);
|
|
45782
45710
|
this.hoveredCell = useState({
|
|
45783
45711
|
col: void 0,
|
|
45784
45712
|
row: void 0
|
|
@@ -45893,7 +45821,7 @@ SpreadsheetDashboard.props = {};
|
|
|
45893
45821
|
css`
|
|
45894
45822
|
.o-header-group {
|
|
45895
45823
|
.o-header-group-header {
|
|
45896
|
-
z-index: ${
|
|
45824
|
+
z-index: ${6};
|
|
45897
45825
|
.o-group-fold-button {
|
|
45898
45826
|
cursor: pointer;
|
|
45899
45827
|
width: 13px;
|
|
@@ -46687,7 +46615,7 @@ var TopBarComposer = class extends Component {
|
|
|
46687
46615
|
});
|
|
46688
46616
|
return cssPropertiesToCss({
|
|
46689
46617
|
"border-color": SELECTION_BORDER_COLOR,
|
|
46690
|
-
"z-index": String(
|
|
46618
|
+
"z-index": String(30)
|
|
46691
46619
|
});
|
|
46692
46620
|
}
|
|
46693
46621
|
};
|
|
@@ -46873,7 +46801,7 @@ css`
|
|
|
46873
46801
|
overflow-y: auto;
|
|
46874
46802
|
overflow-x: hidden;
|
|
46875
46803
|
padding: 2px;
|
|
46876
|
-
z-index: ${
|
|
46804
|
+
z-index: ${21};
|
|
46877
46805
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
46878
46806
|
background-color: white;
|
|
46879
46807
|
|
|
@@ -47011,6 +46939,7 @@ function instantiateClipboard() {
|
|
|
47011
46939
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
47012
46940
|
}
|
|
47013
46941
|
var WebClipboardWrapper = class {
|
|
46942
|
+
clipboard;
|
|
47014
46943
|
constructor(clipboard) {
|
|
47015
46944
|
this.clipboard = clipboard;
|
|
47016
46945
|
}
|
|
@@ -47040,8 +46969,8 @@ var WebClipboardWrapper = class {
|
|
|
47040
46969
|
}
|
|
47041
46970
|
getClipboardItems(content) {
|
|
47042
46971
|
return [new ClipboardItem({
|
|
47043
|
-
[
|
|
47044
|
-
[
|
|
46972
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
46973
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
47045
46974
|
})];
|
|
47046
46975
|
}
|
|
47047
46976
|
getBlob(clipboardContent, type) {
|
|
@@ -47460,6 +47389,8 @@ function createEmptyStructure(node) {
|
|
|
47460
47389
|
* @param operations initial operations
|
|
47461
47390
|
*/
|
|
47462
47391
|
var Branch = class Branch {
|
|
47392
|
+
buildTransformation;
|
|
47393
|
+
operations;
|
|
47463
47394
|
constructor(buildTransformation, operations = []) {
|
|
47464
47395
|
this.buildTransformation = buildTransformation;
|
|
47465
47396
|
this.operations = operations;
|
|
@@ -47576,6 +47507,8 @@ var Branch = class Branch {
|
|
|
47576
47507
|
* to revert it).
|
|
47577
47508
|
*/
|
|
47578
47509
|
var Operation = class {
|
|
47510
|
+
id;
|
|
47511
|
+
data;
|
|
47579
47512
|
constructor(id, data) {
|
|
47580
47513
|
this.id = id;
|
|
47581
47514
|
this.data = data;
|
|
@@ -47585,6 +47518,8 @@ var Operation = class {
|
|
|
47585
47518
|
}
|
|
47586
47519
|
};
|
|
47587
47520
|
var LazyOperation = class LazyOperation {
|
|
47521
|
+
id;
|
|
47522
|
+
lazyData;
|
|
47588
47523
|
constructor(id, lazyData) {
|
|
47589
47524
|
this.id = id;
|
|
47590
47525
|
this.lazyData = lazyData;
|
|
@@ -47610,6 +47545,7 @@ var LazyOperation = class LazyOperation {
|
|
|
47610
47545
|
* ```
|
|
47611
47546
|
*/
|
|
47612
47547
|
var OperationSequence = class OperationSequence {
|
|
47548
|
+
operations;
|
|
47613
47549
|
constructor(operations) {
|
|
47614
47550
|
this.operations = operations;
|
|
47615
47551
|
}
|
|
@@ -47685,6 +47621,7 @@ var OperationSequence = class OperationSequence {
|
|
|
47685
47621
|
*
|
|
47686
47622
|
*/
|
|
47687
47623
|
var Tree = class {
|
|
47624
|
+
buildTransformation;
|
|
47688
47625
|
branches;
|
|
47689
47626
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
47690
47627
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -48277,6 +48214,7 @@ var EventStream = class {
|
|
|
48277
48214
|
* with the new selected anchor
|
|
48278
48215
|
*/
|
|
48279
48216
|
var SelectionStreamProcessorImpl = class {
|
|
48217
|
+
getters;
|
|
48280
48218
|
stream;
|
|
48281
48219
|
/**
|
|
48282
48220
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -48372,7 +48310,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48372
48310
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
48373
48311
|
*/
|
|
48374
48312
|
moveAnchorCell(direction, step = 1) {
|
|
48375
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
48313
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
48376
48314
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
48377
48315
|
return this.selectCell(col, row);
|
|
48378
48316
|
}
|
|
@@ -48434,7 +48372,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48434
48372
|
* of the anchor zone which moves.
|
|
48435
48373
|
*/
|
|
48436
48374
|
resizeAnchorZone(direction, step = 1) {
|
|
48437
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
48375
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
48438
48376
|
const sheetId = this.getters.getActiveSheetId();
|
|
48439
48377
|
const anchor = this.anchor;
|
|
48440
48378
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -48680,7 +48618,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48680
48618
|
previousAnchor: deepCopy(this.anchor)
|
|
48681
48619
|
};
|
|
48682
48620
|
const commandResult = this.checkEventAnchorZone(event);
|
|
48683
|
-
if (commandResult !==
|
|
48621
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
48684
48622
|
this.anchor = event.anchor;
|
|
48685
48623
|
this.stream.send(event);
|
|
48686
48624
|
return DispatchResult.Success;
|
|
@@ -48690,15 +48628,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48690
48628
|
}
|
|
48691
48629
|
checkAnchorZone(anchor) {
|
|
48692
48630
|
const { cell, zone } = anchor;
|
|
48693
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
48631
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
48694
48632
|
const { left, right, top, bottom } = zone;
|
|
48695
48633
|
const sheetId = this.getters.getActiveSheetId();
|
|
48696
48634
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
48697
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
48698
|
-
return
|
|
48635
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
48636
|
+
return "Success";
|
|
48699
48637
|
}
|
|
48700
48638
|
checkAnchorZoneOrThrow(anchor) {
|
|
48701
|
-
if (this.checkAnchorZone(anchor) ===
|
|
48639
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
48702
48640
|
}
|
|
48703
48641
|
/**
|
|
48704
48642
|
* ---- PRIVATE ----
|
|
@@ -48848,7 +48786,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48848
48786
|
col,
|
|
48849
48787
|
row
|
|
48850
48788
|
});
|
|
48851
|
-
return this.getters.getEvaluatedCell(position).type ===
|
|
48789
|
+
return this.getters.getEvaluatedCell(position).type === "empty";
|
|
48852
48790
|
}
|
|
48853
48791
|
/** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
|
|
48854
48792
|
*
|
|
@@ -49355,7 +49293,7 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
49355
49293
|
return ast;
|
|
49356
49294
|
});
|
|
49357
49295
|
ast = convertAstNodes(ast, "REFERENCE", (ast) => {
|
|
49358
|
-
return ast.value ===
|
|
49296
|
+
return ast.value === "#REF" ? {
|
|
49359
49297
|
...ast,
|
|
49360
49298
|
value: "#REF!"
|
|
49361
49299
|
} : ast;
|
|
@@ -49363,7 +49301,7 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
49363
49301
|
return ast ? astToFormula(ast) : formulaText;
|
|
49364
49302
|
}
|
|
49365
49303
|
function adaptFormulaValueToExcel(formulaValue) {
|
|
49366
|
-
return formulaValue ===
|
|
49304
|
+
return formulaValue === "#REF" ? "#REF!" : formulaValue;
|
|
49367
49305
|
}
|
|
49368
49306
|
/**
|
|
49369
49307
|
* Some Excel function need required args that might not be mandatory in o-spreadsheet.
|
|
@@ -50414,13 +50352,6 @@ function createRelRoot() {
|
|
|
50414
50352
|
|
|
50415
50353
|
//#endregion
|
|
50416
50354
|
//#region src/model.ts
|
|
50417
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
50418
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
50419
|
-
Status[Status["Running"] = 1] = "Running";
|
|
50420
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
50421
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
50422
|
-
return Status;
|
|
50423
|
-
}(Status || {});
|
|
50424
50355
|
var Model = class extends EventBus {
|
|
50425
50356
|
corePlugins = [];
|
|
50426
50357
|
featurePlugins = [];
|
|
@@ -50444,7 +50375,7 @@ var Model = class extends EventBus {
|
|
|
50444
50375
|
/**
|
|
50445
50376
|
* Internal status of the model. Important for command handling coordination
|
|
50446
50377
|
*/
|
|
50447
|
-
status =
|
|
50378
|
+
status = 0;
|
|
50448
50379
|
/**
|
|
50449
50380
|
* The config object contains some configuration flag and callbacks
|
|
50450
50381
|
*/
|
|
@@ -50569,7 +50500,7 @@ var Model = class extends EventBus {
|
|
|
50569
50500
|
onRemoteRevisionReceived({ commands }) {
|
|
50570
50501
|
for (const command of commands) {
|
|
50571
50502
|
const previousStatus = this.status;
|
|
50572
|
-
this.status =
|
|
50503
|
+
this.status = 2;
|
|
50573
50504
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
50574
50505
|
this.status = previousStatus;
|
|
50575
50506
|
}
|
|
@@ -50663,7 +50594,7 @@ var Model = class extends EventBus {
|
|
|
50663
50594
|
*/
|
|
50664
50595
|
checkDispatchAllowed(command) {
|
|
50665
50596
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
50666
|
-
if (results.some((r) => r !==
|
|
50597
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
50667
50598
|
return DispatchResult.Success;
|
|
50668
50599
|
}
|
|
50669
50600
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -50675,9 +50606,9 @@ var Model = class extends EventBus {
|
|
|
50675
50606
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
50676
50607
|
}
|
|
50677
50608
|
finalize() {
|
|
50678
|
-
this.status =
|
|
50609
|
+
this.status = 3;
|
|
50679
50610
|
for (const h of this.handlers) h.finalize();
|
|
50680
|
-
this.status =
|
|
50611
|
+
this.status = 0;
|
|
50681
50612
|
}
|
|
50682
50613
|
/**
|
|
50683
50614
|
* Check if a command can be dispatched, and returns a DispatchResult object with the possible
|
|
@@ -50703,23 +50634,23 @@ var Model = class extends EventBus {
|
|
|
50703
50634
|
dispatch = (type, payload) => {
|
|
50704
50635
|
const command = createCommand(type, payload);
|
|
50705
50636
|
const status = this.status;
|
|
50706
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
50707
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
50637
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
50638
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
50708
50639
|
switch (status) {
|
|
50709
|
-
case
|
|
50640
|
+
case 0:
|
|
50710
50641
|
const result = this.checkDispatchAllowed(command);
|
|
50711
50642
|
if (!result.isSuccessful) return result;
|
|
50712
|
-
this.status =
|
|
50643
|
+
this.status = 1;
|
|
50713
50644
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
50714
50645
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
50715
50646
|
this.dispatchToHandlers(this.handlers, command);
|
|
50716
50647
|
this.finalize();
|
|
50717
50648
|
});
|
|
50718
50649
|
this.session.save(command, commands, changes);
|
|
50719
|
-
this.status =
|
|
50650
|
+
this.status = 0;
|
|
50720
50651
|
this.trigger("update");
|
|
50721
50652
|
break;
|
|
50722
|
-
case
|
|
50653
|
+
case 1:
|
|
50723
50654
|
if (isCoreCommand(command)) {
|
|
50724
50655
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
50725
50656
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -50727,8 +50658,8 @@ var Model = class extends EventBus {
|
|
|
50727
50658
|
}
|
|
50728
50659
|
this.dispatchToHandlers(this.handlers, command);
|
|
50729
50660
|
break;
|
|
50730
|
-
case
|
|
50731
|
-
case
|
|
50661
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
50662
|
+
case 2:
|
|
50732
50663
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
50733
50664
|
this.dispatchToHandlers(this.handlers, command);
|
|
50734
50665
|
}
|
|
@@ -50741,7 +50672,7 @@ var Model = class extends EventBus {
|
|
|
50741
50672
|
dispatchFromCorePlugin = (type, payload) => {
|
|
50742
50673
|
const command = createCommand(type, payload);
|
|
50743
50674
|
const previousStatus = this.status;
|
|
50744
|
-
this.status =
|
|
50675
|
+
this.status = 2;
|
|
50745
50676
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
50746
50677
|
this.dispatchToHandlers(handlers, command);
|
|
50747
50678
|
this.status = previousStatus;
|
|
@@ -50944,6 +50875,6 @@ const constants = { DEFAULT_LOCALE };
|
|
|
50944
50875
|
//#endregion
|
|
50945
50876
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
50946
50877
|
|
|
50947
|
-
__info__.version = "17.0.
|
|
50948
|
-
__info__.date = "2026-
|
|
50949
|
-
__info__.hash = "
|
|
50878
|
+
__info__.version = "17.0.100";
|
|
50879
|
+
__info__.date = "2026-06-06T06:18:41.503Z";
|
|
50880
|
+
__info__.hash = "55a7453";
|