@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
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
@@ -15,7 +15,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
15
15
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
16
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17
17
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
19
19
|
var __exportAll = (all, no_symbols) => {
|
|
20
20
|
let target = {};
|
|
21
21
|
for (var name in all) {
|
|
@@ -88,6 +88,7 @@ const _t = function(s, ...values) {
|
|
|
88
88
|
return sprintf(_translate(s), ...values);
|
|
89
89
|
};
|
|
90
90
|
var LazyTranslatedString = class extends String {
|
|
91
|
+
values;
|
|
91
92
|
constructor(str, values) {
|
|
92
93
|
super(str);
|
|
93
94
|
this.values = values;
|
|
@@ -103,53 +104,46 @@ var LazyTranslatedString = class extends String {
|
|
|
103
104
|
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/types/errors.ts
|
|
106
|
-
let CellErrorType = /* @__PURE__ */ function(CellErrorType) {
|
|
107
|
-
CellErrorType["NotAvailable"] = "#N/A";
|
|
108
|
-
CellErrorType["InvalidReference"] = "#REF";
|
|
109
|
-
CellErrorType["BadExpression"] = "#BAD_EXPR";
|
|
110
|
-
CellErrorType["CircularDependency"] = "#CYCLE";
|
|
111
|
-
CellErrorType["UnknownFunction"] = "#NAME?";
|
|
112
|
-
CellErrorType["GenericError"] = "#ERROR";
|
|
113
|
-
return CellErrorType;
|
|
114
|
-
}({});
|
|
115
107
|
let CellErrorLevel = /* @__PURE__ */ function(CellErrorLevel) {
|
|
116
108
|
CellErrorLevel[CellErrorLevel["silent"] = 0] = "silent";
|
|
117
109
|
CellErrorLevel[CellErrorLevel["error"] = 1] = "error";
|
|
118
110
|
return CellErrorLevel;
|
|
119
111
|
}({});
|
|
120
112
|
var EvaluationError = class extends Error {
|
|
121
|
-
|
|
113
|
+
errorType;
|
|
114
|
+
logLevel;
|
|
115
|
+
constructor(errorType, message, logLevel = 1) {
|
|
122
116
|
super(message);
|
|
123
117
|
this.errorType = errorType;
|
|
124
118
|
this.logLevel = logLevel;
|
|
125
119
|
}
|
|
126
120
|
get isVerbose() {
|
|
127
|
-
return this.logLevel >
|
|
121
|
+
return this.logLevel > 0;
|
|
128
122
|
}
|
|
129
123
|
};
|
|
130
124
|
var BadExpressionError = class extends EvaluationError {
|
|
131
125
|
constructor(errorMessage) {
|
|
132
|
-
super(
|
|
126
|
+
super("#BAD_EXPR", errorMessage);
|
|
133
127
|
}
|
|
134
128
|
};
|
|
135
129
|
var CircularDependencyError = class extends EvaluationError {
|
|
136
130
|
constructor() {
|
|
137
|
-
super(
|
|
131
|
+
super("#CYCLE", _t("Circular reference"));
|
|
138
132
|
}
|
|
139
133
|
};
|
|
140
134
|
var InvalidReferenceError = class extends EvaluationError {
|
|
141
135
|
constructor() {
|
|
142
|
-
super(
|
|
136
|
+
super("#REF", _t("Invalid reference"));
|
|
143
137
|
}
|
|
144
138
|
};
|
|
145
139
|
var NotAvailableError = class extends EvaluationError {
|
|
146
140
|
constructor(errorMessage = void 0) {
|
|
147
|
-
super(
|
|
141
|
+
super("#N/A", errorMessage || _t("Data not available"), errorMessage ? 1 : 0);
|
|
148
142
|
}
|
|
149
143
|
};
|
|
150
144
|
var UnknownFunctionError = class extends EvaluationError {
|
|
151
145
|
constructor(fctName) {
|
|
152
|
-
super(
|
|
146
|
+
super("#NAME?", _t("Unknown function: \"%s\"", fctName));
|
|
153
147
|
}
|
|
154
148
|
};
|
|
155
149
|
|
|
@@ -296,7 +290,7 @@ const DEFAULT_FILTER_BORDER_DESC = {
|
|
|
296
290
|
style: "thin",
|
|
297
291
|
color: FILTERS_COLOR
|
|
298
292
|
};
|
|
299
|
-
const INCORRECT_RANGE_STRING =
|
|
293
|
+
const INCORRECT_RANGE_STRING = "#REF";
|
|
300
294
|
const DEFAULT_REVISION_ID = "START_REVISION";
|
|
301
295
|
const DEFAULT_GAUGE_LOWER_COLOR = "#cc0000";
|
|
302
296
|
const DEFAULT_GAUGE_MIDDLE_COLOR = "#f1c232";
|
|
@@ -316,22 +310,6 @@ const FORBIDDEN_SHEET_CHARS = [
|
|
|
316
310
|
];
|
|
317
311
|
const FORBIDDEN_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
318
312
|
const DEFAULT_ERROR_MESSAGE = _t("Invalid expression");
|
|
319
|
-
let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
|
|
320
|
-
ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
|
|
321
|
-
ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
|
|
322
|
-
ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
|
|
323
|
-
ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
|
|
324
|
-
ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
|
|
325
|
-
ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
|
|
326
|
-
ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
|
|
327
|
-
ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
|
|
328
|
-
ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
|
|
329
|
-
ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
|
|
330
|
-
ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
|
|
331
|
-
ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
|
|
332
|
-
ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
|
|
333
|
-
return ComponentsImportance;
|
|
334
|
-
}({});
|
|
335
313
|
let DEFAULT_SHEETVIEW_SIZE = 0;
|
|
336
314
|
function getDefaultSheetViewSize() {
|
|
337
315
|
return DEFAULT_SHEETVIEW_SIZE;
|
|
@@ -1664,25 +1642,6 @@ function percentile(values, percent, isInclusive) {
|
|
|
1664
1642
|
return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
|
|
1665
1643
|
}
|
|
1666
1644
|
|
|
1667
|
-
//#endregion
|
|
1668
|
-
//#region src/types/cells.ts
|
|
1669
|
-
let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
1670
|
-
CellValueType["boolean"] = "boolean";
|
|
1671
|
-
CellValueType["number"] = "number";
|
|
1672
|
-
CellValueType["text"] = "text";
|
|
1673
|
-
CellValueType["empty"] = "empty";
|
|
1674
|
-
CellValueType["error"] = "error";
|
|
1675
|
-
return CellValueType;
|
|
1676
|
-
}({});
|
|
1677
|
-
|
|
1678
|
-
//#endregion
|
|
1679
|
-
//#region src/types/clipboard.ts
|
|
1680
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
1681
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
1682
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
1683
|
-
return ClipboardMIMEType;
|
|
1684
|
-
}({});
|
|
1685
|
-
|
|
1686
1645
|
//#endregion
|
|
1687
1646
|
//#region src/types/commands.ts
|
|
1688
1647
|
function isSheetDependent(cmd) {
|
|
@@ -1811,7 +1770,7 @@ var DispatchResult = class {
|
|
|
1811
1770
|
constructor(results = []) {
|
|
1812
1771
|
if (!Array.isArray(results)) results = [results];
|
|
1813
1772
|
results = [...new Set(results)];
|
|
1814
|
-
this.reasons = results.filter((result) => result !==
|
|
1773
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
1815
1774
|
}
|
|
1816
1775
|
/**
|
|
1817
1776
|
* Static helper which returns a successful DispatchResult
|
|
@@ -1982,27 +1941,6 @@ const borderStyles = [
|
|
|
1982
1941
|
function isMatrix(x) {
|
|
1983
1942
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
1984
1943
|
}
|
|
1985
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
1986
|
-
DIRECTION["UP"] = "up";
|
|
1987
|
-
DIRECTION["DOWN"] = "down";
|
|
1988
|
-
DIRECTION["LEFT"] = "left";
|
|
1989
|
-
DIRECTION["RIGHT"] = "right";
|
|
1990
|
-
return DIRECTION;
|
|
1991
|
-
}({});
|
|
1992
|
-
|
|
1993
|
-
//#endregion
|
|
1994
|
-
//#region src/types/rendering.ts
|
|
1995
|
-
let LAYERS = /* @__PURE__ */ function(LAYERS) {
|
|
1996
|
-
LAYERS[LAYERS["Background"] = 0] = "Background";
|
|
1997
|
-
LAYERS[LAYERS["Highlights"] = 1] = "Highlights";
|
|
1998
|
-
LAYERS[LAYERS["Clipboard"] = 2] = "Clipboard";
|
|
1999
|
-
LAYERS[LAYERS["Search"] = 3] = "Search";
|
|
2000
|
-
LAYERS[LAYERS["Chart"] = 4] = "Chart";
|
|
2001
|
-
LAYERS[LAYERS["Autofill"] = 5] = "Autofill";
|
|
2002
|
-
LAYERS[LAYERS["Selection"] = 6] = "Selection";
|
|
2003
|
-
LAYERS[LAYERS["Headers"] = 7] = "Headers";
|
|
2004
|
-
return LAYERS;
|
|
2005
|
-
}({});
|
|
2006
1944
|
|
|
2007
1945
|
//#endregion
|
|
2008
1946
|
//#region src/functions/helpers.ts
|
|
@@ -2013,7 +1951,7 @@ const SORT_TYPES_ORDER = [
|
|
|
2013
1951
|
"undefined"
|
|
2014
1952
|
];
|
|
2015
1953
|
function assert(condition, message) {
|
|
2016
|
-
if (!condition()) throw new EvaluationError(
|
|
1954
|
+
if (!condition()) throw new EvaluationError("#ERROR", message);
|
|
2017
1955
|
}
|
|
2018
1956
|
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);
|
|
2019
1957
|
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());
|
|
@@ -3560,6 +3498,7 @@ function getZonesRows(zones) {
|
|
|
3560
3498
|
//#endregion
|
|
3561
3499
|
//#region src/helpers/range.ts
|
|
3562
3500
|
var RangeImpl = class RangeImpl {
|
|
3501
|
+
getSheetSize;
|
|
3563
3502
|
_zone;
|
|
3564
3503
|
parts;
|
|
3565
3504
|
invalidXc;
|
|
@@ -4006,12 +3945,12 @@ function _createEvaluatedCell(value, localeFormat) {
|
|
|
4006
3945
|
}
|
|
4007
3946
|
return textCell((value || "").toString(), localeFormat);
|
|
4008
3947
|
} catch (error) {
|
|
4009
|
-
return errorCell(new EvaluationError(
|
|
3948
|
+
return errorCell(new EvaluationError("#ERROR", error.message || DEFAULT_ERROR_MESSAGE));
|
|
4010
3949
|
}
|
|
4011
3950
|
}
|
|
4012
3951
|
function textCell(value, localeFormat) {
|
|
4013
3952
|
return {
|
|
4014
|
-
type:
|
|
3953
|
+
type: "text",
|
|
4015
3954
|
value,
|
|
4016
3955
|
format: localeFormat.format,
|
|
4017
3956
|
isAutoSummable: true,
|
|
@@ -4021,7 +3960,7 @@ function textCell(value, localeFormat) {
|
|
|
4021
3960
|
}
|
|
4022
3961
|
function numberCell(value, localeFormat) {
|
|
4023
3962
|
return {
|
|
4024
|
-
type:
|
|
3963
|
+
type: "number",
|
|
4025
3964
|
value: value || 0,
|
|
4026
3965
|
format: localeFormat.format,
|
|
4027
3966
|
isAutoSummable: true,
|
|
@@ -4030,7 +3969,7 @@ function numberCell(value, localeFormat) {
|
|
|
4030
3969
|
};
|
|
4031
3970
|
}
|
|
4032
3971
|
const EMPTY_EVALUATED_CELL = {
|
|
4033
|
-
type:
|
|
3972
|
+
type: "empty",
|
|
4034
3973
|
value: "",
|
|
4035
3974
|
format: void 0,
|
|
4036
3975
|
isAutoSummable: true,
|
|
@@ -4040,7 +3979,7 @@ const EMPTY_EVALUATED_CELL = {
|
|
|
4040
3979
|
function emptyCell(localeFormat) {
|
|
4041
3980
|
if (localeFormat.format === void 0) return EMPTY_EVALUATED_CELL;
|
|
4042
3981
|
return {
|
|
4043
|
-
type:
|
|
3982
|
+
type: "empty",
|
|
4044
3983
|
value: "",
|
|
4045
3984
|
format: localeFormat.format,
|
|
4046
3985
|
isAutoSummable: true,
|
|
@@ -4051,7 +3990,7 @@ function emptyCell(localeFormat) {
|
|
|
4051
3990
|
function dateTimeCell(value, localeFormat) {
|
|
4052
3991
|
const formattedValue = formatValue(value, localeFormat);
|
|
4053
3992
|
return {
|
|
4054
|
-
type:
|
|
3993
|
+
type: "number",
|
|
4055
3994
|
value,
|
|
4056
3995
|
format: localeFormat.format,
|
|
4057
3996
|
isAutoSummable: false,
|
|
@@ -4062,7 +4001,7 @@ function dateTimeCell(value, localeFormat) {
|
|
|
4062
4001
|
function booleanCell(value, localeFormat) {
|
|
4063
4002
|
const formattedValue = value ? "TRUE" : "FALSE";
|
|
4064
4003
|
return {
|
|
4065
|
-
type:
|
|
4004
|
+
type: "boolean",
|
|
4066
4005
|
value,
|
|
4067
4006
|
format: localeFormat.format,
|
|
4068
4007
|
isAutoSummable: false,
|
|
@@ -4072,7 +4011,7 @@ function booleanCell(value, localeFormat) {
|
|
|
4072
4011
|
}
|
|
4073
4012
|
function errorCell(error) {
|
|
4074
4013
|
return {
|
|
4075
|
-
type:
|
|
4014
|
+
type: "error",
|
|
4076
4015
|
value: error.errorType,
|
|
4077
4016
|
error,
|
|
4078
4017
|
isAutoSummable: false,
|
|
@@ -4116,7 +4055,7 @@ function getDefaultCellHeight(ctx, cell, locale, colSize) {
|
|
|
4116
4055
|
content = formatValue(parseLiteral(cell.content, locale), localeFormat);
|
|
4117
4056
|
}
|
|
4118
4057
|
} catch {
|
|
4119
|
-
content =
|
|
4058
|
+
content = "#ERROR";
|
|
4120
4059
|
}
|
|
4121
4060
|
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4122
4061
|
}
|
|
@@ -4688,16 +4627,16 @@ function chartFontColor(backgroundColor) {
|
|
|
4688
4627
|
}
|
|
4689
4628
|
function checkDataset(definition) {
|
|
4690
4629
|
if (definition.dataSets) {
|
|
4691
|
-
if (definition.dataSets.find((range) => !rangeReference.test(range)) !== void 0) return
|
|
4692
|
-
if (definition.dataSets.map(toUnboundedZone).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
4630
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range)) !== void 0) return "InvalidDataSet";
|
|
4631
|
+
if (definition.dataSets.map(toUnboundedZone).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
4693
4632
|
}
|
|
4694
|
-
return
|
|
4633
|
+
return "Success";
|
|
4695
4634
|
}
|
|
4696
4635
|
function checkLabelRange(definition) {
|
|
4697
4636
|
if (definition.labelRange) {
|
|
4698
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
4637
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
4699
4638
|
}
|
|
4700
|
-
return
|
|
4639
|
+
return "Success";
|
|
4701
4640
|
}
|
|
4702
4641
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
4703
4642
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -4709,7 +4648,7 @@ function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
|
4709
4648
|
}
|
|
4710
4649
|
function getBaselineText(baseline, keyValue, baselineMode, locale) {
|
|
4711
4650
|
if (!baseline) return "";
|
|
4712
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
4651
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") return baseline.formattedValue;
|
|
4713
4652
|
else {
|
|
4714
4653
|
let diff = keyValue.value - baseline.value;
|
|
4715
4654
|
if (baselineMode === "percentage" && diff !== 0) diff = diff / baseline.value * 100;
|
|
@@ -4722,13 +4661,13 @@ function getBaselineText(baseline, keyValue, baselineMode, locale) {
|
|
|
4722
4661
|
}
|
|
4723
4662
|
}
|
|
4724
4663
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
4725
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
4664
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
4726
4665
|
const diff = keyValue.value - baseline.value;
|
|
4727
4666
|
if (diff > 0) return colorUp;
|
|
4728
4667
|
else if (diff < 0) return colorDown;
|
|
4729
4668
|
}
|
|
4730
4669
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
4731
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
4670
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
4732
4671
|
const diff = keyValue.value - baseline.value;
|
|
4733
4672
|
if (diff > 0) return "up";
|
|
4734
4673
|
else if (diff < 0) return "down";
|
|
@@ -4747,10 +4686,10 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
|
|
|
4747
4686
|
//#endregion
|
|
4748
4687
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
4749
4688
|
function checkKeyValue(definition) {
|
|
4750
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
4689
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
4751
4690
|
}
|
|
4752
4691
|
function checkBaseline(definition) {
|
|
4753
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
4692
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
4754
4693
|
}
|
|
4755
4694
|
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");
|
|
4756
4695
|
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");
|
|
@@ -4960,6 +4899,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
4960
4899
|
}, runtime).computeDesign();
|
|
4961
4900
|
}
|
|
4962
4901
|
var ScorecardChartConfigBuilder = class {
|
|
4902
|
+
runtime;
|
|
4963
4903
|
context;
|
|
4964
4904
|
width;
|
|
4965
4905
|
height;
|
|
@@ -5105,6 +5045,7 @@ var ScorecardChartConfigBuilder = class {
|
|
|
5105
5045
|
}
|
|
5106
5046
|
};
|
|
5107
5047
|
var ScorecardScalableElement = class {
|
|
5048
|
+
style;
|
|
5108
5049
|
constructor(style = {}) {
|
|
5109
5050
|
this.style = style;
|
|
5110
5051
|
}
|
|
@@ -5222,19 +5163,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
5222
5163
|
let x = 0;
|
|
5223
5164
|
let y = 0;
|
|
5224
5165
|
switch (direction) {
|
|
5225
|
-
case
|
|
5166
|
+
case "up":
|
|
5226
5167
|
x = 0;
|
|
5227
5168
|
y = -rule.current;
|
|
5228
5169
|
break;
|
|
5229
|
-
case
|
|
5170
|
+
case "down":
|
|
5230
5171
|
x = 0;
|
|
5231
5172
|
y = rule.current;
|
|
5232
5173
|
break;
|
|
5233
|
-
case
|
|
5174
|
+
case "left":
|
|
5234
5175
|
x = -rule.current;
|
|
5235
5176
|
y = 0;
|
|
5236
5177
|
break;
|
|
5237
|
-
case
|
|
5178
|
+
case "right":
|
|
5238
5179
|
x = rule.current;
|
|
5239
5180
|
y = 0;
|
|
5240
5181
|
break;
|
|
@@ -5308,12 +5249,12 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5308
5249
|
},
|
|
5309
5250
|
sequence: 10
|
|
5310
5251
|
}).add("increment_alphanumeric_value", {
|
|
5311
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5252
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
5312
5253
|
generateRule: (cell, cells, direction) => {
|
|
5313
5254
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
5314
5255
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
5315
5256
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
5316
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
5257
|
+
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]));
|
|
5317
5258
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
5318
5259
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
5319
5260
|
return {
|
|
@@ -5326,7 +5267,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5326
5267
|
},
|
|
5327
5268
|
sequence: 15
|
|
5328
5269
|
}).add("copy_text", {
|
|
5329
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5270
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "text",
|
|
5330
5271
|
generateRule: () => {
|
|
5331
5272
|
return { type: "COPY_MODIFIER" };
|
|
5332
5273
|
},
|
|
@@ -5342,16 +5283,16 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
5342
5283
|
},
|
|
5343
5284
|
sequence: 30
|
|
5344
5285
|
}).add("increment_number", {
|
|
5345
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type ===
|
|
5286
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE }).type === "number",
|
|
5346
5287
|
generateRule: (cell, cells, direction) => {
|
|
5347
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
5288
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number").map((cell) => Number(cell.value));
|
|
5348
5289
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
5349
5290
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
5350
5291
|
const evaluation = evaluateLiteral(cell.content, { locale: DEFAULT_LOCALE });
|
|
5351
5292
|
return {
|
|
5352
5293
|
type: "INCREMENT_MODIFIER",
|
|
5353
5294
|
increment,
|
|
5354
|
-
current: evaluation.type ===
|
|
5295
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
5355
5296
|
};
|
|
5356
5297
|
},
|
|
5357
5298
|
sequence: 40
|
|
@@ -5505,7 +5446,7 @@ ErrorToolTip.props = {
|
|
|
5505
5446
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
5506
5447
|
const cell = getters.getEvaluatedCell(position);
|
|
5507
5448
|
const errors = [];
|
|
5508
|
-
if (cell.type ===
|
|
5449
|
+
if (cell.type === "error" && cell.error.isVerbose) errors.push({
|
|
5509
5450
|
title: _t("Error"),
|
|
5510
5451
|
message: cell.error.message
|
|
5511
5452
|
});
|
|
@@ -6029,7 +5970,7 @@ function zoneToRect(zone) {
|
|
|
6029
5970
|
css`
|
|
6030
5971
|
.o-popover {
|
|
6031
5972
|
position: absolute;
|
|
6032
|
-
z-index: ${
|
|
5973
|
+
z-index: ${35};
|
|
6033
5974
|
overflow: auto;
|
|
6034
5975
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
6035
5976
|
width: fit-content;
|
|
@@ -6044,7 +5985,7 @@ var Popover = class extends _odoo_owl.Component {
|
|
|
6044
5985
|
onMouseWheel: () => {},
|
|
6045
5986
|
onPopoverMoved: () => {},
|
|
6046
5987
|
onPopoverHidden: () => {},
|
|
6047
|
-
zIndex:
|
|
5988
|
+
zIndex: 35
|
|
6048
5989
|
};
|
|
6049
5990
|
popoverRef = (0, _odoo_owl.useRef)("popover");
|
|
6050
5991
|
currentPosition = void 0;
|
|
@@ -6130,6 +6071,10 @@ Popover.props = {
|
|
|
6130
6071
|
slots: Object
|
|
6131
6072
|
};
|
|
6132
6073
|
var PopoverPositionContext = class {
|
|
6074
|
+
anchorRect;
|
|
6075
|
+
containerRect;
|
|
6076
|
+
propsMaxSize;
|
|
6077
|
+
spreadsheetOffset;
|
|
6133
6078
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
6134
6079
|
this.anchorRect = anchorRect;
|
|
6135
6080
|
this.containerRect = containerRect;
|
|
@@ -6747,7 +6692,8 @@ var TokenizingChars = class {
|
|
|
6747
6692
|
}
|
|
6748
6693
|
shift() {
|
|
6749
6694
|
const current = this.current;
|
|
6750
|
-
|
|
6695
|
+
const next = this.text[++this.currentIndex];
|
|
6696
|
+
this.current = next;
|
|
6751
6697
|
return current;
|
|
6752
6698
|
}
|
|
6753
6699
|
advanceBy(length) {
|
|
@@ -7290,10 +7236,10 @@ const PasteInteractiveContent = {
|
|
|
7290
7236
|
};
|
|
7291
7237
|
function handlePasteResult(env, result) {
|
|
7292
7238
|
if (!result.isSuccessful) {
|
|
7293
|
-
if (result.reasons.includes(
|
|
7294
|
-
else if (result.reasons.includes(
|
|
7295
|
-
else if (result.reasons.includes(
|
|
7296
|
-
else if (result.reasons.includes(
|
|
7239
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
7240
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
7241
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
7242
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
7297
7243
|
}
|
|
7298
7244
|
}
|
|
7299
7245
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -7314,24 +7260,24 @@ function interactivePasteFromOS(env, target, text, pasteOption) {
|
|
|
7314
7260
|
//#region src/components/translations_terms.ts
|
|
7315
7261
|
const CfTerms = {
|
|
7316
7262
|
Errors: {
|
|
7317
|
-
[
|
|
7318
|
-
[
|
|
7319
|
-
[
|
|
7320
|
-
[
|
|
7321
|
-
[
|
|
7322
|
-
[
|
|
7323
|
-
[
|
|
7324
|
-
[
|
|
7325
|
-
[
|
|
7326
|
-
[
|
|
7327
|
-
[
|
|
7328
|
-
[
|
|
7329
|
-
[
|
|
7330
|
-
[
|
|
7331
|
-
[
|
|
7332
|
-
[
|
|
7333
|
-
[
|
|
7334
|
-
[
|
|
7263
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
7264
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
7265
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
7266
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
7267
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
7268
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
7269
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
7270
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
7271
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
7272
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
7273
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
7274
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
7275
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
7276
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
7277
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
7278
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
7279
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
7280
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
7335
7281
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
7336
7282
|
},
|
|
7337
7283
|
ColorScale: _t("Color scale"),
|
|
@@ -7357,34 +7303,34 @@ const ChartTerms = {
|
|
|
7357
7303
|
Series: _t("Series"),
|
|
7358
7304
|
Errors: {
|
|
7359
7305
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
7360
|
-
[
|
|
7361
|
-
[
|
|
7362
|
-
[
|
|
7363
|
-
[
|
|
7364
|
-
[
|
|
7365
|
-
[
|
|
7366
|
-
[
|
|
7367
|
-
[
|
|
7368
|
-
[
|
|
7369
|
-
[
|
|
7370
|
-
[
|
|
7371
|
-
[
|
|
7306
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
7307
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
7308
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
7309
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
7310
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
7311
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
7312
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
7313
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
7314
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
7315
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
7316
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
7317
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
7372
7318
|
}
|
|
7373
7319
|
};
|
|
7374
7320
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
7375
7321
|
const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
|
|
7376
7322
|
const SplitToColumnsTerms = { Errors: {
|
|
7377
7323
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
7378
|
-
[
|
|
7379
|
-
[
|
|
7380
|
-
[
|
|
7324
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
7325
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
7326
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
7381
7327
|
} };
|
|
7382
7328
|
const RemoveDuplicateTerms = { Errors: {
|
|
7383
7329
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
7384
|
-
[
|
|
7385
|
-
[
|
|
7386
|
-
[
|
|
7387
|
-
[
|
|
7330
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
7331
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
7332
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
7333
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
7388
7334
|
} };
|
|
7389
7335
|
const DVTerms = {
|
|
7390
7336
|
DateIs: {
|
|
@@ -7798,47 +7744,47 @@ function createBarChartRuntime(chart, getters) {
|
|
|
7798
7744
|
//#endregion
|
|
7799
7745
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
7800
7746
|
function isDataRangeValid(definition) {
|
|
7801
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
7747
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
7802
7748
|
}
|
|
7803
7749
|
function checkRangeLimits(check, batchValidations) {
|
|
7804
7750
|
return batchValidations((definition) => {
|
|
7805
7751
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
7806
|
-
return
|
|
7752
|
+
return "Success";
|
|
7807
7753
|
}, (definition) => {
|
|
7808
7754
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
7809
|
-
return
|
|
7755
|
+
return "Success";
|
|
7810
7756
|
});
|
|
7811
7757
|
}
|
|
7812
7758
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
7813
7759
|
return batchValidations((definition) => {
|
|
7814
7760
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
7815
|
-
return
|
|
7761
|
+
return "Success";
|
|
7816
7762
|
}, (definition) => {
|
|
7817
7763
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
7818
|
-
return
|
|
7764
|
+
return "Success";
|
|
7819
7765
|
});
|
|
7820
7766
|
}
|
|
7821
7767
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
7822
7768
|
if (definition.sectionRule) {
|
|
7823
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
7769
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
7824
7770
|
}
|
|
7825
|
-
return
|
|
7771
|
+
return "Success";
|
|
7826
7772
|
}
|
|
7827
7773
|
function checkEmpty(value, valueName) {
|
|
7828
7774
|
if (value === "") switch (valueName) {
|
|
7829
|
-
case "rangeMin": return
|
|
7830
|
-
case "rangeMax": return
|
|
7775
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
7776
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
7831
7777
|
}
|
|
7832
|
-
return
|
|
7778
|
+
return "Success";
|
|
7833
7779
|
}
|
|
7834
7780
|
function checkNaN(value, valueName) {
|
|
7835
7781
|
if (isNaN(value)) switch (valueName) {
|
|
7836
|
-
case "rangeMin": return
|
|
7837
|
-
case "rangeMax": return
|
|
7838
|
-
case "lowerInflectionPointValue": return
|
|
7839
|
-
case "upperInflectionPointValue": return
|
|
7782
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
7783
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
7784
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
7785
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
7840
7786
|
}
|
|
7841
|
-
return
|
|
7787
|
+
return "Success";
|
|
7842
7788
|
}
|
|
7843
7789
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
7844
7790
|
dataRange;
|
|
@@ -7997,7 +7943,7 @@ function createGaugeChartRuntime(chart, getters) {
|
|
|
7997
7943
|
col: dataRange.zone.left,
|
|
7998
7944
|
row: dataRange.zone.top
|
|
7999
7945
|
});
|
|
8000
|
-
if (cell.type ===
|
|
7946
|
+
if (cell.type === "number") {
|
|
8001
7947
|
needleValue = clip(cell.value, minNeedleValue - deltaBeyondRangeLimit, maxNeedleValue + deltaBeyondRangeLimit);
|
|
8002
7948
|
cellFormatter = () => getters.getRangeFormattedValues(dataRange)[0];
|
|
8003
7949
|
displayValue = true;
|
|
@@ -8905,7 +8851,7 @@ function inverseUnhideColumnsRows(cmd) {
|
|
|
8905
8851
|
function interactiveCut(env) {
|
|
8906
8852
|
const result = env.model.dispatch("CUT");
|
|
8907
8853
|
if (!result.isSuccessful) {
|
|
8908
|
-
if (result.isCancelledBecause(
|
|
8854
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
8909
8855
|
}
|
|
8910
8856
|
}
|
|
8911
8857
|
|
|
@@ -8920,8 +8866,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
8920
8866
|
sheetId,
|
|
8921
8867
|
target
|
|
8922
8868
|
});
|
|
8923
|
-
if (result.isCancelledBecause(
|
|
8924
|
-
else if (result.isCancelledBecause(
|
|
8869
|
+
if (result.isCancelledBecause("MergeInFilter")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
8870
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
8925
8871
|
env.model.dispatch("ADD_MERGE", {
|
|
8926
8872
|
sheetId,
|
|
8927
8873
|
target,
|
|
@@ -9023,9 +8969,9 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
9023
8969
|
...dataSetZone,
|
|
9024
8970
|
bottom: dataSetZone.top
|
|
9025
8971
|
});
|
|
9026
|
-
const dataSetsHaveTitle = !!cellsInFirstRow.find((cell) => cell.type !==
|
|
8972
|
+
const dataSetsHaveTitle = !!cellsInFirstRow.find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
9027
8973
|
if (dataSetsHaveTitle) {
|
|
9028
|
-
const texts = cellsInFirstRow.filter((cell) => cell.type !==
|
|
8974
|
+
const texts = cellsInFirstRow.filter((cell) => cell.type !== "error" && cell.type !== "empty").map((cell) => cell.formattedValue);
|
|
9029
8975
|
const lastElement = texts.splice(-1)[0];
|
|
9030
8976
|
title = texts.join(", ");
|
|
9031
8977
|
if (lastElement) title += (title ? " " + _t("and") + " " : "") + lastElement;
|
|
@@ -9335,7 +9281,7 @@ async function paste$1(env, pasteOption) {
|
|
|
9335
9281
|
const target = env.model.getters.getSelectedZones();
|
|
9336
9282
|
if (osClipboard && osClipboard.content !== spreadsheetClipboard) interactivePasteFromOS(env, target, osClipboard.content, pasteOption);
|
|
9337
9283
|
else interactivePaste(env, target, pasteOption);
|
|
9338
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "onlyValue") await env.clipboard.write({ [
|
|
9284
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "onlyValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
9339
9285
|
break;
|
|
9340
9286
|
case "notImplemented":
|
|
9341
9287
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -12659,15 +12605,15 @@ const DATEDIF = {
|
|
|
12659
12605
|
const jsEndDate = numberToJsDate(_endDate);
|
|
12660
12606
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
12661
12607
|
switch (_unit) {
|
|
12662
|
-
case
|
|
12663
|
-
case
|
|
12664
|
-
case
|
|
12665
|
-
case
|
|
12666
|
-
case
|
|
12608
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
12609
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
12610
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
12611
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
12612
|
+
case "MD":
|
|
12667
12613
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
12668
12614
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
12669
12615
|
return days;
|
|
12670
|
-
case
|
|
12616
|
+
case "YD": {
|
|
12671
12617
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
12672
12618
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
12673
12619
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -13200,18 +13146,18 @@ const DELTA = {
|
|
|
13200
13146
|
//#endregion
|
|
13201
13147
|
//#region src/helpers/sort.ts
|
|
13202
13148
|
const SORT_TYPES = [
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13149
|
+
"number",
|
|
13150
|
+
"error",
|
|
13151
|
+
"text",
|
|
13152
|
+
"boolean"
|
|
13207
13153
|
];
|
|
13208
13154
|
function cellsSortingCriterion(sortingOrder) {
|
|
13209
13155
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
13210
13156
|
return (left, right) => {
|
|
13211
|
-
if (left.type ===
|
|
13212
|
-
else if (right.type ===
|
|
13157
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
13158
|
+
else if (right.type === "empty") return -1;
|
|
13213
13159
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
13214
|
-
if (typeOrder === 0) if (left.type ===
|
|
13160
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
13215
13161
|
else typeOrder = left.value - right.value;
|
|
13216
13162
|
return inverse * typeOrder;
|
|
13217
13163
|
};
|
|
@@ -13222,9 +13168,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
13222
13168
|
type: cell.type,
|
|
13223
13169
|
value: cell.value
|
|
13224
13170
|
}));
|
|
13225
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
13171
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
13226
13172
|
...cell,
|
|
13227
|
-
type:
|
|
13173
|
+
type: "number",
|
|
13228
13174
|
value: 0
|
|
13229
13175
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
13230
13176
|
}
|
|
@@ -13286,7 +13232,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
13286
13232
|
});
|
|
13287
13233
|
});
|
|
13288
13234
|
}
|
|
13289
|
-
if (result.isCancelledBecause(
|
|
13235
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
13290
13236
|
const { col, row } = anchor;
|
|
13291
13237
|
env.model.selection.selectZone({
|
|
13292
13238
|
cell: {
|
|
@@ -13339,11 +13285,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
13339
13285
|
const right = sortColumn[b];
|
|
13340
13286
|
const leftCell = {
|
|
13341
13287
|
value: left,
|
|
13342
|
-
type: left === null ?
|
|
13288
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
13343
13289
|
};
|
|
13344
13290
|
const rightCell = {
|
|
13345
13291
|
value: right,
|
|
13346
|
-
type: right === null ?
|
|
13292
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
13347
13293
|
};
|
|
13348
13294
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
13349
13295
|
if (result !== 0) return result;
|
|
@@ -15256,7 +15202,7 @@ const ISERR = {
|
|
|
15256
15202
|
value();
|
|
15257
15203
|
return false;
|
|
15258
15204
|
} catch (e) {
|
|
15259
|
-
return e?.errorType !==
|
|
15205
|
+
return e?.errorType !== "#N/A";
|
|
15260
15206
|
}
|
|
15261
15207
|
},
|
|
15262
15208
|
isExported: true
|
|
@@ -15297,7 +15243,7 @@ const ISNA = {
|
|
|
15297
15243
|
value();
|
|
15298
15244
|
return false;
|
|
15299
15245
|
} catch (e) {
|
|
15300
|
-
return e?.errorType ===
|
|
15246
|
+
return e?.errorType === "#N/A";
|
|
15301
15247
|
}
|
|
15302
15248
|
},
|
|
15303
15249
|
isExported: true
|
|
@@ -15446,7 +15392,7 @@ const IFNA = {
|
|
|
15446
15392
|
try {
|
|
15447
15393
|
result = value();
|
|
15448
15394
|
} catch (e) {
|
|
15449
|
-
if (e.errorType ===
|
|
15395
|
+
if (e.errorType === "#N/A") result = valueIfError();
|
|
15450
15396
|
else result = value();
|
|
15451
15397
|
}
|
|
15452
15398
|
if (result === void 0) return { value: "" };
|
|
@@ -16397,7 +16343,7 @@ function addInputHandling(descr, computeFunction) {
|
|
|
16397
16343
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
16398
16344
|
const arg = args[i];
|
|
16399
16345
|
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
16400
|
-
if (arg.length !== 1 || arg[0].length !== 1) throw new EvaluationError(
|
|
16346
|
+
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));
|
|
16401
16347
|
args[i] = arg[0][0];
|
|
16402
16348
|
}
|
|
16403
16349
|
}
|
|
@@ -16773,9 +16719,9 @@ function interactiveAddFilter(env, sheetId, target) {
|
|
|
16773
16719
|
target,
|
|
16774
16720
|
sheetId
|
|
16775
16721
|
});
|
|
16776
|
-
if (result.isCancelledBecause(
|
|
16777
|
-
else if (result.isCancelledBecause(
|
|
16778
|
-
else if (result.isCancelledBecause(
|
|
16722
|
+
if (result.isCancelledBecause("FilterOverlap")) env.raiseError(AddFilterInteractiveContent.filterOverlap);
|
|
16723
|
+
else if (result.isCancelledBecause("MergeInFilter")) env.raiseError(AddFilterInteractiveContent.mergeInFilter);
|
|
16724
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
|
|
16779
16725
|
}
|
|
16780
16726
|
|
|
16781
16727
|
//#endregion
|
|
@@ -16786,7 +16732,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
16786
16732
|
if (env.model.dispatch(cmd, {
|
|
16787
16733
|
sheetId,
|
|
16788
16734
|
quantity: base
|
|
16789
|
-
}).isCancelledBecause(
|
|
16735
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
16790
16736
|
}
|
|
16791
16737
|
|
|
16792
16738
|
//#endregion
|
|
@@ -18333,10 +18279,10 @@ var LineBarPieConfigPanel = class extends _odoo_owl.Component {
|
|
|
18333
18279
|
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
18334
18280
|
}
|
|
18335
18281
|
get isDatasetInvalid() {
|
|
18336
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
18282
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
18337
18283
|
}
|
|
18338
18284
|
get isLabelInvalid() {
|
|
18339
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
18285
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
18340
18286
|
}
|
|
18341
18287
|
onUpdateDataSetsHaveTitle(ev) {
|
|
18342
18288
|
this.props.updateChart(this.props.figureId, { dataSetsHaveTitle: ev.target.checked });
|
|
@@ -19024,7 +18970,7 @@ var GaugeChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
19024
18970
|
return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
19025
18971
|
}
|
|
19026
18972
|
get isDataRangeInvalid() {
|
|
19027
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
18973
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
19028
18974
|
}
|
|
19029
18975
|
onDataRangeChanged(ranges) {
|
|
19030
18976
|
this.dataRange = ranges[0];
|
|
@@ -19104,16 +19050,16 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
19104
19050
|
this.props.updateChart(this.props.figureId, { title: this.state.title });
|
|
19105
19051
|
}
|
|
19106
19052
|
isRangeMinInvalid() {
|
|
19107
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19053
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
19108
19054
|
}
|
|
19109
19055
|
isRangeMaxInvalid() {
|
|
19110
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19056
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
19111
19057
|
}
|
|
19112
19058
|
get isLowerInflectionPointInvalid() {
|
|
19113
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19059
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
19114
19060
|
}
|
|
19115
19061
|
get isUpperInflectionPointInvalid() {
|
|
19116
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
19062
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
19117
19063
|
}
|
|
19118
19064
|
updateSectionColor(target, color) {
|
|
19119
19065
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -19190,10 +19136,10 @@ var ScorecardChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
19190
19136
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
19191
19137
|
}
|
|
19192
19138
|
get isKeyValueInvalid() {
|
|
19193
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
19139
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
19194
19140
|
}
|
|
19195
19141
|
get isBaselineInvalid() {
|
|
19196
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
19142
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
19197
19143
|
}
|
|
19198
19144
|
onKeyValueRangeChanged(ranges) {
|
|
19199
19145
|
this.keyValue = ranges[0];
|
|
@@ -19492,7 +19438,7 @@ const ICON_SETS = {
|
|
|
19492
19438
|
css`
|
|
19493
19439
|
.o-icon-picker {
|
|
19494
19440
|
position: absolute;
|
|
19495
|
-
z-index: ${
|
|
19441
|
+
z-index: ${25};
|
|
19496
19442
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
19497
19443
|
background-color: white;
|
|
19498
19444
|
padding: 2px 1px;
|
|
@@ -19742,6 +19688,7 @@ var DOMDndHelper = class {
|
|
|
19742
19688
|
}
|
|
19743
19689
|
};
|
|
19744
19690
|
var ContainerWrapper = class {
|
|
19691
|
+
el;
|
|
19745
19692
|
constructor(el) {
|
|
19746
19693
|
this.el = el;
|
|
19747
19694
|
}
|
|
@@ -20099,11 +20046,12 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20099
20046
|
colorNumberString = colorNumberString;
|
|
20100
20047
|
state;
|
|
20101
20048
|
setup() {
|
|
20049
|
+
const cf = this.props.editedCf || {
|
|
20050
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
20051
|
+
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
20052
|
+
};
|
|
20102
20053
|
this.state = (0, _odoo_owl.useState)({
|
|
20103
|
-
currentCF:
|
|
20104
|
-
id: this.env.model.uuidGenerator.smallUuid(),
|
|
20105
|
-
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
20106
|
-
},
|
|
20054
|
+
currentCF: cf,
|
|
20107
20055
|
currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
|
|
20108
20056
|
errors: [],
|
|
20109
20057
|
rules: this.getDefaultRules()
|
|
@@ -20122,7 +20070,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20122
20070
|
(0, _odoo_owl.useExternalListener)(window, "click", this.closeMenus);
|
|
20123
20071
|
}
|
|
20124
20072
|
get isRangeValid() {
|
|
20125
|
-
return this.state.errors.includes(
|
|
20073
|
+
return this.state.errors.includes("EmptyRange");
|
|
20126
20074
|
}
|
|
20127
20075
|
errorMessage(error) {
|
|
20128
20076
|
return CfTerms.Errors[error] || CfTerms.Errors.Unexpected;
|
|
@@ -20130,7 +20078,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20130
20078
|
saveConditionalFormat() {
|
|
20131
20079
|
if (this.state.currentCF) {
|
|
20132
20080
|
if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
20133
|
-
this.state.errors = [
|
|
20081
|
+
this.state.errors = ["InvalidRange"];
|
|
20134
20082
|
return;
|
|
20135
20083
|
}
|
|
20136
20084
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -20220,10 +20168,10 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20220
20168
|
* Cell Is Rule
|
|
20221
20169
|
****************************************************************************/
|
|
20222
20170
|
get isValue1Invalid() {
|
|
20223
|
-
return !!this.state.errors?.includes(
|
|
20171
|
+
return !!this.state.errors?.includes("FirstArgMissing");
|
|
20224
20172
|
}
|
|
20225
20173
|
get isValue2Invalid() {
|
|
20226
|
-
return !!this.state.errors?.includes(
|
|
20174
|
+
return !!this.state.errors?.includes("SecondArgMissing");
|
|
20227
20175
|
}
|
|
20228
20176
|
toggleStyle(tool) {
|
|
20229
20177
|
const style = this.state.rules.cellIs.style;
|
|
@@ -20252,9 +20200,9 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20252
20200
|
****************************************************************************/
|
|
20253
20201
|
isValueInvalid(threshold) {
|
|
20254
20202
|
switch (threshold) {
|
|
20255
|
-
case "minimum": return this.state.errors.includes(
|
|
20256
|
-
case "midpoint": return this.state.errors.includes(
|
|
20257
|
-
case "maximum": return this.state.errors.includes(
|
|
20203
|
+
case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
|
|
20204
|
+
case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
|
|
20205
|
+
case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
|
|
20258
20206
|
default: return false;
|
|
20259
20207
|
}
|
|
20260
20208
|
}
|
|
@@ -20291,8 +20239,8 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
20291
20239
|
****************************************************************************/
|
|
20292
20240
|
isInflectionPointInvalid(inflectionPoint) {
|
|
20293
20241
|
switch (inflectionPoint) {
|
|
20294
|
-
case "lowerInflectionPoint": return this.state.errors.includes(
|
|
20295
|
-
case "upperInflectionPoint": return this.state.errors.includes(
|
|
20242
|
+
case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
20243
|
+
case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
20296
20244
|
default: return true;
|
|
20297
20245
|
}
|
|
20298
20246
|
}
|
|
@@ -20461,13 +20409,14 @@ var CustomCurrencyPanel = class extends _odoo_owl.Component {
|
|
|
20461
20409
|
if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
|
|
20462
20410
|
currenciesRegistry.add(index.toString(), currency);
|
|
20463
20411
|
});
|
|
20464
|
-
|
|
20412
|
+
const emptyCurrency = {
|
|
20465
20413
|
name: _t(CustomCurrencyTerms.Custom),
|
|
20466
20414
|
code: "",
|
|
20467
20415
|
symbol: "",
|
|
20468
20416
|
decimalPlaces: 2,
|
|
20469
20417
|
position: "after"
|
|
20470
|
-
}
|
|
20418
|
+
};
|
|
20419
|
+
this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
|
|
20471
20420
|
}
|
|
20472
20421
|
updateSelectCurrency(ev) {
|
|
20473
20422
|
const target = ev.target;
|
|
@@ -20815,7 +20764,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
20815
20764
|
separator,
|
|
20816
20765
|
addNewColumns
|
|
20817
20766
|
});
|
|
20818
|
-
if (result.isCancelledBecause(
|
|
20767
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
20819
20768
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
20820
20769
|
separator,
|
|
20821
20770
|
addNewColumns,
|
|
@@ -21240,13 +21189,13 @@ dataValidationEvaluatorRegistry.add("customFormula", {
|
|
|
21240
21189
|
getPreview: (criterion) => _t("Custom formula %s", criterion.values[0])
|
|
21241
21190
|
});
|
|
21242
21191
|
function getNumberCriterionlocalizedValues(criterion, locale) {
|
|
21243
|
-
return criterion.values.map((value) => value !== void 0 ? localizeContent(value, locale) :
|
|
21192
|
+
return criterion.values.map((value) => value !== void 0 ? localizeContent(value, locale) : "#REF");
|
|
21244
21193
|
}
|
|
21245
21194
|
function getDateCriterionLocalizedValues(criterion, locale) {
|
|
21246
21195
|
return getDateNumberCriterionValues(criterion, DEFAULT_LOCALE).map((value) => value !== void 0 ? formatValue(value, {
|
|
21247
21196
|
locale,
|
|
21248
21197
|
format: locale.dateFormat
|
|
21249
|
-
}) :
|
|
21198
|
+
}) : "#REF");
|
|
21250
21199
|
}
|
|
21251
21200
|
function checkValueIsDate(value) {
|
|
21252
21201
|
return valueToDateNumber(value, DEFAULT_LOCALE) !== void 0;
|
|
@@ -21270,7 +21219,7 @@ function getDateCriterionFormattedValues(criterion, getters) {
|
|
|
21270
21219
|
//#endregion
|
|
21271
21220
|
//#region src/helpers/ui/stop_edition_interactive.ts
|
|
21272
21221
|
function interactiveStopEdition(env) {
|
|
21273
|
-
if (env.model.dispatch("STOP_EDITION").isCancelledBecause(
|
|
21222
|
+
if (env.model.dispatch("STOP_EDITION").isCancelledBecause("BlockingValidationRule")) {
|
|
21274
21223
|
const editedCell = env.model.getters.getCurrentEditedCell();
|
|
21275
21224
|
const cellXc = toXC(editedCell.col, editedCell.row);
|
|
21276
21225
|
const rule = env.model.getters.getValidationRuleForCell(editedCell);
|
|
@@ -21347,8 +21296,8 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
21347
21296
|
}).reasons;
|
|
21348
21297
|
const errors = /* @__PURE__ */ new Set();
|
|
21349
21298
|
for (const reason of cancelledReasons) switch (reason) {
|
|
21350
|
-
case
|
|
21351
|
-
case
|
|
21299
|
+
case "SplitWillOverwriteContent":
|
|
21300
|
+
case "EmptySplitSeparator": break;
|
|
21352
21301
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
21353
21302
|
}
|
|
21354
21303
|
return Array.from(errors);
|
|
@@ -21359,7 +21308,7 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
21359
21308
|
separator: this.separatorValue,
|
|
21360
21309
|
addNewColumns: this.state.addNewColumns,
|
|
21361
21310
|
force: false
|
|
21362
|
-
}).reasons.includes(
|
|
21311
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
21363
21312
|
return warnings;
|
|
21364
21313
|
}
|
|
21365
21314
|
get separatorValue() {
|
|
@@ -22084,7 +22033,7 @@ css`
|
|
|
22084
22033
|
box-sizing: content-box;
|
|
22085
22034
|
|
|
22086
22035
|
.o-fig-anchor {
|
|
22087
|
-
z-index: ${
|
|
22036
|
+
z-index: ${1e3};
|
|
22088
22037
|
position: absolute;
|
|
22089
22038
|
width: ${ANCHOR_SIZE}px;
|
|
22090
22039
|
height: ${ANCHOR_SIZE}px;
|
|
@@ -22172,7 +22121,7 @@ var FigureComponent = class extends _odoo_owl.Component {
|
|
|
22172
22121
|
top: `${y}px`,
|
|
22173
22122
|
width: `${width}px`,
|
|
22174
22123
|
height: `${height}px`,
|
|
22175
|
-
"z-index": String(
|
|
22124
|
+
"z-index": String(10 + (this.isSelected ? 1 : 0))
|
|
22176
22125
|
});
|
|
22177
22126
|
}
|
|
22178
22127
|
getResizerPosition(resizer) {
|
|
@@ -22319,7 +22268,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
22319
22268
|
end: group.end
|
|
22320
22269
|
});
|
|
22321
22270
|
if (!result.isSuccessful) {
|
|
22322
|
-
if (result.isCancelledBecause(
|
|
22271
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
22323
22272
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
22324
22273
|
env.raiseError(errorMessage);
|
|
22325
22274
|
}
|
|
@@ -23481,7 +23430,7 @@ const COMPOSER_BORDER_WIDTH = 3 * .4 * window.devicePixelRatio || 1;
|
|
|
23481
23430
|
const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
|
|
23482
23431
|
css`
|
|
23483
23432
|
div.o-grid-composer {
|
|
23484
|
-
z-index: ${
|
|
23433
|
+
z-index: ${20};
|
|
23485
23434
|
box-sizing: border-box;
|
|
23486
23435
|
position: absolute;
|
|
23487
23436
|
border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
|
|
@@ -23492,7 +23441,7 @@ css`
|
|
|
23492
23441
|
|
|
23493
23442
|
div.o-cell-reference {
|
|
23494
23443
|
position: absolute;
|
|
23495
|
-
z-index: ${
|
|
23444
|
+
z-index: ${20};
|
|
23496
23445
|
background: ${SELECTION_BORDER_COLOR};
|
|
23497
23446
|
color: white;
|
|
23498
23447
|
font-size: 12px;
|
|
@@ -24148,7 +24097,7 @@ function getAxis(fig, axisType) {
|
|
|
24148
24097
|
css`
|
|
24149
24098
|
.o-figure-snap-line {
|
|
24150
24099
|
position: relative;
|
|
24151
|
-
z-index: ${
|
|
24100
|
+
z-index: ${1001};
|
|
24152
24101
|
&.vertical {
|
|
24153
24102
|
width: 0px;
|
|
24154
24103
|
border-left: 1px dashed black;
|
|
@@ -24811,7 +24760,7 @@ GridOverlay.props = {
|
|
|
24811
24760
|
var GridPopover = class extends _odoo_owl.Component {
|
|
24812
24761
|
static template = "o-spreadsheet-GridPopover";
|
|
24813
24762
|
static components = { Popover };
|
|
24814
|
-
zIndex =
|
|
24763
|
+
zIndex = 19;
|
|
24815
24764
|
get cellPopover() {
|
|
24816
24765
|
const popover = this.env.model.getters.getCellPopover(this.props.hoveredCell);
|
|
24817
24766
|
if (!popover.isOpen) return { isOpen: false };
|
|
@@ -25059,7 +25008,7 @@ css`
|
|
|
25059
25008
|
top: calc(${26}px / 2 - ${14}px / 2);
|
|
25060
25009
|
}
|
|
25061
25010
|
.o-unhide:hover {
|
|
25062
|
-
z-index: ${
|
|
25011
|
+
z-index: ${0 + 1};
|
|
25063
25012
|
background-color: lightgrey;
|
|
25064
25013
|
}
|
|
25065
25014
|
.o-unhide > svg {
|
|
@@ -25135,7 +25084,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
25135
25084
|
elements,
|
|
25136
25085
|
position: this.state.position
|
|
25137
25086
|
});
|
|
25138
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
25087
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
25139
25088
|
}
|
|
25140
25089
|
_selectElement(index, addDistinctHeader) {
|
|
25141
25090
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -25229,7 +25178,7 @@ css`
|
|
|
25229
25178
|
top: calc(${14}px / 2 - ${18}px / 2);
|
|
25230
25179
|
}
|
|
25231
25180
|
.o-unhide:hover {
|
|
25232
|
-
z-index: ${
|
|
25181
|
+
z-index: ${0 + 1};
|
|
25233
25182
|
background-color: lightgrey;
|
|
25234
25183
|
}
|
|
25235
25184
|
}
|
|
@@ -25301,7 +25250,7 @@ var RowResizer = class extends AbstractResizer {
|
|
|
25301
25250
|
elements,
|
|
25302
25251
|
position: this.state.position
|
|
25303
25252
|
});
|
|
25304
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
25253
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
25305
25254
|
}
|
|
25306
25255
|
_selectElement(index, addDistinctHeader) {
|
|
25307
25256
|
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -25525,7 +25474,7 @@ Corner.props = {
|
|
|
25525
25474
|
//#region src/components/highlight/highlight/highlight.ts
|
|
25526
25475
|
css`
|
|
25527
25476
|
.o-highlight {
|
|
25528
|
-
z-index: ${
|
|
25477
|
+
z-index: ${5};
|
|
25529
25478
|
}
|
|
25530
25479
|
`;
|
|
25531
25480
|
var Highlight = class extends _odoo_owl.Component {
|
|
@@ -25646,7 +25595,7 @@ css`
|
|
|
25646
25595
|
.o-scrollbar {
|
|
25647
25596
|
position: absolute;
|
|
25648
25597
|
overflow: auto;
|
|
25649
|
-
z-index: ${
|
|
25598
|
+
z-index: ${15};
|
|
25650
25599
|
background-color: ${BACKGROUND_GRAY_COLOR};
|
|
25651
25600
|
|
|
25652
25601
|
&.corner {
|
|
@@ -25887,12 +25836,12 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
25887
25836
|
}
|
|
25888
25837
|
keyDownMapping = {
|
|
25889
25838
|
ENTER: () => {
|
|
25890
|
-
this.env.model.getters.getActiveCell().type ===
|
|
25839
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.props.onGridComposerCellFocused() : this.props.onComposerContentFocused();
|
|
25891
25840
|
},
|
|
25892
25841
|
TAB: () => this.env.model.selection.moveAnchorCell("right", 1),
|
|
25893
25842
|
"SHIFT+TAB": () => this.env.model.selection.moveAnchorCell("left", 1),
|
|
25894
25843
|
F2: () => {
|
|
25895
|
-
this.env.model.getters.getActiveCell().type ===
|
|
25844
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.props.onGridComposerCellFocused() : this.props.onComposerContentFocused();
|
|
25896
25845
|
},
|
|
25897
25846
|
DELETE: () => {
|
|
25898
25847
|
this.env.model.dispatch("DELETE_CONTENT", {
|
|
@@ -26124,7 +26073,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
26124
26073
|
sheetId,
|
|
26125
26074
|
col,
|
|
26126
26075
|
row
|
|
26127
|
-
}).type ===
|
|
26076
|
+
}).type === "empty") this.props.onGridComposerCellFocused();
|
|
26128
26077
|
else this.props.onComposerContentFocused();
|
|
26129
26078
|
}
|
|
26130
26079
|
closeOpenedPopover() {
|
|
@@ -26210,15 +26159,15 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
26210
26159
|
this.displayWarningCopyPasteNotSupported();
|
|
26211
26160
|
return;
|
|
26212
26161
|
}
|
|
26213
|
-
if (clipboardData.types.indexOf(
|
|
26162
|
+
if (clipboardData.types.indexOf("text/plain") > -1) {
|
|
26214
26163
|
ev.preventDefault();
|
|
26215
|
-
const content = clipboardData.getData(
|
|
26164
|
+
const content = clipboardData.getData("text/plain");
|
|
26216
26165
|
const target = this.env.model.getters.getSelectedZones();
|
|
26217
26166
|
const clipboardString = this.env.model.getters.getClipboardTextContent();
|
|
26218
26167
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
26219
26168
|
if (clipboardString === content) interactivePaste(this.env, target);
|
|
26220
26169
|
else interactivePasteFromOS(this.env, target, content);
|
|
26221
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
26170
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
26222
26171
|
}
|
|
26223
26172
|
}
|
|
26224
26173
|
displayWarningCopyPasteNotSupported() {
|
|
@@ -26368,6 +26317,7 @@ Grid.props = {
|
|
|
26368
26317
|
* Represent a raw XML string
|
|
26369
26318
|
*/
|
|
26370
26319
|
var XMLString = class {
|
|
26320
|
+
xmlString;
|
|
26371
26321
|
/**
|
|
26372
26322
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
26373
26323
|
*/
|
|
@@ -26480,6 +26430,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
26480
26430
|
ROUNDDOWN: [{
|
|
26481
26431
|
type: "NUMBER",
|
|
26482
26432
|
value: 0
|
|
26433
|
+
}],
|
|
26434
|
+
IFERROR: [{
|
|
26435
|
+
type: "NUMBER",
|
|
26436
|
+
value: 0
|
|
26483
26437
|
}]
|
|
26484
26438
|
};
|
|
26485
26439
|
/**
|
|
@@ -26645,6 +26599,7 @@ const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
|
26645
26599
|
//#endregion
|
|
26646
26600
|
//#region src/formulas/code_builder.ts
|
|
26647
26601
|
var FunctionCodeBuilder = class {
|
|
26602
|
+
scope;
|
|
26648
26603
|
code = "";
|
|
26649
26604
|
constructor(scope = new Scope()) {
|
|
26650
26605
|
this.scope = scope;
|
|
@@ -26660,6 +26615,8 @@ var FunctionCodeBuilder = class {
|
|
|
26660
26615
|
}
|
|
26661
26616
|
};
|
|
26662
26617
|
var FunctionCodeImpl = class {
|
|
26618
|
+
scope;
|
|
26619
|
+
returnExpression;
|
|
26663
26620
|
code;
|
|
26664
26621
|
constructor(scope, code, returnExpression) {
|
|
26665
26622
|
this.scope = scope;
|
|
@@ -26720,46 +26677,6 @@ function indentCode(code) {
|
|
|
26720
26677
|
|
|
26721
26678
|
//#endregion
|
|
26722
26679
|
//#region src/formulas/range_tokenizer.ts
|
|
26723
|
-
var State = /* @__PURE__ */ function(State) {
|
|
26724
|
-
/**
|
|
26725
|
-
* Initial state.
|
|
26726
|
-
* Expecting any reference for the left part of a range
|
|
26727
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
26728
|
-
*/
|
|
26729
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
26730
|
-
/**
|
|
26731
|
-
* Expecting any reference for the right part of a range
|
|
26732
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
26733
|
-
*/
|
|
26734
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
26735
|
-
/**
|
|
26736
|
-
* Expecting the separator without any constraint on the right part
|
|
26737
|
-
*/
|
|
26738
|
-
State[State["Separator"] = 2] = "Separator";
|
|
26739
|
-
/**
|
|
26740
|
-
* Expecting the separator for a full column range
|
|
26741
|
-
*/
|
|
26742
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
26743
|
-
/**
|
|
26744
|
-
* Expecting the separator for a full row range
|
|
26745
|
-
*/
|
|
26746
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
26747
|
-
/**
|
|
26748
|
-
* Expecting the right part of a full column range
|
|
26749
|
-
* e.g. "1", "A1"
|
|
26750
|
-
*/
|
|
26751
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
26752
|
-
/**
|
|
26753
|
-
* Expecting the right part of a full row range
|
|
26754
|
-
* e.g. "A", "A1"
|
|
26755
|
-
*/
|
|
26756
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
26757
|
-
/**
|
|
26758
|
-
* Final state. A range has been matched
|
|
26759
|
-
*/
|
|
26760
|
-
State[State["Found"] = 7] = "Found";
|
|
26761
|
-
return State;
|
|
26762
|
-
}(State || {});
|
|
26763
26680
|
const goTo = (state, guard = () => true) => [{
|
|
26764
26681
|
goTo: state,
|
|
26765
26682
|
guard
|
|
@@ -26769,41 +26686,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
26769
26686
|
guard
|
|
26770
26687
|
});
|
|
26771
26688
|
const machine = {
|
|
26772
|
-
[
|
|
26773
|
-
REFERENCE: goTo(
|
|
26774
|
-
NUMBER: goTo(
|
|
26775
|
-
SYMBOL: [goToMulti(
|
|
26689
|
+
[0]: {
|
|
26690
|
+
REFERENCE: goTo(2),
|
|
26691
|
+
NUMBER: goTo(4),
|
|
26692
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
26776
26693
|
},
|
|
26777
|
-
[
|
|
26778
|
-
SPACE: goTo(
|
|
26779
|
-
OPERATOR: goTo(
|
|
26694
|
+
[3]: {
|
|
26695
|
+
SPACE: goTo(3),
|
|
26696
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
26780
26697
|
},
|
|
26781
|
-
[
|
|
26782
|
-
SPACE: goTo(
|
|
26783
|
-
OPERATOR: goTo(
|
|
26698
|
+
[4]: {
|
|
26699
|
+
SPACE: goTo(4),
|
|
26700
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
26784
26701
|
},
|
|
26785
|
-
[
|
|
26786
|
-
SPACE: goTo(
|
|
26787
|
-
OPERATOR: goTo(
|
|
26702
|
+
[2]: {
|
|
26703
|
+
SPACE: goTo(2),
|
|
26704
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
26788
26705
|
},
|
|
26789
|
-
[
|
|
26790
|
-
SPACE: goTo(
|
|
26791
|
-
NUMBER: goTo(
|
|
26792
|
-
REFERENCE: goTo(
|
|
26793
|
-
SYMBOL: goTo(
|
|
26706
|
+
[1]: {
|
|
26707
|
+
SPACE: goTo(1),
|
|
26708
|
+
NUMBER: goTo(7),
|
|
26709
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
26710
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
26794
26711
|
},
|
|
26795
|
-
[
|
|
26796
|
-
SPACE: goTo(
|
|
26797
|
-
SYMBOL: goTo(
|
|
26798
|
-
REFERENCE: goTo(
|
|
26712
|
+
[5]: {
|
|
26713
|
+
SPACE: goTo(5),
|
|
26714
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
26715
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
26799
26716
|
},
|
|
26800
|
-
[
|
|
26801
|
-
SPACE: goTo(
|
|
26802
|
-
NUMBER: goTo(
|
|
26803
|
-
REFERENCE: goTo(
|
|
26804
|
-
SYMBOL: goTo(
|
|
26717
|
+
[6]: {
|
|
26718
|
+
SPACE: goTo(6),
|
|
26719
|
+
NUMBER: goTo(7),
|
|
26720
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
26721
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
26805
26722
|
},
|
|
26806
|
-
[
|
|
26723
|
+
[7]: {}
|
|
26807
26724
|
};
|
|
26808
26725
|
/**
|
|
26809
26726
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -26813,7 +26730,7 @@ const machine = {
|
|
|
26813
26730
|
*/
|
|
26814
26731
|
function matchReference(tokens) {
|
|
26815
26732
|
let head = 0;
|
|
26816
|
-
let transitions = machine[
|
|
26733
|
+
let transitions = machine[0];
|
|
26817
26734
|
let matchedTokens = "";
|
|
26818
26735
|
while (transitions !== void 0) {
|
|
26819
26736
|
const token = tokens[head++];
|
|
@@ -26822,7 +26739,7 @@ function matchReference(tokens) {
|
|
|
26822
26739
|
const nextState = transition ? transition.goTo : void 0;
|
|
26823
26740
|
switch (nextState) {
|
|
26824
26741
|
case void 0: return null;
|
|
26825
|
-
case
|
|
26742
|
+
case 7:
|
|
26826
26743
|
matchedTokens += token.value;
|
|
26827
26744
|
tokens.splice(0, head);
|
|
26828
26745
|
return {
|
|
@@ -26900,7 +26817,7 @@ function parseOperand(tokens) {
|
|
|
26900
26817
|
};
|
|
26901
26818
|
case "INVALID_REFERENCE": return {
|
|
26902
26819
|
type: "REFERENCE",
|
|
26903
|
-
value:
|
|
26820
|
+
value: "#REF"
|
|
26904
26821
|
};
|
|
26905
26822
|
case "REFERENCE":
|
|
26906
26823
|
if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
|
|
@@ -27415,26 +27332,6 @@ function isExportableToExcel(tokens) {
|
|
|
27415
27332
|
|
|
27416
27333
|
//#endregion
|
|
27417
27334
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
27418
|
-
/**
|
|
27419
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
27420
|
-
*/
|
|
27421
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
27422
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
27423
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
27424
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
27425
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
27426
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
27427
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
27428
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
27429
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
27430
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
27431
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
27432
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
27433
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
27434
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
27435
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
27436
|
-
return WarningTypes;
|
|
27437
|
-
}({});
|
|
27438
27335
|
var XLSXImportWarningManager = class {
|
|
27439
27336
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
27440
27337
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -27946,7 +27843,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
27946
27843
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
27947
27844
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
27948
27845
|
} catch (e) {}
|
|
27949
|
-
warningManager.generateNotSupportedWarning(
|
|
27846
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
27950
27847
|
}
|
|
27951
27848
|
function isFormatSupported(format) {
|
|
27952
27849
|
try {
|
|
@@ -28030,20 +27927,20 @@ function convertFormats(data, warningManager) {
|
|
|
28030
27927
|
return arrayToObject(formats, 1);
|
|
28031
27928
|
}
|
|
28032
27929
|
function addStyleWarnings(font, fill, warningManager) {
|
|
28033
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
28034
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
27930
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
27931
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
28035
27932
|
}
|
|
28036
27933
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
28037
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
27934
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
28038
27935
|
}
|
|
28039
27936
|
function addBorderWarnings(border, warningManager) {
|
|
28040
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
27937
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
28041
27938
|
}
|
|
28042
27939
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
28043
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
27940
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
28044
27941
|
}
|
|
28045
27942
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
28046
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
27943
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
28047
27944
|
}
|
|
28048
27945
|
|
|
28049
27946
|
//#endregion
|
|
@@ -28183,7 +28080,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
28183
28080
|
lower: icons.upper
|
|
28184
28081
|
};
|
|
28185
28082
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
28186
|
-
warningManager.generateNotSupportedWarning(
|
|
28083
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
28187
28084
|
switch (key) {
|
|
28188
28085
|
case "upper":
|
|
28189
28086
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -28224,13 +28121,13 @@ function prefixFormula(formula) {
|
|
|
28224
28121
|
return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
|
|
28225
28122
|
}
|
|
28226
28123
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
28227
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
28228
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
28124
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
28125
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
28229
28126
|
if (cf.cfRules[0].dxfId) {
|
|
28230
28127
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
28231
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
28232
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
28233
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
28128
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
28129
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
28130
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
28234
28131
|
}
|
|
28235
28132
|
}
|
|
28236
28133
|
|
|
@@ -28728,7 +28625,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
28728
28625
|
}
|
|
28729
28626
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
28730
28627
|
const label = link.display || cellValue;
|
|
28731
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
28628
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
28732
28629
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
28733
28630
|
}
|
|
28734
28631
|
function getSheetDims(sheet) {
|
|
@@ -30851,7 +30748,7 @@ var BasePlugin = class {
|
|
|
30851
30748
|
* There should not be any side effects in this method.
|
|
30852
30749
|
*/
|
|
30853
30750
|
allowDispatch(command) {
|
|
30854
|
-
return
|
|
30751
|
+
return "Success";
|
|
30855
30752
|
}
|
|
30856
30753
|
/**
|
|
30857
30754
|
* This method is useful when a plugin need to perform some action before a
|
|
@@ -30887,10 +30784,10 @@ var BasePlugin = class {
|
|
|
30887
30784
|
for (const validation of validations) {
|
|
30888
30785
|
let results = validation.call(this, toValidate);
|
|
30889
30786
|
if (!Array.isArray(results)) results = [results];
|
|
30890
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
30787
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
30891
30788
|
if (cancelledReasons.length) return cancelledReasons;
|
|
30892
30789
|
}
|
|
30893
|
-
return
|
|
30790
|
+
return "Success";
|
|
30894
30791
|
};
|
|
30895
30792
|
}
|
|
30896
30793
|
checkValidations(command, ...validations) {
|
|
@@ -30949,7 +30846,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
30949
30846
|
allowDispatch(cmd) {
|
|
30950
30847
|
switch (cmd.type) {
|
|
30951
30848
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
30952
|
-
default: return
|
|
30849
|
+
default: return "Success";
|
|
30953
30850
|
}
|
|
30954
30851
|
}
|
|
30955
30852
|
handle(cmd) {
|
|
@@ -31321,8 +31218,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
31321
31218
|
checkBordersUnchanged(cmd) {
|
|
31322
31219
|
const currentBorder = this.getCellBorder(cmd);
|
|
31323
31220
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
31324
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
31325
|
-
return
|
|
31221
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
31222
|
+
return "Success";
|
|
31326
31223
|
}
|
|
31327
31224
|
import(data) {
|
|
31328
31225
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const xc in sheet.cells) {
|
|
@@ -31389,8 +31286,8 @@ var CellPlugin = class extends CorePlugin {
|
|
|
31389
31286
|
switch (cmd.type) {
|
|
31390
31287
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
31391
31288
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
31392
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
31393
|
-
default: return
|
|
31289
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
31290
|
+
default: return "Success";
|
|
31394
31291
|
}
|
|
31395
31292
|
}
|
|
31396
31293
|
handle(cmd) {
|
|
@@ -31756,25 +31653,30 @@ var CellPlugin = class extends CorePlugin {
|
|
|
31756
31653
|
}
|
|
31757
31654
|
checkCellOutOfSheet(cmd) {
|
|
31758
31655
|
const { sheetId, col, row } = cmd;
|
|
31759
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
31760
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
31656
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
31657
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
31761
31658
|
}
|
|
31762
31659
|
checkUselessClearCell(cmd) {
|
|
31763
31660
|
const cell = this.getters.getCell(cmd);
|
|
31764
|
-
if (!cell) return
|
|
31765
|
-
if (!cell.content && !cell.style && !cell.format) return
|
|
31766
|
-
return
|
|
31661
|
+
if (!cell) return "NoChanges";
|
|
31662
|
+
if (!cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
31663
|
+
return "Success";
|
|
31767
31664
|
}
|
|
31768
31665
|
checkUselessUpdateCell(cmd) {
|
|
31769
31666
|
const cell = this.getters.getCell(cmd);
|
|
31770
31667
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
31771
31668
|
const hasStyle = "style" in cmd;
|
|
31772
31669
|
const hasFormat = "format" in cmd;
|
|
31773
|
-
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
31774
|
-
return
|
|
31670
|
+
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
31671
|
+
return "Success";
|
|
31775
31672
|
}
|
|
31776
31673
|
};
|
|
31777
31674
|
var FormulaCellWithDependencies = class {
|
|
31675
|
+
id;
|
|
31676
|
+
format;
|
|
31677
|
+
style;
|
|
31678
|
+
sheetId;
|
|
31679
|
+
getRangeString;
|
|
31778
31680
|
isFormula = true;
|
|
31779
31681
|
compiledFormula;
|
|
31780
31682
|
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
@@ -31809,6 +31711,10 @@ var FormulaCellWithDependencies = class {
|
|
|
31809
31711
|
}
|
|
31810
31712
|
};
|
|
31811
31713
|
var RangeReferenceToken = class {
|
|
31714
|
+
ranges;
|
|
31715
|
+
rangeIndex;
|
|
31716
|
+
sheetId;
|
|
31717
|
+
getRangeString;
|
|
31812
31718
|
type = "REFERENCE";
|
|
31813
31719
|
constructor(ranges, rangeIndex, sheetId, getRangeString) {
|
|
31814
31720
|
this.ranges = ranges;
|
|
@@ -31843,7 +31749,7 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
31843
31749
|
switch (cmd.type) {
|
|
31844
31750
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
31845
31751
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
31846
|
-
default: return
|
|
31752
|
+
default: return "Success";
|
|
31847
31753
|
}
|
|
31848
31754
|
}
|
|
31849
31755
|
handle(cmd) {
|
|
@@ -31962,10 +31868,10 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
31962
31868
|
if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
31963
31869
|
}
|
|
31964
31870
|
checkChartDuplicate(cmd) {
|
|
31965
|
-
return this.getters.getFigureSheetId(cmd.id) ?
|
|
31871
|
+
return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
|
|
31966
31872
|
}
|
|
31967
31873
|
checkChartExists(cmd) {
|
|
31968
|
-
return this.isChartDefined(cmd.id) ?
|
|
31874
|
+
return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
|
|
31969
31875
|
}
|
|
31970
31876
|
};
|
|
31971
31877
|
|
|
@@ -32292,7 +32198,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32292
32198
|
case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
|
|
32293
32199
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
32294
32200
|
}
|
|
32295
|
-
return
|
|
32201
|
+
return "Success";
|
|
32296
32202
|
}
|
|
32297
32203
|
handle(cmd) {
|
|
32298
32204
|
switch (cmd.type) {
|
|
@@ -32406,21 +32312,21 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32406
32312
|
this.history.update("cfRules", sheet, currentCF);
|
|
32407
32313
|
}
|
|
32408
32314
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
32409
|
-
if (!this.cfRules[sheetId]) return
|
|
32315
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
32410
32316
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
32411
|
-
if (ruleIndex === -1) return
|
|
32317
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
32412
32318
|
const cfIndex2 = ruleIndex - delta;
|
|
32413
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
32414
|
-
return
|
|
32319
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
32320
|
+
return "Success";
|
|
32415
32321
|
}
|
|
32416
32322
|
checkEmptyRange(cmd) {
|
|
32417
|
-
return cmd.ranges.length ?
|
|
32323
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
32418
32324
|
}
|
|
32419
32325
|
checkCFRule(cmd) {
|
|
32420
32326
|
const rule = cmd.cf.rule;
|
|
32421
32327
|
switch (rule.type) {
|
|
32422
32328
|
case "CellIsRule":
|
|
32423
|
-
if (!CellIsOperators[rule.operator]) return
|
|
32329
|
+
if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
|
|
32424
32330
|
return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
|
|
32425
32331
|
"BeginsWith",
|
|
32426
32332
|
"ContainsText",
|
|
@@ -32434,7 +32340,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32434
32340
|
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)));
|
|
32435
32341
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
32436
32342
|
}
|
|
32437
|
-
return
|
|
32343
|
+
return "InvalidConditionalFormatType";
|
|
32438
32344
|
}
|
|
32439
32345
|
checkOperatorArgsNumber(expectedNumber, operators) {
|
|
32440
32346
|
if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
@@ -32442,11 +32348,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32442
32348
|
if (operators.includes(rule.operator)) {
|
|
32443
32349
|
const errors = [];
|
|
32444
32350
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
32445
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
32446
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
32447
|
-
return errors.length ? errors :
|
|
32351
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
32352
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
32353
|
+
return errors.length ? errors : "Success";
|
|
32448
32354
|
}
|
|
32449
|
-
return
|
|
32355
|
+
return "Success";
|
|
32450
32356
|
};
|
|
32451
32357
|
}
|
|
32452
32358
|
checkNaN(threshold, thresholdName) {
|
|
@@ -32455,31 +32361,31 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32455
32361
|
"percentage",
|
|
32456
32362
|
"percentile"
|
|
32457
32363
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
32458
|
-
case "min": return
|
|
32459
|
-
case "max": return
|
|
32460
|
-
case "mid": return
|
|
32461
|
-
case "upperInflectionPoint": return
|
|
32462
|
-
case "lowerInflectionPoint": return
|
|
32364
|
+
case "min": return "MinNaN";
|
|
32365
|
+
case "max": return "MaxNaN";
|
|
32366
|
+
case "mid": return "MidNaN";
|
|
32367
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
32368
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
32463
32369
|
}
|
|
32464
|
-
return
|
|
32370
|
+
return "Success";
|
|
32465
32371
|
}
|
|
32466
32372
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
32467
|
-
if (threshold.type !== "formula") return
|
|
32373
|
+
if (threshold.type !== "formula") return "Success";
|
|
32468
32374
|
try {
|
|
32469
32375
|
compile(threshold.value || "");
|
|
32470
32376
|
} catch (error) {
|
|
32471
32377
|
switch (thresholdName) {
|
|
32472
|
-
case "min": return
|
|
32473
|
-
case "max": return
|
|
32474
|
-
case "mid": return
|
|
32475
|
-
case "upperInflectionPoint": return
|
|
32476
|
-
case "lowerInflectionPoint": return
|
|
32378
|
+
case "min": return "MinInvalidFormula";
|
|
32379
|
+
case "max": return "MaxInvalidFormula";
|
|
32380
|
+
case "mid": return "MidInvalidFormula";
|
|
32381
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
32382
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
32477
32383
|
}
|
|
32478
32384
|
}
|
|
32479
|
-
return
|
|
32385
|
+
return "Success";
|
|
32480
32386
|
}
|
|
32481
32387
|
checkThresholds(check) {
|
|
32482
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
32388
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
32483
32389
|
}
|
|
32484
32390
|
checkInflectionPoints(check) {
|
|
32485
32391
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -32491,8 +32397,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32491
32397
|
"number",
|
|
32492
32398
|
"percentage",
|
|
32493
32399
|
"percentile"
|
|
32494
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
32495
|
-
return
|
|
32400
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
32401
|
+
return "Success";
|
|
32496
32402
|
}
|
|
32497
32403
|
checkMinBiggerThanMax(rule) {
|
|
32498
32404
|
const minValue = rule.minimum.value;
|
|
@@ -32501,8 +32407,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32501
32407
|
"number",
|
|
32502
32408
|
"percentage",
|
|
32503
32409
|
"percentile"
|
|
32504
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
32505
|
-
return
|
|
32410
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
32411
|
+
return "Success";
|
|
32506
32412
|
}
|
|
32507
32413
|
checkMidBiggerThanMax(rule) {
|
|
32508
32414
|
const midValue = rule.midpoint?.value;
|
|
@@ -32511,8 +32417,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32511
32417
|
"number",
|
|
32512
32418
|
"percentage",
|
|
32513
32419
|
"percentile"
|
|
32514
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
32515
|
-
return
|
|
32420
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
32421
|
+
return "Success";
|
|
32516
32422
|
}
|
|
32517
32423
|
checkMinBiggerThanMid(rule) {
|
|
32518
32424
|
const minValue = rule.minimum.value;
|
|
@@ -32521,8 +32427,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
32521
32427
|
"number",
|
|
32522
32428
|
"percentage",
|
|
32523
32429
|
"percentile"
|
|
32524
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
32525
|
-
return
|
|
32430
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
32431
|
+
return "Success";
|
|
32526
32432
|
}
|
|
32527
32433
|
removeConditionalFormatting(id, sheet) {
|
|
32528
32434
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -32585,14 +32491,14 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32585
32491
|
allowDispatch(cmd) {
|
|
32586
32492
|
switch (cmd.type) {
|
|
32587
32493
|
case "ADD_DATA_VALIDATION_RULE":
|
|
32588
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
32494
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
32589
32495
|
return this.checkValidations(cmd, this.chainValidations(this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
32590
32496
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
32591
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
32592
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
32497
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
32498
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
32593
32499
|
break;
|
|
32594
32500
|
}
|
|
32595
|
-
return
|
|
32501
|
+
return "Success";
|
|
32596
32502
|
}
|
|
32597
32503
|
handle(cmd) {
|
|
32598
32504
|
switch (cmd.type) {
|
|
@@ -32703,13 +32609,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32703
32609
|
}
|
|
32704
32610
|
}
|
|
32705
32611
|
checkCriterionTypeIsValid(cmd) {
|
|
32706
|
-
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
32612
|
+
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
32707
32613
|
}
|
|
32708
32614
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
32709
32615
|
const criterion = cmd.rule.criterion;
|
|
32710
32616
|
const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
32711
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
32712
|
-
return
|
|
32617
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
32618
|
+
return "Success";
|
|
32713
32619
|
}
|
|
32714
32620
|
checkCriterionValuesAreValid(cmd) {
|
|
32715
32621
|
const criterion = cmd.rule.criterion;
|
|
@@ -32718,8 +32624,8 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
32718
32624
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
|
|
32719
32625
|
else if (evaluator.allowedValues === "onlyFormulas") return true;
|
|
32720
32626
|
else return !evaluator.isCriterionValueValid(value);
|
|
32721
|
-
})) return
|
|
32722
|
-
return
|
|
32627
|
+
})) return "InvalidDataValidationCriterionValue";
|
|
32628
|
+
return "Success";
|
|
32723
32629
|
}
|
|
32724
32630
|
};
|
|
32725
32631
|
|
|
@@ -32738,7 +32644,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
32738
32644
|
case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
|
|
32739
32645
|
case "UPDATE_FIGURE":
|
|
32740
32646
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
32741
|
-
default: return
|
|
32647
|
+
default: return "Success";
|
|
32742
32648
|
}
|
|
32743
32649
|
}
|
|
32744
32650
|
beforeHandle(cmd) {
|
|
@@ -32832,12 +32738,12 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
32832
32738
|
this.history.update("figures", sheetId, id, void 0);
|
|
32833
32739
|
}
|
|
32834
32740
|
checkFigureExists(sheetId, figureId) {
|
|
32835
|
-
if (this.figures[sheetId]?.[figureId] === void 0) return
|
|
32836
|
-
return
|
|
32741
|
+
if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
|
|
32742
|
+
return "Success";
|
|
32837
32743
|
}
|
|
32838
32744
|
checkFigureDuplicate(figureId) {
|
|
32839
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return
|
|
32840
|
-
return
|
|
32745
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
|
|
32746
|
+
return "Success";
|
|
32841
32747
|
}
|
|
32842
32748
|
getFigures(sheetId) {
|
|
32843
32749
|
const figures = [];
|
|
@@ -32945,23 +32851,23 @@ var FiltersPlugin = class extends CorePlugin {
|
|
|
32945
32851
|
allowDispatch(cmd) {
|
|
32946
32852
|
switch (cmd.type) {
|
|
32947
32853
|
case "CREATE_FILTER_TABLE":
|
|
32948
|
-
if (!areZonesContinuous(...cmd.target)) return
|
|
32854
|
+
if (!areZonesContinuous(...cmd.target)) return "NonContinuousTargets";
|
|
32949
32855
|
const zone = union(...cmd.target);
|
|
32950
32856
|
const checkFilterOverlap = () => {
|
|
32951
|
-
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) return
|
|
32952
|
-
return
|
|
32857
|
+
if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) return "FilterOverlap";
|
|
32858
|
+
return "Success";
|
|
32953
32859
|
};
|
|
32954
32860
|
const checkMergeInFilter = () => {
|
|
32955
32861
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
|
|
32956
|
-
for (const merge of mergesInTarget) if (overlap(zone, merge)) return
|
|
32957
|
-
return
|
|
32862
|
+
for (const merge of mergesInTarget) if (overlap(zone, merge)) return "MergeInFilter";
|
|
32863
|
+
return "Success";
|
|
32958
32864
|
};
|
|
32959
32865
|
return this.checkValidations(cmd, checkFilterOverlap, checkMergeInFilter);
|
|
32960
32866
|
case "ADD_MERGE":
|
|
32961
|
-
for (const merge of cmd.target) for (const filterTable of this.getFilterTables(cmd.sheetId)) if (overlap(filterTable.zone, merge)) return
|
|
32867
|
+
for (const merge of cmd.target) for (const filterTable of this.getFilterTables(cmd.sheetId)) if (overlap(filterTable.zone, merge)) return "MergeInFilter";
|
|
32962
32868
|
break;
|
|
32963
32869
|
}
|
|
32964
|
-
return
|
|
32870
|
+
return "Success";
|
|
32965
32871
|
}
|
|
32966
32872
|
handle(cmd) {
|
|
32967
32873
|
switch (cmd.type) {
|
|
@@ -33255,19 +33161,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
33255
33161
|
allowDispatch(cmd) {
|
|
33256
33162
|
switch (cmd.type) {
|
|
33257
33163
|
case "HIDE_COLUMNS_ROWS": {
|
|
33258
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
33164
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
33259
33165
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
33260
33166
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
33261
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
33262
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
33263
|
-
else return
|
|
33167
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
33168
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
33169
|
+
else return "Success";
|
|
33264
33170
|
}
|
|
33265
33171
|
case "REMOVE_COLUMNS_ROWS":
|
|
33266
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
33267
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
33268
|
-
return
|
|
33172
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
33173
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
33174
|
+
return "Success";
|
|
33269
33175
|
}
|
|
33270
|
-
return
|
|
33176
|
+
return "Success";
|
|
33271
33177
|
}
|
|
33272
33178
|
handle(cmd) {
|
|
33273
33179
|
switch (cmd.type) {
|
|
@@ -33395,9 +33301,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
33395
33301
|
allowDispatch(cmd) {
|
|
33396
33302
|
switch (cmd.type) {
|
|
33397
33303
|
case "CREATE_IMAGE":
|
|
33398
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
33399
|
-
return
|
|
33400
|
-
default: return
|
|
33304
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
33305
|
+
return "Success";
|
|
33306
|
+
default: return "Success";
|
|
33401
33307
|
}
|
|
33402
33308
|
}
|
|
33403
33309
|
handle(cmd) {
|
|
@@ -33539,7 +33445,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33539
33445
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
33540
33446
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
33541
33447
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
33542
|
-
default: return
|
|
33448
|
+
default: return "Success";
|
|
33543
33449
|
}
|
|
33544
33450
|
}
|
|
33545
33451
|
handle(cmd) {
|
|
@@ -33729,18 +33635,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33729
33635
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
33730
33636
|
}
|
|
33731
33637
|
checkDestructiveMerge({ sheetId, target }) {
|
|
33732
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
33733
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
33638
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
33639
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
33734
33640
|
}
|
|
33735
33641
|
checkOverlap({ target }) {
|
|
33736
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
33737
|
-
return
|
|
33642
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
33643
|
+
return "Success";
|
|
33738
33644
|
}
|
|
33739
33645
|
checkFrozenPanes({ sheetId, target }) {
|
|
33740
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
33646
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
33741
33647
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
33742
|
-
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
33743
|
-
return
|
|
33648
|
+
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
33649
|
+
return "Success";
|
|
33744
33650
|
}
|
|
33745
33651
|
/**
|
|
33746
33652
|
* The content of a merged cell should always be empty.
|
|
@@ -33748,10 +33654,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33748
33654
|
*/
|
|
33749
33655
|
checkMergedContentUpdate(cmd) {
|
|
33750
33656
|
const { col, row, content } = cmd;
|
|
33751
|
-
if (content === void 0) return
|
|
33657
|
+
if (content === void 0) return "Success";
|
|
33752
33658
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
33753
|
-
if (mainCol === col && mainRow === row) return
|
|
33754
|
-
return
|
|
33659
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
33660
|
+
return "CellIsMerged";
|
|
33755
33661
|
}
|
|
33756
33662
|
checkMergeExists(cmd) {
|
|
33757
33663
|
const { sheetId, target } = cmd;
|
|
@@ -33762,9 +33668,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
33762
33668
|
col: left,
|
|
33763
33669
|
row: top
|
|
33764
33670
|
});
|
|
33765
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
33671
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
33766
33672
|
}
|
|
33767
|
-
return
|
|
33673
|
+
return "Success";
|
|
33768
33674
|
}
|
|
33769
33675
|
/**
|
|
33770
33676
|
* Merge the current selection. Note that:
|
|
@@ -33910,8 +33816,8 @@ var RangeAdapter = class {
|
|
|
33910
33816
|
"getRangeFromZone"
|
|
33911
33817
|
];
|
|
33912
33818
|
allowDispatch(cmd) {
|
|
33913
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
33914
|
-
return
|
|
33819
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
33820
|
+
return "Success";
|
|
33915
33821
|
}
|
|
33916
33822
|
beforeHandle(command) {}
|
|
33917
33823
|
handle(cmd) {
|
|
@@ -34270,39 +34176,39 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34270
34176
|
cellPosition = {};
|
|
34271
34177
|
allowDispatch(cmd) {
|
|
34272
34178
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
34273
|
-
if (genericChecks !==
|
|
34179
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
34274
34180
|
switch (cmd.type) {
|
|
34275
34181
|
case "HIDE_SHEET":
|
|
34276
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
34277
|
-
return
|
|
34182
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
34183
|
+
return "Success";
|
|
34278
34184
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
34279
34185
|
case "DUPLICATE_SHEET":
|
|
34280
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
34281
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
34282
|
-
return
|
|
34186
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
34187
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
34188
|
+
return "Success";
|
|
34283
34189
|
case "MOVE_SHEET": try {
|
|
34284
34190
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
34285
34191
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
34286
|
-
return
|
|
34192
|
+
return "Success";
|
|
34287
34193
|
} catch (e) {
|
|
34288
|
-
return
|
|
34194
|
+
return "WrongSheetMove";
|
|
34289
34195
|
}
|
|
34290
34196
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
34291
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
34197
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
34292
34198
|
case "ADD_COLUMNS_ROWS":
|
|
34293
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
34294
|
-
else if (cmd.quantity <= 0) return
|
|
34295
|
-
return
|
|
34199
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
34200
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
34201
|
+
return "Success";
|
|
34296
34202
|
case "REMOVE_COLUMNS_ROWS": {
|
|
34297
34203
|
const min = largeMin(cmd.elements);
|
|
34298
34204
|
const max = largeMax(cmd.elements);
|
|
34299
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
34300
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
34301
|
-
else return
|
|
34205
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
34206
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
34207
|
+
else return "Success";
|
|
34302
34208
|
}
|
|
34303
34209
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
34304
34210
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
34305
|
-
default: return
|
|
34211
|
+
default: return "Success";
|
|
34306
34212
|
}
|
|
34307
34213
|
}
|
|
34308
34214
|
handle(cmd) {
|
|
@@ -34566,12 +34472,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34566
34472
|
* not outside the sheet.
|
|
34567
34473
|
*/
|
|
34568
34474
|
checkZonesExistInSheet(sheetId, zones) {
|
|
34569
|
-
if (!zones.every(isZoneValid)) return
|
|
34475
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
34570
34476
|
if (zones.length) {
|
|
34571
34477
|
const sheetZone = this.getSheetZone(sheetId);
|
|
34572
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
34478
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
34573
34479
|
}
|
|
34574
|
-
return
|
|
34480
|
+
return "Success";
|
|
34575
34481
|
}
|
|
34576
34482
|
updateCellPosition(cmd) {
|
|
34577
34483
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -34653,36 +34559,36 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34653
34559
|
}
|
|
34654
34560
|
checkSheetName(cmd) {
|
|
34655
34561
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
34656
|
-
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return
|
|
34562
|
+
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
|
|
34657
34563
|
const { orderedSheetIds, sheets } = this;
|
|
34658
34564
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
34659
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
34660
|
-
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) return
|
|
34661
|
-
return
|
|
34565
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
34566
|
+
if (FORBIDDEN_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
34567
|
+
return "Success";
|
|
34662
34568
|
}
|
|
34663
34569
|
checkSheetPosition(cmd) {
|
|
34664
34570
|
const { orderedSheetIds } = this;
|
|
34665
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
34666
|
-
return
|
|
34571
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
34572
|
+
return "Success";
|
|
34667
34573
|
}
|
|
34668
34574
|
checkRowFreezeQuantity(cmd) {
|
|
34669
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
34575
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
34670
34576
|
}
|
|
34671
34577
|
checkColFreezeQuantity(cmd) {
|
|
34672
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
34578
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
34673
34579
|
}
|
|
34674
34580
|
checkRowFreezeOverlapMerge(cmd) {
|
|
34675
34581
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
34676
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
34677
|
-
return
|
|
34582
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
34583
|
+
return "Success";
|
|
34678
34584
|
}
|
|
34679
34585
|
checkColFreezeOverlapMerge(cmd) {
|
|
34680
34586
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
34681
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
34682
|
-
return
|
|
34587
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
34588
|
+
return "Success";
|
|
34683
34589
|
}
|
|
34684
34590
|
isRenameAllowed(cmd) {
|
|
34685
|
-
if (!(cmd.name && cmd.name.trim().toLowerCase())) return
|
|
34591
|
+
if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
|
|
34686
34592
|
return this.checkSheetName(cmd);
|
|
34687
34593
|
}
|
|
34688
34594
|
renameSheet(sheet, name) {
|
|
@@ -34904,17 +34810,17 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
34904
34810
|
* sheet.
|
|
34905
34811
|
*/
|
|
34906
34812
|
checkSheetExists(cmd) {
|
|
34907
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
34908
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
34909
|
-
return
|
|
34813
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
34814
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
34815
|
+
return "Success";
|
|
34910
34816
|
}
|
|
34911
34817
|
/**
|
|
34912
34818
|
* Check if zones in the command are well formed and
|
|
34913
34819
|
* not outside the sheet.
|
|
34914
34820
|
*/
|
|
34915
34821
|
checkZonesAreInSheet(cmd) {
|
|
34916
|
-
if (!("sheetId" in cmd)) return
|
|
34917
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
34822
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
34823
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
34918
34824
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
34919
34825
|
}
|
|
34920
34826
|
};
|
|
@@ -34937,28 +34843,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
34937
34843
|
switch (cmd.type) {
|
|
34938
34844
|
case "GROUP_HEADERS": {
|
|
34939
34845
|
const { start, end, sheetId } = cmd;
|
|
34940
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
34941
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
34942
|
-
if (start > end) return
|
|
34943
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
34846
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
34847
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
34848
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
34849
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
34944
34850
|
break;
|
|
34945
34851
|
}
|
|
34946
34852
|
case "UNGROUP_HEADERS": {
|
|
34947
34853
|
const { start, end, sheetId } = cmd;
|
|
34948
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
34949
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
34950
|
-
if (start > end) return
|
|
34854
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
34855
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
34856
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
34951
34857
|
break;
|
|
34952
34858
|
}
|
|
34953
34859
|
case "UNFOLD_HEADER_GROUP":
|
|
34954
34860
|
case "FOLD_HEADER_GROUP":
|
|
34955
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
34861
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
34956
34862
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
34957
|
-
if (!group) return
|
|
34958
|
-
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
|
|
34863
|
+
if (!group) return "UnknownHeaderGroup";
|
|
34864
|
+
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";
|
|
34959
34865
|
break;
|
|
34960
34866
|
}
|
|
34961
|
-
return
|
|
34867
|
+
return "Success";
|
|
34962
34868
|
}
|
|
34963
34869
|
handle(cmd) {
|
|
34964
34870
|
switch (cmd.type) {
|
|
@@ -35241,9 +35147,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
35241
35147
|
locale = DEFAULT_LOCALE;
|
|
35242
35148
|
allowDispatch(cmd) {
|
|
35243
35149
|
switch (cmd.type) {
|
|
35244
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
35150
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
35245
35151
|
}
|
|
35246
|
-
return
|
|
35152
|
+
return "Success";
|
|
35247
35153
|
}
|
|
35248
35154
|
handle(cmd) {
|
|
35249
35155
|
switch (cmd.type) {
|
|
@@ -35316,6 +35222,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
35316
35222
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
35317
35223
|
}
|
|
35318
35224
|
var CompilationParametersBuilder = class {
|
|
35225
|
+
getters;
|
|
35226
|
+
computeCell;
|
|
35319
35227
|
evalContext;
|
|
35320
35228
|
rangeCache = {};
|
|
35321
35229
|
constructor(context, getters, computeCell) {
|
|
@@ -35359,12 +35267,12 @@ var CompilationParametersBuilder = class {
|
|
|
35359
35267
|
value: null,
|
|
35360
35268
|
format: this.getters.getCell(position)?.format
|
|
35361
35269
|
};
|
|
35362
|
-
if (evaluatedCell.type ===
|
|
35270
|
+
if (evaluatedCell.type === "error") throw evaluatedCell.error;
|
|
35363
35271
|
return evaluatedCell;
|
|
35364
35272
|
}
|
|
35365
35273
|
getEvaluatedCellIfNotEmpty(position) {
|
|
35366
35274
|
const evaluatedCell = this.computeCell(position);
|
|
35367
|
-
if (evaluatedCell.type ===
|
|
35275
|
+
if (evaluatedCell.type === "empty") {
|
|
35368
35276
|
const cell = this.getters.getCell(position);
|
|
35369
35277
|
if (!cell || !cell.isFormula && cell.content === "") return;
|
|
35370
35278
|
}
|
|
@@ -35403,7 +35311,7 @@ var CompilationParametersBuilder = class {
|
|
|
35403
35311
|
col,
|
|
35404
35312
|
row
|
|
35405
35313
|
});
|
|
35406
|
-
if (evaluatedCell?.type ===
|
|
35314
|
+
if (evaluatedCell?.type === "error") {
|
|
35407
35315
|
this.rangeCache[cacheKey] = evaluatedCell.error;
|
|
35408
35316
|
throw evaluatedCell.error;
|
|
35409
35317
|
}
|
|
@@ -35983,6 +35891,7 @@ var ZoneRBush = class extends import_rbush.default {
|
|
|
35983
35891
|
* It uses an R-Tree data structure to efficiently find dependent cells.
|
|
35984
35892
|
*/
|
|
35985
35893
|
var FormulaDependencyGraph = class {
|
|
35894
|
+
encoder;
|
|
35986
35895
|
dependencies = /* @__PURE__ */ new Map();
|
|
35987
35896
|
rTree;
|
|
35988
35897
|
constructor(encoder, data = []) {
|
|
@@ -36119,6 +36028,7 @@ const EMPTY_ARRAY = [];
|
|
|
36119
36028
|
//#region src/plugins/ui_core_views/cell_evaluation/evaluator.ts
|
|
36120
36029
|
const MAX_ITERATION = 30;
|
|
36121
36030
|
var Evaluator = class {
|
|
36031
|
+
context;
|
|
36122
36032
|
getters;
|
|
36123
36033
|
compilationParams;
|
|
36124
36034
|
encoder = new PositionBitsEncoder();
|
|
@@ -36280,7 +36190,7 @@ var Evaluator = class {
|
|
|
36280
36190
|
return evaluatedCell;
|
|
36281
36191
|
}
|
|
36282
36192
|
handleError(e) {
|
|
36283
|
-
if (!(e instanceof EvaluationError)) e = new EvaluationError(
|
|
36193
|
+
if (!(e instanceof EvaluationError)) e = new EvaluationError("#ERROR", e.message);
|
|
36284
36194
|
const __lastFnCalled = this.compilationParams[2].__lastFnCalled || "";
|
|
36285
36195
|
e.message = e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled);
|
|
36286
36196
|
return errorCell(e);
|
|
@@ -36381,7 +36291,7 @@ var Evaluator = class {
|
|
|
36381
36291
|
col: i + col,
|
|
36382
36292
|
row: j + row
|
|
36383
36293
|
};
|
|
36384
|
-
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !==
|
|
36294
|
+
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
36385
36295
|
this.blockedArrayFormulas.add(formulaPositionId);
|
|
36386
36296
|
throw new Error(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
|
|
36387
36297
|
}
|
|
@@ -36635,7 +36545,7 @@ var EvaluationPlugin = class extends UIPlugin {
|
|
|
36635
36545
|
sheetId,
|
|
36636
36546
|
col,
|
|
36637
36547
|
row
|
|
36638
|
-
})).every((cell) => cell.type ===
|
|
36548
|
+
})).every((cell) => cell.type === "empty");
|
|
36639
36549
|
}
|
|
36640
36550
|
exportForExcel(data) {
|
|
36641
36551
|
for (const sheet of data.sheets) sheet.formulaSpillRanges = {};
|
|
@@ -37046,7 +36956,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
37046
36956
|
return computedIcons;
|
|
37047
36957
|
}
|
|
37048
36958
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
37049
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type ===
|
|
36959
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
37050
36960
|
switch (threshold.type) {
|
|
37051
36961
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
37052
36962
|
case "number": return Number(threshold.value);
|
|
@@ -37077,7 +36987,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
37077
36987
|
col,
|
|
37078
36988
|
row
|
|
37079
36989
|
});
|
|
37080
|
-
if (cell.type !==
|
|
36990
|
+
if (cell.type !== "number") continue;
|
|
37081
36991
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
37082
36992
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
37083
36993
|
computedIcons[col][row] = icon;
|
|
@@ -37118,7 +37028,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
37118
37028
|
col,
|
|
37119
37029
|
row
|
|
37120
37030
|
});
|
|
37121
|
-
if (cell.type ===
|
|
37031
|
+
if (cell.type === "number") {
|
|
37122
37032
|
const value = clip(cell.value, minValue, maxValue);
|
|
37123
37033
|
let color;
|
|
37124
37034
|
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);
|
|
@@ -37152,7 +37062,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
37152
37062
|
*/
|
|
37153
37063
|
rulePredicate = { CellIsRule: (target, rule) => {
|
|
37154
37064
|
const cell = this.getters.getEvaluatedCell(target);
|
|
37155
|
-
if (cell.type ===
|
|
37065
|
+
if (cell.type === "error") return false;
|
|
37156
37066
|
const [value0, value1] = rule.values.map((val) => {
|
|
37157
37067
|
if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
37158
37068
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
@@ -37259,7 +37169,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
37259
37169
|
if (!validationResults[col]) validationResults[col] = [];
|
|
37260
37170
|
validationResults[col][row] = lazy(() => {
|
|
37261
37171
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
37262
|
-
if (evaluatedCell.type ===
|
|
37172
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
37263
37173
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
37264
37174
|
});
|
|
37265
37175
|
}
|
|
@@ -37299,7 +37209,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
37299
37209
|
const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
|
|
37300
37210
|
return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
|
|
37301
37211
|
} catch (e) {
|
|
37302
|
-
return e instanceof EvaluationError ? e.errorType :
|
|
37212
|
+
return e instanceof EvaluationError ? e.errorType : "#ERROR";
|
|
37303
37213
|
}
|
|
37304
37214
|
});
|
|
37305
37215
|
}
|
|
@@ -37500,7 +37410,7 @@ var AutofillGenerator = class {
|
|
|
37500
37410
|
*
|
|
37501
37411
|
*/
|
|
37502
37412
|
var AutofillPlugin = class extends UIPlugin {
|
|
37503
|
-
static layers = [
|
|
37413
|
+
static layers = [5];
|
|
37504
37414
|
static getters = ["getAutofillTooltip"];
|
|
37505
37415
|
autofillZone;
|
|
37506
37416
|
steps;
|
|
@@ -37513,13 +37423,13 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37513
37423
|
const sheetId = this.getters.getActiveSheetId();
|
|
37514
37424
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
37515
37425
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
37516
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
37517
|
-
return
|
|
37426
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
37427
|
+
return "InvalidAutofillSelection";
|
|
37518
37428
|
case "AUTOFILL_AUTO":
|
|
37519
37429
|
const zone = this.getters.getSelectedZone();
|
|
37520
|
-
return zone.top === zone.bottom ?
|
|
37430
|
+
return zone.top === zone.bottom ? "Success" : "CancelledForUnknownReason";
|
|
37521
37431
|
}
|
|
37522
|
-
return
|
|
37432
|
+
return "Success";
|
|
37523
37433
|
}
|
|
37524
37434
|
handle(cmd) {
|
|
37525
37435
|
switch (cmd.type) {
|
|
@@ -37551,7 +37461,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37551
37461
|
const target = this.autofillZone;
|
|
37552
37462
|
const autofillCellsData = [];
|
|
37553
37463
|
switch (this.direction) {
|
|
37554
|
-
case
|
|
37464
|
+
case "down":
|
|
37555
37465
|
for (let col = source.left; col <= source.right; col++) {
|
|
37556
37466
|
const xcs = [];
|
|
37557
37467
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -37559,7 +37469,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37559
37469
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37560
37470
|
}
|
|
37561
37471
|
break;
|
|
37562
|
-
case
|
|
37472
|
+
case "up":
|
|
37563
37473
|
for (let col = source.left; col <= source.right; col++) {
|
|
37564
37474
|
const xcs = [];
|
|
37565
37475
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -37567,7 +37477,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37567
37477
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37568
37478
|
}
|
|
37569
37479
|
break;
|
|
37570
|
-
case
|
|
37480
|
+
case "left":
|
|
37571
37481
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
37572
37482
|
const xcs = [];
|
|
37573
37483
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -37575,7 +37485,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37575
37485
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
37576
37486
|
}
|
|
37577
37487
|
break;
|
|
37578
|
-
case
|
|
37488
|
+
case "right":
|
|
37579
37489
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
37580
37490
|
const xcs = [];
|
|
37581
37491
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -37701,19 +37611,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37701
37611
|
}
|
|
37702
37612
|
this.direction = this.getDirection(col, row);
|
|
37703
37613
|
switch (this.direction) {
|
|
37704
|
-
case
|
|
37614
|
+
case "up":
|
|
37705
37615
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
37706
37616
|
this.steps = source.top - row;
|
|
37707
37617
|
break;
|
|
37708
|
-
case
|
|
37618
|
+
case "down":
|
|
37709
37619
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
37710
37620
|
this.steps = row - source.bottom;
|
|
37711
37621
|
break;
|
|
37712
|
-
case
|
|
37622
|
+
case "left":
|
|
37713
37623
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
37714
37624
|
this.steps = source.left - col;
|
|
37715
37625
|
break;
|
|
37716
|
-
case
|
|
37626
|
+
case "right":
|
|
37717
37627
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
37718
37628
|
this.steps = col - source.right;
|
|
37719
37629
|
break;
|
|
@@ -37845,19 +37755,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
37845
37755
|
const position = {
|
|
37846
37756
|
up: {
|
|
37847
37757
|
number: source.top - row,
|
|
37848
|
-
value:
|
|
37758
|
+
value: "up"
|
|
37849
37759
|
},
|
|
37850
37760
|
down: {
|
|
37851
37761
|
number: row - source.bottom,
|
|
37852
|
-
value:
|
|
37762
|
+
value: "down"
|
|
37853
37763
|
},
|
|
37854
37764
|
left: {
|
|
37855
37765
|
number: source.left - col,
|
|
37856
|
-
value:
|
|
37766
|
+
value: "left"
|
|
37857
37767
|
},
|
|
37858
37768
|
right: {
|
|
37859
37769
|
number: col - source.right,
|
|
37860
|
-
value:
|
|
37770
|
+
value: "right"
|
|
37861
37771
|
}
|
|
37862
37772
|
};
|
|
37863
37773
|
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;
|
|
@@ -38060,7 +37970,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
38060
37970
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
38061
37971
|
}
|
|
38062
37972
|
isNumber(cell) {
|
|
38063
|
-
return cell.type ===
|
|
37973
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
38064
37974
|
}
|
|
38065
37975
|
isZoneValid(zone) {
|
|
38066
37976
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -38228,10 +38138,10 @@ var CellPopoverPlugin = class extends UIPlugin {
|
|
|
38228
38138
|
try {
|
|
38229
38139
|
cellPopoverRegistry.get(cmd.popoverType);
|
|
38230
38140
|
} catch (error) {
|
|
38231
|
-
return
|
|
38141
|
+
return "InvalidCellPopover";
|
|
38232
38142
|
}
|
|
38233
|
-
return
|
|
38234
|
-
default: return
|
|
38143
|
+
return "Success";
|
|
38144
|
+
default: return "Success";
|
|
38235
38145
|
}
|
|
38236
38146
|
}
|
|
38237
38147
|
handle(cmd) {
|
|
@@ -38641,6 +38551,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
38641
38551
|
//#endregion
|
|
38642
38552
|
//#region src/collaborative/revisions.ts
|
|
38643
38553
|
var Revision = class {
|
|
38554
|
+
rootCommand;
|
|
38555
|
+
timestamp;
|
|
38644
38556
|
id;
|
|
38645
38557
|
clientId;
|
|
38646
38558
|
_commands = [];
|
|
@@ -38677,6 +38589,9 @@ var Revision = class {
|
|
|
38677
38589
|
//#region src/collaborative/session.ts
|
|
38678
38590
|
var ClientDisconnectedError = class extends Error {};
|
|
38679
38591
|
var Session = class extends EventBus {
|
|
38592
|
+
revisions;
|
|
38593
|
+
transportService;
|
|
38594
|
+
serverRevisionId;
|
|
38680
38595
|
/**
|
|
38681
38596
|
* Positions of the others client.
|
|
38682
38597
|
*/
|
|
@@ -39052,7 +38967,7 @@ var CollaborativePlugin = class extends UIPlugin {
|
|
|
39052
38967
|
"getConnectedClients",
|
|
39053
38968
|
"isFullySynchronized"
|
|
39054
38969
|
];
|
|
39055
|
-
static layers = [
|
|
38970
|
+
static layers = [6];
|
|
39056
38971
|
availableColors = new Set(colors);
|
|
39057
38972
|
colors = {};
|
|
39058
38973
|
session;
|
|
@@ -39134,6 +39049,9 @@ var CollaborativePlugin = class extends UIPlugin {
|
|
|
39134
39049
|
//#region src/helpers/clipboard/clipboard_abstract_cell_state.ts
|
|
39135
39050
|
/** Abstract state of the clipboard when copying/cutting content that is pasted in cells of the sheet */
|
|
39136
39051
|
var ClipboardCellsAbstractState = class {
|
|
39052
|
+
getters;
|
|
39053
|
+
dispatch;
|
|
39054
|
+
selection;
|
|
39137
39055
|
operation;
|
|
39138
39056
|
sheetId;
|
|
39139
39057
|
constructor(operation, getters, dispatch, selection) {
|
|
@@ -39144,10 +39062,10 @@ var ClipboardCellsAbstractState = class {
|
|
|
39144
39062
|
this.sheetId = getters.getActiveSheetId();
|
|
39145
39063
|
}
|
|
39146
39064
|
isCutAllowed(target) {
|
|
39147
|
-
return
|
|
39065
|
+
return "Success";
|
|
39148
39066
|
}
|
|
39149
39067
|
isPasteAllowed(target, clipboardOption) {
|
|
39150
|
-
return
|
|
39068
|
+
return "Success";
|
|
39151
39069
|
}
|
|
39152
39070
|
/**
|
|
39153
39071
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -39255,23 +39173,23 @@ var ClipboardCellsState = class extends ClipboardCellsAbstractState {
|
|
|
39255
39173
|
this.copiedTables = tables;
|
|
39256
39174
|
}
|
|
39257
39175
|
isCutAllowed(target) {
|
|
39258
|
-
if (target.length !== 1) return
|
|
39259
|
-
return
|
|
39176
|
+
if (target.length !== 1) return "WrongCutSelection";
|
|
39177
|
+
return "Success";
|
|
39260
39178
|
}
|
|
39261
39179
|
isPasteAllowed(target, clipboardOption) {
|
|
39262
39180
|
const sheetId = this.getters.getActiveSheetId();
|
|
39263
|
-
if (this.operation === "CUT" && clipboardOption?.pasteOption !== void 0) return
|
|
39181
|
+
if (this.operation === "CUT" && clipboardOption?.pasteOption !== void 0) return "WrongPasteOption";
|
|
39264
39182
|
if (target.length > 1) {
|
|
39265
|
-
if (this.cells.length > 1 || this.cells[0].length > 1) return
|
|
39183
|
+
if (this.cells.length > 1 || this.cells[0].length > 1) return "WrongPasteSelection";
|
|
39266
39184
|
}
|
|
39267
39185
|
const clipboardHeight = this.cells.length;
|
|
39268
39186
|
const clipboardWidth = this.cells[0].length;
|
|
39269
39187
|
for (const zone of this.getPasteZones(target)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
39270
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
39188
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
39271
39189
|
}
|
|
39272
39190
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
39273
|
-
for (const zone of this.getPasteZones(target)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
39274
|
-
return
|
|
39191
|
+
for (const zone of this.getPasteZones(target)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
39192
|
+
return "Success";
|
|
39275
39193
|
}
|
|
39276
39194
|
/**
|
|
39277
39195
|
* Paste the clipboard content in the given target
|
|
@@ -39502,8 +39420,8 @@ var ClipboardCellsState = class extends ClipboardCellsAbstractState {
|
|
|
39502
39420
|
}
|
|
39503
39421
|
getClipboardContent() {
|
|
39504
39422
|
return {
|
|
39505
|
-
[
|
|
39506
|
-
[
|
|
39423
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
39424
|
+
["text/html"]: this.getHTMLContent()
|
|
39507
39425
|
};
|
|
39508
39426
|
}
|
|
39509
39427
|
getPlainTextContent() {
|
|
@@ -39696,7 +39614,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39696
39614
|
switch (cmd.type) {
|
|
39697
39615
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
39698
39616
|
}
|
|
39699
|
-
return
|
|
39617
|
+
return "Success";
|
|
39700
39618
|
}
|
|
39701
39619
|
handle(cmd) {
|
|
39702
39620
|
switch (cmd.type) {
|
|
@@ -39773,34 +39691,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39773
39691
|
});
|
|
39774
39692
|
}
|
|
39775
39693
|
checkSingleRangeSelected() {
|
|
39776
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
39777
|
-
return
|
|
39694
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
39695
|
+
return "Success";
|
|
39778
39696
|
}
|
|
39779
39697
|
checkNoMergeInZone() {
|
|
39780
39698
|
const sheetId = this.getters.getActiveSheetId();
|
|
39781
39699
|
const zone = this.getters.getSelectedZone();
|
|
39782
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
39783
|
-
return
|
|
39700
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
39701
|
+
return "Success";
|
|
39784
39702
|
}
|
|
39785
39703
|
checkRangeContainsValues(cmd) {
|
|
39786
39704
|
const sheetId = this.getters.getActiveSheetId();
|
|
39787
39705
|
const zone = this.getters.getSelectedZone();
|
|
39788
39706
|
if (cmd.hasHeader) zone.top += 1;
|
|
39789
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
39790
|
-
return
|
|
39707
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
39708
|
+
return "Success";
|
|
39791
39709
|
}
|
|
39792
39710
|
checkNoColumnProvided(cmd) {
|
|
39793
|
-
if (cmd.columns.length === 0) return
|
|
39794
|
-
return
|
|
39711
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
39712
|
+
return "Success";
|
|
39795
39713
|
}
|
|
39796
39714
|
checkColumnsIncludedInZone(cmd) {
|
|
39797
39715
|
const zone = this.getters.getSelectedZone();
|
|
39798
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
39799
|
-
return
|
|
39716
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
39717
|
+
return "Success";
|
|
39800
39718
|
}
|
|
39801
39719
|
checkColumnsAreUnique(cmd) {
|
|
39802
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
39803
|
-
return
|
|
39720
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
39721
|
+
return "Success";
|
|
39804
39722
|
}
|
|
39805
39723
|
trimWhitespace() {
|
|
39806
39724
|
const zones = this.getters.getSelectedZones();
|
|
@@ -39837,12 +39755,6 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
39837
39755
|
//#region src/plugins/ui_feature/find_and_replace.ts
|
|
39838
39756
|
const BORDER_COLOR = "#8B008B";
|
|
39839
39757
|
const BACKGROUND_COLOR = "#8B008B33";
|
|
39840
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
39841
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
39842
|
-
Direction[Direction["current"] = 0] = "current";
|
|
39843
|
-
Direction[Direction["next"] = 1] = "next";
|
|
39844
|
-
return Direction;
|
|
39845
|
-
}(Direction || {});
|
|
39846
39758
|
/**
|
|
39847
39759
|
* Find and Replace Plugin
|
|
39848
39760
|
*
|
|
@@ -39853,7 +39765,7 @@ var Direction = /* @__PURE__ */ function(Direction) {
|
|
|
39853
39765
|
* the search with a new value.
|
|
39854
39766
|
*/
|
|
39855
39767
|
var FindAndReplacePlugin = class extends UIPlugin {
|
|
39856
|
-
static layers = [
|
|
39768
|
+
static layers = [3];
|
|
39857
39769
|
static getters = ["getSearchMatches", "getCurrentSelectedMatchIndex"];
|
|
39858
39770
|
searchMatches = [];
|
|
39859
39771
|
selectedMatchIndex = null;
|
|
@@ -39874,10 +39786,10 @@ var FindAndReplacePlugin = class extends UIPlugin {
|
|
|
39874
39786
|
this.clearSearch();
|
|
39875
39787
|
break;
|
|
39876
39788
|
case "SELECT_SEARCH_PREVIOUS_MATCH":
|
|
39877
|
-
this.selectNextCell(
|
|
39789
|
+
this.selectNextCell(-1);
|
|
39878
39790
|
break;
|
|
39879
39791
|
case "SELECT_SEARCH_NEXT_MATCH":
|
|
39880
|
-
this.selectNextCell(
|
|
39792
|
+
this.selectNextCell(1);
|
|
39881
39793
|
break;
|
|
39882
39794
|
case "REPLACE_SEARCH":
|
|
39883
39795
|
this.replace(cmd.replaceWith);
|
|
@@ -39929,8 +39841,9 @@ var FindAndReplacePlugin = class extends UIPlugin {
|
|
|
39929
39841
|
* refresh the matches according to the current search options
|
|
39930
39842
|
*/
|
|
39931
39843
|
refreshSearch() {
|
|
39932
|
-
|
|
39933
|
-
this.
|
|
39844
|
+
const matches = this.findMatches();
|
|
39845
|
+
this.searchMatches = matches;
|
|
39846
|
+
this.selectNextCell(0);
|
|
39934
39847
|
}
|
|
39935
39848
|
/**
|
|
39936
39849
|
* Updates the regex based on the current searchOptions and
|
|
@@ -40131,7 +40044,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
40131
40044
|
getCellNumberFormat(position) {
|
|
40132
40045
|
for (const pos of [position]) {
|
|
40133
40046
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
40134
|
-
if (cell.type ===
|
|
40047
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
40135
40048
|
}
|
|
40136
40049
|
}
|
|
40137
40050
|
};
|
|
@@ -40198,7 +40111,7 @@ var HeaderVisibilityUIPlugin = class extends UIPlugin {
|
|
|
40198
40111
|
* HighlightPlugin
|
|
40199
40112
|
*/
|
|
40200
40113
|
var HighlightPlugin = class extends UIPlugin {
|
|
40201
|
-
static layers = [
|
|
40114
|
+
static layers = [1];
|
|
40202
40115
|
static getters = ["getHighlights"];
|
|
40203
40116
|
getHighlights() {
|
|
40204
40117
|
return this.prepareHighlights(this.getters.getComposerHighlights().concat(this.getters.getSelectionInputHighlights()));
|
|
@@ -40242,7 +40155,7 @@ var HighlightPlugin = class extends UIPlugin {
|
|
|
40242
40155
|
//#endregion
|
|
40243
40156
|
//#region src/plugins/ui_feature/renderer.ts
|
|
40244
40157
|
var RendererPlugin = class extends UIPlugin {
|
|
40245
|
-
static layers = [
|
|
40158
|
+
static layers = [0, 7];
|
|
40246
40159
|
static getters = ["getColDimensionsInViewport", "getRowDimensionsInViewport"];
|
|
40247
40160
|
boxes = [];
|
|
40248
40161
|
/**
|
|
@@ -40284,7 +40197,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40284
40197
|
}
|
|
40285
40198
|
drawGrid(renderingContext, layer) {
|
|
40286
40199
|
switch (layer) {
|
|
40287
|
-
case
|
|
40200
|
+
case 0:
|
|
40288
40201
|
this.drawGlobalBackground(renderingContext);
|
|
40289
40202
|
for (const { zone, rect } of this.getters.getAllActiveViewportsZonesAndRect()) {
|
|
40290
40203
|
const { ctx } = renderingContext;
|
|
@@ -40303,7 +40216,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40303
40216
|
}
|
|
40304
40217
|
this.drawFrozenPanes(renderingContext);
|
|
40305
40218
|
break;
|
|
40306
|
-
case
|
|
40219
|
+
case 7:
|
|
40307
40220
|
if (!this.getters.isDashboard()) {
|
|
40308
40221
|
this.drawHeaders(renderingContext);
|
|
40309
40222
|
this.drawFrozenPanesHeaders(renderingContext);
|
|
@@ -40651,7 +40564,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40651
40564
|
const nextCellBorder = this.getters.getCellBorderWithFilterBorder(position);
|
|
40652
40565
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
40653
40566
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
40654
|
-
if (nextCell.type !==
|
|
40567
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
|
|
40655
40568
|
col++;
|
|
40656
40569
|
}
|
|
40657
40570
|
return col;
|
|
@@ -40669,7 +40582,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40669
40582
|
const previousCellBorder = this.getters.getCellBorderWithFilterBorder(position);
|
|
40670
40583
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
40671
40584
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
40672
|
-
if (previousCell.type !==
|
|
40585
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
|
|
40673
40586
|
col--;
|
|
40674
40587
|
}
|
|
40675
40588
|
return col;
|
|
@@ -40678,7 +40591,7 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40678
40591
|
if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
|
|
40679
40592
|
const { align } = this.getters.getCellStyle(position);
|
|
40680
40593
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
40681
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
40594
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
40682
40595
|
return align || evaluatedCell.defaultAlign;
|
|
40683
40596
|
}
|
|
40684
40597
|
createZoneBox(sheetId, zone, viewport) {
|
|
@@ -40702,9 +40615,9 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40702
40615
|
border: this.getters.getCellBorderWithFilterBorder(position) || void 0,
|
|
40703
40616
|
style: this.getters.getCellComputedStyle(position),
|
|
40704
40617
|
verticalAlign,
|
|
40705
|
-
isError: cell.type ===
|
|
40618
|
+
isError: cell.type === "error" && cell.error.isVerbose || this.getters.isDataValidationInvalid(position)
|
|
40706
40619
|
};
|
|
40707
|
-
if (cell.type ===
|
|
40620
|
+
if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
|
|
40708
40621
|
/** Icon CF */
|
|
40709
40622
|
const cfIcon = this.getters.getConditionalIcon(position);
|
|
40710
40623
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
@@ -40866,7 +40779,8 @@ var RendererPlugin = class extends UIPlugin {
|
|
|
40866
40779
|
* This plugin handles this internal state.
|
|
40867
40780
|
*/
|
|
40868
40781
|
var SelectionInputPlugin = class extends UIPlugin {
|
|
40869
|
-
|
|
40782
|
+
inputHasSingleRange;
|
|
40783
|
+
static layers = [1];
|
|
40870
40784
|
static getters = [];
|
|
40871
40785
|
ranges = [];
|
|
40872
40786
|
focusedRangeIndex = null;
|
|
@@ -41077,7 +40991,8 @@ var SelectionInputPlugin = class extends UIPlugin {
|
|
|
41077
40991
|
* This plugin handles this internal state.
|
|
41078
40992
|
*/
|
|
41079
40993
|
var SelectionInputsManagerPlugin = class extends UIPlugin {
|
|
41080
|
-
|
|
40994
|
+
config;
|
|
40995
|
+
static layers = [1];
|
|
41081
40996
|
static getters = [
|
|
41082
40997
|
"getSelectionInput",
|
|
41083
40998
|
"getSelectionInputValue",
|
|
@@ -41098,26 +41013,26 @@ var SelectionInputsManagerPlugin = class extends UIPlugin {
|
|
|
41098
41013
|
case "FOCUS_RANGE":
|
|
41099
41014
|
case "CHANGE_RANGE":
|
|
41100
41015
|
case "ADD_EMPTY_RANGE":
|
|
41101
|
-
case "REMOVE_RANGE": if (!this.inputs[cmd.id]) return
|
|
41016
|
+
case "REMOVE_RANGE": if (!this.inputs[cmd.id]) return "InvalidInputId";
|
|
41102
41017
|
}
|
|
41103
41018
|
switch (cmd.type) {
|
|
41104
41019
|
case "FOCUS_RANGE":
|
|
41105
41020
|
const index = this.currentInput?.getIndex(cmd.rangeId);
|
|
41106
|
-
if (this.focusedInputId === cmd.id && this.currentInput?.focusedRangeIndex === index) return
|
|
41021
|
+
if (this.focusedInputId === cmd.id && this.currentInput?.focusedRangeIndex === index) return "InputAlreadyFocused";
|
|
41107
41022
|
break;
|
|
41108
41023
|
case "ADD_RANGE":
|
|
41109
41024
|
case "ADD_EMPTY_RANGE":
|
|
41110
41025
|
const input = this.inputs[cmd.id];
|
|
41111
|
-
if (input.inputHasSingleRange && input.ranges.length === 1) return
|
|
41026
|
+
if (input.inputHasSingleRange && input.ranges.length === 1) return "MaximumRangesReached";
|
|
41112
41027
|
break;
|
|
41113
41028
|
case "REMOVE_RANGE":
|
|
41114
|
-
if (this.inputs[cmd.id].ranges.length === 1) return
|
|
41029
|
+
if (this.inputs[cmd.id].ranges.length === 1) return "MinimumRangesReached";
|
|
41115
41030
|
break;
|
|
41116
41031
|
case "CHANGE_RANGE":
|
|
41117
|
-
if (this.inputs[cmd.id].inputHasSingleRange && cmd.value.split(",").length > 1) return
|
|
41032
|
+
if (this.inputs[cmd.id].inputHasSingleRange && cmd.value.split(",").length > 1) return "MaximumRangesReached";
|
|
41118
41033
|
break;
|
|
41119
41034
|
}
|
|
41120
|
-
return
|
|
41035
|
+
return "Success";
|
|
41121
41036
|
}
|
|
41122
41037
|
handle(cmd) {
|
|
41123
41038
|
switch (cmd.type) {
|
|
@@ -41236,7 +41151,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41236
41151
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
41237
41152
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
41238
41153
|
}
|
|
41239
|
-
return
|
|
41154
|
+
return "Success";
|
|
41240
41155
|
}
|
|
41241
41156
|
handle(cmd) {
|
|
41242
41157
|
switch (cmd.type) {
|
|
@@ -41246,24 +41161,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41246
41161
|
}
|
|
41247
41162
|
}
|
|
41248
41163
|
checkMerge({ sheetId, zone }) {
|
|
41249
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
41164
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
41250
41165
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
41251
41166
|
sheetId,
|
|
41252
41167
|
col,
|
|
41253
41168
|
row
|
|
41254
|
-
}))) return
|
|
41255
|
-
return
|
|
41169
|
+
}))) return "InvalidSortZone";
|
|
41170
|
+
return "Success";
|
|
41256
41171
|
}
|
|
41257
41172
|
checkMergeSizes({ sheetId, zone }) {
|
|
41258
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
41173
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
41259
41174
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
41260
41175
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
41261
41176
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
41262
41177
|
if (!merges.every((merge) => {
|
|
41263
41178
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
41264
41179
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
41265
|
-
})) return
|
|
41266
|
-
return
|
|
41180
|
+
})) return "InvalidSortZone";
|
|
41181
|
+
return "Success";
|
|
41267
41182
|
}
|
|
41268
41183
|
/**
|
|
41269
41184
|
* safe-version of expandZone to make sure we don't get out of the grid
|
|
@@ -41419,9 +41334,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
41419
41334
|
col,
|
|
41420
41335
|
row
|
|
41421
41336
|
}).type));
|
|
41422
|
-
if (cells[0][0] ===
|
|
41423
|
-
if (cells.some((item) => item[0] ===
|
|
41424
|
-
else if (cells.some((item) => item[1] !==
|
|
41337
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
41338
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
41339
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
41425
41340
|
else return false;
|
|
41426
41341
|
}
|
|
41427
41342
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -41604,8 +41519,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
41604
41519
|
* sheet.
|
|
41605
41520
|
*/
|
|
41606
41521
|
checkSheetExists(cmd) {
|
|
41607
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
41608
|
-
return
|
|
41522
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
41523
|
+
return "Success";
|
|
41609
41524
|
}
|
|
41610
41525
|
/**
|
|
41611
41526
|
* Check if zones in the command are well formed and
|
|
@@ -41613,11 +41528,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
41613
41528
|
*/
|
|
41614
41529
|
checkZonesAreInSheet(cmd) {
|
|
41615
41530
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
41616
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
41531
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
41617
41532
|
const zones = this.getters.getCommandZones(cmd);
|
|
41618
|
-
if (!sheetId && zones.length > 0) return
|
|
41533
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
41619
41534
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
41620
|
-
return
|
|
41535
|
+
return "Success";
|
|
41621
41536
|
}
|
|
41622
41537
|
autoResizeRows(sheetId, rows) {
|
|
41623
41538
|
const rowSizes = [];
|
|
@@ -41890,13 +41805,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
41890
41805
|
allowDispatch(cmd) {
|
|
41891
41806
|
switch (cmd.type) {
|
|
41892
41807
|
case "REQUEST_UNDO":
|
|
41893
|
-
if (!this.canUndo()) return
|
|
41808
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
41894
41809
|
break;
|
|
41895
41810
|
case "REQUEST_REDO":
|
|
41896
|
-
if (!this.canRedo()) return
|
|
41811
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
41897
41812
|
break;
|
|
41898
41813
|
}
|
|
41899
|
-
return
|
|
41814
|
+
return "Success";
|
|
41900
41815
|
}
|
|
41901
41816
|
handle(cmd) {
|
|
41902
41817
|
switch (cmd.type) {
|
|
@@ -41958,7 +41873,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41958
41873
|
switch (cmd.type) {
|
|
41959
41874
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
41960
41875
|
}
|
|
41961
|
-
return
|
|
41876
|
+
return "Success";
|
|
41962
41877
|
}
|
|
41963
41878
|
handle(cmd) {
|
|
41964
41879
|
switch (cmd.type) {
|
|
@@ -41969,7 +41884,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
41969
41884
|
}
|
|
41970
41885
|
getAutomaticSeparator() {
|
|
41971
41886
|
const cells = this.getters.getSelectedCells();
|
|
41972
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
41887
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
41973
41888
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
41974
41889
|
if (separator) return separator;
|
|
41975
41890
|
}
|
|
@@ -42105,24 +42020,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
42105
42020
|
});
|
|
42106
42021
|
}
|
|
42107
42022
|
checkSingleColSelected() {
|
|
42108
|
-
if (!this.getters.isSingleColSelected()) return
|
|
42109
|
-
return
|
|
42023
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
42024
|
+
return "Success";
|
|
42110
42025
|
}
|
|
42111
42026
|
checkNonEmptySelector(cmd) {
|
|
42112
|
-
if (cmd.separator === "") return
|
|
42113
|
-
return
|
|
42027
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
42028
|
+
return "Success";
|
|
42114
42029
|
}
|
|
42115
42030
|
checkNotOverwritingContent(cmd) {
|
|
42116
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
42031
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
42117
42032
|
const selection = this.getters.getSelectedZones()[0];
|
|
42118
42033
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
42119
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
42120
|
-
return
|
|
42034
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
42035
|
+
return "Success";
|
|
42121
42036
|
}
|
|
42122
42037
|
checkSeparatorInSelection({ separator }) {
|
|
42123
42038
|
const cells = this.getters.getSelectedCells();
|
|
42124
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
42125
|
-
return
|
|
42039
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
42040
|
+
return "NoSplitSeparatorInSelection";
|
|
42126
42041
|
}
|
|
42127
42042
|
};
|
|
42128
42043
|
|
|
@@ -42130,6 +42045,9 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
42130
42045
|
//#region src/helpers/clipboard/clipboard_figure_state.ts
|
|
42131
42046
|
/** State of the clipboard when copying/cutting figures */
|
|
42132
42047
|
var ClipboardFigureState = class {
|
|
42048
|
+
operation;
|
|
42049
|
+
getters;
|
|
42050
|
+
dispatch;
|
|
42133
42051
|
sheetId;
|
|
42134
42052
|
copiedFigure;
|
|
42135
42053
|
copiedFigureContent;
|
|
@@ -42154,12 +42072,12 @@ var ClipboardFigureState = class {
|
|
|
42154
42072
|
}
|
|
42155
42073
|
}
|
|
42156
42074
|
isCutAllowed(target) {
|
|
42157
|
-
return
|
|
42075
|
+
return "Success";
|
|
42158
42076
|
}
|
|
42159
42077
|
isPasteAllowed(target, option) {
|
|
42160
|
-
if (target.length === 0) return
|
|
42161
|
-
if (option?.pasteOption !== void 0) return
|
|
42162
|
-
return
|
|
42078
|
+
if (target.length === 0) return "EmptyTarget";
|
|
42079
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
42080
|
+
return "Success";
|
|
42163
42081
|
}
|
|
42164
42082
|
/**
|
|
42165
42083
|
* Paste the clipboard content in the given target
|
|
@@ -42189,7 +42107,7 @@ var ClipboardFigureState = class {
|
|
|
42189
42107
|
this.dispatch("SELECT_FIGURE", { id: newId });
|
|
42190
42108
|
}
|
|
42191
42109
|
getClipboardContent() {
|
|
42192
|
-
return { [
|
|
42110
|
+
return { ["text/plain"]: " " };
|
|
42193
42111
|
}
|
|
42194
42112
|
isColRowDirtyingClipboard(position, dimension) {
|
|
42195
42113
|
return false;
|
|
@@ -42197,6 +42115,8 @@ var ClipboardFigureState = class {
|
|
|
42197
42115
|
drawClipboard(renderingContext) {}
|
|
42198
42116
|
};
|
|
42199
42117
|
var ClipboardFigureChart = class {
|
|
42118
|
+
dispatch;
|
|
42119
|
+
sheetId;
|
|
42200
42120
|
copiedChart;
|
|
42201
42121
|
constructor(dispatch, getters, sheetId, copiedFigureId) {
|
|
42202
42122
|
this.dispatch = dispatch;
|
|
@@ -42217,11 +42137,14 @@ var ClipboardFigureChart = class {
|
|
|
42217
42137
|
}
|
|
42218
42138
|
};
|
|
42219
42139
|
var ClipboardFigureImage = class {
|
|
42140
|
+
dispatch;
|
|
42141
|
+
sheetId;
|
|
42220
42142
|
copiedImage;
|
|
42221
42143
|
constructor(dispatch, getters, sheetId, copiedFigureId) {
|
|
42222
42144
|
this.dispatch = dispatch;
|
|
42223
42145
|
this.sheetId = sheetId;
|
|
42224
|
-
|
|
42146
|
+
const image = getters.getImage(copiedFigureId);
|
|
42147
|
+
this.copiedImage = deepCopy(image);
|
|
42225
42148
|
}
|
|
42226
42149
|
paste(sheetId, figureId, position, size) {
|
|
42227
42150
|
const copy = deepCopy(this.copiedImage);
|
|
@@ -42247,8 +42170,8 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42247
42170
|
isPasteAllowed(target, clipboardOption) {
|
|
42248
42171
|
const sheetId = this.getters.getActiveSheetId();
|
|
42249
42172
|
const pasteZone = this.getPasteZone(target);
|
|
42250
|
-
if (this.getters.doesIntersectMerge(sheetId, pasteZone)) return
|
|
42251
|
-
return
|
|
42173
|
+
if (this.getters.doesIntersectMerge(sheetId, pasteZone)) return "WillRemoveExistingMerge";
|
|
42174
|
+
return "Success";
|
|
42252
42175
|
}
|
|
42253
42176
|
paste(target, clipboardOption) {
|
|
42254
42177
|
if (clipboardOption?.pasteOption === "onlyFormat") return;
|
|
@@ -42280,7 +42203,7 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42280
42203
|
}, { scrollIntoView: false });
|
|
42281
42204
|
}
|
|
42282
42205
|
getClipboardContent() {
|
|
42283
|
-
return { [
|
|
42206
|
+
return { ["text/plain"]: this.values.map((values) => values.join(" ")).join("\n") };
|
|
42284
42207
|
}
|
|
42285
42208
|
getPasteZone(target) {
|
|
42286
42209
|
const height = this.values.length;
|
|
@@ -42304,7 +42227,7 @@ var ClipboardOsState = class extends ClipboardCellsAbstractState {
|
|
|
42304
42227
|
* application, and with the OS clipboard as well.
|
|
42305
42228
|
*/
|
|
42306
42229
|
var ClipboardPlugin = class extends UIPlugin {
|
|
42307
|
-
static layers = [
|
|
42230
|
+
static layers = [2];
|
|
42308
42231
|
static getters = [
|
|
42309
42232
|
"getClipboardContent",
|
|
42310
42233
|
"getClipboardTextContent",
|
|
@@ -42322,18 +42245,18 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42322
42245
|
const zones = this.getters.getSelectedZones();
|
|
42323
42246
|
return this.getClipboardState(zones, cmd.type).isCutAllowed(zones);
|
|
42324
42247
|
case "PASTE":
|
|
42325
|
-
if (!this.state) return
|
|
42248
|
+
if (!this.state) return "EmptyClipboard";
|
|
42326
42249
|
const pasteOption = cmd.pasteOption || (this.paintFormatStatus !== "inactive" ? "onlyFormat" : void 0);
|
|
42327
42250
|
return this.state.isPasteAllowed(cmd.target, { pasteOption });
|
|
42328
42251
|
case "PASTE_FROM_OS_CLIPBOARD": return new ClipboardOsState(cmd.text, this.getters, this.dispatch, this.selection).isPasteAllowed(cmd.target, { pasteOption: cmd.pasteOption });
|
|
42329
42252
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
42330
42253
|
const zones = this.getters.getSelectedZones();
|
|
42331
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
42254
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
42332
42255
|
break;
|
|
42333
42256
|
}
|
|
42334
42257
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
42335
42258
|
const zones = this.getters.getSelectedZones();
|
|
42336
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
42259
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
42337
42260
|
break;
|
|
42338
42261
|
}
|
|
42339
42262
|
case "INSERT_CELL": {
|
|
@@ -42344,9 +42267,9 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42344
42267
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
42345
42268
|
return this.getClipboardStateForCopyCells(cut, "CUT", "shiftCells").isPasteAllowed(paste);
|
|
42346
42269
|
}
|
|
42347
|
-
case "ACTIVATE_PAINT_FORMAT": if (this.paintFormatStatus !== "inactive") return
|
|
42270
|
+
case "ACTIVATE_PAINT_FORMAT": if (this.paintFormatStatus !== "inactive") return "AlreadyInPaintingFormatMode";
|
|
42348
42271
|
}
|
|
42349
|
-
return
|
|
42272
|
+
return "Success";
|
|
42350
42273
|
}
|
|
42351
42274
|
handle(cmd) {
|
|
42352
42275
|
switch (cmd.type) {
|
|
@@ -42483,10 +42406,10 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
42483
42406
|
* considered as a copy content.
|
|
42484
42407
|
*/
|
|
42485
42408
|
getClipboardContent() {
|
|
42486
|
-
return this.state?.getClipboardContent() || { [
|
|
42409
|
+
return this.state?.getClipboardContent() || { ["text/plain"]: " " };
|
|
42487
42410
|
}
|
|
42488
42411
|
getClipboardTextContent() {
|
|
42489
|
-
return this.state?.getClipboardContent()[
|
|
42412
|
+
return this.state?.getClipboardContent()["text/plain"] || " ";
|
|
42490
42413
|
}
|
|
42491
42414
|
isCutOperation() {
|
|
42492
42415
|
return this.state ? this.state.operation === "CUT" : false;
|
|
@@ -42681,10 +42604,10 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
42681
42604
|
}
|
|
42682
42605
|
break;
|
|
42683
42606
|
case "STOP_EDITION":
|
|
42684
|
-
if (this.mode === "inactive") return
|
|
42607
|
+
if (this.mode === "inactive") return "Success";
|
|
42685
42608
|
return this.checkDataValidation(cmd);
|
|
42686
42609
|
}
|
|
42687
|
-
return
|
|
42610
|
+
return "Success";
|
|
42688
42611
|
}
|
|
42689
42612
|
handleEvent(event) {
|
|
42690
42613
|
const sheetId = this.getters.getActiveSheetId();
|
|
@@ -42867,7 +42790,7 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
42867
42790
|
});
|
|
42868
42791
|
}
|
|
42869
42792
|
validateSelection(length, start, end) {
|
|
42870
|
-
return start >= 0 && start <= length && end >= 0 && end <= length ?
|
|
42793
|
+
return start >= 0 && start <= length && end >= 0 && end <= length ? "Success" : "WrongComposerSelection";
|
|
42871
42794
|
}
|
|
42872
42795
|
onColumnsRemoved(cmd) {
|
|
42873
42796
|
if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
|
|
@@ -43023,11 +42946,11 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
43023
42946
|
if (cell?.isFormula) return localizeFormula(cell.content, locale);
|
|
43024
42947
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
43025
42948
|
switch (type) {
|
|
43026
|
-
case
|
|
43027
|
-
case
|
|
43028
|
-
case
|
|
43029
|
-
case
|
|
43030
|
-
case
|
|
42949
|
+
case "text":
|
|
42950
|
+
case "empty": return value;
|
|
42951
|
+
case "boolean": return formattedValue;
|
|
42952
|
+
case "error": return cell?.content || "";
|
|
42953
|
+
case "number":
|
|
43031
42954
|
if (format && isDateTimeFormat(format)) {
|
|
43032
42955
|
if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
|
|
43033
42956
|
return formatValue(value, {
|
|
@@ -43249,12 +43172,12 @@ var EditionPlugin = class extends UIPlugin {
|
|
|
43249
43172
|
try {
|
|
43250
43173
|
const content = this.getCurrentCanonicalContent();
|
|
43251
43174
|
const cellValue = content.startsWith("=") ? this.getters.evaluateFormula(this.sheetId, content) : parseLiteral(content, this.getters.getLocale());
|
|
43252
|
-
if (isMatrix(cellValue)) return
|
|
43175
|
+
if (isMatrix(cellValue)) return "Success";
|
|
43253
43176
|
const validationResult = this.getters.getValidationResultForCellValue(cellValue, cellPosition);
|
|
43254
|
-
if (!validationResult.isValid && validationResult.rule.isBlocking) return
|
|
43255
|
-
return
|
|
43177
|
+
if (!validationResult.isValid && validationResult.rule.isBlocking) return "BlockingValidationRule";
|
|
43178
|
+
return "Success";
|
|
43256
43179
|
} catch (e) {
|
|
43257
|
-
return this.getters.getValidationRuleForCell(cellPosition)?.isBlocking ?
|
|
43180
|
+
return this.getters.getValidationRuleForCell(cellPosition)?.isBlocking ? "BlockingValidationRule" : "Success";
|
|
43258
43181
|
}
|
|
43259
43182
|
}
|
|
43260
43183
|
};
|
|
@@ -43274,10 +43197,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
43274
43197
|
allowDispatch(cmd) {
|
|
43275
43198
|
switch (cmd.type) {
|
|
43276
43199
|
case "UPDATE_FILTER":
|
|
43277
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
43200
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
43278
43201
|
break;
|
|
43279
43202
|
}
|
|
43280
|
-
return
|
|
43203
|
+
return "Success";
|
|
43281
43204
|
}
|
|
43282
43205
|
handle(cmd) {
|
|
43283
43206
|
switch (cmd.type) {
|
|
@@ -43478,41 +43401,41 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
43478
43401
|
const selectionStatisticFunctions = [
|
|
43479
43402
|
{
|
|
43480
43403
|
name: _t("Sum"),
|
|
43481
|
-
types: [
|
|
43404
|
+
types: ["number"],
|
|
43482
43405
|
compute: (values, locale) => SUM.compute.bind({ locale })([values])
|
|
43483
43406
|
},
|
|
43484
43407
|
{
|
|
43485
43408
|
name: _t("Avg"),
|
|
43486
|
-
types: [
|
|
43409
|
+
types: ["number"],
|
|
43487
43410
|
compute: (values, locale) => AVERAGE.compute.bind({ locale })([values])
|
|
43488
43411
|
},
|
|
43489
43412
|
{
|
|
43490
43413
|
name: _t("Min"),
|
|
43491
|
-
types: [
|
|
43414
|
+
types: ["number"],
|
|
43492
43415
|
compute: (values, locale) => MIN.compute.bind({ locale })([values])
|
|
43493
43416
|
},
|
|
43494
43417
|
{
|
|
43495
43418
|
name: _t("Max"),
|
|
43496
|
-
types: [
|
|
43419
|
+
types: ["number"],
|
|
43497
43420
|
compute: (values, locale) => MAX.compute.bind({ locale })([values])
|
|
43498
43421
|
},
|
|
43499
43422
|
{
|
|
43500
43423
|
name: _t("Count"),
|
|
43501
43424
|
types: [
|
|
43502
|
-
|
|
43503
|
-
|
|
43504
|
-
|
|
43505
|
-
|
|
43425
|
+
"number",
|
|
43426
|
+
"text",
|
|
43427
|
+
"boolean",
|
|
43428
|
+
"error"
|
|
43506
43429
|
],
|
|
43507
43430
|
compute: (values, locale) => COUNTA.compute.bind({ locale })([values])
|
|
43508
43431
|
},
|
|
43509
43432
|
{
|
|
43510
43433
|
name: _t("Count Numbers"),
|
|
43511
43434
|
types: [
|
|
43512
|
-
|
|
43513
|
-
|
|
43514
|
-
|
|
43515
|
-
|
|
43435
|
+
"number",
|
|
43436
|
+
"text",
|
|
43437
|
+
"boolean",
|
|
43438
|
+
"error"
|
|
43516
43439
|
],
|
|
43517
43440
|
compute: (values, locale) => COUNT.compute.bind({ locale })([values])
|
|
43518
43441
|
}
|
|
@@ -43521,7 +43444,7 @@ const selectionStatisticFunctions = [
|
|
|
43521
43444
|
* SelectionPlugin
|
|
43522
43445
|
*/
|
|
43523
43446
|
var GridSelectionPlugin = class extends UIPlugin {
|
|
43524
|
-
static layers = [
|
|
43447
|
+
static layers = [6];
|
|
43525
43448
|
static getters = [
|
|
43526
43449
|
"getActiveSheet",
|
|
43527
43450
|
"getActiveSheetId",
|
|
@@ -43578,11 +43501,11 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43578
43501
|
this.getters.getSheet(cmd.sheetIdTo);
|
|
43579
43502
|
break;
|
|
43580
43503
|
} catch (error) {
|
|
43581
|
-
return
|
|
43504
|
+
return "InvalidSheetId";
|
|
43582
43505
|
}
|
|
43583
43506
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
43584
43507
|
}
|
|
43585
|
-
return
|
|
43508
|
+
return "Success";
|
|
43586
43509
|
}
|
|
43587
43510
|
handleEvent(event) {
|
|
43588
43511
|
const anchor = event.anchor;
|
|
@@ -43797,7 +43720,7 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43797
43720
|
col,
|
|
43798
43721
|
row
|
|
43799
43722
|
});
|
|
43800
|
-
if (evaluatedCell.type !==
|
|
43723
|
+
if (evaluatedCell.type !== "empty") cells.add(evaluatedCell);
|
|
43801
43724
|
}
|
|
43802
43725
|
const cellsTypes = /* @__PURE__ */ new Set();
|
|
43803
43726
|
const cellsValues = [];
|
|
@@ -43825,7 +43748,7 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43825
43748
|
col,
|
|
43826
43749
|
row
|
|
43827
43750
|
});
|
|
43828
|
-
if (cell.type ===
|
|
43751
|
+
if (cell.type === "number") {
|
|
43829
43752
|
n++;
|
|
43830
43753
|
aggregate += cell.value;
|
|
43831
43754
|
}
|
|
@@ -43922,7 +43845,8 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
43922
43845
|
}, [zone]);
|
|
43923
43846
|
}
|
|
43924
43847
|
setActiveSheet(id) {
|
|
43925
|
-
|
|
43848
|
+
const sheet = this.getters.getSheet(id);
|
|
43849
|
+
this.activeSheet = sheet;
|
|
43926
43850
|
}
|
|
43927
43851
|
activateNextSheet(direction) {
|
|
43928
43852
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -44041,11 +43965,11 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
44041
43965
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
44042
43966
|
const id = cmd.sheetId;
|
|
44043
43967
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
44044
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
43968
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
44045
43969
|
const headers = [cmd.base, ...cmd.elements];
|
|
44046
43970
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
44047
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
44048
|
-
return
|
|
43971
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
43972
|
+
return "Success";
|
|
44049
43973
|
}
|
|
44050
43974
|
fallbackToVisibleSheet() {
|
|
44051
43975
|
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
@@ -44126,6 +44050,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
44126
44050
|
//#endregion
|
|
44127
44051
|
//#region src/helpers/internal_viewport.ts
|
|
44128
44052
|
var InternalViewport = class {
|
|
44053
|
+
getters;
|
|
44054
|
+
sheetId;
|
|
44055
|
+
boundaries;
|
|
44129
44056
|
top;
|
|
44130
44057
|
bottom;
|
|
44131
44058
|
left;
|
|
@@ -44476,7 +44403,7 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
44476
44403
|
switch (cmd.type) {
|
|
44477
44404
|
case "SET_VIEWPORT_OFFSET": return this.checkScrollingDirection(cmd);
|
|
44478
44405
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
44479
|
-
default: return
|
|
44406
|
+
default: return "Success";
|
|
44480
44407
|
}
|
|
44481
44408
|
}
|
|
44482
44409
|
handleEvent(event) {
|
|
@@ -44857,18 +44784,18 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
44857
44784
|
return Object.values(this.viewports[sheetId]).filter(isDefined$1);
|
|
44858
44785
|
}
|
|
44859
44786
|
checkPositiveDimension(cmd) {
|
|
44860
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
44861
|
-
return
|
|
44787
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
44788
|
+
return "Success";
|
|
44862
44789
|
}
|
|
44863
44790
|
checkValuesAreDifferent(cmd) {
|
|
44864
44791
|
const { height, width } = this.getSheetViewDimension();
|
|
44865
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
44866
|
-
return
|
|
44792
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
44793
|
+
return "Success";
|
|
44867
44794
|
}
|
|
44868
44795
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
44869
44796
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
44870
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
44871
|
-
return
|
|
44797
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
44798
|
+
return "Success";
|
|
44872
44799
|
}
|
|
44873
44800
|
getMainViewport(sheetId) {
|
|
44874
44801
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -45462,9 +45389,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
45462
45389
|
sheetId,
|
|
45463
45390
|
name
|
|
45464
45391
|
});
|
|
45465
|
-
if (result.reasons.includes(
|
|
45466
|
-
else if (result.reasons.includes(
|
|
45467
|
-
else if (result.reasons.includes(
|
|
45392
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
45393
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
45394
|
+
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);
|
|
45468
45395
|
}
|
|
45469
45396
|
|
|
45470
45397
|
//#endregion
|
|
@@ -45963,7 +45890,8 @@ var SpreadsheetDashboard = class extends _odoo_owl.Component {
|
|
|
45963
45890
|
canvasPosition;
|
|
45964
45891
|
hoveredCell;
|
|
45965
45892
|
setup() {
|
|
45966
|
-
|
|
45893
|
+
const gridRef = (0, _odoo_owl.useRef)("grid");
|
|
45894
|
+
this.canvasPosition = useAbsoluteBoundingRect(gridRef);
|
|
45967
45895
|
this.hoveredCell = (0, _odoo_owl.useState)({
|
|
45968
45896
|
col: void 0,
|
|
45969
45897
|
row: void 0
|
|
@@ -46078,7 +46006,7 @@ SpreadsheetDashboard.props = {};
|
|
|
46078
46006
|
css`
|
|
46079
46007
|
.o-header-group {
|
|
46080
46008
|
.o-header-group-header {
|
|
46081
|
-
z-index: ${
|
|
46009
|
+
z-index: ${6};
|
|
46082
46010
|
.o-group-fold-button {
|
|
46083
46011
|
cursor: pointer;
|
|
46084
46012
|
width: 13px;
|
|
@@ -46872,7 +46800,7 @@ var TopBarComposer = class extends _odoo_owl.Component {
|
|
|
46872
46800
|
});
|
|
46873
46801
|
return cssPropertiesToCss({
|
|
46874
46802
|
"border-color": SELECTION_BORDER_COLOR,
|
|
46875
|
-
"z-index": String(
|
|
46803
|
+
"z-index": String(30)
|
|
46876
46804
|
});
|
|
46877
46805
|
}
|
|
46878
46806
|
};
|
|
@@ -47058,7 +46986,7 @@ css`
|
|
|
47058
46986
|
overflow-y: auto;
|
|
47059
46987
|
overflow-x: hidden;
|
|
47060
46988
|
padding: 2px;
|
|
47061
|
-
z-index: ${
|
|
46989
|
+
z-index: ${21};
|
|
47062
46990
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
47063
46991
|
background-color: white;
|
|
47064
46992
|
|
|
@@ -47196,6 +47124,7 @@ function instantiateClipboard() {
|
|
|
47196
47124
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
47197
47125
|
}
|
|
47198
47126
|
var WebClipboardWrapper = class {
|
|
47127
|
+
clipboard;
|
|
47199
47128
|
constructor(clipboard) {
|
|
47200
47129
|
this.clipboard = clipboard;
|
|
47201
47130
|
}
|
|
@@ -47225,8 +47154,8 @@ var WebClipboardWrapper = class {
|
|
|
47225
47154
|
}
|
|
47226
47155
|
getClipboardItems(content) {
|
|
47227
47156
|
return [new ClipboardItem({
|
|
47228
|
-
[
|
|
47229
|
-
[
|
|
47157
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
47158
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
47230
47159
|
})];
|
|
47231
47160
|
}
|
|
47232
47161
|
getBlob(clipboardContent, type) {
|
|
@@ -47645,6 +47574,8 @@ function createEmptyStructure(node) {
|
|
|
47645
47574
|
* @param operations initial operations
|
|
47646
47575
|
*/
|
|
47647
47576
|
var Branch = class Branch {
|
|
47577
|
+
buildTransformation;
|
|
47578
|
+
operations;
|
|
47648
47579
|
constructor(buildTransformation, operations = []) {
|
|
47649
47580
|
this.buildTransformation = buildTransformation;
|
|
47650
47581
|
this.operations = operations;
|
|
@@ -47761,6 +47692,8 @@ var Branch = class Branch {
|
|
|
47761
47692
|
* to revert it).
|
|
47762
47693
|
*/
|
|
47763
47694
|
var Operation = class {
|
|
47695
|
+
id;
|
|
47696
|
+
data;
|
|
47764
47697
|
constructor(id, data) {
|
|
47765
47698
|
this.id = id;
|
|
47766
47699
|
this.data = data;
|
|
@@ -47770,6 +47703,8 @@ var Operation = class {
|
|
|
47770
47703
|
}
|
|
47771
47704
|
};
|
|
47772
47705
|
var LazyOperation = class LazyOperation {
|
|
47706
|
+
id;
|
|
47707
|
+
lazyData;
|
|
47773
47708
|
constructor(id, lazyData) {
|
|
47774
47709
|
this.id = id;
|
|
47775
47710
|
this.lazyData = lazyData;
|
|
@@ -47795,6 +47730,7 @@ var LazyOperation = class LazyOperation {
|
|
|
47795
47730
|
* ```
|
|
47796
47731
|
*/
|
|
47797
47732
|
var OperationSequence = class OperationSequence {
|
|
47733
|
+
operations;
|
|
47798
47734
|
constructor(operations) {
|
|
47799
47735
|
this.operations = operations;
|
|
47800
47736
|
}
|
|
@@ -47870,6 +47806,7 @@ var OperationSequence = class OperationSequence {
|
|
|
47870
47806
|
*
|
|
47871
47807
|
*/
|
|
47872
47808
|
var Tree = class {
|
|
47809
|
+
buildTransformation;
|
|
47873
47810
|
branches;
|
|
47874
47811
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
47875
47812
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -48462,6 +48399,7 @@ var EventStream = class {
|
|
|
48462
48399
|
* with the new selected anchor
|
|
48463
48400
|
*/
|
|
48464
48401
|
var SelectionStreamProcessorImpl = class {
|
|
48402
|
+
getters;
|
|
48465
48403
|
stream;
|
|
48466
48404
|
/**
|
|
48467
48405
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -48557,7 +48495,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48557
48495
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
48558
48496
|
*/
|
|
48559
48497
|
moveAnchorCell(direction, step = 1) {
|
|
48560
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
48498
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
48561
48499
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
48562
48500
|
return this.selectCell(col, row);
|
|
48563
48501
|
}
|
|
@@ -48619,7 +48557,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48619
48557
|
* of the anchor zone which moves.
|
|
48620
48558
|
*/
|
|
48621
48559
|
resizeAnchorZone(direction, step = 1) {
|
|
48622
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
48560
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
48623
48561
|
const sheetId = this.getters.getActiveSheetId();
|
|
48624
48562
|
const anchor = this.anchor;
|
|
48625
48563
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -48865,7 +48803,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48865
48803
|
previousAnchor: deepCopy(this.anchor)
|
|
48866
48804
|
};
|
|
48867
48805
|
const commandResult = this.checkEventAnchorZone(event);
|
|
48868
|
-
if (commandResult !==
|
|
48806
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
48869
48807
|
this.anchor = event.anchor;
|
|
48870
48808
|
this.stream.send(event);
|
|
48871
48809
|
return DispatchResult.Success;
|
|
@@ -48875,15 +48813,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
48875
48813
|
}
|
|
48876
48814
|
checkAnchorZone(anchor) {
|
|
48877
48815
|
const { cell, zone } = anchor;
|
|
48878
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
48816
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
48879
48817
|
const { left, right, top, bottom } = zone;
|
|
48880
48818
|
const sheetId = this.getters.getActiveSheetId();
|
|
48881
48819
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
48882
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
48883
|
-
return
|
|
48820
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
48821
|
+
return "Success";
|
|
48884
48822
|
}
|
|
48885
48823
|
checkAnchorZoneOrThrow(anchor) {
|
|
48886
|
-
if (this.checkAnchorZone(anchor) ===
|
|
48824
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
48887
48825
|
}
|
|
48888
48826
|
/**
|
|
48889
48827
|
* ---- PRIVATE ----
|
|
@@ -49033,7 +48971,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
49033
48971
|
col,
|
|
49034
48972
|
row
|
|
49035
48973
|
});
|
|
49036
|
-
return this.getters.getEvaluatedCell(position).type ===
|
|
48974
|
+
return this.getters.getEvaluatedCell(position).type === "empty";
|
|
49037
48975
|
}
|
|
49038
48976
|
/** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
|
|
49039
48977
|
*
|
|
@@ -49540,7 +49478,7 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
49540
49478
|
return ast;
|
|
49541
49479
|
});
|
|
49542
49480
|
ast = convertAstNodes(ast, "REFERENCE", (ast) => {
|
|
49543
|
-
return ast.value ===
|
|
49481
|
+
return ast.value === "#REF" ? {
|
|
49544
49482
|
...ast,
|
|
49545
49483
|
value: "#REF!"
|
|
49546
49484
|
} : ast;
|
|
@@ -49548,7 +49486,7 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
49548
49486
|
return ast ? astToFormula(ast) : formulaText;
|
|
49549
49487
|
}
|
|
49550
49488
|
function adaptFormulaValueToExcel(formulaValue) {
|
|
49551
|
-
return formulaValue ===
|
|
49489
|
+
return formulaValue === "#REF" ? "#REF!" : formulaValue;
|
|
49552
49490
|
}
|
|
49553
49491
|
/**
|
|
49554
49492
|
* Some Excel function need required args that might not be mandatory in o-spreadsheet.
|
|
@@ -50599,13 +50537,6 @@ function createRelRoot() {
|
|
|
50599
50537
|
|
|
50600
50538
|
//#endregion
|
|
50601
50539
|
//#region src/model.ts
|
|
50602
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
50603
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
50604
|
-
Status[Status["Running"] = 1] = "Running";
|
|
50605
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
50606
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
50607
|
-
return Status;
|
|
50608
|
-
}(Status || {});
|
|
50609
50540
|
var Model = class extends EventBus {
|
|
50610
50541
|
corePlugins = [];
|
|
50611
50542
|
featurePlugins = [];
|
|
@@ -50629,7 +50560,7 @@ var Model = class extends EventBus {
|
|
|
50629
50560
|
/**
|
|
50630
50561
|
* Internal status of the model. Important for command handling coordination
|
|
50631
50562
|
*/
|
|
50632
|
-
status =
|
|
50563
|
+
status = 0;
|
|
50633
50564
|
/**
|
|
50634
50565
|
* The config object contains some configuration flag and callbacks
|
|
50635
50566
|
*/
|
|
@@ -50754,7 +50685,7 @@ var Model = class extends EventBus {
|
|
|
50754
50685
|
onRemoteRevisionReceived({ commands }) {
|
|
50755
50686
|
for (const command of commands) {
|
|
50756
50687
|
const previousStatus = this.status;
|
|
50757
|
-
this.status =
|
|
50688
|
+
this.status = 2;
|
|
50758
50689
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
50759
50690
|
this.status = previousStatus;
|
|
50760
50691
|
}
|
|
@@ -50848,7 +50779,7 @@ var Model = class extends EventBus {
|
|
|
50848
50779
|
*/
|
|
50849
50780
|
checkDispatchAllowed(command) {
|
|
50850
50781
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
50851
|
-
if (results.some((r) => r !==
|
|
50782
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
50852
50783
|
return DispatchResult.Success;
|
|
50853
50784
|
}
|
|
50854
50785
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -50860,9 +50791,9 @@ var Model = class extends EventBus {
|
|
|
50860
50791
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
50861
50792
|
}
|
|
50862
50793
|
finalize() {
|
|
50863
|
-
this.status =
|
|
50794
|
+
this.status = 3;
|
|
50864
50795
|
for (const h of this.handlers) h.finalize();
|
|
50865
|
-
this.status =
|
|
50796
|
+
this.status = 0;
|
|
50866
50797
|
}
|
|
50867
50798
|
/**
|
|
50868
50799
|
* Check if a command can be dispatched, and returns a DispatchResult object with the possible
|
|
@@ -50888,23 +50819,23 @@ var Model = class extends EventBus {
|
|
|
50888
50819
|
dispatch = (type, payload) => {
|
|
50889
50820
|
const command = createCommand(type, payload);
|
|
50890
50821
|
const status = this.status;
|
|
50891
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
50892
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
50822
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
50823
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
50893
50824
|
switch (status) {
|
|
50894
|
-
case
|
|
50825
|
+
case 0:
|
|
50895
50826
|
const result = this.checkDispatchAllowed(command);
|
|
50896
50827
|
if (!result.isSuccessful) return result;
|
|
50897
|
-
this.status =
|
|
50828
|
+
this.status = 1;
|
|
50898
50829
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
50899
50830
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
50900
50831
|
this.dispatchToHandlers(this.handlers, command);
|
|
50901
50832
|
this.finalize();
|
|
50902
50833
|
});
|
|
50903
50834
|
this.session.save(command, commands, changes);
|
|
50904
|
-
this.status =
|
|
50835
|
+
this.status = 0;
|
|
50905
50836
|
this.trigger("update");
|
|
50906
50837
|
break;
|
|
50907
|
-
case
|
|
50838
|
+
case 1:
|
|
50908
50839
|
if (isCoreCommand(command)) {
|
|
50909
50840
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
50910
50841
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -50912,8 +50843,8 @@ var Model = class extends EventBus {
|
|
|
50912
50843
|
}
|
|
50913
50844
|
this.dispatchToHandlers(this.handlers, command);
|
|
50914
50845
|
break;
|
|
50915
|
-
case
|
|
50916
|
-
case
|
|
50846
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
50847
|
+
case 2:
|
|
50917
50848
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
50918
50849
|
this.dispatchToHandlers(this.handlers, command);
|
|
50919
50850
|
}
|
|
@@ -50926,7 +50857,7 @@ var Model = class extends EventBus {
|
|
|
50926
50857
|
dispatchFromCorePlugin = (type, payload) => {
|
|
50927
50858
|
const command = createCommand(type, payload);
|
|
50928
50859
|
const previousStatus = this.status;
|
|
50929
|
-
this.status =
|
|
50860
|
+
this.status = 2;
|
|
50930
50861
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
50931
50862
|
this.dispatchToHandlers(handlers, command);
|
|
50932
50863
|
this.status = previousStatus;
|
|
@@ -51165,6 +51096,6 @@ exports.setDefaultSheetViewSize = setDefaultSheetViewSize;
|
|
|
51165
51096
|
exports.setTranslationMethod = setTranslationMethod;
|
|
51166
51097
|
exports.tokenize = tokenize;
|
|
51167
51098
|
|
|
51168
|
-
__info__.version = "17.0.
|
|
51169
|
-
__info__.date = "2026-
|
|
51170
|
-
__info__.hash = "
|
|
51099
|
+
__info__.version = "17.0.100";
|
|
51100
|
+
__info__.date = "2026-06-06T06:18:41.503Z";
|
|
51101
|
+
__info__.hash = "55a7453";
|