@odoo/o-spreadsheet 19.3.3 → 19.3.4
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 +878 -843
- package/dist/o_spreadsheet.css +3 -3
- package/dist/o_spreadsheet.esm.js +878 -843
- package/dist/o_spreadsheet.iife.js +880 -845
- package/dist/o_spreadsheet.min.iife.js +387 -387
- package/dist/o_spreadsheet.xml +6 -5
- package/dist/types/components/menu/menu.d.ts +5 -0
- package/dist/types/components/side_panel/chart/chart_type_picker/chart_type_picker.d.ts +3 -1
- package/dist/types/helpers/figures/chart.d.ts +1 -2
- package/package.json +17 -17
package/dist/o_spreadsheet.cjs
CHANGED
|
@@ -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 19.3.
|
|
6
|
-
* @date 2026-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.3.4
|
|
6
|
+
* @date 2026-05-15T07:07:34.417Z
|
|
7
|
+
* @hash 1dc7b42
|
|
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) {
|
|
@@ -462,13 +462,6 @@ const borderStyles = [
|
|
|
462
462
|
function isMatrix(x) {
|
|
463
463
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
464
464
|
}
|
|
465
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
466
|
-
DIRECTION["UP"] = "up";
|
|
467
|
-
DIRECTION["DOWN"] = "down";
|
|
468
|
-
DIRECTION["LEFT"] = "left";
|
|
469
|
-
DIRECTION["RIGHT"] = "right";
|
|
470
|
-
return DIRECTION;
|
|
471
|
-
}({});
|
|
472
465
|
|
|
473
466
|
//#endregion
|
|
474
467
|
//#region src/helpers/misc.ts
|
|
@@ -925,7 +918,8 @@ var TokenizingChars = class {
|
|
|
925
918
|
}
|
|
926
919
|
shift() {
|
|
927
920
|
const current = this.current;
|
|
928
|
-
|
|
921
|
+
const next = this.text[++this.currentIndex];
|
|
922
|
+
this.current = next;
|
|
929
923
|
return current;
|
|
930
924
|
}
|
|
931
925
|
advanceBy(length) {
|
|
@@ -2113,6 +2107,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
2113
2107
|
}
|
|
2114
2108
|
};
|
|
2115
2109
|
var StoreFactory = class {
|
|
2110
|
+
get;
|
|
2116
2111
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
2117
2112
|
constructor(get) {
|
|
2118
2113
|
this.get = get;
|
|
@@ -2157,6 +2152,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2157
2152
|
return MetaStore;
|
|
2158
2153
|
}
|
|
2159
2154
|
var DisposableStore = class {
|
|
2155
|
+
get;
|
|
2160
2156
|
disposeCallbacks = [];
|
|
2161
2157
|
constructor(get) {
|
|
2162
2158
|
this.get = get;
|
|
@@ -2260,6 +2256,7 @@ function addRenderingLayer(layer, priority) {
|
|
|
2260
2256
|
//#endregion
|
|
2261
2257
|
//#region src/stores/renderer_store.ts
|
|
2262
2258
|
var RendererStore = class {
|
|
2259
|
+
layers;
|
|
2263
2260
|
mutators = [
|
|
2264
2261
|
"register",
|
|
2265
2262
|
"unRegister",
|
|
@@ -2914,6 +2911,7 @@ function getAlternatingColorsPalette(quantity) {
|
|
|
2914
2911
|
else return ALTERNATING_COLORS_XL;
|
|
2915
2912
|
}
|
|
2916
2913
|
var ColorGenerator = class {
|
|
2914
|
+
preferredColors;
|
|
2917
2915
|
currentColorIndex = 0;
|
|
2918
2916
|
palette;
|
|
2919
2917
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -3310,6 +3308,7 @@ const _t = function(s, ...values) {
|
|
|
3310
3308
|
return sprintf(_translate(s), ...values);
|
|
3311
3309
|
};
|
|
3312
3310
|
var LazyTranslatedString = class extends String {
|
|
3311
|
+
values;
|
|
3313
3312
|
constructor(str, values) {
|
|
3314
3313
|
super(str);
|
|
3315
3314
|
this.values = values;
|
|
@@ -3339,6 +3338,8 @@ const CellErrorType = {
|
|
|
3339
3338
|
};
|
|
3340
3339
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3341
3340
|
var EvaluationError = class {
|
|
3341
|
+
message;
|
|
3342
|
+
value;
|
|
3342
3343
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3343
3344
|
this.message = message;
|
|
3344
3345
|
this.value = value;
|
|
@@ -3371,6 +3372,7 @@ var UnknownFunctionError = class extends EvaluationError {
|
|
|
3371
3372
|
}
|
|
3372
3373
|
};
|
|
3373
3374
|
var SplillBlockedError = class extends EvaluationError {
|
|
3375
|
+
errorOriginPosition;
|
|
3374
3376
|
constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
|
|
3375
3377
|
super(message, CellErrorType.SpilledBlocked);
|
|
3376
3378
|
this.errorOriginPosition = errorOriginPosition;
|
|
@@ -5053,46 +5055,6 @@ function tokenizeInvalidRange(chars) {
|
|
|
5053
5055
|
|
|
5054
5056
|
//#endregion
|
|
5055
5057
|
//#region src/formulas/range_tokenizer.ts
|
|
5056
|
-
var State = /* @__PURE__ */ function(State) {
|
|
5057
|
-
/**
|
|
5058
|
-
* Initial state.
|
|
5059
|
-
* Expecting any reference for the left part of a range
|
|
5060
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5061
|
-
*/
|
|
5062
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
5063
|
-
/**
|
|
5064
|
-
* Expecting any reference for the right part of a range
|
|
5065
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5066
|
-
*/
|
|
5067
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
5068
|
-
/**
|
|
5069
|
-
* Expecting the separator without any constraint on the right part
|
|
5070
|
-
*/
|
|
5071
|
-
State[State["Separator"] = 2] = "Separator";
|
|
5072
|
-
/**
|
|
5073
|
-
* Expecting the separator for a full column range
|
|
5074
|
-
*/
|
|
5075
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
5076
|
-
/**
|
|
5077
|
-
* Expecting the separator for a full row range
|
|
5078
|
-
*/
|
|
5079
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
5080
|
-
/**
|
|
5081
|
-
* Expecting the right part of a full column range
|
|
5082
|
-
* e.g. "1", "A1"
|
|
5083
|
-
*/
|
|
5084
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
5085
|
-
/**
|
|
5086
|
-
* Expecting the right part of a full row range
|
|
5087
|
-
* e.g. "A", "A1"
|
|
5088
|
-
*/
|
|
5089
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
5090
|
-
/**
|
|
5091
|
-
* Final state. A range has been matched
|
|
5092
|
-
*/
|
|
5093
|
-
State[State["Found"] = 7] = "Found";
|
|
5094
|
-
return State;
|
|
5095
|
-
}(State || {});
|
|
5096
5058
|
const goTo = (state, guard = () => true) => [{
|
|
5097
5059
|
goTo: state,
|
|
5098
5060
|
guard
|
|
@@ -5102,41 +5064,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
5102
5064
|
guard
|
|
5103
5065
|
});
|
|
5104
5066
|
const machine = {
|
|
5105
|
-
[
|
|
5106
|
-
REFERENCE: goTo(
|
|
5107
|
-
NUMBER: goTo(
|
|
5108
|
-
SYMBOL: [goToMulti(
|
|
5109
|
-
},
|
|
5110
|
-
[
|
|
5111
|
-
SPACE: goTo(
|
|
5112
|
-
OPERATOR: goTo(
|
|
5113
|
-
},
|
|
5114
|
-
[
|
|
5115
|
-
SPACE: goTo(
|
|
5116
|
-
OPERATOR: goTo(
|
|
5117
|
-
},
|
|
5118
|
-
[
|
|
5119
|
-
SPACE: goTo(
|
|
5120
|
-
OPERATOR: goTo(
|
|
5121
|
-
},
|
|
5122
|
-
[
|
|
5123
|
-
SPACE: goTo(
|
|
5124
|
-
NUMBER: goTo(
|
|
5125
|
-
REFERENCE: goTo(
|
|
5126
|
-
SYMBOL: goTo(
|
|
5127
|
-
},
|
|
5128
|
-
[
|
|
5129
|
-
SPACE: goTo(
|
|
5130
|
-
SYMBOL: goTo(
|
|
5131
|
-
REFERENCE: goTo(
|
|
5132
|
-
},
|
|
5133
|
-
[
|
|
5134
|
-
SPACE: goTo(
|
|
5135
|
-
NUMBER: goTo(
|
|
5136
|
-
REFERENCE: goTo(
|
|
5137
|
-
SYMBOL: goTo(
|
|
5138
|
-
},
|
|
5139
|
-
[
|
|
5067
|
+
[0]: {
|
|
5068
|
+
REFERENCE: goTo(2),
|
|
5069
|
+
NUMBER: goTo(4),
|
|
5070
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
5071
|
+
},
|
|
5072
|
+
[3]: {
|
|
5073
|
+
SPACE: goTo(3),
|
|
5074
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
5075
|
+
},
|
|
5076
|
+
[4]: {
|
|
5077
|
+
SPACE: goTo(4),
|
|
5078
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
5079
|
+
},
|
|
5080
|
+
[2]: {
|
|
5081
|
+
SPACE: goTo(2),
|
|
5082
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
5083
|
+
},
|
|
5084
|
+
[1]: {
|
|
5085
|
+
SPACE: goTo(1),
|
|
5086
|
+
NUMBER: goTo(7),
|
|
5087
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5088
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
5089
|
+
},
|
|
5090
|
+
[5]: {
|
|
5091
|
+
SPACE: goTo(5),
|
|
5092
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
5093
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
5094
|
+
},
|
|
5095
|
+
[6]: {
|
|
5096
|
+
SPACE: goTo(6),
|
|
5097
|
+
NUMBER: goTo(7),
|
|
5098
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5099
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
5100
|
+
},
|
|
5101
|
+
[7]: {}
|
|
5140
5102
|
};
|
|
5141
5103
|
/**
|
|
5142
5104
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -5146,7 +5108,7 @@ const machine = {
|
|
|
5146
5108
|
*/
|
|
5147
5109
|
function matchReference(tokens) {
|
|
5148
5110
|
let head = 0;
|
|
5149
|
-
let transitions = machine[
|
|
5111
|
+
let transitions = machine[0];
|
|
5150
5112
|
let matchedTokens = "";
|
|
5151
5113
|
while (transitions !== void 0) {
|
|
5152
5114
|
const token = tokens[head++];
|
|
@@ -5155,7 +5117,7 @@ function matchReference(tokens) {
|
|
|
5155
5117
|
const nextState = transition ? transition.goTo : void 0;
|
|
5156
5118
|
switch (nextState) {
|
|
5157
5119
|
case void 0: return null;
|
|
5158
|
-
case
|
|
5120
|
+
case 7:
|
|
5159
5121
|
matchedTokens += token.value;
|
|
5160
5122
|
tokens.splice(0, head);
|
|
5161
5123
|
return {
|
|
@@ -6102,6 +6064,7 @@ function getRange(sheetXC, sheetId) {
|
|
|
6102
6064
|
//#endregion
|
|
6103
6065
|
//#region src/formulas/code_builder.ts
|
|
6104
6066
|
var FunctionCodeBuilder = class {
|
|
6067
|
+
scope;
|
|
6105
6068
|
code = "";
|
|
6106
6069
|
constructor(scope = new Scope()) {
|
|
6107
6070
|
this.scope = scope;
|
|
@@ -6117,6 +6080,8 @@ var FunctionCodeBuilder = class {
|
|
|
6117
6080
|
}
|
|
6118
6081
|
};
|
|
6119
6082
|
var FunctionCodeImpl = class {
|
|
6083
|
+
scope;
|
|
6084
|
+
returnExpression;
|
|
6120
6085
|
code;
|
|
6121
6086
|
constructor(scope, code, returnExpression) {
|
|
6122
6087
|
this.scope = scope;
|
|
@@ -6199,6 +6164,13 @@ const collator = new Intl.Collator("en", { sensitivity: "accent" });
|
|
|
6199
6164
|
* without recompiling it (for example when the formula is copied to another cell, or when we want to replace literal values but keep the same structure).
|
|
6200
6165
|
* */
|
|
6201
6166
|
var CompiledFormula = class CompiledFormula {
|
|
6167
|
+
sheetId;
|
|
6168
|
+
tokens;
|
|
6169
|
+
literalValues;
|
|
6170
|
+
symbols;
|
|
6171
|
+
isBadExpression;
|
|
6172
|
+
normalizedFormula;
|
|
6173
|
+
execute;
|
|
6202
6174
|
rangeDependencies;
|
|
6203
6175
|
hasDependencies;
|
|
6204
6176
|
constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
|
|
@@ -7804,7 +7776,7 @@ var DispatchResult = class {
|
|
|
7804
7776
|
constructor(results = []) {
|
|
7805
7777
|
if (!Array.isArray(results)) results = [results];
|
|
7806
7778
|
results = [...new Set(results)];
|
|
7807
|
-
this.reasons = results.filter((result) => result !==
|
|
7779
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
7808
7780
|
}
|
|
7809
7781
|
/**
|
|
7810
7782
|
* Static helper which returns a successful DispatchResult
|
|
@@ -8002,7 +7974,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
8002
7974
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
8003
7975
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
8004
7976
|
sheetIdTo: sheetId
|
|
8005
|
-
}).isCancelledBecause(
|
|
7977
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
8006
7978
|
type: "warning",
|
|
8007
7979
|
sticky: false,
|
|
8008
7980
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -8136,22 +8108,22 @@ function _createEvaluatedCell(functionResult, locale, position, cell) {
|
|
|
8136
8108
|
return textCell(value, format, formattedValue, position);
|
|
8137
8109
|
}
|
|
8138
8110
|
function isNumberResult(result) {
|
|
8139
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8111
|
+
return !!result && getEvaluatedCellType(result) === "number";
|
|
8140
8112
|
}
|
|
8141
8113
|
function isTextResult(result) {
|
|
8142
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8114
|
+
return !!result && getEvaluatedCellType(result) === "text";
|
|
8143
8115
|
}
|
|
8144
8116
|
function isErrorResult(result) {
|
|
8145
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8117
|
+
return !!result && getEvaluatedCellType(result) === "error";
|
|
8146
8118
|
}
|
|
8147
8119
|
function getEvaluatedCellType({ value, format }) {
|
|
8148
|
-
if (value === null) return
|
|
8149
|
-
else if (isEvaluationError(value)) return
|
|
8150
|
-
else if (isTextFormat(format)) return
|
|
8120
|
+
if (value === null) return "empty";
|
|
8121
|
+
else if (isEvaluationError(value)) return "error";
|
|
8122
|
+
else if (isTextFormat(format)) return "text";
|
|
8151
8123
|
switch (typeof value) {
|
|
8152
|
-
case "number": return
|
|
8153
|
-
case "boolean": return
|
|
8154
|
-
case "string": return
|
|
8124
|
+
case "number": return "number";
|
|
8125
|
+
case "boolean": return "boolean";
|
|
8126
|
+
case "string": return "text";
|
|
8155
8127
|
}
|
|
8156
8128
|
}
|
|
8157
8129
|
function textCell(value, format, formattedValue, position) {
|
|
@@ -8160,7 +8132,7 @@ function textCell(value, format, formattedValue, position) {
|
|
|
8160
8132
|
format,
|
|
8161
8133
|
formattedValue,
|
|
8162
8134
|
position,
|
|
8163
|
-
type:
|
|
8135
|
+
type: "text",
|
|
8164
8136
|
isAutoSummable: true,
|
|
8165
8137
|
defaultAlign: "left"
|
|
8166
8138
|
};
|
|
@@ -8171,7 +8143,7 @@ function numberCell(value, format, formattedValue, position) {
|
|
|
8171
8143
|
format,
|
|
8172
8144
|
formattedValue,
|
|
8173
8145
|
position,
|
|
8174
|
-
type:
|
|
8146
|
+
type: "number",
|
|
8175
8147
|
isAutoSummable: true,
|
|
8176
8148
|
defaultAlign: "right"
|
|
8177
8149
|
};
|
|
@@ -8181,7 +8153,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
8181
8153
|
value: null,
|
|
8182
8154
|
format,
|
|
8183
8155
|
formattedValue: "",
|
|
8184
|
-
type:
|
|
8156
|
+
type: "empty",
|
|
8185
8157
|
isAutoSummable: true,
|
|
8186
8158
|
defaultAlign: "left"
|
|
8187
8159
|
};
|
|
@@ -8192,7 +8164,7 @@ function dateTimeCell(value, format, formattedValue, position) {
|
|
|
8192
8164
|
format,
|
|
8193
8165
|
formattedValue,
|
|
8194
8166
|
position,
|
|
8195
|
-
type:
|
|
8167
|
+
type: "number",
|
|
8196
8168
|
isAutoSummable: false,
|
|
8197
8169
|
defaultAlign: "right"
|
|
8198
8170
|
};
|
|
@@ -8203,7 +8175,7 @@ function booleanCell(value, format, formattedValue, position) {
|
|
|
8203
8175
|
format,
|
|
8204
8176
|
formattedValue,
|
|
8205
8177
|
position,
|
|
8206
|
-
type:
|
|
8178
|
+
type: "boolean",
|
|
8207
8179
|
isAutoSummable: false,
|
|
8208
8180
|
defaultAlign: "center"
|
|
8209
8181
|
};
|
|
@@ -8214,7 +8186,7 @@ function errorCell(value, message, position, errorOriginPosition) {
|
|
|
8214
8186
|
formattedValue: value,
|
|
8215
8187
|
message,
|
|
8216
8188
|
position,
|
|
8217
|
-
type:
|
|
8189
|
+
type: "error",
|
|
8218
8190
|
isAutoSummable: false,
|
|
8219
8191
|
defaultAlign: "center",
|
|
8220
8192
|
errorOriginPosition
|
|
@@ -9457,15 +9429,15 @@ function chartMutedFontColor(backgroundColor) {
|
|
|
9457
9429
|
return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
|
|
9458
9430
|
}
|
|
9459
9431
|
function checkDataset(dataSource) {
|
|
9460
|
-
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
9461
|
-
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
9462
|
-
return
|
|
9432
|
+
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
9433
|
+
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
9434
|
+
return "Success";
|
|
9463
9435
|
}
|
|
9464
9436
|
function checkLabelRange(dataSource) {
|
|
9465
9437
|
if (dataSource.labelRange) {
|
|
9466
|
-
if (!rangeReference.test(dataSource.labelRange || "")) return
|
|
9438
|
+
if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
|
|
9467
9439
|
}
|
|
9468
|
-
return
|
|
9440
|
+
return "Success";
|
|
9469
9441
|
}
|
|
9470
9442
|
function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
|
|
9471
9443
|
return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
|
|
@@ -11130,7 +11102,7 @@ var AbstractChart = class {
|
|
|
11130
11102
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
11131
11103
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
11132
11104
|
if (!baseline) return "";
|
|
11133
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
11105
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
11134
11106
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
11135
11107
|
return baseline.formattedValue;
|
|
11136
11108
|
}
|
|
@@ -11159,23 +11131,23 @@ function getKeyValueText(keyValueCell, humanizeNumbers, locale) {
|
|
|
11159
11131
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
11160
11132
|
}
|
|
11161
11133
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
11162
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
11134
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
11163
11135
|
const diff = keyValue.value - baseline.value;
|
|
11164
11136
|
if (diff > 0) return colorUp;
|
|
11165
11137
|
else if (diff < 0) return colorDown;
|
|
11166
11138
|
}
|
|
11167
11139
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
11168
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
11140
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
11169
11141
|
const diff = keyValue.value - baseline.value;
|
|
11170
11142
|
if (diff > 0) return "up";
|
|
11171
11143
|
else if (diff < 0) return "down";
|
|
11172
11144
|
return "neutral";
|
|
11173
11145
|
}
|
|
11174
11146
|
function checkKeyValue(definition) {
|
|
11175
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
11147
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
11176
11148
|
}
|
|
11177
11149
|
function checkBaseline(definition) {
|
|
11178
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
11150
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
11179
11151
|
}
|
|
11180
11152
|
const Path2DConstructor = globalThis.Path2D;
|
|
11181
11153
|
const arrowDownPath = Path2DConstructor && new Path2DConstructor("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");
|
|
@@ -11434,6 +11406,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
11434
11406
|
}, runtime).computeDesign();
|
|
11435
11407
|
}
|
|
11436
11408
|
var ScorecardChartConfigBuilder = class {
|
|
11409
|
+
runtime;
|
|
11437
11410
|
context;
|
|
11438
11411
|
width;
|
|
11439
11412
|
height;
|
|
@@ -12761,15 +12734,6 @@ function schemeToColorScale(scheme) {
|
|
|
12761
12734
|
};
|
|
12762
12735
|
}
|
|
12763
12736
|
|
|
12764
|
-
//#endregion
|
|
12765
|
-
//#region src/types/clipboard.ts
|
|
12766
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
12767
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
12768
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
12769
|
-
ClipboardMIMEType["Image"] = "image";
|
|
12770
|
-
return ClipboardMIMEType;
|
|
12771
|
-
}({});
|
|
12772
|
-
|
|
12773
12737
|
//#endregion
|
|
12774
12738
|
//#region src/types/conditional_formatting.ts
|
|
12775
12739
|
const cfOperators = [
|
|
@@ -15077,7 +15041,7 @@ const BarChart = {
|
|
|
15077
15041
|
copyInSheetId: (definition) => definition,
|
|
15078
15042
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15079
15043
|
transformDefinition: (definition) => definition,
|
|
15080
|
-
validateDefinition: () =>
|
|
15044
|
+
validateDefinition: () => "Success",
|
|
15081
15045
|
updateRanges: (definition) => definition,
|
|
15082
15046
|
getContextCreation: (definition) => definition,
|
|
15083
15047
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15142,42 +15106,42 @@ const BarChart = {
|
|
|
15142
15106
|
//#endregion
|
|
15143
15107
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
15144
15108
|
function isDataRangeValid(definition) {
|
|
15145
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
15109
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
15146
15110
|
}
|
|
15147
15111
|
function checkRangeLimits(check, batchValidations) {
|
|
15148
15112
|
return batchValidations((definition) => {
|
|
15149
15113
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
15150
|
-
return
|
|
15114
|
+
return "Success";
|
|
15151
15115
|
}, (definition) => {
|
|
15152
15116
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
15153
|
-
return
|
|
15117
|
+
return "Success";
|
|
15154
15118
|
});
|
|
15155
15119
|
}
|
|
15156
15120
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
15157
15121
|
return batchValidations((definition) => {
|
|
15158
15122
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
15159
|
-
return
|
|
15123
|
+
return "Success";
|
|
15160
15124
|
}, (definition) => {
|
|
15161
15125
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
15162
|
-
return
|
|
15126
|
+
return "Success";
|
|
15163
15127
|
});
|
|
15164
15128
|
}
|
|
15165
15129
|
function checkEmpty(value, valueName) {
|
|
15166
15130
|
if (value === "") switch (valueName) {
|
|
15167
|
-
case "rangeMin": return
|
|
15168
|
-
case "rangeMax": return
|
|
15131
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
15132
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
15169
15133
|
}
|
|
15170
|
-
return
|
|
15134
|
+
return "Success";
|
|
15171
15135
|
}
|
|
15172
15136
|
function checkValueIsNumberOrFormula(value, valueName) {
|
|
15173
|
-
if (value.startsWith("=")) return
|
|
15137
|
+
if (value.startsWith("=")) return "Success";
|
|
15174
15138
|
if (isNaN(value)) switch (valueName) {
|
|
15175
|
-
case "rangeMin": return
|
|
15176
|
-
case "rangeMax": return
|
|
15177
|
-
case "lowerInflectionPointValue": return
|
|
15178
|
-
case "upperInflectionPointValue": return
|
|
15139
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
15140
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
15141
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
15142
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
15179
15143
|
}
|
|
15180
|
-
return
|
|
15144
|
+
return "Success";
|
|
15181
15145
|
}
|
|
15182
15146
|
const GaugeChart = {
|
|
15183
15147
|
sequence: 50,
|
|
@@ -15299,7 +15263,7 @@ const GaugeChart = {
|
|
|
15299
15263
|
col: dataRange.zone.left,
|
|
15300
15264
|
row: dataRange.zone.top
|
|
15301
15265
|
});
|
|
15302
|
-
if (cell.type ===
|
|
15266
|
+
if (cell.type === "number") {
|
|
15303
15267
|
gaugeValue = cell.value;
|
|
15304
15268
|
formattedValue = cell.formattedValue;
|
|
15305
15269
|
format = cell.format;
|
|
@@ -15433,7 +15397,7 @@ const LineChart = {
|
|
|
15433
15397
|
copyInSheetId: (definition) => definition,
|
|
15434
15398
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15435
15399
|
transformDefinition: (definition) => definition,
|
|
15436
|
-
validateDefinition: () =>
|
|
15400
|
+
validateDefinition: () => "Success",
|
|
15437
15401
|
updateRanges: (definition) => definition,
|
|
15438
15402
|
getContextCreation: (definition) => definition,
|
|
15439
15403
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15517,7 +15481,7 @@ const PieChart = {
|
|
|
15517
15481
|
copyInSheetId: (definition) => definition,
|
|
15518
15482
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15519
15483
|
transformDefinition: (definition) => definition,
|
|
15520
|
-
validateDefinition: () =>
|
|
15484
|
+
validateDefinition: () => "Success",
|
|
15521
15485
|
updateRanges: (definition) => definition,
|
|
15522
15486
|
getContextCreation: (definition) => definition,
|
|
15523
15487
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15596,7 +15560,7 @@ const WaterfallChart = {
|
|
|
15596
15560
|
copyInSheetId: (definition) => definition,
|
|
15597
15561
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15598
15562
|
transformDefinition: (definition) => definition,
|
|
15599
|
-
validateDefinition: () =>
|
|
15563
|
+
validateDefinition: () => "Success",
|
|
15600
15564
|
updateRanges: (definition) => definition,
|
|
15601
15565
|
getContextCreation: (definition) => definition,
|
|
15602
15566
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -16908,6 +16872,10 @@ var GaugeChartComponent = class extends _odoo_owl.Component {
|
|
|
16908
16872
|
* Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
|
|
16909
16873
|
*/
|
|
16910
16874
|
var Animation = class {
|
|
16875
|
+
startValue;
|
|
16876
|
+
endValue;
|
|
16877
|
+
duration;
|
|
16878
|
+
callback;
|
|
16911
16879
|
startTime = void 0;
|
|
16912
16880
|
animationFrameId = null;
|
|
16913
16881
|
constructor(startValue, endValue, duration, callback) {
|
|
@@ -17136,6 +17104,10 @@ var Menu = class extends _odoo_owl.Component {
|
|
|
17136
17104
|
onKeyDown: {
|
|
17137
17105
|
type: Function,
|
|
17138
17106
|
optional: true
|
|
17107
|
+
},
|
|
17108
|
+
disableKeyboardNavigation: {
|
|
17109
|
+
type: Boolean,
|
|
17110
|
+
optional: true
|
|
17139
17111
|
}
|
|
17140
17112
|
};
|
|
17141
17113
|
static components = {};
|
|
@@ -17143,7 +17115,7 @@ var Menu = class extends _odoo_owl.Component {
|
|
|
17143
17115
|
menuRef = (0, _odoo_owl.useRef)("menu");
|
|
17144
17116
|
setup() {
|
|
17145
17117
|
(0, _odoo_owl.useEffect)(() => {
|
|
17146
|
-
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
|
|
17118
|
+
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
|
|
17147
17119
|
const selector = `[data-name='${this.props.hoveredMenuId}']`;
|
|
17148
17120
|
this.menuRef.el.querySelector(selector)?.focus();
|
|
17149
17121
|
}
|
|
@@ -17378,6 +17350,11 @@ var Popover = class extends _odoo_owl.Component {
|
|
|
17378
17350
|
}
|
|
17379
17351
|
};
|
|
17380
17352
|
var PopoverPositionContext = class {
|
|
17353
|
+
anchorRect;
|
|
17354
|
+
containerRect;
|
|
17355
|
+
propsMaxSize;
|
|
17356
|
+
spreadsheetOffset;
|
|
17357
|
+
lastPosition;
|
|
17381
17358
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
|
|
17382
17359
|
this.anchorRect = anchorRect;
|
|
17383
17360
|
this.containerRect = containerRect;
|
|
@@ -17572,7 +17549,8 @@ var MenuPopover = class MenuPopover extends _odoo_owl.Component {
|
|
|
17572
17549
|
onScroll: this.onScroll.bind(this),
|
|
17573
17550
|
onKeyDown: this.onKeydown.bind(this),
|
|
17574
17551
|
hoveredMenuId,
|
|
17575
|
-
isHoveredMenuFocused: !this.subMenu.isOpen
|
|
17552
|
+
isHoveredMenuFocused: !this.subMenu.isOpen,
|
|
17553
|
+
disableKeyboardNavigation: this.props.disableKeyboardNavigation
|
|
17576
17554
|
};
|
|
17577
17555
|
}
|
|
17578
17556
|
get subMenuAnchorRect() {
|
|
@@ -18431,26 +18409,26 @@ var DelayedHoveredCellStore = class extends SpreadsheetStore {
|
|
|
18431
18409
|
//#region src/components/translations_terms.ts
|
|
18432
18410
|
const CfTerms = {
|
|
18433
18411
|
Errors: {
|
|
18434
|
-
[
|
|
18435
|
-
[
|
|
18436
|
-
[
|
|
18437
|
-
[
|
|
18438
|
-
[
|
|
18439
|
-
[
|
|
18440
|
-
[
|
|
18441
|
-
[
|
|
18442
|
-
[
|
|
18443
|
-
[
|
|
18444
|
-
[
|
|
18445
|
-
[
|
|
18446
|
-
[
|
|
18447
|
-
[
|
|
18448
|
-
[
|
|
18449
|
-
[
|
|
18450
|
-
[
|
|
18451
|
-
[
|
|
18452
|
-
[
|
|
18453
|
-
[
|
|
18412
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18413
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
18414
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
18415
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
18416
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
18417
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
18418
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
18419
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
18420
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
18421
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
18422
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
18423
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
18424
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
18425
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
18426
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
18427
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
18428
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
18429
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
18430
|
+
["EmptyTarget"]: _t("Target must contain at least one zone"),
|
|
18431
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
18454
18432
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
18455
18433
|
},
|
|
18456
18434
|
ColorScale: _t("Color scale"),
|
|
@@ -18469,17 +18447,17 @@ const ChartTerms = {
|
|
|
18469
18447
|
AggregatedChart: _t("Aggregate"),
|
|
18470
18448
|
Errors: {
|
|
18471
18449
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18472
|
-
[
|
|
18473
|
-
[
|
|
18474
|
-
[
|
|
18475
|
-
[
|
|
18476
|
-
[
|
|
18477
|
-
[
|
|
18478
|
-
[
|
|
18479
|
-
[
|
|
18480
|
-
[
|
|
18481
|
-
[
|
|
18482
|
-
[
|
|
18450
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18451
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18452
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18453
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18454
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18455
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18456
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
18457
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
18458
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
18459
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
18460
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
18483
18461
|
},
|
|
18484
18462
|
ColorScales: {
|
|
18485
18463
|
blues: _t("Blues"),
|
|
@@ -18499,16 +18477,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
18499
18477
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
18500
18478
|
const SplitToColumnsTerms = { Errors: {
|
|
18501
18479
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
18502
|
-
[
|
|
18503
|
-
[
|
|
18504
|
-
[
|
|
18480
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
18481
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
18482
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
18505
18483
|
} };
|
|
18506
18484
|
const RemoveDuplicateTerms = { Errors: {
|
|
18507
18485
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
18508
|
-
[
|
|
18509
|
-
[
|
|
18510
|
-
[
|
|
18511
|
-
[
|
|
18486
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
18487
|
+
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
18488
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
18489
|
+
["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
|
|
18512
18490
|
} };
|
|
18513
18491
|
const DVTerms = {
|
|
18514
18492
|
DateIs: {
|
|
@@ -18536,19 +18514,19 @@ const DVTerms = {
|
|
|
18536
18514
|
positiveNumber: _t("The value must be a positive number")
|
|
18537
18515
|
},
|
|
18538
18516
|
Errors: {
|
|
18539
|
-
[
|
|
18540
|
-
[
|
|
18541
|
-
[
|
|
18517
|
+
["InvalidRange"]: _t("The range is invalid."),
|
|
18518
|
+
["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
|
|
18519
|
+
["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
|
|
18542
18520
|
Unexpected: _t("The rule is invalid for an unknown reason.")
|
|
18543
18521
|
}
|
|
18544
18522
|
};
|
|
18545
18523
|
const TableTerms = {
|
|
18546
18524
|
Errors: {
|
|
18547
18525
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
18548
|
-
[
|
|
18549
|
-
[
|
|
18550
|
-
[
|
|
18551
|
-
[
|
|
18526
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
18527
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
18528
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18529
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
18552
18530
|
},
|
|
18553
18531
|
Checkboxes: {
|
|
18554
18532
|
hasFilters: _t("Filter button"),
|
|
@@ -18872,6 +18850,7 @@ function getDateTimeFormat(locale) {
|
|
|
18872
18850
|
* Represent a raw XML string
|
|
18873
18851
|
*/
|
|
18874
18852
|
var XMLString = class {
|
|
18853
|
+
xmlString;
|
|
18875
18854
|
/**
|
|
18876
18855
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
18877
18856
|
*/
|
|
@@ -19222,30 +19201,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
19222
19201
|
|
|
19223
19202
|
//#endregion
|
|
19224
19203
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
19225
|
-
/**
|
|
19226
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
19227
|
-
*/
|
|
19228
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
19229
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
19230
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
19231
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
19232
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
19233
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
19234
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
19235
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
19236
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
19237
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
19238
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
19239
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
19240
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
19241
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
19242
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
19243
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
19244
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
19245
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
19246
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
19247
|
-
return WarningTypes;
|
|
19248
|
-
}({});
|
|
19249
19204
|
var XLSXImportWarningManager = class {
|
|
19250
19205
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
19251
19206
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -20005,7 +19960,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
20005
19960
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
20006
19961
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
20007
19962
|
} catch (e) {}
|
|
20008
|
-
warningManager.generateNotSupportedWarning(
|
|
19963
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
20009
19964
|
}
|
|
20010
19965
|
function isFormatSupported(format) {
|
|
20011
19966
|
try {
|
|
@@ -20090,20 +20045,20 @@ function convertFormats(data, warningManager) {
|
|
|
20090
20045
|
return arrayToObject(formats, 1);
|
|
20091
20046
|
}
|
|
20092
20047
|
function addStyleWarnings(font, fill, warningManager) {
|
|
20093
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
20094
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
20048
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
20049
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
20095
20050
|
}
|
|
20096
20051
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
20097
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
20052
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
20098
20053
|
}
|
|
20099
20054
|
function addBorderWarnings(border, warningManager) {
|
|
20100
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
20055
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
20101
20056
|
}
|
|
20102
20057
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
20103
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20058
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
20104
20059
|
}
|
|
20105
20060
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
20106
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20061
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
20107
20062
|
}
|
|
20108
20063
|
|
|
20109
20064
|
//#endregion
|
|
@@ -20272,7 +20227,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
20272
20227
|
lower: icons.upper
|
|
20273
20228
|
};
|
|
20274
20229
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
20275
|
-
warningManager.generateNotSupportedWarning(
|
|
20230
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
20276
20231
|
switch (key) {
|
|
20277
20232
|
case "upper":
|
|
20278
20233
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -20308,13 +20263,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
20308
20263
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
20309
20264
|
}
|
|
20310
20265
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
20311
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
20312
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
20266
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
20267
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
20313
20268
|
if (cf.cfRules[0].dxfId) {
|
|
20314
20269
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
20315
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
20316
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
20317
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
20270
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
20271
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
20272
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
20318
20273
|
}
|
|
20319
20274
|
}
|
|
20320
20275
|
|
|
@@ -20480,13 +20435,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20480
20435
|
if (!dv) continue;
|
|
20481
20436
|
switch (dv.type) {
|
|
20482
20437
|
case "time":
|
|
20483
|
-
warningManager.generateNotSupportedWarning(
|
|
20438
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
20484
20439
|
break;
|
|
20485
20440
|
case "textLength":
|
|
20486
|
-
warningManager.generateNotSupportedWarning(
|
|
20441
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
20487
20442
|
break;
|
|
20488
20443
|
case "whole":
|
|
20489
|
-
warningManager.generateNotSupportedWarning(
|
|
20444
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
20490
20445
|
break;
|
|
20491
20446
|
case "decimal":
|
|
20492
20447
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -20498,7 +20453,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20498
20453
|
break;
|
|
20499
20454
|
case "date":
|
|
20500
20455
|
if (dv.operator === "notEqual") {
|
|
20501
|
-
warningManager.generateNotSupportedWarning(
|
|
20456
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
20502
20457
|
break;
|
|
20503
20458
|
}
|
|
20504
20459
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -20795,7 +20750,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
20795
20750
|
}
|
|
20796
20751
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
20797
20752
|
const label = link.display || cellValue;
|
|
20798
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
20753
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
20799
20754
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
20800
20755
|
}
|
|
20801
20756
|
function getSheetDims(sheet) {
|
|
@@ -23999,7 +23954,7 @@ function createEmptyExcelWorkbookData() {
|
|
|
23999
23954
|
//#endregion
|
|
24000
23955
|
//#region src/helpers/ui/paste_interactive.ts
|
|
24001
23956
|
const handleCopyPasteResult = (env, command) => {
|
|
24002
|
-
if (env.model.dispatch(command.type).isCancelledBecause(
|
|
23957
|
+
if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
|
|
24003
23958
|
};
|
|
24004
23959
|
const PasteInteractiveContent = {
|
|
24005
23960
|
wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
|
|
@@ -24009,10 +23964,10 @@ const PasteInteractiveContent = {
|
|
|
24009
23964
|
};
|
|
24010
23965
|
function handlePasteResult(env, result) {
|
|
24011
23966
|
if (!result.isSuccessful) {
|
|
24012
|
-
if (result.reasons.includes(
|
|
24013
|
-
else if (result.reasons.includes(
|
|
24014
|
-
else if (result.reasons.includes(
|
|
24015
|
-
else if (result.reasons.includes(
|
|
23967
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
23968
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
23969
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
23970
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
24016
23971
|
}
|
|
24017
23972
|
}
|
|
24018
23973
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -24200,7 +24155,7 @@ var ErrorToolTip = class extends _odoo_owl.Component {
|
|
|
24200
24155
|
};
|
|
24201
24156
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
24202
24157
|
const cell = getters.getEvaluatedCell(position);
|
|
24203
|
-
if (cell.type ===
|
|
24158
|
+
if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
|
|
24204
24159
|
isOpen: true,
|
|
24205
24160
|
props: { cellPosition: position },
|
|
24206
24161
|
Component: ErrorToolTip,
|
|
@@ -24249,7 +24204,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24249
24204
|
sortDirection,
|
|
24250
24205
|
sortOptions
|
|
24251
24206
|
});
|
|
24252
|
-
if (result.isCancelledBecause(
|
|
24207
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
24253
24208
|
const { col, row } = anchor;
|
|
24254
24209
|
env.model.selection.selectZone({
|
|
24255
24210
|
cell: {
|
|
@@ -24260,7 +24215,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24260
24215
|
});
|
|
24261
24216
|
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
24262
24217
|
}
|
|
24263
|
-
if (result.isCancelledBecause(
|
|
24218
|
+
if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
|
|
24264
24219
|
const { col, row } = anchor;
|
|
24265
24220
|
env.model.selection.selectZone({
|
|
24266
24221
|
cell: {
|
|
@@ -26911,6 +26866,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
26911
26866
|
//#endregion
|
|
26912
26867
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
26913
26868
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
26869
|
+
args;
|
|
26914
26870
|
constructor(get, args) {
|
|
26915
26871
|
super(get);
|
|
26916
26872
|
this.args = args;
|
|
@@ -27814,6 +27770,7 @@ var DOMDndHelper = class {
|
|
|
27814
27770
|
}
|
|
27815
27771
|
};
|
|
27816
27772
|
var ContainerWrapper = class {
|
|
27773
|
+
el;
|
|
27817
27774
|
constructor(el) {
|
|
27818
27775
|
this.el = el;
|
|
27819
27776
|
}
|
|
@@ -27885,6 +27842,10 @@ var FocusStore = class {
|
|
|
27885
27842
|
* This plugin handles this internal state.
|
|
27886
27843
|
*/
|
|
27887
27844
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
27845
|
+
initialRanges;
|
|
27846
|
+
inputHasSingleRange;
|
|
27847
|
+
colors;
|
|
27848
|
+
disabledRanges;
|
|
27888
27849
|
mutators = [
|
|
27889
27850
|
"resetWithRanges",
|
|
27890
27851
|
"focusById",
|
|
@@ -29007,8 +28968,8 @@ var FilterMenu = class extends _odoo_owl.Component {
|
|
|
29007
28968
|
row,
|
|
29008
28969
|
col: position.col
|
|
29009
28970
|
});
|
|
29010
|
-
if (cell.type ===
|
|
29011
|
-
else if (cell.type ===
|
|
28971
|
+
if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
|
|
28972
|
+
else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
|
|
29012
28973
|
else cellTypesCount.number++;
|
|
29013
28974
|
}
|
|
29014
28975
|
const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
|
|
@@ -29369,8 +29330,8 @@ function getPasteZones(target, content) {
|
|
|
29369
29330
|
}
|
|
29370
29331
|
function parseOSClipboardContent(content) {
|
|
29371
29332
|
let spreadsheetContent = void 0;
|
|
29372
|
-
if (content[
|
|
29373
|
-
const textContent = content[
|
|
29333
|
+
if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
|
|
29334
|
+
const textContent = content["text/plain"] || "";
|
|
29374
29335
|
let imageBlob = void 0;
|
|
29375
29336
|
if (!textContent.trim()) {
|
|
29376
29337
|
for (const type of AllowedImageMimeTypes) if (content[type]) {
|
|
@@ -29497,10 +29458,10 @@ function detectColumnType(cells) {
|
|
|
29497
29458
|
let detectedType = "empty";
|
|
29498
29459
|
for (const cell of cells) {
|
|
29499
29460
|
let type = null;
|
|
29500
|
-
if (cell.type ===
|
|
29461
|
+
if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
|
|
29501
29462
|
else if (cell.format?.includes("%")) type = "percentage";
|
|
29502
29463
|
else type = "number";
|
|
29503
|
-
else if (cell.type ===
|
|
29464
|
+
else if (cell.type === "text") type = "text";
|
|
29504
29465
|
if (type) {
|
|
29505
29466
|
const newCount = ++counts[type];
|
|
29506
29467
|
if (newCount > max) {
|
|
@@ -29535,7 +29496,7 @@ function isDatasetTitled(getters, column) {
|
|
|
29535
29496
|
col: column.zone.left,
|
|
29536
29497
|
row: column.zone.top
|
|
29537
29498
|
});
|
|
29538
|
-
return ![
|
|
29499
|
+
return !["number", "empty"].includes(titleCell.type);
|
|
29539
29500
|
}
|
|
29540
29501
|
/**
|
|
29541
29502
|
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
|
|
@@ -29858,8 +29819,8 @@ function interactiveCreateTable(env, sheetId, tableConfig = DEFAULT_TABLE_CONFIG
|
|
|
29858
29819
|
config: tableConfig,
|
|
29859
29820
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29860
29821
|
});
|
|
29861
|
-
if (result.isCancelledBecause(
|
|
29862
|
-
else if (result.isCancelledBecause(
|
|
29822
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29823
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29863
29824
|
return result;
|
|
29864
29825
|
}
|
|
29865
29826
|
|
|
@@ -29887,9 +29848,9 @@ async function paste$1(env, pasteOption) {
|
|
|
29887
29848
|
case "ok":
|
|
29888
29849
|
const clipboardId = env.model.getters.getClipboardId();
|
|
29889
29850
|
const target = env.model.getters.getSelectedZones();
|
|
29890
|
-
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
29851
|
+
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
|
|
29891
29852
|
else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
|
|
29892
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29853
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29893
29854
|
break;
|
|
29894
29855
|
case "notImplemented":
|
|
29895
29856
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -32434,13 +32395,13 @@ var ChartRangeDataSourceComponent = class extends _odoo_owl.Component {
|
|
|
32434
32395
|
if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
|
|
32435
32396
|
}
|
|
32436
32397
|
get errorMessages() {
|
|
32437
|
-
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
32398
|
+
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32438
32399
|
}
|
|
32439
32400
|
get isDatasetInvalid() {
|
|
32440
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32401
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32441
32402
|
}
|
|
32442
32403
|
get isLabelInvalid() {
|
|
32443
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32404
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32444
32405
|
}
|
|
32445
32406
|
get dataSetsHaveTitleLabel() {
|
|
32446
32407
|
return this.datasetOrientation === "rows" ? _t("Use col %(column_name)s as headers", { column_name: numberToLetters(this.calculateHeaderPosition() || 0) }) : _t("Use row %(row_position)s as headers", { row_position: this.calculateHeaderPosition() || "" });
|
|
@@ -32772,6 +32733,11 @@ var ChartRangeDataSourceComponent = class extends _odoo_owl.Component {
|
|
|
32772
32733
|
//#endregion
|
|
32773
32734
|
//#region src/helpers/figures/chart.ts
|
|
32774
32735
|
var SpreadsheetChart = class SpreadsheetChart {
|
|
32736
|
+
getters;
|
|
32737
|
+
sheetId;
|
|
32738
|
+
definition;
|
|
32739
|
+
chartTypeBuilder;
|
|
32740
|
+
dataSourceBuilder;
|
|
32775
32741
|
dataSource;
|
|
32776
32742
|
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
32777
32743
|
this.getters = getters;
|
|
@@ -32809,9 +32775,6 @@ var SpreadsheetChart = class SpreadsheetChart {
|
|
|
32809
32775
|
dataSource: newDataSource
|
|
32810
32776
|
};
|
|
32811
32777
|
}
|
|
32812
|
-
getSupportedChartTypes() {
|
|
32813
|
-
return new Set(this.dataSourceBuilder.supportedChartTypes);
|
|
32814
|
-
}
|
|
32815
32778
|
getRangeDefinition() {
|
|
32816
32779
|
return {
|
|
32817
32780
|
...this.definition,
|
|
@@ -33010,6 +32973,10 @@ const ChartRangeDataSourceHandler = {
|
|
|
33010
32973
|
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
33011
32974
|
};
|
|
33012
32975
|
},
|
|
32976
|
+
/**
|
|
32977
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
32978
|
+
* sheetIdTo.
|
|
32979
|
+
*/
|
|
33013
32980
|
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
33014
32981
|
return {
|
|
33015
32982
|
...dataSource,
|
|
@@ -33163,7 +33130,7 @@ const ChartNeverDataSourceHandler = {
|
|
|
33163
33130
|
fromExternalDefinition: () => ({ type: "none" }),
|
|
33164
33131
|
fromContextCreation: () => ({ type: "none" }),
|
|
33165
33132
|
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
33166
|
-
validate: () =>
|
|
33133
|
+
validate: () => "Success",
|
|
33167
33134
|
transform: () => ({ type: "none" }),
|
|
33168
33135
|
extractData: () => ({
|
|
33169
33136
|
dataSetsValues: [],
|
|
@@ -33498,10 +33465,10 @@ var GaugeChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33498
33465
|
state = (0, _odoo_owl.useState)({ dataRangeDispatchResult: void 0 });
|
|
33499
33466
|
dataRange = this.props.definition.dataRange;
|
|
33500
33467
|
get configurationErrorMessages() {
|
|
33501
|
-
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33468
|
+
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33502
33469
|
}
|
|
33503
33470
|
get isDataRangeInvalid() {
|
|
33504
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33471
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33505
33472
|
}
|
|
33506
33473
|
onDataRangeChanged(ranges) {
|
|
33507
33474
|
this.dataRange = ranges[0];
|
|
@@ -33538,19 +33505,19 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
33538
33505
|
});
|
|
33539
33506
|
}
|
|
33540
33507
|
get designErrorMessages() {
|
|
33541
|
-
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !==
|
|
33508
|
+
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33542
33509
|
}
|
|
33543
33510
|
get isRangeMinInvalid() {
|
|
33544
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33511
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
|
|
33545
33512
|
}
|
|
33546
33513
|
get isRangeMaxInvalid() {
|
|
33547
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33514
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
|
|
33548
33515
|
}
|
|
33549
33516
|
get isLowerInflectionPointInvalid() {
|
|
33550
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33517
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
|
|
33551
33518
|
}
|
|
33552
33519
|
get isUpperInflectionPointInvalid() {
|
|
33553
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33520
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
|
|
33554
33521
|
}
|
|
33555
33522
|
updateSectionColor(target, color) {
|
|
33556
33523
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33614,10 +33581,10 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
33614
33581
|
}
|
|
33615
33582
|
checkSectionRuleFormulasAreValid(sectionRule) {
|
|
33616
33583
|
const reasons = /* @__PURE__ */ new Set();
|
|
33617
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(
|
|
33618
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(
|
|
33619
|
-
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(
|
|
33620
|
-
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(
|
|
33584
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
|
|
33585
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
|
|
33586
|
+
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
|
|
33587
|
+
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
|
|
33621
33588
|
return reasons;
|
|
33622
33589
|
}
|
|
33623
33590
|
valueIsValidNumber(value) {
|
|
@@ -33957,13 +33924,13 @@ var ScorecardChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33957
33924
|
keyValue = this.props.definition.keyValue;
|
|
33958
33925
|
baseline = this.props.definition.baseline;
|
|
33959
33926
|
get errorMessages() {
|
|
33960
|
-
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33927
|
+
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33961
33928
|
}
|
|
33962
33929
|
get isKeyValueInvalid() {
|
|
33963
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33930
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33964
33931
|
}
|
|
33965
33932
|
get isBaselineInvalid() {
|
|
33966
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33933
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
33967
33934
|
}
|
|
33968
33935
|
onKeyValueRangeChanged(ranges) {
|
|
33969
33936
|
this.keyValue = ranges[0];
|
|
@@ -34397,13 +34364,23 @@ var ChartTypePicker = class extends _odoo_owl.Component {
|
|
|
34397
34364
|
});
|
|
34398
34365
|
setup() {
|
|
34399
34366
|
(0, _odoo_owl.useExternalListener)(window, "pointerdown", this.onExternalClick, { capture: true });
|
|
34400
|
-
const
|
|
34367
|
+
const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
|
|
34368
|
+
const supportedTypes = this.getSupportedChartTypes(definition);
|
|
34401
34369
|
for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
|
|
34402
34370
|
if (!supportedTypes.has(subtypeProperties.chartType)) continue;
|
|
34403
34371
|
if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
|
|
34404
34372
|
else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
|
|
34405
34373
|
}
|
|
34406
34374
|
}
|
|
34375
|
+
getSupportedChartTypes(definition) {
|
|
34376
|
+
let supportedTypes;
|
|
34377
|
+
if (definition.dataSource) {
|
|
34378
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
|
|
34379
|
+
supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
|
|
34380
|
+
} else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
|
|
34381
|
+
else throw new Error("Missing chart data source for a chart type that requires it");
|
|
34382
|
+
return supportedTypes;
|
|
34383
|
+
}
|
|
34407
34384
|
onExternalClick(ev) {
|
|
34408
34385
|
if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
|
|
34409
34386
|
this.closePopover();
|
|
@@ -34697,10 +34674,10 @@ const columnStatisticFunctions = [
|
|
|
34697
34674
|
{
|
|
34698
34675
|
name: _t("Unique values"),
|
|
34699
34676
|
types: [
|
|
34700
|
-
|
|
34701
|
-
|
|
34702
|
-
|
|
34703
|
-
|
|
34677
|
+
"number",
|
|
34678
|
+
"text",
|
|
34679
|
+
"boolean",
|
|
34680
|
+
"error"
|
|
34704
34681
|
],
|
|
34705
34682
|
compute: (values, locale) => {
|
|
34706
34683
|
const uniqueValues = /* @__PURE__ */ new Set();
|
|
@@ -34711,27 +34688,27 @@ const columnStatisticFunctions = [
|
|
|
34711
34688
|
},
|
|
34712
34689
|
{
|
|
34713
34690
|
name: _t("Sum"),
|
|
34714
|
-
types: [
|
|
34691
|
+
types: ["number"],
|
|
34715
34692
|
compute: (values, locale) => sum([[values]], locale)
|
|
34716
34693
|
},
|
|
34717
34694
|
{
|
|
34718
34695
|
name: _t("Average"),
|
|
34719
|
-
types: [
|
|
34696
|
+
types: ["number"],
|
|
34720
34697
|
compute: (values, locale) => average([[values]], locale)
|
|
34721
34698
|
},
|
|
34722
34699
|
{
|
|
34723
34700
|
name: _t("Median"),
|
|
34724
|
-
types: [
|
|
34701
|
+
types: ["number"],
|
|
34725
34702
|
compute: (values, locale) => median([[values]], locale) ?? ""
|
|
34726
34703
|
},
|
|
34727
34704
|
{
|
|
34728
34705
|
name: _t("Minimum value"),
|
|
34729
|
-
types: [
|
|
34706
|
+
types: ["number"],
|
|
34730
34707
|
compute: (values, locale) => min([[values]], locale).value
|
|
34731
34708
|
},
|
|
34732
34709
|
{
|
|
34733
34710
|
name: _t("Maximum value"),
|
|
34734
|
-
types: [
|
|
34711
|
+
types: ["number"],
|
|
34735
34712
|
compute: (values, locale) => max([[values]], locale).value
|
|
34736
34713
|
}
|
|
34737
34714
|
];
|
|
@@ -34878,12 +34855,13 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34878
34855
|
}
|
|
34879
34856
|
const { sheetId, col } = getters.getActivePosition();
|
|
34880
34857
|
this.selectedColumn = col;
|
|
34881
|
-
|
|
34858
|
+
const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
|
|
34882
34859
|
top: 0,
|
|
34883
34860
|
left: col,
|
|
34884
34861
|
bottom: getters.getNumberRows(sheetId) - 1,
|
|
34885
34862
|
right: col
|
|
34886
|
-
}).map((cell) => cell.format)
|
|
34863
|
+
}).map((cell) => cell.format);
|
|
34864
|
+
this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
|
|
34887
34865
|
const numberOfRows = getters.getNumberRows(sheetId);
|
|
34888
34866
|
const cells = [];
|
|
34889
34867
|
const numericValues = [];
|
|
@@ -34901,20 +34879,21 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34901
34879
|
row
|
|
34902
34880
|
});
|
|
34903
34881
|
cells.push(evaluatedCell);
|
|
34904
|
-
if (evaluatedCell.type !==
|
|
34882
|
+
if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
|
|
34905
34883
|
values.push({
|
|
34906
34884
|
row,
|
|
34907
34885
|
col,
|
|
34908
34886
|
value: evaluatedCell.value
|
|
34909
34887
|
});
|
|
34910
|
-
if (evaluatedCell.type ===
|
|
34888
|
+
if (evaluatedCell.type === "number") numericValues.push({
|
|
34911
34889
|
row,
|
|
34912
34890
|
col,
|
|
34913
34891
|
value: evaluatedCell.value
|
|
34914
34892
|
});
|
|
34915
34893
|
}
|
|
34916
34894
|
}
|
|
34917
|
-
|
|
34895
|
+
const locale = getters.getLocale();
|
|
34896
|
+
this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
|
|
34918
34897
|
this.numericValues = numericValues;
|
|
34919
34898
|
this.values = values;
|
|
34920
34899
|
this.countChartData = this.computeCountChartData();
|
|
@@ -35248,7 +35227,7 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35248
35227
|
updateConditionalFormat(newCf) {
|
|
35249
35228
|
const ranges = newCf.ranges || this.state.ranges;
|
|
35250
35229
|
if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35251
|
-
if (!newCf.suppressErrors) this.state.errors = [
|
|
35230
|
+
if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
|
|
35252
35231
|
return;
|
|
35253
35232
|
}
|
|
35254
35233
|
const sheetId = this.model.getters.getActiveSheetId();
|
|
@@ -35263,11 +35242,11 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35263
35242
|
sheetId
|
|
35264
35243
|
});
|
|
35265
35244
|
if (result.isSuccessful) this.state.hasEditedCf = true;
|
|
35266
|
-
const reasons = result.reasons.filter((r) => r !==
|
|
35245
|
+
const reasons = result.reasons.filter((r) => r !== "NoChanges");
|
|
35267
35246
|
if (!newCf.suppressErrors) this.state.errors = reasons;
|
|
35268
35247
|
}
|
|
35269
35248
|
get isRangeValid() {
|
|
35270
|
-
return this.state.errors.includes(
|
|
35249
|
+
return this.state.errors.includes("EmptyRange");
|
|
35271
35250
|
}
|
|
35272
35251
|
get errorMessages() {
|
|
35273
35252
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35521,9 +35500,9 @@ var ColorScaleRuleEditorThreshold = class extends _odoo_owl.Component {
|
|
|
35521
35500
|
isValueInvalid() {
|
|
35522
35501
|
const errors = this.props.store.state.errors;
|
|
35523
35502
|
switch (this.props.thresholdType) {
|
|
35524
|
-
case "minimum": return errors.includes(
|
|
35525
|
-
case "midpoint": return errors.includes(
|
|
35526
|
-
case "maximum": return errors.includes(
|
|
35503
|
+
case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
|
|
35504
|
+
case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
|
|
35505
|
+
case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
|
|
35527
35506
|
default: return false;
|
|
35528
35507
|
}
|
|
35529
35508
|
}
|
|
@@ -35631,8 +35610,8 @@ var IconSetRuleEditor = class extends _odoo_owl.Component {
|
|
|
35631
35610
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35632
35611
|
const errors = this.props.store.state.errors;
|
|
35633
35612
|
switch (inflectionPoint) {
|
|
35634
|
-
case "lowerInflectionPoint": return errors.includes(
|
|
35635
|
-
case "upperInflectionPoint": return errors.includes(
|
|
35613
|
+
case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35614
|
+
case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35636
35615
|
default: return true;
|
|
35637
35616
|
}
|
|
35638
35617
|
}
|
|
@@ -36049,12 +36028,6 @@ var DataValidationEditor = class extends _odoo_owl.Component {
|
|
|
36049
36028
|
//#endregion
|
|
36050
36029
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
36051
36030
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
36052
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
36053
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
36054
|
-
Direction[Direction["current"] = 0] = "current";
|
|
36055
|
-
Direction[Direction["next"] = 1] = "next";
|
|
36056
|
-
return Direction;
|
|
36057
|
-
}(Direction || {});
|
|
36058
36031
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
36059
36032
|
mutators = [
|
|
36060
36033
|
"updateSearchOptions",
|
|
@@ -36116,13 +36089,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36116
36089
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
36117
36090
|
}
|
|
36118
36091
|
selectPreviousMatch() {
|
|
36119
|
-
this.selectNextCell(
|
|
36092
|
+
this.selectNextCell(-1, {
|
|
36120
36093
|
jumpToMatchSheet: true,
|
|
36121
36094
|
updateSelection: true
|
|
36122
36095
|
});
|
|
36123
36096
|
}
|
|
36124
36097
|
selectNextMatch() {
|
|
36125
|
-
this.selectNextCell(
|
|
36098
|
+
this.selectNextCell(1, {
|
|
36126
36099
|
jumpToMatchSheet: true,
|
|
36127
36100
|
updateSelection: true
|
|
36128
36101
|
});
|
|
@@ -36205,7 +36178,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36205
36178
|
refreshSearch(options) {
|
|
36206
36179
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
36207
36180
|
this.findMatches();
|
|
36208
|
-
this.selectNextCell(
|
|
36181
|
+
this.selectNextCell(0, options);
|
|
36209
36182
|
}
|
|
36210
36183
|
getSheetsInSearchOrder() {
|
|
36211
36184
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37289,10 +37262,10 @@ function interactiveUpdateNamedRange(env, payload) {
|
|
|
37289
37262
|
}
|
|
37290
37263
|
function handleResult(env, result) {
|
|
37291
37264
|
if (!result.isSuccessful) {
|
|
37292
|
-
if (result.isCancelledBecause(
|
|
37293
|
-
else if (result.isCancelledBecause(
|
|
37294
|
-
else if (result.isCancelledBecause(
|
|
37295
|
-
else if (result.isCancelledBecause(
|
|
37265
|
+
if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
|
|
37266
|
+
else if (result.isCancelledBecause("NamedRangeInvalidName")) env.raiseError(_t("The named range name is invalid. Valid names can contain letters, digits, underscores, and periods. The name cannot be only a number, TRUE, or FALSE."));
|
|
37267
|
+
else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
|
|
37268
|
+
else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
|
|
37296
37269
|
}
|
|
37297
37270
|
}
|
|
37298
37271
|
|
|
@@ -37379,6 +37352,8 @@ var NamedRangesPanel = class extends _odoo_owl.Component {
|
|
|
37379
37352
|
//#endregion
|
|
37380
37353
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37381
37354
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37355
|
+
pivotId;
|
|
37356
|
+
initialMeasure;
|
|
37382
37357
|
mutators = [
|
|
37383
37358
|
"cancelMeasureDisplayEdition",
|
|
37384
37359
|
"updateMeasureDisplayType",
|
|
@@ -38321,7 +38296,7 @@ var PivotTitleSection = class extends _odoo_owl.Component {
|
|
|
38321
38296
|
});
|
|
38322
38297
|
let text;
|
|
38323
38298
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38324
|
-
else if (result.isCancelledBecause(
|
|
38299
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38325
38300
|
else text = _t("Pivot duplication failed.");
|
|
38326
38301
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38327
38302
|
this.env.notifyUser({
|
|
@@ -38398,13 +38373,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38398
38373
|
break;
|
|
38399
38374
|
}
|
|
38400
38375
|
return {
|
|
38376
|
+
/**
|
|
38377
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38378
|
+
*/
|
|
38401
38379
|
id: measure.id,
|
|
38380
|
+
/**
|
|
38381
|
+
* Display name of the measure
|
|
38382
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38383
|
+
*/
|
|
38402
38384
|
get displayName() {
|
|
38403
38385
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38404
38386
|
},
|
|
38405
38387
|
userDefinedName: measure.userDefinedName,
|
|
38388
|
+
/**
|
|
38389
|
+
* Get the name of the field of the measure
|
|
38390
|
+
*/
|
|
38406
38391
|
fieldName,
|
|
38392
|
+
/**
|
|
38393
|
+
* Get the aggregator of the measure
|
|
38394
|
+
*/
|
|
38407
38395
|
aggregator,
|
|
38396
|
+
/**
|
|
38397
|
+
* Get the type of the measure field
|
|
38398
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38399
|
+
*/
|
|
38408
38400
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38409
38401
|
isValid,
|
|
38410
38402
|
isHidden: measure.isHidden,
|
|
@@ -38418,10 +38410,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38418
38410
|
const type = field?.type ?? "integer";
|
|
38419
38411
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38420
38412
|
return {
|
|
38413
|
+
/**
|
|
38414
|
+
* Get the display name of the dimension
|
|
38415
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38416
|
+
*/
|
|
38421
38417
|
displayName: field?.string ?? dimension.fieldName,
|
|
38418
|
+
/**
|
|
38419
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38420
|
+
* e.g. "stage_id", "create_date:month"
|
|
38421
|
+
*/
|
|
38422
38422
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38423
|
+
/**
|
|
38424
|
+
* Get the name of the field of the dimension
|
|
38425
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38426
|
+
*/
|
|
38423
38427
|
fieldName: dimension.fieldName,
|
|
38428
|
+
/**
|
|
38429
|
+
* Get the aggregate operator of the dimension
|
|
38430
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38431
|
+
*/
|
|
38424
38432
|
granularity,
|
|
38433
|
+
/**
|
|
38434
|
+
* Get the type of the field of the dimension
|
|
38435
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38436
|
+
*/
|
|
38425
38437
|
type: field?.isCustomField ? "custom" : type,
|
|
38426
38438
|
order: dimension.order,
|
|
38427
38439
|
isValid: !!field,
|
|
@@ -39181,14 +39193,6 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
39181
39193
|
|
|
39182
39194
|
//#endregion
|
|
39183
39195
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39184
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39185
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39186
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39187
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39188
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39189
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39190
|
-
return ReloadType;
|
|
39191
|
-
}(ReloadType || {});
|
|
39192
39196
|
/**
|
|
39193
39197
|
* This class represents a pivot table that is created from a range of cells.
|
|
39194
39198
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39231,15 +39235,15 @@ var SpreadsheetPivot = class {
|
|
|
39231
39235
|
}
|
|
39232
39236
|
init(params = {}) {
|
|
39233
39237
|
if (!this._definition || params.reload) {
|
|
39234
|
-
this.reload(
|
|
39238
|
+
this.reload(4);
|
|
39235
39239
|
this.needsReevaluation = false;
|
|
39236
39240
|
}
|
|
39237
39241
|
}
|
|
39238
39242
|
reload(type) {
|
|
39239
|
-
if (type ===
|
|
39240
|
-
if (type >=
|
|
39241
|
-
if (type >=
|
|
39242
|
-
if (type >=
|
|
39243
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39244
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39245
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39246
|
+
if (type >= 1) {
|
|
39243
39247
|
this.collapsedTable = void 0;
|
|
39244
39248
|
this.expandedTable = void 0;
|
|
39245
39249
|
}
|
|
@@ -39248,13 +39252,13 @@ var SpreadsheetPivot = class {
|
|
|
39248
39252
|
const actualDefinition = this.coreDefinition;
|
|
39249
39253
|
this.coreDefinition = nextDefinition;
|
|
39250
39254
|
if (this._definition) {
|
|
39251
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39255
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39252
39256
|
this.reload(reloadType);
|
|
39253
39257
|
}
|
|
39254
39258
|
}
|
|
39255
39259
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39256
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39257
|
-
return
|
|
39260
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39261
|
+
return 4;
|
|
39258
39262
|
}
|
|
39259
39263
|
get isInvalidRange() {
|
|
39260
39264
|
return !!this.invalidRangeError;
|
|
@@ -39327,7 +39331,7 @@ var SpreadsheetPivot = class {
|
|
|
39327
39331
|
if (dataEntries.length === 0) return { value: "" };
|
|
39328
39332
|
const measure = this.getMeasure(measureId);
|
|
39329
39333
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39330
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39334
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39331
39335
|
const aggregator = measure.aggregator;
|
|
39332
39336
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39333
39337
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39429,16 +39433,16 @@ var SpreadsheetPivot = class {
|
|
|
39429
39433
|
return this.definition.getDimension(nameWithGranularity);
|
|
39430
39434
|
}
|
|
39431
39435
|
getTypeFromZone(sheetId, zone) {
|
|
39432
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39436
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39433
39437
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39434
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39435
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39436
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39438
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39439
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39440
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39437
39441
|
return "char";
|
|
39438
39442
|
}
|
|
39439
39443
|
assertCellIsValidField(col, row, cell) {
|
|
39440
|
-
if (cell.type ===
|
|
39441
|
-
if (cell.type ===
|
|
39444
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39445
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39442
39446
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39443
39447
|
}
|
|
39444
39448
|
/**
|
|
@@ -39497,7 +39501,7 @@ var SpreadsheetPivot = class {
|
|
|
39497
39501
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39498
39502
|
if (cell.value === "") entry[field.name] = {
|
|
39499
39503
|
value: null,
|
|
39500
|
-
type:
|
|
39504
|
+
type: "empty",
|
|
39501
39505
|
formattedValue: ""
|
|
39502
39506
|
};
|
|
39503
39507
|
else entry[field.name] = cell;
|
|
@@ -39510,7 +39514,7 @@ var SpreadsheetPivot = class {
|
|
|
39510
39514
|
if (!baseValue || !parentField) {
|
|
39511
39515
|
entry[customFieldName] = {
|
|
39512
39516
|
value: null,
|
|
39513
|
-
type:
|
|
39517
|
+
type: "empty",
|
|
39514
39518
|
formattedValue: ""
|
|
39515
39519
|
};
|
|
39516
39520
|
continue;
|
|
@@ -39523,7 +39527,7 @@ var SpreadsheetPivot = class {
|
|
|
39523
39527
|
}
|
|
39524
39528
|
entry["__count"] = {
|
|
39525
39529
|
value: 1,
|
|
39526
|
-
type:
|
|
39530
|
+
type: "number",
|
|
39527
39531
|
formattedValue: "1"
|
|
39528
39532
|
};
|
|
39529
39533
|
dataEntries.push(entry);
|
|
@@ -39536,7 +39540,7 @@ var SpreadsheetPivot = class {
|
|
|
39536
39540
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39537
39541
|
entry[dimension.nameWithGranularity] = {
|
|
39538
39542
|
value,
|
|
39539
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39543
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39540
39544
|
format: entry[dimension.fieldName]?.format,
|
|
39541
39545
|
formattedValue: formatValue(valueToFormat, {
|
|
39542
39546
|
locale,
|
|
@@ -39691,6 +39695,8 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
39691
39695
|
//#endregion
|
|
39692
39696
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39693
39697
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39698
|
+
pivotId;
|
|
39699
|
+
updateMode;
|
|
39694
39700
|
mutators = [
|
|
39695
39701
|
"reset",
|
|
39696
39702
|
"deferUpdates",
|
|
@@ -39852,7 +39858,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39852
39858
|
};
|
|
39853
39859
|
}
|
|
39854
39860
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39855
|
-
|
|
39861
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39862
|
+
this.draft = cleanedWithGranularity;
|
|
39856
39863
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39857
39864
|
}
|
|
39858
39865
|
/**
|
|
@@ -41608,7 +41615,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
41608
41615
|
separator,
|
|
41609
41616
|
addNewColumns
|
|
41610
41617
|
});
|
|
41611
|
-
if (result.isCancelledBecause(
|
|
41618
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
41612
41619
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
41613
41620
|
separator,
|
|
41614
41621
|
addNewColumns,
|
|
@@ -41690,8 +41697,8 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
41690
41697
|
}).reasons;
|
|
41691
41698
|
const errors = /* @__PURE__ */ new Set();
|
|
41692
41699
|
for (const reason of cancelledReasons) switch (reason) {
|
|
41693
|
-
case
|
|
41694
|
-
case
|
|
41700
|
+
case "SplitWillOverwriteContent":
|
|
41701
|
+
case "EmptySplitSeparator": break;
|
|
41695
41702
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
41696
41703
|
}
|
|
41697
41704
|
return Array.from(errors);
|
|
@@ -41702,7 +41709,7 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
41702
41709
|
separator: this.separatorValue,
|
|
41703
41710
|
addNewColumns: this.state.addNewColumns,
|
|
41704
41711
|
force: false
|
|
41705
|
-
}).reasons.includes(
|
|
41712
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
41706
41713
|
return warnings;
|
|
41707
41714
|
}
|
|
41708
41715
|
get separatorValue() {
|
|
@@ -42333,7 +42340,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
42333
42340
|
if (env.model.dispatch(cmd, {
|
|
42334
42341
|
sheetId,
|
|
42335
42342
|
quantity: base
|
|
42336
|
-
}).isCancelledBecause(
|
|
42343
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
42337
42344
|
}
|
|
42338
42345
|
|
|
42339
42346
|
//#endregion
|
|
@@ -42513,11 +42520,11 @@ var FormulaFingerprintStore = class extends SpreadsheetStore {
|
|
|
42513
42520
|
}
|
|
42514
42521
|
getLiteralFingerprint(position) {
|
|
42515
42522
|
switch (this.getters.getEvaluatedCell(position).type) {
|
|
42516
|
-
case
|
|
42517
|
-
case
|
|
42518
|
-
case
|
|
42519
|
-
case
|
|
42520
|
-
case
|
|
42523
|
+
case "number":
|
|
42524
|
+
case "boolean": return DATA_FINGERPRINT;
|
|
42525
|
+
case "text":
|
|
42526
|
+
case "empty":
|
|
42527
|
+
case "error": return;
|
|
42521
42528
|
}
|
|
42522
42529
|
}
|
|
42523
42530
|
};
|
|
@@ -42801,7 +42808,7 @@ const togglePinPanel = {
|
|
|
42801
42808
|
function interactiveCut(env) {
|
|
42802
42809
|
const result = env.model.dispatch("CUT");
|
|
42803
42810
|
if (!result.isSuccessful) {
|
|
42804
|
-
if (result.isCancelledBecause(
|
|
42811
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
42805
42812
|
}
|
|
42806
42813
|
}
|
|
42807
42814
|
|
|
@@ -42872,8 +42879,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
42872
42879
|
sheetId,
|
|
42873
42880
|
target
|
|
42874
42881
|
});
|
|
42875
|
-
if (result.isCancelledBecause(
|
|
42876
|
-
else if (result.isCancelledBecause(
|
|
42882
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
42883
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
42877
42884
|
env.model.dispatch("ADD_MERGE", {
|
|
42878
42885
|
sheetId,
|
|
42879
42886
|
target,
|
|
@@ -43110,7 +43117,7 @@ const FIX_FORMULAS = {
|
|
|
43110
43117
|
if (!pivotId) return false;
|
|
43111
43118
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
43112
43119
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
43113
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
43120
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
43114
43121
|
},
|
|
43115
43122
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
43116
43123
|
};
|
|
@@ -43751,7 +43758,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
43751
43758
|
end: group.end
|
|
43752
43759
|
});
|
|
43753
43760
|
if (!result.isSuccessful) {
|
|
43754
|
-
if (result.isCancelledBecause(
|
|
43761
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
43755
43762
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
43756
43763
|
env.raiseError(errorMessage);
|
|
43757
43764
|
}
|
|
@@ -44706,11 +44713,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44706
44713
|
if (cell?.content.startsWith("'")) return { text: cell.content };
|
|
44707
44714
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
44708
44715
|
switch (type) {
|
|
44709
|
-
case
|
|
44710
|
-
case
|
|
44711
|
-
case
|
|
44712
|
-
case
|
|
44713
|
-
case
|
|
44716
|
+
case "empty": return { text: "" };
|
|
44717
|
+
case "text":
|
|
44718
|
+
case "error": return { text: value };
|
|
44719
|
+
case "boolean": return { text: formattedValue };
|
|
44720
|
+
case "number":
|
|
44714
44721
|
if (format && isDateTimeFormat(format)) {
|
|
44715
44722
|
if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
|
|
44716
44723
|
return { text: formatValue(value, {
|
|
@@ -44767,7 +44774,7 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44767
44774
|
startEdition(text, selection) {
|
|
44768
44775
|
if (this.getters.isCurrentSheetLocked()) {
|
|
44769
44776
|
this.model.trigger("command-rejected", {
|
|
44770
|
-
result: new DispatchResult(
|
|
44777
|
+
result: new DispatchResult("SheetLocked"),
|
|
44771
44778
|
command: { sheetId: this.getters.getActiveSheetId() }
|
|
44772
44779
|
});
|
|
44773
44780
|
return "NoStateChange";
|
|
@@ -46392,7 +46399,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
46392
46399
|
elements,
|
|
46393
46400
|
position: this.state.position
|
|
46394
46401
|
});
|
|
46395
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
46402
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46396
46403
|
}
|
|
46397
46404
|
_selectElement(index, addDistinctHeader) {
|
|
46398
46405
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -46529,8 +46536,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
46529
46536
|
position: this.state.position
|
|
46530
46537
|
});
|
|
46531
46538
|
if (!result.isSuccessful) {
|
|
46532
|
-
if (result.reasons.includes(
|
|
46533
|
-
else if (result.reasons.includes(
|
|
46539
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46540
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
46534
46541
|
}
|
|
46535
46542
|
}
|
|
46536
46543
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -46607,6 +46614,7 @@ var HeadersOverlay = class extends _odoo_owl.Component {
|
|
|
46607
46614
|
//#region src/stores/grid_renderer_store.ts
|
|
46608
46615
|
const CELL_ANIMATION_DURATION = 200;
|
|
46609
46616
|
var GridRenderer = class extends DisposableStore {
|
|
46617
|
+
renderer;
|
|
46610
46618
|
fingerprints;
|
|
46611
46619
|
hoveredTables;
|
|
46612
46620
|
hoveredIcon;
|
|
@@ -47091,7 +47099,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47091
47099
|
const nextCell = this.getters.getEvaluatedCell(position);
|
|
47092
47100
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
47093
47101
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47094
|
-
if (nextCell.type !==
|
|
47102
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
|
|
47095
47103
|
col++;
|
|
47096
47104
|
}
|
|
47097
47105
|
return col;
|
|
@@ -47107,7 +47115,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47107
47115
|
const previousCell = this.getters.getEvaluatedCell(position);
|
|
47108
47116
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
47109
47117
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47110
|
-
if (previousCell.type !==
|
|
47118
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
|
|
47111
47119
|
col--;
|
|
47112
47120
|
}
|
|
47113
47121
|
return col;
|
|
@@ -47117,7 +47125,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47117
47125
|
const { align } = this.getters.getCellStyle(position);
|
|
47118
47126
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
47119
47127
|
if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
|
|
47120
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
47128
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
47121
47129
|
return align || evaluatedCell.defaultAlign;
|
|
47122
47130
|
}
|
|
47123
47131
|
createZoneBox(viewports, sheetId, zone, viewport) {
|
|
@@ -47162,12 +47170,12 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47162
47170
|
style,
|
|
47163
47171
|
dataBarFill,
|
|
47164
47172
|
overlayColor: this.hoveredTables.overlayColors.get(position),
|
|
47165
|
-
isError: cell.type ===
|
|
47173
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
|
|
47166
47174
|
icons: cellIcons,
|
|
47167
47175
|
disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
|
|
47168
47176
|
};
|
|
47169
47177
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
47170
|
-
if (cell.type ===
|
|
47178
|
+
if (cell.type === "empty" || box.icons.center) return box;
|
|
47171
47179
|
/** Content */
|
|
47172
47180
|
const wrapping = style.wrapping || "overflow";
|
|
47173
47181
|
const wrapText = wrapping === "wrap" && !showFormula;
|
|
@@ -48343,7 +48351,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48343
48351
|
"Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
|
|
48344
48352
|
};
|
|
48345
48353
|
focusComposerFromActiveCell() {
|
|
48346
|
-
this.env.model.getters.getActiveCell().type ===
|
|
48354
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
48347
48355
|
}
|
|
48348
48356
|
editOrMoveInSelection(direction) {
|
|
48349
48357
|
if (this.isSingleCellOrMergeSelection()) {
|
|
@@ -48468,7 +48476,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48468
48476
|
sheetId,
|
|
48469
48477
|
col,
|
|
48470
48478
|
row
|
|
48471
|
-
}).type ===
|
|
48479
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
48472
48480
|
else this.onComposerContentFocused();
|
|
48473
48481
|
}
|
|
48474
48482
|
processArrows(ev) {
|
|
@@ -48549,18 +48557,18 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48549
48557
|
if (!clipboardData) return;
|
|
48550
48558
|
const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
|
|
48551
48559
|
const osClipboard = { content: {
|
|
48552
|
-
[
|
|
48553
|
-
[
|
|
48560
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
48561
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
48554
48562
|
} };
|
|
48555
48563
|
if (image) osClipboard.content[image.type] = image;
|
|
48556
48564
|
const target = this.env.model.getters.getSelectedZones();
|
|
48557
48565
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
48558
|
-
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
48566
|
+
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
|
|
48559
48567
|
else {
|
|
48560
48568
|
const osClipboardContent = parseOSClipboardContent(osClipboard.content);
|
|
48561
48569
|
await interactivePasteFromOS(this.env, target, osClipboardContent);
|
|
48562
48570
|
}
|
|
48563
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
48571
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
48564
48572
|
}
|
|
48565
48573
|
clearFormatting() {
|
|
48566
48574
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -49047,7 +49055,7 @@ var BasePlugin = class {
|
|
|
49047
49055
|
* There should not be any side effects in this method.
|
|
49048
49056
|
*/
|
|
49049
49057
|
allowDispatch(command) {
|
|
49050
|
-
return
|
|
49058
|
+
return "Success";
|
|
49051
49059
|
}
|
|
49052
49060
|
/**
|
|
49053
49061
|
* This method is useful when a plugin needs to perform some action before a
|
|
@@ -49083,10 +49091,10 @@ var BasePlugin = class {
|
|
|
49083
49091
|
for (const validation of validations) {
|
|
49084
49092
|
let results = validation.call(this, toValidate);
|
|
49085
49093
|
if (!Array.isArray(results)) results = [results];
|
|
49086
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
49094
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
49087
49095
|
if (cancelledReasons.length) return cancelledReasons;
|
|
49088
49096
|
}
|
|
49089
|
-
return
|
|
49097
|
+
return "Success";
|
|
49090
49098
|
};
|
|
49091
49099
|
}
|
|
49092
49100
|
checkValidations(command, ...validations) {
|
|
@@ -49143,7 +49151,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49143
49151
|
allowDispatch(cmd) {
|
|
49144
49152
|
switch (cmd.type) {
|
|
49145
49153
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
49146
|
-
default: return
|
|
49154
|
+
default: return "Success";
|
|
49147
49155
|
}
|
|
49148
49156
|
}
|
|
49149
49157
|
handle(cmd) {
|
|
@@ -49557,8 +49565,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49557
49565
|
checkBordersUnchanged(cmd) {
|
|
49558
49566
|
const currentBorder = this.getCellBorder(cmd);
|
|
49559
49567
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
49560
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
49561
|
-
return
|
|
49568
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
49569
|
+
return "Success";
|
|
49562
49570
|
}
|
|
49563
49571
|
import(data) {
|
|
49564
49572
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
|
|
@@ -49606,13 +49614,13 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
49606
49614
|
allowDispatch(cmd) {
|
|
49607
49615
|
switch (cmd.type) {
|
|
49608
49616
|
case "CREATE_CAROUSEL":
|
|
49609
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
49610
|
-
return
|
|
49617
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
|
|
49618
|
+
return "Success";
|
|
49611
49619
|
case "UPDATE_CAROUSEL":
|
|
49612
|
-
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return
|
|
49613
|
-
return
|
|
49620
|
+
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
49621
|
+
return "Success";
|
|
49614
49622
|
}
|
|
49615
|
-
return
|
|
49623
|
+
return "Success";
|
|
49616
49624
|
}
|
|
49617
49625
|
handle(cmd) {
|
|
49618
49626
|
switch (cmd.type) {
|
|
@@ -50232,9 +50240,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50232
50240
|
switch (cmd.type) {
|
|
50233
50241
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
50234
50242
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
50235
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
50243
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
50236
50244
|
case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
|
|
50237
|
-
default: return
|
|
50245
|
+
default: return "Success";
|
|
50238
50246
|
}
|
|
50239
50247
|
}
|
|
50240
50248
|
handle(cmd) {
|
|
@@ -50590,28 +50598,28 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50590
50598
|
}
|
|
50591
50599
|
checkCellOutOfSheet(cmd) {
|
|
50592
50600
|
const { sheetId, col, row } = cmd;
|
|
50593
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50594
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
50601
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50602
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
50595
50603
|
}
|
|
50596
50604
|
checkUselessClearCell(cmd) {
|
|
50597
50605
|
const cell = this.getters.getCell(cmd);
|
|
50598
|
-
if (!cell) return
|
|
50599
|
-
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return
|
|
50600
|
-
return
|
|
50606
|
+
if (!cell) return "NoChanges";
|
|
50607
|
+
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
50608
|
+
return "Success";
|
|
50601
50609
|
}
|
|
50602
50610
|
checkUselessUpdateCell(cmd) {
|
|
50603
50611
|
const cell = this.getters.getCell(cmd);
|
|
50604
50612
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
50605
50613
|
const hasStyle = "style" in cmd;
|
|
50606
50614
|
const hasFormat = "format" in cmd;
|
|
50607
|
-
if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
50608
|
-
return
|
|
50615
|
+
if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
50616
|
+
return "Success";
|
|
50609
50617
|
}
|
|
50610
50618
|
checkUselessSetFormatting(cmd) {
|
|
50611
50619
|
const { sheetId, target } = cmd;
|
|
50612
50620
|
const hasStyle = "style" in cmd;
|
|
50613
50621
|
const hasFormat = "format" in cmd;
|
|
50614
|
-
if (!hasStyle && !hasFormat) return
|
|
50622
|
+
if (!hasStyle && !hasFormat) return "NoChanges";
|
|
50615
50623
|
for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50616
50624
|
const position = {
|
|
50617
50625
|
sheetId,
|
|
@@ -50619,9 +50627,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50619
50627
|
row
|
|
50620
50628
|
};
|
|
50621
50629
|
const cell = this.getters.getCell(position);
|
|
50622
|
-
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return
|
|
50630
|
+
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
|
|
50623
50631
|
}
|
|
50624
|
-
return
|
|
50632
|
+
return "NoChanges";
|
|
50625
50633
|
}
|
|
50626
50634
|
};
|
|
50627
50635
|
|
|
@@ -50652,8 +50660,8 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50652
50660
|
switch (cmd.type) {
|
|
50653
50661
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
|
|
50654
50662
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
50655
|
-
case "DELETE_CHART": return
|
|
50656
|
-
default: return
|
|
50663
|
+
case "DELETE_CHART": return "SubCommandOnly";
|
|
50664
|
+
default: return "Success";
|
|
50657
50665
|
}
|
|
50658
50666
|
}
|
|
50659
50667
|
handle(cmd) {
|
|
@@ -50812,22 +50820,22 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50812
50820
|
}
|
|
50813
50821
|
}
|
|
50814
50822
|
checkChartDuplicate(cmd) {
|
|
50815
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50823
|
+
return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
|
|
50816
50824
|
}
|
|
50817
50825
|
checkChartDefinition(cmd) {
|
|
50818
50826
|
return SpreadsheetChart.validate(this, cmd.definition);
|
|
50819
50827
|
}
|
|
50820
50828
|
checkChartExists(cmd) {
|
|
50821
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50829
|
+
return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
|
|
50822
50830
|
}
|
|
50823
50831
|
checkChartChanged(cmd) {
|
|
50824
|
-
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return
|
|
50825
|
-
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ?
|
|
50832
|
+
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
|
|
50833
|
+
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
|
|
50826
50834
|
}
|
|
50827
50835
|
/** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
|
|
50828
50836
|
checkFigureArguments(cmd) {
|
|
50829
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
50830
|
-
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ?
|
|
50837
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
|
|
50838
|
+
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
|
|
50831
50839
|
}
|
|
50832
50840
|
};
|
|
50833
50841
|
|
|
@@ -50894,11 +50902,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
50894
50902
|
allowDispatch(cmd) {
|
|
50895
50903
|
switch (cmd.type) {
|
|
50896
50904
|
case "ADD_CONDITIONAL_FORMAT":
|
|
50897
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
50905
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
50898
50906
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
50899
50907
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
50900
50908
|
}
|
|
50901
|
-
return
|
|
50909
|
+
return "Success";
|
|
50902
50910
|
}
|
|
50903
50911
|
handle(cmd) {
|
|
50904
50912
|
switch (cmd.type) {
|
|
@@ -51031,27 +51039,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51031
51039
|
this.history.update("cfRules", sheet, currentCF);
|
|
51032
51040
|
}
|
|
51033
51041
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
51034
|
-
if (!this.cfRules[sheetId]) return
|
|
51042
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
51035
51043
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
51036
|
-
if (ruleIndex === -1) return
|
|
51044
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
51037
51045
|
const cfIndex2 = ruleIndex - delta;
|
|
51038
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
51039
|
-
return
|
|
51046
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
51047
|
+
return "Success";
|
|
51040
51048
|
}
|
|
51041
51049
|
checkEmptyRange(cmd) {
|
|
51042
|
-
return cmd.ranges.length ?
|
|
51050
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51043
51051
|
}
|
|
51044
51052
|
checkCFRule(cmd) {
|
|
51045
51053
|
const rule = cmd.cf.rule;
|
|
51046
51054
|
switch (rule.type) {
|
|
51047
51055
|
case "CellIsRule":
|
|
51048
|
-
if (!availableConditionalFormatOperators.has(rule.operator)) return
|
|
51056
|
+
if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
|
|
51049
51057
|
return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
|
|
51050
51058
|
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)));
|
|
51051
51059
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
51052
|
-
case "DataBarRule": return
|
|
51060
|
+
case "DataBarRule": return "Success";
|
|
51053
51061
|
}
|
|
51054
|
-
return
|
|
51062
|
+
return "InvalidConditionalFormatType";
|
|
51055
51063
|
}
|
|
51056
51064
|
checkCFHasChanged(cmd) {
|
|
51057
51065
|
const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
|
|
@@ -51059,8 +51067,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51059
51067
|
ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
|
|
51060
51068
|
});
|
|
51061
51069
|
const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
|
|
51062
|
-
if (currentCF && deepEquals(newCF, currentCF)) return
|
|
51063
|
-
return
|
|
51070
|
+
if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
|
|
51071
|
+
return "Success";
|
|
51064
51072
|
}
|
|
51065
51073
|
checkOperatorArgsNumber(rule) {
|
|
51066
51074
|
const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
|
|
@@ -51070,9 +51078,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51070
51078
|
if (expectedNumber === void 0 || expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
51071
51079
|
const errors = [];
|
|
51072
51080
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
51073
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
51074
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
51075
|
-
return errors.length ? errors :
|
|
51081
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
51082
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
51083
|
+
return errors.length ? errors : "Success";
|
|
51076
51084
|
}
|
|
51077
51085
|
checkNaN(threshold, thresholdName) {
|
|
51078
51086
|
if ([
|
|
@@ -51080,27 +51088,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51080
51088
|
"percentage",
|
|
51081
51089
|
"percentile"
|
|
51082
51090
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
51083
|
-
case "min": return
|
|
51084
|
-
case "max": return
|
|
51085
|
-
case "mid": return
|
|
51086
|
-
case "upperInflectionPoint": return
|
|
51087
|
-
case "lowerInflectionPoint": return
|
|
51091
|
+
case "min": return "MinNaN";
|
|
51092
|
+
case "max": return "MaxNaN";
|
|
51093
|
+
case "mid": return "MidNaN";
|
|
51094
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
51095
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
51088
51096
|
}
|
|
51089
|
-
return
|
|
51097
|
+
return "Success";
|
|
51090
51098
|
}
|
|
51091
51099
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
51092
|
-
if (threshold.type !== "formula") return
|
|
51100
|
+
if (threshold.type !== "formula") return "Success";
|
|
51093
51101
|
if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
|
|
51094
|
-
case "min": return
|
|
51095
|
-
case "max": return
|
|
51096
|
-
case "mid": return
|
|
51097
|
-
case "upperInflectionPoint": return
|
|
51098
|
-
case "lowerInflectionPoint": return
|
|
51102
|
+
case "min": return "MinInvalidFormula";
|
|
51103
|
+
case "max": return "MaxInvalidFormula";
|
|
51104
|
+
case "mid": return "MidInvalidFormula";
|
|
51105
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
51106
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
51099
51107
|
}
|
|
51100
|
-
return
|
|
51108
|
+
return "Success";
|
|
51101
51109
|
}
|
|
51102
51110
|
checkThresholds(check) {
|
|
51103
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
51111
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
51104
51112
|
}
|
|
51105
51113
|
checkInflectionPoints(check) {
|
|
51106
51114
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -51112,8 +51120,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51112
51120
|
"number",
|
|
51113
51121
|
"percentage",
|
|
51114
51122
|
"percentile"
|
|
51115
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
51116
|
-
return
|
|
51123
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
51124
|
+
return "Success";
|
|
51117
51125
|
}
|
|
51118
51126
|
checkMinBiggerThanMax(rule) {
|
|
51119
51127
|
const minValue = rule.minimum.value;
|
|
@@ -51122,8 +51130,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51122
51130
|
"number",
|
|
51123
51131
|
"percentage",
|
|
51124
51132
|
"percentile"
|
|
51125
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
51126
|
-
return
|
|
51133
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
51134
|
+
return "Success";
|
|
51127
51135
|
}
|
|
51128
51136
|
checkMidBiggerThanMax(rule) {
|
|
51129
51137
|
const midValue = rule.midpoint?.value;
|
|
@@ -51132,8 +51140,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51132
51140
|
"number",
|
|
51133
51141
|
"percentage",
|
|
51134
51142
|
"percentile"
|
|
51135
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
51136
|
-
return
|
|
51143
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
51144
|
+
return "Success";
|
|
51137
51145
|
}
|
|
51138
51146
|
checkMinBiggerThanMid(rule) {
|
|
51139
51147
|
const minValue = rule.minimum.value;
|
|
@@ -51142,15 +51150,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51142
51150
|
"number",
|
|
51143
51151
|
"percentage",
|
|
51144
51152
|
"percentile"
|
|
51145
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
51146
|
-
return
|
|
51153
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
51154
|
+
return "Success";
|
|
51147
51155
|
}
|
|
51148
51156
|
checkCFValues(rule) {
|
|
51149
51157
|
for (const value of rule.values) {
|
|
51150
51158
|
if (!value.startsWith("=")) continue;
|
|
51151
|
-
if (CompiledFormula.IsBadExpression(value)) return
|
|
51159
|
+
if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
|
|
51152
51160
|
}
|
|
51153
|
-
return
|
|
51161
|
+
return "Success";
|
|
51154
51162
|
}
|
|
51155
51163
|
removeConditionalFormatting(id, sheet) {
|
|
51156
51164
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -51225,15 +51233,15 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51225
51233
|
allowDispatch(cmd) {
|
|
51226
51234
|
switch (cmd.type) {
|
|
51227
51235
|
case "ADD_DATA_VALIDATION_RULE":
|
|
51228
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51229
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
51236
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51237
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
51230
51238
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
51231
51239
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
51232
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51233
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
51240
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51241
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
51234
51242
|
break;
|
|
51235
51243
|
}
|
|
51236
|
-
return
|
|
51244
|
+
return "Success";
|
|
51237
51245
|
}
|
|
51238
51246
|
handle(cmd) {
|
|
51239
51247
|
switch (cmd.type) {
|
|
@@ -51343,7 +51351,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51343
51351
|
}
|
|
51344
51352
|
}
|
|
51345
51353
|
checkEmptyRange(cmd) {
|
|
51346
|
-
return cmd.ranges.length ?
|
|
51354
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51347
51355
|
}
|
|
51348
51356
|
import(data) {
|
|
51349
51357
|
for (const sheet of data.sheets) {
|
|
@@ -51386,13 +51394,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51386
51394
|
}
|
|
51387
51395
|
}
|
|
51388
51396
|
checkCriterionTypeIsValid(cmd) {
|
|
51389
|
-
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
51397
|
+
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
51390
51398
|
}
|
|
51391
51399
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
51392
51400
|
const criterion = cmd.rule.criterion;
|
|
51393
51401
|
const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
51394
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
51395
|
-
return
|
|
51402
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
51403
|
+
return "Success";
|
|
51396
51404
|
}
|
|
51397
51405
|
checkCriterionValuesAreValid(cmd) {
|
|
51398
51406
|
const criterion = cmd.rule.criterion;
|
|
@@ -51402,12 +51410,12 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51402
51410
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
|
|
51403
51411
|
return !evaluator.isCriterionValueValid(value);
|
|
51404
51412
|
};
|
|
51405
|
-
if (criterion.values.some(isInvalid)) return
|
|
51406
|
-
return
|
|
51413
|
+
if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
|
|
51414
|
+
return "Success";
|
|
51407
51415
|
}
|
|
51408
51416
|
checkValidRange(cmd) {
|
|
51409
|
-
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return
|
|
51410
|
-
return
|
|
51417
|
+
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return "InvalidRange";
|
|
51418
|
+
return "Success";
|
|
51411
51419
|
}
|
|
51412
51420
|
};
|
|
51413
51421
|
|
|
@@ -51463,7 +51471,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51463
51471
|
case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
|
|
51464
51472
|
case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
|
|
51465
51473
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd);
|
|
51466
|
-
default: return
|
|
51474
|
+
default: return "Success";
|
|
51467
51475
|
}
|
|
51468
51476
|
}
|
|
51469
51477
|
beforeHandle(cmd) {
|
|
@@ -51632,16 +51640,16 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51632
51640
|
this.history.update("figures", sheetId, id, void 0);
|
|
51633
51641
|
}
|
|
51634
51642
|
checkFigureExists(cmd) {
|
|
51635
|
-
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return
|
|
51636
|
-
return
|
|
51643
|
+
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
|
|
51644
|
+
return "Success";
|
|
51637
51645
|
}
|
|
51638
51646
|
checkFigureDuplicate(cmd) {
|
|
51639
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return
|
|
51640
|
-
return
|
|
51647
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
|
|
51648
|
+
return "Success";
|
|
51641
51649
|
}
|
|
51642
51650
|
checkFigureAnchorOffset(cmd) {
|
|
51643
|
-
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return
|
|
51644
|
-
return
|
|
51651
|
+
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
|
|
51652
|
+
return "Success";
|
|
51645
51653
|
}
|
|
51646
51654
|
getFigures(sheetId) {
|
|
51647
51655
|
const figures = [];
|
|
@@ -51692,28 +51700,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
51692
51700
|
switch (cmd.type) {
|
|
51693
51701
|
case "GROUP_HEADERS": {
|
|
51694
51702
|
const { start, end, sheetId } = cmd;
|
|
51695
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51696
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51697
|
-
if (start > end) return
|
|
51698
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
51703
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51704
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51705
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51706
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
51699
51707
|
break;
|
|
51700
51708
|
}
|
|
51701
51709
|
case "UNGROUP_HEADERS": {
|
|
51702
51710
|
const { start, end, sheetId } = cmd;
|
|
51703
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51704
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51705
|
-
if (start > end) return
|
|
51711
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51712
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51713
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51706
51714
|
break;
|
|
51707
51715
|
}
|
|
51708
51716
|
case "UNFOLD_HEADER_GROUP":
|
|
51709
51717
|
case "FOLD_HEADER_GROUP":
|
|
51710
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51718
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51711
51719
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
51712
|
-
if (!group) return
|
|
51713
|
-
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
|
|
51720
|
+
if (!group) return "UnknownHeaderGroup";
|
|
51721
|
+
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";
|
|
51714
51722
|
break;
|
|
51715
51723
|
}
|
|
51716
|
-
return
|
|
51724
|
+
return "Success";
|
|
51717
51725
|
}
|
|
51718
51726
|
handle(cmd) {
|
|
51719
51727
|
switch (cmd.type) {
|
|
@@ -52121,19 +52129,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
52121
52129
|
allowDispatch(cmd) {
|
|
52122
52130
|
switch (cmd.type) {
|
|
52123
52131
|
case "HIDE_COLUMNS_ROWS": {
|
|
52124
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52132
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52125
52133
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
52126
52134
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
52127
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
52128
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
52129
|
-
else return
|
|
52135
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
52136
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
52137
|
+
else return "Success";
|
|
52130
52138
|
}
|
|
52131
52139
|
case "REMOVE_COLUMNS_ROWS":
|
|
52132
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52133
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
52134
|
-
return
|
|
52140
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52141
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
52142
|
+
return "Success";
|
|
52135
52143
|
}
|
|
52136
|
-
return
|
|
52144
|
+
return "Success";
|
|
52137
52145
|
}
|
|
52138
52146
|
handle(cmd) {
|
|
52139
52147
|
switch (cmd.type) {
|
|
@@ -52261,9 +52269,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
52261
52269
|
allowDispatch(cmd) {
|
|
52262
52270
|
switch (cmd.type) {
|
|
52263
52271
|
case "CREATE_IMAGE":
|
|
52264
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
52265
|
-
return
|
|
52266
|
-
default: return
|
|
52272
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
52273
|
+
return "Success";
|
|
52274
|
+
default: return "Success";
|
|
52267
52275
|
}
|
|
52268
52276
|
}
|
|
52269
52277
|
handle(cmd) {
|
|
@@ -52387,7 +52395,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52387
52395
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
52388
52396
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
52389
52397
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
52390
|
-
default: return
|
|
52398
|
+
default: return "Success";
|
|
52391
52399
|
}
|
|
52392
52400
|
}
|
|
52393
52401
|
handle(cmd) {
|
|
@@ -52548,18 +52556,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52548
52556
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
52549
52557
|
}
|
|
52550
52558
|
checkDestructiveMerge({ sheetId, target }) {
|
|
52551
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52552
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
52559
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52560
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
52553
52561
|
}
|
|
52554
52562
|
checkOverlap({ target }) {
|
|
52555
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
52556
|
-
return
|
|
52563
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
52564
|
+
return "Success";
|
|
52557
52565
|
}
|
|
52558
52566
|
checkFrozenPanes({ sheetId, target }) {
|
|
52559
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52567
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52560
52568
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
52561
|
-
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return
|
|
52562
|
-
return
|
|
52569
|
+
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
52570
|
+
return "Success";
|
|
52563
52571
|
}
|
|
52564
52572
|
/**
|
|
52565
52573
|
* The content of a merged cell should always be empty.
|
|
@@ -52567,10 +52575,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52567
52575
|
*/
|
|
52568
52576
|
checkMergedContentUpdate(cmd) {
|
|
52569
52577
|
const { col, row, content } = cmd;
|
|
52570
|
-
if (content === void 0) return
|
|
52578
|
+
if (content === void 0) return "Success";
|
|
52571
52579
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
52572
|
-
if (mainCol === col && mainRow === row) return
|
|
52573
|
-
return
|
|
52580
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
52581
|
+
return "CellIsMerged";
|
|
52574
52582
|
}
|
|
52575
52583
|
checkMergeExists(cmd) {
|
|
52576
52584
|
const { sheetId, target } = cmd;
|
|
@@ -52581,9 +52589,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52581
52589
|
col: left,
|
|
52582
52590
|
row: top
|
|
52583
52591
|
});
|
|
52584
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
52592
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
52585
52593
|
}
|
|
52586
|
-
return
|
|
52594
|
+
return "Success";
|
|
52587
52595
|
}
|
|
52588
52596
|
/**
|
|
52589
52597
|
* Merge the current selection. Note that:
|
|
@@ -52748,10 +52756,10 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52748
52756
|
allowDispatch(cmd) {
|
|
52749
52757
|
switch (cmd.type) {
|
|
52750
52758
|
case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
|
|
52751
|
-
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) :
|
|
52759
|
+
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
|
|
52752
52760
|
case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
|
|
52753
52761
|
}
|
|
52754
|
-
return
|
|
52762
|
+
return "Success";
|
|
52755
52763
|
}
|
|
52756
52764
|
handle(cmd) {
|
|
52757
52765
|
switch (cmd.type) {
|
|
@@ -52815,14 +52823,14 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52815
52823
|
}
|
|
52816
52824
|
}
|
|
52817
52825
|
checkValidNewNamedRangeName(name) {
|
|
52818
|
-
if (this.getNamedRange(name)) return
|
|
52819
|
-
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return
|
|
52820
|
-
if (rangeReference.test(name)) return
|
|
52821
|
-
return
|
|
52826
|
+
if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
|
|
52827
|
+
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
|
|
52828
|
+
if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
|
|
52829
|
+
return "Success";
|
|
52822
52830
|
}
|
|
52823
52831
|
checkNamedRangeExists(name) {
|
|
52824
|
-
if (!this.getNamedRange(name)) return
|
|
52825
|
-
return
|
|
52832
|
+
if (!this.getNamedRange(name)) return "NamedRangeNotFound";
|
|
52833
|
+
return "Success";
|
|
52826
52834
|
}
|
|
52827
52835
|
};
|
|
52828
52836
|
|
|
@@ -52847,25 +52855,25 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
52847
52855
|
allowDispatch(cmd) {
|
|
52848
52856
|
switch (cmd.type) {
|
|
52849
52857
|
case "ADD_PIVOT":
|
|
52850
|
-
if (cmd.pivotId in this.pivots) return
|
|
52858
|
+
if (cmd.pivotId in this.pivots) return "PivotIdTaken";
|
|
52851
52859
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52852
52860
|
case "UPDATE_PIVOT":
|
|
52853
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52854
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
52855
|
-
if (cmd.pivot.name === "") return
|
|
52861
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52862
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
52863
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
52856
52864
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52857
52865
|
case "RENAME_PIVOT":
|
|
52858
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52859
|
-
if (cmd.name === "") return
|
|
52866
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52867
|
+
if (cmd.name === "") return "EmptyName";
|
|
52860
52868
|
break;
|
|
52861
52869
|
case "REMOVE_PIVOT":
|
|
52862
52870
|
case "DUPLICATE_PIVOT":
|
|
52863
52871
|
case "INSERT_PIVOT":
|
|
52864
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52872
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52865
52873
|
break;
|
|
52866
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
52874
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52867
52875
|
}
|
|
52868
|
-
return
|
|
52876
|
+
return "Success";
|
|
52869
52877
|
}
|
|
52870
52878
|
handle(cmd) {
|
|
52871
52879
|
switch (cmd.type) {
|
|
@@ -53062,13 +53070,13 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53062
53070
|
}
|
|
53063
53071
|
checkSortedColumnInMeasures(definition) {
|
|
53064
53072
|
const measures = definition.measures.map((measure) => measure.id);
|
|
53065
|
-
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return
|
|
53066
|
-
return
|
|
53073
|
+
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
|
|
53074
|
+
return "Success";
|
|
53067
53075
|
}
|
|
53068
53076
|
checkDuplicatedMeasureIds(definition) {
|
|
53069
53077
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
53070
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
53071
|
-
return
|
|
53078
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
53079
|
+
return "Success";
|
|
53072
53080
|
}
|
|
53073
53081
|
checkCustomFieldsAreValid(definition) {
|
|
53074
53082
|
for (const customFieldName in definition.customFields) {
|
|
@@ -53077,15 +53085,15 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53077
53085
|
const groupNames = /* @__PURE__ */ new Set();
|
|
53078
53086
|
let hasOtherGroup = false;
|
|
53079
53087
|
for (const group of customField.groups) {
|
|
53080
|
-
if (!group.name || groupNames.has(group.name)) return
|
|
53081
|
-
if (group.values.some((value) => groupedValues.has(value))) return
|
|
53082
|
-
if (group.isOtherGroup && hasOtherGroup) return
|
|
53088
|
+
if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
|
|
53089
|
+
if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
|
|
53090
|
+
if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
|
|
53083
53091
|
group.values.forEach((value) => groupedValues.add(value));
|
|
53084
53092
|
groupNames.add(group.name);
|
|
53085
53093
|
hasOtherGroup ||= !!group.isOtherGroup;
|
|
53086
53094
|
}
|
|
53087
53095
|
}
|
|
53088
|
-
return
|
|
53096
|
+
return "Success";
|
|
53089
53097
|
}
|
|
53090
53098
|
/**
|
|
53091
53099
|
* Import the pivots
|
|
@@ -53114,9 +53122,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
53114
53122
|
locale = DEFAULT_LOCALE;
|
|
53115
53123
|
allowDispatch(cmd) {
|
|
53116
53124
|
switch (cmd.type) {
|
|
53117
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
53125
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
53118
53126
|
}
|
|
53119
|
-
return
|
|
53127
|
+
return "Success";
|
|
53120
53128
|
}
|
|
53121
53129
|
handle(cmd) {
|
|
53122
53130
|
switch (cmd.type) {
|
|
@@ -53197,7 +53205,7 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53197
53205
|
cellPosition = {};
|
|
53198
53206
|
allowDispatch(cmd) {
|
|
53199
53207
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
53200
|
-
if (genericChecks !==
|
|
53208
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
53201
53209
|
let sheetNameMissing = false;
|
|
53202
53210
|
switch (cmd.type) {
|
|
53203
53211
|
case "CREATE_SHEET":
|
|
@@ -53213,37 +53221,37 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53213
53221
|
if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
|
|
53214
53222
|
switch (cmd.type) {
|
|
53215
53223
|
case "HIDE_SHEET":
|
|
53216
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
53217
|
-
return
|
|
53224
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
53225
|
+
return "Success";
|
|
53218
53226
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
|
|
53219
53227
|
case "DUPLICATE_SHEET":
|
|
53220
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
53221
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
53222
|
-
return
|
|
53228
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
53229
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
53230
|
+
return "Success";
|
|
53223
53231
|
case "MOVE_SHEET": try {
|
|
53224
53232
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
53225
53233
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
53226
|
-
return
|
|
53234
|
+
return "Success";
|
|
53227
53235
|
} catch (e) {
|
|
53228
|
-
return
|
|
53236
|
+
return "WrongSheetMove";
|
|
53229
53237
|
}
|
|
53230
53238
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
53231
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
53232
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
53239
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
53240
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
53233
53241
|
case "ADD_COLUMNS_ROWS":
|
|
53234
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
53235
|
-
else if (cmd.quantity <= 0) return
|
|
53236
|
-
return
|
|
53242
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
53243
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
53244
|
+
return "Success";
|
|
53237
53245
|
case "REMOVE_COLUMNS_ROWS": {
|
|
53238
53246
|
const min = largeMin(cmd.elements);
|
|
53239
53247
|
const max = largeMax(cmd.elements);
|
|
53240
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
53241
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
53242
|
-
else return
|
|
53248
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
53249
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
53250
|
+
else return "Success";
|
|
53243
53251
|
}
|
|
53244
53252
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
53245
53253
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
53246
|
-
default: return
|
|
53254
|
+
default: return "Success";
|
|
53247
53255
|
}
|
|
53248
53256
|
}
|
|
53249
53257
|
handle(cmd) {
|
|
@@ -53518,12 +53526,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53518
53526
|
* not outside the sheet.
|
|
53519
53527
|
*/
|
|
53520
53528
|
checkZonesExistInSheet(sheetId, zones) {
|
|
53521
|
-
if (!zones.every(isZoneValid)) return
|
|
53529
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
53522
53530
|
if (zones.length) {
|
|
53523
53531
|
const sheetZone = this.getSheetZone(sheetId);
|
|
53524
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
53532
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
53525
53533
|
}
|
|
53526
|
-
return
|
|
53534
|
+
return "Success";
|
|
53527
53535
|
}
|
|
53528
53536
|
updateCellPosition(cmd) {
|
|
53529
53537
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -53597,42 +53605,42 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53597
53605
|
throw new Error("There is not enough visible sheets");
|
|
53598
53606
|
}
|
|
53599
53607
|
createSheetHasName(cmd) {
|
|
53600
|
-
if (cmd.name !== void 0 && !cmd.name.trim()) return
|
|
53601
|
-
return
|
|
53608
|
+
if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
|
|
53609
|
+
return "Success";
|
|
53602
53610
|
}
|
|
53603
53611
|
checkSheetName(cmd) {
|
|
53604
53612
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
53605
53613
|
const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
|
|
53606
|
-
if (originalSheetName !== void 0 && sheetName === originalSheetName) return
|
|
53614
|
+
if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
|
|
53607
53615
|
const { orderedSheetIds, sheets } = this;
|
|
53608
53616
|
const name = sheetName && sheetName.trim().toLowerCase();
|
|
53609
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
53610
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
53611
|
-
return
|
|
53617
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
53618
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
53619
|
+
return "Success";
|
|
53612
53620
|
}
|
|
53613
53621
|
checkSheetPosition(cmd) {
|
|
53614
53622
|
const { orderedSheetIds } = this;
|
|
53615
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
53616
|
-
return
|
|
53623
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
53624
|
+
return "Success";
|
|
53617
53625
|
}
|
|
53618
53626
|
checkRowFreezeQuantity(cmd) {
|
|
53619
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
53627
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53620
53628
|
}
|
|
53621
53629
|
checkColFreezeQuantity(cmd) {
|
|
53622
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
53630
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53623
53631
|
}
|
|
53624
53632
|
checkRowFreezeOverlapMerge(cmd) {
|
|
53625
53633
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53626
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
53627
|
-
return
|
|
53634
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
53635
|
+
return "Success";
|
|
53628
53636
|
}
|
|
53629
53637
|
checkColFreezeOverlapMerge(cmd) {
|
|
53630
53638
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53631
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
53632
|
-
return
|
|
53639
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
53640
|
+
return "Success";
|
|
53633
53641
|
}
|
|
53634
53642
|
isRenameAllowed(cmd) {
|
|
53635
|
-
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return
|
|
53643
|
+
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
|
|
53636
53644
|
return this.checkSheetName(cmd);
|
|
53637
53645
|
}
|
|
53638
53646
|
renameSheet(sheet, name) {
|
|
@@ -53855,19 +53863,19 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53855
53863
|
* sheet.
|
|
53856
53864
|
*/
|
|
53857
53865
|
checkSheetExists(cmd) {
|
|
53858
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
53859
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
53860
|
-
return
|
|
53866
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
53867
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
53868
|
+
return "Success";
|
|
53861
53869
|
}
|
|
53862
53870
|
/**
|
|
53863
53871
|
* Check if zones in the command are well formed and
|
|
53864
53872
|
* not outside the sheet.
|
|
53865
53873
|
*/
|
|
53866
53874
|
checkZonesAreInSheet(cmd) {
|
|
53867
|
-
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return
|
|
53868
|
-
if (!("sheetId" in cmd)) return
|
|
53869
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
53870
|
-
if (isTargetDependent(cmd) && cmd.target.length === 0) return
|
|
53875
|
+
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
|
|
53876
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
53877
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
53878
|
+
if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
|
|
53871
53879
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
53872
53880
|
}
|
|
53873
53881
|
};
|
|
@@ -53882,15 +53890,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
53882
53890
|
const definition = cmd.pivot;
|
|
53883
53891
|
return this.checkDataSetValidity(definition);
|
|
53884
53892
|
}
|
|
53885
|
-
return
|
|
53893
|
+
return "Success";
|
|
53886
53894
|
}
|
|
53887
53895
|
checkDataSetValidity(definition) {
|
|
53888
53896
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53889
53897
|
const { zone, sheetId } = definition.dataSet;
|
|
53890
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
53898
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
53891
53899
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53892
53900
|
}
|
|
53893
|
-
return
|
|
53901
|
+
return "Success";
|
|
53894
53902
|
}
|
|
53895
53903
|
};
|
|
53896
53904
|
|
|
@@ -53908,18 +53916,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
53908
53916
|
switch (cmd.type) {
|
|
53909
53917
|
case "CREATE_TABLE":
|
|
53910
53918
|
case "UPDATE_TABLE":
|
|
53911
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
53919
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
53912
53920
|
break;
|
|
53913
53921
|
case "CREATE_TABLE_STYLE":
|
|
53914
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
53922
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
53915
53923
|
try {
|
|
53916
53924
|
toHex(cmd.primaryColor);
|
|
53917
53925
|
} catch (e) {
|
|
53918
|
-
return
|
|
53926
|
+
return "InvalidTableStyle";
|
|
53919
53927
|
}
|
|
53920
53928
|
break;
|
|
53921
53929
|
}
|
|
53922
|
-
return
|
|
53930
|
+
return "Success";
|
|
53923
53931
|
}
|
|
53924
53932
|
handle(cmd) {
|
|
53925
53933
|
switch (cmd.type) {
|
|
@@ -53990,21 +53998,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
53990
53998
|
allowDispatch(cmd) {
|
|
53991
53999
|
switch (cmd.type) {
|
|
53992
54000
|
case "CREATE_TABLE":
|
|
53993
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
54001
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
53994
54002
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
53995
|
-
if (!areZonesContinuous(zones)) return
|
|
53996
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
54003
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
54004
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53997
54005
|
case "UPDATE_TABLE":
|
|
53998
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
54006
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
53999
54007
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
54000
54008
|
case "ADD_MERGE":
|
|
54001
54009
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
54002
54010
|
const tableZone = table.range.zone;
|
|
54003
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
54011
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
54004
54012
|
}
|
|
54005
54013
|
break;
|
|
54006
54014
|
}
|
|
54007
|
-
return
|
|
54015
|
+
return "Success";
|
|
54008
54016
|
}
|
|
54009
54017
|
handle(cmd) {
|
|
54010
54018
|
switch (cmd.type) {
|
|
@@ -54138,19 +54146,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
54138
54146
|
}
|
|
54139
54147
|
}
|
|
54140
54148
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
54141
|
-
if (!cmd.newTableRange) return
|
|
54149
|
+
if (!cmd.newTableRange) return "Success";
|
|
54142
54150
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
54143
54151
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
54144
|
-
if (zoneIsInSheet !==
|
|
54152
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
54145
54153
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
54146
|
-
if (!updatedTable) return
|
|
54147
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
54154
|
+
if (!updatedTable) return "TableNotFound";
|
|
54155
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
54148
54156
|
}
|
|
54149
54157
|
checkTableConfigUpdateIsValid(config) {
|
|
54150
|
-
if (!config) return
|
|
54151
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
54152
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
54153
|
-
return
|
|
54158
|
+
if (!config) return "Success";
|
|
54159
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
54160
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
54161
|
+
return "Success";
|
|
54154
54162
|
}
|
|
54155
54163
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
54156
54164
|
const zone = tableRange.zone;
|
|
@@ -54390,6 +54398,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
54390
54398
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
54391
54399
|
}
|
|
54392
54400
|
var CompilationParametersBuilder = class {
|
|
54401
|
+
getters;
|
|
54402
|
+
computeCell;
|
|
54393
54403
|
evalContext;
|
|
54394
54404
|
rangeCache = {};
|
|
54395
54405
|
constructor(context, getters, computeCell) {
|
|
@@ -54481,6 +54491,9 @@ var CompilationParametersBuilder = class {
|
|
|
54481
54491
|
//#endregion
|
|
54482
54492
|
//#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
|
|
54483
54493
|
var IntervalNode = class {
|
|
54494
|
+
interval;
|
|
54495
|
+
left;
|
|
54496
|
+
right;
|
|
54484
54497
|
/**
|
|
54485
54498
|
* Augmented value: the highest 'bottom' boundary in this subtree.
|
|
54486
54499
|
* Allows O(log n) pruning during overlap searches.
|
|
@@ -55565,6 +55578,7 @@ onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
|
55565
55578
|
const MAX_ITERATION = 30;
|
|
55566
55579
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
55567
55580
|
var Evaluator = class {
|
|
55581
|
+
context;
|
|
55568
55582
|
getters;
|
|
55569
55583
|
compilationParams;
|
|
55570
55584
|
evaluatedCells = new PositionMap();
|
|
@@ -55583,7 +55597,7 @@ var Evaluator = class {
|
|
|
55583
55597
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
55584
55598
|
if (!spreadZone) return;
|
|
55585
55599
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
55586
|
-
if (evaluatedCell?.type ===
|
|
55600
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
55587
55601
|
return union(positionToZone(position), spreadZone);
|
|
55588
55602
|
}
|
|
55589
55603
|
getEvaluatedPositions() {
|
|
@@ -55593,7 +55607,7 @@ var Evaluator = class {
|
|
|
55593
55607
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
55594
55608
|
}
|
|
55595
55609
|
getArrayFormulaSpreadingOn(position) {
|
|
55596
|
-
if (this.getEvaluatedCell(position).type ===
|
|
55610
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
55597
55611
|
return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
|
|
55598
55612
|
}
|
|
55599
55613
|
isArrayFormulaSpillBlocked(position) {
|
|
@@ -55790,7 +55804,7 @@ var Evaluator = class {
|
|
|
55790
55804
|
const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
|
|
55791
55805
|
if (!isMatrix(formulaReturn)) {
|
|
55792
55806
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
|
|
55793
|
-
if (evaluatedCell.type ===
|
|
55807
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
|
|
55794
55808
|
return evaluatedCell;
|
|
55795
55809
|
}
|
|
55796
55810
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
@@ -55851,7 +55865,7 @@ var Evaluator = class {
|
|
|
55851
55865
|
row: j + row
|
|
55852
55866
|
};
|
|
55853
55867
|
const rawCell = this.getters.getCell(position);
|
|
55854
|
-
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !==
|
|
55868
|
+
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
55855
55869
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
55856
55870
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
|
|
55857
55871
|
}
|
|
@@ -55868,7 +55882,7 @@ var Evaluator = class {
|
|
|
55868
55882
|
};
|
|
55869
55883
|
const cell = this.getters.getCell(position);
|
|
55870
55884
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
|
|
55871
|
-
if (evaluatedCell.type ===
|
|
55885
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
|
|
55872
55886
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
55873
55887
|
};
|
|
55874
55888
|
return spreadValues;
|
|
@@ -56072,7 +56086,7 @@ var EvaluationPlugin = class extends CoreViewPlugin {
|
|
|
56072
56086
|
sheetId,
|
|
56073
56087
|
col,
|
|
56074
56088
|
row
|
|
56075
|
-
})).every((cell) => cell.type ===
|
|
56089
|
+
})).every((cell) => cell.type === "empty");
|
|
56076
56090
|
}
|
|
56077
56091
|
/**
|
|
56078
56092
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -57025,7 +57039,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57025
57039
|
}
|
|
57026
57040
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
57027
57041
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
57028
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type ===
|
|
57042
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
57029
57043
|
switch (threshold.type) {
|
|
57030
57044
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
57031
57045
|
case "number": return Number(threshold.value);
|
|
@@ -57056,7 +57070,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57056
57070
|
col,
|
|
57057
57071
|
row
|
|
57058
57072
|
});
|
|
57059
|
-
if (cell.type !==
|
|
57073
|
+
if (cell.type !== "number") continue;
|
|
57060
57074
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
57061
57075
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
57062
57076
|
computedIcons[col][row] = icon;
|
|
@@ -57069,7 +57083,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57069
57083
|
}
|
|
57070
57084
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
57071
57085
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
57072
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
57086
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
57073
57087
|
if (max <= 0) return;
|
|
57074
57088
|
const color = rule.color;
|
|
57075
57089
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -57082,7 +57096,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57082
57096
|
col: targetCol,
|
|
57083
57097
|
row: targetRow
|
|
57084
57098
|
});
|
|
57085
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
57099
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
57086
57100
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
57087
57101
|
computedDataBars[col][row] = {
|
|
57088
57102
|
color: colorNumberToHex(color),
|
|
@@ -57116,7 +57130,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57116
57130
|
col,
|
|
57117
57131
|
row
|
|
57118
57132
|
});
|
|
57119
|
-
if (cell.type ===
|
|
57133
|
+
if (cell.type === "number") {
|
|
57120
57134
|
const value = clip(cell.value, minValue, maxValue);
|
|
57121
57135
|
if (!computedStyle[col]) computedStyle[col] = [];
|
|
57122
57136
|
computedStyle[col][row] = computedStyle[col]?.[row] || {};
|
|
@@ -57126,7 +57140,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57126
57140
|
}
|
|
57127
57141
|
getRuleResultForTarget(target, rule, preComputedCriterion) {
|
|
57128
57142
|
const cell = this.getters.getEvaluatedCell(target);
|
|
57129
|
-
if (cell.type ===
|
|
57143
|
+
if (cell.type === "error") return false;
|
|
57130
57144
|
const { sheetId } = target;
|
|
57131
57145
|
const evaluator = criterionEvaluatorRegistry.get(rule.operator);
|
|
57132
57146
|
const evaluatedCriterionValues = rule.values.map((value) => {
|
|
@@ -57272,7 +57286,7 @@ var EvaluationDataValidationPlugin = class extends CoreViewPlugin {
|
|
|
57272
57286
|
if (!validationResults[col]) validationResults[col] = [];
|
|
57273
57287
|
validationResults[col][row] = lazy(() => {
|
|
57274
57288
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
57275
|
-
if (evaluatedCell.type ===
|
|
57289
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
57276
57290
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
57277
57291
|
});
|
|
57278
57292
|
}
|
|
@@ -58214,7 +58228,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58214
58228
|
const result = [];
|
|
58215
58229
|
for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
|
|
58216
58230
|
const position = this.getters.getCellPosition(cellId);
|
|
58217
|
-
if (this.getters.getEvaluatedCell(position).type ===
|
|
58231
|
+
if (this.getters.getEvaluatedCell(position).type === "error") continue;
|
|
58218
58232
|
const pivotInfo = this.getPivotStyleAtPosition(position);
|
|
58219
58233
|
if (pivotInfo) result.push({
|
|
58220
58234
|
position,
|
|
@@ -58246,6 +58260,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58246
58260
|
//#endregion
|
|
58247
58261
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
58248
58262
|
var ClipboardHandler = class {
|
|
58263
|
+
getters;
|
|
58264
|
+
dispatch;
|
|
58249
58265
|
constructor(getters, dispatch) {
|
|
58250
58266
|
this.getters = getters;
|
|
58251
58267
|
this.dispatch = dispatch;
|
|
@@ -58253,10 +58269,10 @@ var ClipboardHandler = class {
|
|
|
58253
58269
|
copy(data, isCutOperation, mode = "copyPaste") {}
|
|
58254
58270
|
paste(target, clippedContent, options) {}
|
|
58255
58271
|
isPasteAllowed(sheetId, target, content, option) {
|
|
58256
|
-
return
|
|
58272
|
+
return "Success";
|
|
58257
58273
|
}
|
|
58258
58274
|
isCutAllowed(data) {
|
|
58259
|
-
return
|
|
58275
|
+
return "Success";
|
|
58260
58276
|
}
|
|
58261
58277
|
getPasteTarget(sheetId, target, content, options) {
|
|
58262
58278
|
return {
|
|
@@ -58282,8 +58298,8 @@ var AbstractCellClipboardHandler = class extends ClipboardHandler {
|
|
|
58282
58298
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
58283
58299
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
58284
58300
|
isCutAllowed(data) {
|
|
58285
|
-
if (data.zones.length !== 1) return
|
|
58286
|
-
return
|
|
58301
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
58302
|
+
return "Success";
|
|
58287
58303
|
}
|
|
58288
58304
|
copy(data, isCutOperation, mode = "copyPaste") {
|
|
58289
58305
|
const sheetId = data.sheetId;
|
|
@@ -58348,17 +58364,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
58348
58364
|
};
|
|
58349
58365
|
}
|
|
58350
58366
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
58351
|
-
if (!content.cells) return
|
|
58352
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
58367
|
+
if (!content.cells) return "Success";
|
|
58368
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
58353
58369
|
if (target.length > 1) {
|
|
58354
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
58370
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
58355
58371
|
}
|
|
58356
58372
|
const clipboardHeight = content.cells.length;
|
|
58357
58373
|
const clipboardWidth = content.cells[0].length;
|
|
58358
58374
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
58359
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
58375
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
58360
58376
|
}
|
|
58361
|
-
return
|
|
58377
|
+
return "Success";
|
|
58362
58378
|
}
|
|
58363
58379
|
/**
|
|
58364
58380
|
* Paste the clipboard content in the given target
|
|
@@ -58507,7 +58523,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58507
58523
|
switch (cmd.type) {
|
|
58508
58524
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
58509
58525
|
}
|
|
58510
|
-
return
|
|
58526
|
+
return "Success";
|
|
58511
58527
|
}
|
|
58512
58528
|
handle(cmd) {
|
|
58513
58529
|
switch (cmd.type) {
|
|
@@ -58590,34 +58606,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58590
58606
|
});
|
|
58591
58607
|
}
|
|
58592
58608
|
checkSingleRangeSelected() {
|
|
58593
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
58594
|
-
return
|
|
58609
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
58610
|
+
return "Success";
|
|
58595
58611
|
}
|
|
58596
58612
|
checkNoMergeInZone() {
|
|
58597
58613
|
const sheetId = this.getters.getActiveSheetId();
|
|
58598
58614
|
const zone = this.getters.getSelectedZone();
|
|
58599
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
58600
|
-
return
|
|
58615
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
58616
|
+
return "Success";
|
|
58601
58617
|
}
|
|
58602
58618
|
checkRangeContainsValues(cmd) {
|
|
58603
58619
|
const sheetId = this.getters.getActiveSheetId();
|
|
58604
58620
|
const zone = this.getters.getSelectedZone();
|
|
58605
58621
|
if (cmd.hasHeader) zone.top += 1;
|
|
58606
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
58607
|
-
return
|
|
58622
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
|
|
58623
|
+
return "Success";
|
|
58608
58624
|
}
|
|
58609
58625
|
checkNoColumnProvided(cmd) {
|
|
58610
|
-
if (cmd.columns.length === 0) return
|
|
58611
|
-
return
|
|
58626
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
58627
|
+
return "Success";
|
|
58612
58628
|
}
|
|
58613
58629
|
checkColumnsIncludedInZone(cmd) {
|
|
58614
58630
|
const zone = this.getters.getSelectedZone();
|
|
58615
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
58616
|
-
return
|
|
58631
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
58632
|
+
return "Success";
|
|
58617
58633
|
}
|
|
58618
58634
|
checkColumnsAreUnique(cmd) {
|
|
58619
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
58620
|
-
return
|
|
58635
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
58636
|
+
return "Success";
|
|
58621
58637
|
}
|
|
58622
58638
|
trimWhitespace() {
|
|
58623
58639
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -58735,19 +58751,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
58735
58751
|
let x = 0;
|
|
58736
58752
|
let y = 0;
|
|
58737
58753
|
switch (direction) {
|
|
58738
|
-
case
|
|
58754
|
+
case "up":
|
|
58739
58755
|
x = 0;
|
|
58740
58756
|
y = -rule.current;
|
|
58741
58757
|
break;
|
|
58742
|
-
case
|
|
58758
|
+
case "down":
|
|
58743
58759
|
x = 0;
|
|
58744
58760
|
y = rule.current;
|
|
58745
58761
|
break;
|
|
58746
|
-
case
|
|
58762
|
+
case "left":
|
|
58747
58763
|
x = -rule.current;
|
|
58748
58764
|
y = 0;
|
|
58749
58765
|
break;
|
|
58750
|
-
case
|
|
58766
|
+
case "right":
|
|
58751
58767
|
x = rule.current;
|
|
58752
58768
|
y = 0;
|
|
58753
58769
|
break;
|
|
@@ -58874,11 +58890,11 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58874
58890
|
},
|
|
58875
58891
|
sequence: 10
|
|
58876
58892
|
}).add("increment_alphanumeric_value", {
|
|
58877
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58893
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
58878
58894
|
generateRule: (cell, cells, direction) => {
|
|
58879
58895
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
58880
58896
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
58881
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58897
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
|
|
58882
58898
|
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
58883
58899
|
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
58884
58900
|
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
@@ -58896,7 +58912,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58896
58912
|
},
|
|
58897
58913
|
sequence: 15
|
|
58898
58914
|
}).add("copy_text", {
|
|
58899
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58915
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
58900
58916
|
generateRule: () => {
|
|
58901
58917
|
return { type: "COPY_MODIFIER" };
|
|
58902
58918
|
},
|
|
@@ -58913,10 +58929,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58913
58929
|
sequence: 30
|
|
58914
58930
|
}).add("increment_dates", {
|
|
58915
58931
|
condition: (cell, cells) => {
|
|
58916
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58932
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
58917
58933
|
},
|
|
58918
58934
|
generateRule: (cell, cells) => {
|
|
58919
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58935
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
58920
58936
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
58921
58937
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
58922
58938
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -58925,26 +58941,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58925
58941
|
if (typeof increment === "object") return {
|
|
58926
58942
|
type: "DATE_INCREMENT_MODIFIER",
|
|
58927
58943
|
increment,
|
|
58928
|
-
current: evaluation.type ===
|
|
58944
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58929
58945
|
};
|
|
58930
58946
|
return {
|
|
58931
58947
|
type: "INCREMENT_MODIFIER",
|
|
58932
58948
|
increment,
|
|
58933
|
-
current: evaluation.type ===
|
|
58949
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58934
58950
|
};
|
|
58935
58951
|
},
|
|
58936
58952
|
sequence: 25
|
|
58937
58953
|
}).add("increment_number", {
|
|
58938
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58954
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
58939
58955
|
generateRule: (cell, cells, direction) => {
|
|
58940
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58956
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
58941
58957
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
58942
58958
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
58943
58959
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
58944
58960
|
return {
|
|
58945
58961
|
type: "INCREMENT_MODIFIER",
|
|
58946
58962
|
increment,
|
|
58947
|
-
current: evaluation.type ===
|
|
58963
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58948
58964
|
};
|
|
58949
58965
|
},
|
|
58950
58966
|
sequence: 40
|
|
@@ -59054,10 +59070,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59054
59070
|
const sheetId = this.getters.getActiveSheetId();
|
|
59055
59071
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
59056
59072
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
59057
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
59058
|
-
return
|
|
59073
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
59074
|
+
return "InvalidAutofillSelection";
|
|
59059
59075
|
}
|
|
59060
|
-
return
|
|
59076
|
+
return "Success";
|
|
59061
59077
|
}
|
|
59062
59078
|
handle(cmd) {
|
|
59063
59079
|
switch (cmd.type) {
|
|
@@ -59089,7 +59105,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59089
59105
|
const target = this.autofillZone;
|
|
59090
59106
|
const autofillCellsData = [];
|
|
59091
59107
|
switch (this.direction) {
|
|
59092
|
-
case
|
|
59108
|
+
case "down":
|
|
59093
59109
|
for (let col = source.left; col <= source.right; col++) {
|
|
59094
59110
|
const xcs = [];
|
|
59095
59111
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -59097,7 +59113,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59097
59113
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59098
59114
|
}
|
|
59099
59115
|
break;
|
|
59100
|
-
case
|
|
59116
|
+
case "up":
|
|
59101
59117
|
for (let col = source.left; col <= source.right; col++) {
|
|
59102
59118
|
const xcs = [];
|
|
59103
59119
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -59105,7 +59121,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59105
59121
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59106
59122
|
}
|
|
59107
59123
|
break;
|
|
59108
|
-
case
|
|
59124
|
+
case "left":
|
|
59109
59125
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
59110
59126
|
const xcs = [];
|
|
59111
59127
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -59113,7 +59129,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59113
59129
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59114
59130
|
}
|
|
59115
59131
|
break;
|
|
59116
|
-
case
|
|
59132
|
+
case "right":
|
|
59117
59133
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
59118
59134
|
const xcs = [];
|
|
59119
59135
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -59239,19 +59255,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59239
59255
|
}
|
|
59240
59256
|
this.direction = this.getDirection(col, row);
|
|
59241
59257
|
switch (this.direction) {
|
|
59242
|
-
case
|
|
59258
|
+
case "up":
|
|
59243
59259
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
59244
59260
|
this.steps = source.top - row;
|
|
59245
59261
|
break;
|
|
59246
|
-
case
|
|
59262
|
+
case "down":
|
|
59247
59263
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
59248
59264
|
this.steps = row - source.bottom;
|
|
59249
59265
|
break;
|
|
59250
|
-
case
|
|
59266
|
+
case "left":
|
|
59251
59267
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
59252
59268
|
this.steps = source.left - col;
|
|
59253
59269
|
break;
|
|
59254
|
-
case
|
|
59270
|
+
case "right":
|
|
59255
59271
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
59256
59272
|
this.steps = col - source.right;
|
|
59257
59273
|
break;
|
|
@@ -59270,7 +59286,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59270
59286
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
59271
59287
|
...activePosition,
|
|
59272
59288
|
row
|
|
59273
|
-
}).type !==
|
|
59289
|
+
}).type !== "empty") {
|
|
59274
59290
|
autofillRow = row - 1;
|
|
59275
59291
|
break;
|
|
59276
59292
|
}
|
|
@@ -59290,7 +59306,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59290
59306
|
col: col - 1,
|
|
59291
59307
|
row
|
|
59292
59308
|
};
|
|
59293
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
59309
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
59294
59310
|
row += 1;
|
|
59295
59311
|
leftPosition = {
|
|
59296
59312
|
sheetId,
|
|
@@ -59307,7 +59323,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59307
59323
|
col: col + 1,
|
|
59308
59324
|
row
|
|
59309
59325
|
};
|
|
59310
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
59326
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
59311
59327
|
row += 1;
|
|
59312
59328
|
rightPosition = {
|
|
59313
59329
|
sheetId,
|
|
@@ -59397,19 +59413,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59397
59413
|
const position = {
|
|
59398
59414
|
up: {
|
|
59399
59415
|
number: source.top - row,
|
|
59400
|
-
value:
|
|
59416
|
+
value: "up"
|
|
59401
59417
|
},
|
|
59402
59418
|
down: {
|
|
59403
59419
|
number: row - source.bottom,
|
|
59404
|
-
value:
|
|
59420
|
+
value: "down"
|
|
59405
59421
|
},
|
|
59406
59422
|
left: {
|
|
59407
59423
|
number: source.left - col,
|
|
59408
|
-
value:
|
|
59424
|
+
value: "left"
|
|
59409
59425
|
},
|
|
59410
59426
|
right: {
|
|
59411
59427
|
number: col - source.right,
|
|
59412
|
-
value:
|
|
59428
|
+
value: "right"
|
|
59413
59429
|
}
|
|
59414
59430
|
};
|
|
59415
59431
|
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;
|
|
@@ -59612,7 +59628,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
59612
59628
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
59613
59629
|
}
|
|
59614
59630
|
isNumber(cell) {
|
|
59615
|
-
return cell.type ===
|
|
59631
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
59616
59632
|
}
|
|
59617
59633
|
isZoneValid(zone) {
|
|
59618
59634
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -60675,6 +60691,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
60675
60691
|
//#endregion
|
|
60676
60692
|
//#region src/collaborative/revisions.ts
|
|
60677
60693
|
var Revision = class {
|
|
60694
|
+
rootCommand;
|
|
60695
|
+
timestamp;
|
|
60678
60696
|
id;
|
|
60679
60697
|
clientId;
|
|
60680
60698
|
_commands = [];
|
|
@@ -60711,6 +60729,10 @@ var Revision = class {
|
|
|
60711
60729
|
//#region src/collaborative/session.ts
|
|
60712
60730
|
var ClientDisconnectedError = class extends Error {};
|
|
60713
60731
|
var Session = class extends EventBus {
|
|
60732
|
+
revisions;
|
|
60733
|
+
transportService;
|
|
60734
|
+
serverRevisionId;
|
|
60735
|
+
commandSquisher;
|
|
60714
60736
|
/**
|
|
60715
60737
|
* Positions of the others client.
|
|
60716
60738
|
*/
|
|
@@ -61177,7 +61199,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61177
61199
|
...position,
|
|
61178
61200
|
content: "FALSE"
|
|
61179
61201
|
});
|
|
61180
|
-
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type ===
|
|
61202
|
+
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
|
|
61181
61203
|
let value;
|
|
61182
61204
|
if (cell.isFormula) {
|
|
61183
61205
|
const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
|
|
@@ -61187,7 +61209,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61187
61209
|
...position,
|
|
61188
61210
|
content: "FALSE"
|
|
61189
61211
|
});
|
|
61190
|
-
} else if (evaluatedCell.type !==
|
|
61212
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
61191
61213
|
...position,
|
|
61192
61214
|
content: "FALSE"
|
|
61193
61215
|
});
|
|
@@ -61314,7 +61336,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
61314
61336
|
getCellNumberFormat(position) {
|
|
61315
61337
|
for (const pos of [position]) {
|
|
61316
61338
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
61317
|
-
if (cell.type ===
|
|
61339
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
61318
61340
|
}
|
|
61319
61341
|
}
|
|
61320
61342
|
};
|
|
@@ -61482,11 +61504,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
61482
61504
|
allowDispatch(cmd) {
|
|
61483
61505
|
switch (cmd.type) {
|
|
61484
61506
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
61485
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
61486
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
61507
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
61508
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
61487
61509
|
break;
|
|
61488
61510
|
}
|
|
61489
|
-
return
|
|
61511
|
+
return "Success";
|
|
61490
61512
|
}
|
|
61491
61513
|
handle(cmd) {
|
|
61492
61514
|
switch (cmd.type) {
|
|
@@ -61749,13 +61771,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
61749
61771
|
allowDispatch(cmd) {
|
|
61750
61772
|
switch (cmd.type) {
|
|
61751
61773
|
case "REQUEST_UNDO":
|
|
61752
|
-
if (!this.canUndo()) return
|
|
61774
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
61753
61775
|
break;
|
|
61754
61776
|
case "REQUEST_REDO":
|
|
61755
|
-
if (!this.canRedo()) return
|
|
61777
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
61756
61778
|
break;
|
|
61757
61779
|
}
|
|
61758
|
-
return
|
|
61780
|
+
return "Success";
|
|
61759
61781
|
}
|
|
61760
61782
|
handle(cmd) {
|
|
61761
61783
|
switch (cmd.type) {
|
|
@@ -61819,9 +61841,9 @@ var LockSheetPlugin = class extends UIPlugin {
|
|
|
61819
61841
|
* to other users and can do any operation and can do core modifications that will only affect them
|
|
61820
61842
|
* It is acceptable to bypass the locked sheet restriction in this case
|
|
61821
61843
|
*/
|
|
61822
|
-
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return
|
|
61823
|
-
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return
|
|
61824
|
-
return
|
|
61844
|
+
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
|
|
61845
|
+
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
|
|
61846
|
+
return "Success";
|
|
61825
61847
|
}
|
|
61826
61848
|
isCurrentSheetLocked() {
|
|
61827
61849
|
return this.getters.isSheetLocked(this.getters.getActiveSheetId());
|
|
@@ -61886,18 +61908,18 @@ var PivotPresencePlugin = class extends UIPlugin {
|
|
|
61886
61908
|
//#endregion
|
|
61887
61909
|
//#region src/helpers/sort.ts
|
|
61888
61910
|
const SORT_TYPES = [
|
|
61889
|
-
|
|
61890
|
-
|
|
61891
|
-
|
|
61892
|
-
|
|
61911
|
+
"number",
|
|
61912
|
+
"error",
|
|
61913
|
+
"text",
|
|
61914
|
+
"boolean"
|
|
61893
61915
|
];
|
|
61894
61916
|
function cellsSortingCriterion(sortingOrder) {
|
|
61895
61917
|
const inverse = sortingOrder === "asc" ? 1 : -1;
|
|
61896
61918
|
return (left, right) => {
|
|
61897
|
-
if (left.type ===
|
|
61898
|
-
else if (right.type ===
|
|
61919
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
61920
|
+
else if (right.type === "empty") return -1;
|
|
61899
61921
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
61900
|
-
if (typeOrder === 0) if (left.type ===
|
|
61922
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
61901
61923
|
else typeOrder = left.value - right.value;
|
|
61902
61924
|
return inverse * typeOrder;
|
|
61903
61925
|
};
|
|
@@ -61908,9 +61930,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
61908
61930
|
type: cell.type,
|
|
61909
61931
|
value: cell.value
|
|
61910
61932
|
}));
|
|
61911
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
61933
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
61912
61934
|
...cell,
|
|
61913
|
-
type:
|
|
61935
|
+
type: "number",
|
|
61914
61936
|
value: 0
|
|
61915
61937
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
61916
61938
|
}
|
|
@@ -61921,10 +61943,10 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61921
61943
|
allowDispatch(cmd) {
|
|
61922
61944
|
switch (cmd.type) {
|
|
61923
61945
|
case "SORT_CELLS":
|
|
61924
|
-
if (!isInside(cmd.col, cmd.row, cmd.zone)) return
|
|
61946
|
+
if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
|
|
61925
61947
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
|
|
61926
61948
|
}
|
|
61927
|
-
return
|
|
61949
|
+
return "Success";
|
|
61928
61950
|
}
|
|
61929
61951
|
handle(cmd) {
|
|
61930
61952
|
switch (cmd.type) {
|
|
@@ -61934,24 +61956,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61934
61956
|
}
|
|
61935
61957
|
}
|
|
61936
61958
|
checkMerge({ sheetId, zone }) {
|
|
61937
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61959
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61938
61960
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
61939
61961
|
sheetId,
|
|
61940
61962
|
col,
|
|
61941
61963
|
row
|
|
61942
|
-
}))) return
|
|
61943
|
-
return
|
|
61964
|
+
}))) return "InvalidSortZone";
|
|
61965
|
+
return "Success";
|
|
61944
61966
|
}
|
|
61945
61967
|
checkMergeSizes({ sheetId, zone }) {
|
|
61946
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61968
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61947
61969
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
61948
61970
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
61949
61971
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
61950
61972
|
if (!merges.every((merge) => {
|
|
61951
61973
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
61952
61974
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
61953
|
-
})) return
|
|
61954
|
-
return
|
|
61975
|
+
})) return "InvalidSortZone";
|
|
61976
|
+
return "Success";
|
|
61955
61977
|
}
|
|
61956
61978
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
61957
61979
|
return positions(zone).some(({ col, row }) => {
|
|
@@ -61965,7 +61987,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61965
61987
|
col,
|
|
61966
61988
|
row
|
|
61967
61989
|
});
|
|
61968
|
-
}) ?
|
|
61990
|
+
}) ? "SortZoneWithArrayFormulas" : "Success";
|
|
61969
61991
|
}
|
|
61970
61992
|
/**
|
|
61971
61993
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -61983,9 +62005,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61983
62005
|
col,
|
|
61984
62006
|
row
|
|
61985
62007
|
}).type));
|
|
61986
|
-
if (cells[0][0] ===
|
|
61987
|
-
if (cells.some((item) => item[0] ===
|
|
61988
|
-
else if (cells.some((item) => item[1] !==
|
|
62008
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
62009
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
62010
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
61989
62011
|
else return false;
|
|
61990
62012
|
}
|
|
61991
62013
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -62074,7 +62096,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62074
62096
|
switch (cmd.type) {
|
|
62075
62097
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
62076
62098
|
}
|
|
62077
|
-
return
|
|
62099
|
+
return "Success";
|
|
62078
62100
|
}
|
|
62079
62101
|
handle(cmd) {
|
|
62080
62102
|
switch (cmd.type) {
|
|
@@ -62085,7 +62107,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62085
62107
|
}
|
|
62086
62108
|
getAutomaticSeparator() {
|
|
62087
62109
|
const cells = this.getters.getSelectedCells();
|
|
62088
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
62110
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
62089
62111
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
62090
62112
|
if (separator) return separator;
|
|
62091
62113
|
}
|
|
@@ -62223,24 +62245,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62223
62245
|
});
|
|
62224
62246
|
}
|
|
62225
62247
|
checkSingleColSelected() {
|
|
62226
|
-
if (!this.getters.isSingleColSelected()) return
|
|
62227
|
-
return
|
|
62248
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
62249
|
+
return "Success";
|
|
62228
62250
|
}
|
|
62229
62251
|
checkNonEmptySelector(cmd) {
|
|
62230
|
-
if (cmd.separator === "") return
|
|
62231
|
-
return
|
|
62252
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
62253
|
+
return "Success";
|
|
62232
62254
|
}
|
|
62233
62255
|
checkNotOverwritingContent(cmd) {
|
|
62234
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
62256
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
62235
62257
|
const selection = this.getters.getSelectedZones()[0];
|
|
62236
62258
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
62237
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
62238
|
-
return
|
|
62259
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
62260
|
+
return "Success";
|
|
62239
62261
|
}
|
|
62240
62262
|
checkSeparatorInSelection({ separator }) {
|
|
62241
62263
|
const cells = this.getters.getSelectedCells();
|
|
62242
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
62243
|
-
return
|
|
62264
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
62265
|
+
return "NoSplitSeparatorInSelection";
|
|
62244
62266
|
}
|
|
62245
62267
|
};
|
|
62246
62268
|
|
|
@@ -62285,7 +62307,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
62285
62307
|
col,
|
|
62286
62308
|
row: r,
|
|
62287
62309
|
sheetId
|
|
62288
|
-
}).type !==
|
|
62310
|
+
}).type !== "empty") return;
|
|
62289
62311
|
}
|
|
62290
62312
|
const oldSelection = {
|
|
62291
62313
|
zone: this.getters.getSelectedZone(),
|
|
@@ -62314,13 +62336,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
62314
62336
|
switch (cmd.type) {
|
|
62315
62337
|
case "RESIZE_TABLE":
|
|
62316
62338
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
62317
|
-
if (!table) return
|
|
62339
|
+
if (!table) return "TableNotFound";
|
|
62318
62340
|
const oldTableZone = table.range.zone;
|
|
62319
62341
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
62320
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
62342
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
62321
62343
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
62322
62344
|
}
|
|
62323
|
-
return
|
|
62345
|
+
return "Success";
|
|
62324
62346
|
}
|
|
62325
62347
|
handle(cmd) {
|
|
62326
62348
|
switch (cmd.type) {
|
|
@@ -62548,7 +62570,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62548
62570
|
*/
|
|
62549
62571
|
isCellEmpty(position) {
|
|
62550
62572
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
62551
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
62573
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
62552
62574
|
}
|
|
62553
62575
|
getColMaxWidth(sheetId, index) {
|
|
62554
62576
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -62562,8 +62584,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62562
62584
|
* sheet.
|
|
62563
62585
|
*/
|
|
62564
62586
|
checkSheetExists(cmd) {
|
|
62565
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return
|
|
62566
|
-
return
|
|
62587
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
|
|
62588
|
+
return "Success";
|
|
62567
62589
|
}
|
|
62568
62590
|
/**
|
|
62569
62591
|
* Check if zones in the command are well formed and
|
|
@@ -62571,11 +62593,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62571
62593
|
*/
|
|
62572
62594
|
checkZonesAreInSheet(cmd) {
|
|
62573
62595
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
62574
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
62596
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
62575
62597
|
const zones = this.getters.getCommandZones(cmd);
|
|
62576
|
-
if (!sheetId && zones.length > 0) return
|
|
62598
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
62577
62599
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
62578
|
-
return
|
|
62600
|
+
return "Success";
|
|
62579
62601
|
}
|
|
62580
62602
|
autoResizeRows(sheetId, rows) {
|
|
62581
62603
|
const rowSizes = [];
|
|
@@ -62622,20 +62644,20 @@ var CarouselUIPlugin = class extends UIPlugin {
|
|
|
62622
62644
|
allowDispatch(cmd) {
|
|
62623
62645
|
switch (cmd.type) {
|
|
62624
62646
|
case "ADD_FIGURE_CHART_TO_CAROUSEL":
|
|
62625
|
-
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return
|
|
62626
|
-
return
|
|
62647
|
+
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
|
|
62648
|
+
return "Success";
|
|
62627
62649
|
case "DUPLICATE_CAROUSEL_CHART":
|
|
62628
|
-
if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return
|
|
62629
|
-
return
|
|
62650
|
+
if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return "InvalidFigureId";
|
|
62651
|
+
return "Success";
|
|
62630
62652
|
case "ADD_NEW_CHART_TO_CAROUSEL":
|
|
62631
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62632
|
-
return
|
|
62653
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62654
|
+
return "Success";
|
|
62633
62655
|
case "UPDATE_CAROUSEL_ACTIVE_ITEM":
|
|
62634
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62635
|
-
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return
|
|
62636
|
-
return
|
|
62656
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62657
|
+
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
|
|
62658
|
+
return "Success";
|
|
62637
62659
|
}
|
|
62638
|
-
return
|
|
62660
|
+
return "Success";
|
|
62639
62661
|
}
|
|
62640
62662
|
handle(cmd) {
|
|
62641
62663
|
switch (cmd.type) {
|
|
@@ -62872,7 +62894,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62872
62894
|
});
|
|
62873
62895
|
}
|
|
62874
62896
|
case "PASTE": {
|
|
62875
|
-
if (!this.copiedData) return
|
|
62897
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
62876
62898
|
const pasteOption = cmd.pasteOption;
|
|
62877
62899
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
62878
62900
|
pasteOption,
|
|
@@ -62881,21 +62903,21 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62881
62903
|
}
|
|
62882
62904
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
62883
62905
|
const zones = this.getters.getSelectedZones();
|
|
62884
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
62906
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
62885
62907
|
const zone = this.getters.getSelectedZone();
|
|
62886
62908
|
const copiedData = this.getCopiedDataAbove(zone);
|
|
62887
62909
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62888
62910
|
}
|
|
62889
62911
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
62890
62912
|
const zones = this.getters.getSelectedZones();
|
|
62891
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
62913
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
62892
62914
|
const zone = this.getters.getSelectedZone();
|
|
62893
62915
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62894
62916
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62895
62917
|
}
|
|
62896
62918
|
case "COPY_PASTE_CELLS_ON_ZONE": {
|
|
62897
62919
|
const zones = this.getters.getSelectedZones();
|
|
62898
|
-
if (zones.length > 1) return
|
|
62920
|
+
if (zones.length > 1) return "InvalidCopyPasteSelection";
|
|
62899
62921
|
const zone = this.getters.getSelectedZone();
|
|
62900
62922
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62901
62923
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
@@ -62911,7 +62933,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62911
62933
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
62912
62934
|
}
|
|
62913
62935
|
}
|
|
62914
|
-
return
|
|
62936
|
+
return "Success";
|
|
62915
62937
|
}
|
|
62916
62938
|
handle(cmd) {
|
|
62917
62939
|
switch (cmd.type) {
|
|
@@ -63114,16 +63136,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63114
63136
|
const clipboardData = this.getClipboardData(zones);
|
|
63115
63137
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
63116
63138
|
const result = handler.isCutAllowed(clipboardData);
|
|
63117
|
-
if (result !==
|
|
63139
|
+
if (result !== "Success") return result;
|
|
63118
63140
|
}
|
|
63119
|
-
return
|
|
63141
|
+
return "Success";
|
|
63120
63142
|
}
|
|
63121
63143
|
isPasteAllowed(target, copiedData, options) {
|
|
63122
63144
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
63123
63145
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
63124
|
-
if (result !==
|
|
63146
|
+
if (result !== "Success") return result;
|
|
63125
63147
|
}
|
|
63126
|
-
return
|
|
63148
|
+
return "Success";
|
|
63127
63149
|
}
|
|
63128
63150
|
isColRowDirtyingClipboard(position, dimension) {
|
|
63129
63151
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -63204,12 +63226,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63204
63226
|
const file = await this.getImageContent();
|
|
63205
63227
|
const mime = file?.type;
|
|
63206
63228
|
const content = {
|
|
63207
|
-
[
|
|
63208
|
-
[
|
|
63229
|
+
["text/plain"]: "",
|
|
63230
|
+
["text/html"]: ""
|
|
63209
63231
|
};
|
|
63210
63232
|
try {
|
|
63211
|
-
content[
|
|
63212
|
-
content[
|
|
63233
|
+
content["text/plain"] = this.getPlainTextContent();
|
|
63234
|
+
content["text/html"] = await this.getHTMLContent();
|
|
63213
63235
|
} catch (error) {
|
|
63214
63236
|
this.ui.notifyUI({
|
|
63215
63237
|
type: "danger",
|
|
@@ -63401,10 +63423,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
63401
63423
|
allowDispatch(cmd) {
|
|
63402
63424
|
switch (cmd.type) {
|
|
63403
63425
|
case "UPDATE_FILTER":
|
|
63404
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
63426
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
63405
63427
|
break;
|
|
63406
63428
|
}
|
|
63407
|
-
return
|
|
63429
|
+
return "Success";
|
|
63408
63430
|
}
|
|
63409
63431
|
handle(cmd) {
|
|
63410
63432
|
switch (cmd.type) {
|
|
@@ -63768,14 +63790,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
63768
63790
|
allowDispatch(cmd) {
|
|
63769
63791
|
switch (cmd.type) {
|
|
63770
63792
|
case "ACTIVATE_SHEET": try {
|
|
63771
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
63793
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
63772
63794
|
break;
|
|
63773
63795
|
} catch (error) {
|
|
63774
|
-
return
|
|
63796
|
+
return "InvalidSheetId";
|
|
63775
63797
|
}
|
|
63776
63798
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
63777
63799
|
}
|
|
63778
|
-
return
|
|
63800
|
+
return "Success";
|
|
63779
63801
|
}
|
|
63780
63802
|
handleEvent(event) {
|
|
63781
63803
|
let anchor = event.anchor;
|
|
@@ -64296,12 +64318,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64296
64318
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
64297
64319
|
const id = cmd.sheetId;
|
|
64298
64320
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
64299
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
64321
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
64300
64322
|
const headers = [cmd.base, ...cmd.elements];
|
|
64301
64323
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
64302
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
64303
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
64304
|
-
return
|
|
64324
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
64325
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
64326
|
+
return "Success";
|
|
64305
64327
|
}
|
|
64306
64328
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
64307
64329
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -64403,6 +64425,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64403
64425
|
//#endregion
|
|
64404
64426
|
//#region src/helpers/internal_viewport.ts
|
|
64405
64427
|
var InternalViewport = class {
|
|
64428
|
+
getters;
|
|
64429
|
+
sheetId;
|
|
64430
|
+
boundaries;
|
|
64406
64431
|
top;
|
|
64407
64432
|
bottom;
|
|
64408
64433
|
left;
|
|
@@ -64674,6 +64699,10 @@ var InternalViewport = class {
|
|
|
64674
64699
|
* ↓ ↓
|
|
64675
64700
|
*/
|
|
64676
64701
|
var ViewportCollection = class {
|
|
64702
|
+
paneDivision;
|
|
64703
|
+
sheetViewWidth;
|
|
64704
|
+
sheetViewHeight;
|
|
64705
|
+
zoomLevel;
|
|
64677
64706
|
getters;
|
|
64678
64707
|
viewports = {};
|
|
64679
64708
|
gridOffsetX = 0;
|
|
@@ -64990,22 +65019,22 @@ var ViewportCollection = class {
|
|
|
64990
65019
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
64991
65020
|
}
|
|
64992
65021
|
checkPositiveDimension(cmd) {
|
|
64993
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
64994
|
-
return
|
|
65022
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
65023
|
+
return "Success";
|
|
64995
65024
|
}
|
|
64996
65025
|
checkValuesAreDifferent(cmd) {
|
|
64997
65026
|
const { height, width } = this.getSheetViewDimension();
|
|
64998
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
64999
|
-
return
|
|
65027
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
65028
|
+
return "Success";
|
|
65000
65029
|
}
|
|
65001
65030
|
checkScrollingDirection(sheetId, { offsetX, offsetY }) {
|
|
65002
65031
|
const pane = this.getMainInternalViewport(sheetId);
|
|
65003
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
65004
|
-
return
|
|
65032
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
65033
|
+
return "Success";
|
|
65005
65034
|
}
|
|
65006
65035
|
checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
|
|
65007
65036
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
|
|
65008
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
65037
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
65009
65038
|
}
|
|
65010
65039
|
getMainViewport(sheetId) {
|
|
65011
65040
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -65322,9 +65351,9 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
65322
65351
|
return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
|
|
65323
65352
|
}
|
|
65324
65353
|
case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
|
|
65325
|
-
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return
|
|
65326
|
-
else return
|
|
65327
|
-
default: return
|
|
65354
|
+
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
|
|
65355
|
+
else return "Success";
|
|
65356
|
+
default: return "Success";
|
|
65328
65357
|
}
|
|
65329
65358
|
}
|
|
65330
65359
|
handleEvent(event) {
|
|
@@ -67398,9 +67427,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
67398
67427
|
newName: name,
|
|
67399
67428
|
oldName: env.model.getters.getSheetName(sheetId)
|
|
67400
67429
|
});
|
|
67401
|
-
if (result.reasons.includes(
|
|
67402
|
-
else if (result.reasons.includes(
|
|
67403
|
-
else if (result.reasons.includes(
|
|
67430
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
67431
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
67432
|
+
else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
|
|
67404
67433
|
}
|
|
67405
67434
|
|
|
67406
67435
|
//#endregion
|
|
@@ -67458,7 +67487,7 @@ var BottomBarSheet = class extends _odoo_owl.Component {
|
|
|
67458
67487
|
(0, _odoo_owl.onMounted)(() => {
|
|
67459
67488
|
const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
|
|
67460
67489
|
this.env.model.on("command-rejected", this, async ({ command, result }) => {
|
|
67461
|
-
if (result.isCancelledBecause(
|
|
67490
|
+
if (result.isCancelledBecause("SheetLocked")) {
|
|
67462
67491
|
if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
|
|
67463
67492
|
this.scrollToSheet();
|
|
67464
67493
|
await animateLockedSheet();
|
|
@@ -67595,41 +67624,41 @@ var BottomBarSheet = class extends _odoo_owl.Component {
|
|
|
67595
67624
|
const selectionStatisticFunctions = [
|
|
67596
67625
|
{
|
|
67597
67626
|
name: _t("Sum"),
|
|
67598
|
-
types: [
|
|
67627
|
+
types: ["number"],
|
|
67599
67628
|
compute: (values, locale) => sum([[values]], locale)
|
|
67600
67629
|
},
|
|
67601
67630
|
{
|
|
67602
67631
|
name: _t("Avg"),
|
|
67603
|
-
types: [
|
|
67632
|
+
types: ["number"],
|
|
67604
67633
|
compute: (values, locale) => average([[values]], locale)
|
|
67605
67634
|
},
|
|
67606
67635
|
{
|
|
67607
67636
|
name: _t("Min"),
|
|
67608
|
-
types: [
|
|
67637
|
+
types: ["number"],
|
|
67609
67638
|
compute: (values, locale) => min([[values]], locale).value
|
|
67610
67639
|
},
|
|
67611
67640
|
{
|
|
67612
67641
|
name: _t("Max"),
|
|
67613
|
-
types: [
|
|
67642
|
+
types: ["number"],
|
|
67614
67643
|
compute: (values, locale) => max([[values]], locale).value
|
|
67615
67644
|
},
|
|
67616
67645
|
{
|
|
67617
67646
|
name: _t("Count"),
|
|
67618
67647
|
types: [
|
|
67619
|
-
|
|
67620
|
-
|
|
67621
|
-
|
|
67622
|
-
|
|
67648
|
+
"number",
|
|
67649
|
+
"text",
|
|
67650
|
+
"boolean",
|
|
67651
|
+
"error"
|
|
67623
67652
|
],
|
|
67624
67653
|
compute: (values) => countAny([[values]])
|
|
67625
67654
|
},
|
|
67626
67655
|
{
|
|
67627
67656
|
name: _t("Count Numbers"),
|
|
67628
67657
|
types: [
|
|
67629
|
-
|
|
67630
|
-
|
|
67631
|
-
|
|
67632
|
-
|
|
67658
|
+
"number",
|
|
67659
|
+
"text",
|
|
67660
|
+
"boolean",
|
|
67661
|
+
"error"
|
|
67633
67662
|
],
|
|
67634
67663
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
67635
67664
|
}
|
|
@@ -67682,7 +67711,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
67682
67711
|
col,
|
|
67683
67712
|
row
|
|
67684
67713
|
});
|
|
67685
|
-
if (evaluatedCell.type !==
|
|
67714
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
67686
67715
|
}
|
|
67687
67716
|
return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
|
|
67688
67717
|
}
|
|
@@ -68630,6 +68659,7 @@ var SmallBottomBar = class extends _odoo_owl.Component {
|
|
|
68630
68659
|
//#region src/components/standalone_grid_canvas/figure_renderer_store.ts
|
|
68631
68660
|
/** Store that draws the figures directly onto the canvas */
|
|
68632
68661
|
var FigureRendererStore = class extends DisposableStore {
|
|
68662
|
+
renderer;
|
|
68633
68663
|
mutators = ["addLoadedImage"];
|
|
68634
68664
|
getters = this.get(ModelStore).getters;
|
|
68635
68665
|
loadedImages = {};
|
|
@@ -68975,7 +69005,7 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
68975
69005
|
const coreCell = this.getters.getCell(position);
|
|
68976
69006
|
if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
|
|
68977
69007
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
68978
|
-
if (evaluatedCell && evaluatedCell.type !==
|
|
69008
|
+
if (evaluatedCell && evaluatedCell.type !== "empty") return true;
|
|
68979
69009
|
}
|
|
68980
69010
|
return false;
|
|
68981
69011
|
}
|
|
@@ -69316,7 +69346,7 @@ var NamedRangeSelector = class extends _odoo_owl.Component {
|
|
|
69316
69346
|
}
|
|
69317
69347
|
navigateToRange(range) {
|
|
69318
69348
|
const { sheetId, zone } = range;
|
|
69319
|
-
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !==
|
|
69349
|
+
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
|
|
69320
69350
|
this.env.raiseError(_t("The range you specified is outside of the sheet.\n\nIf you meant to create a named range, named range cannot have the same name as a cell reference. Please choose another name."));
|
|
69321
69351
|
return;
|
|
69322
69352
|
}
|
|
@@ -70201,6 +70231,7 @@ function instantiateClipboard() {
|
|
|
70201
70231
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
70202
70232
|
}
|
|
70203
70233
|
var WebClipboardWrapper = class {
|
|
70234
|
+
clipboard;
|
|
70204
70235
|
constructor(clipboard) {
|
|
70205
70236
|
this.clipboard = clipboard;
|
|
70206
70237
|
}
|
|
@@ -70216,12 +70247,12 @@ var WebClipboardWrapper = class {
|
|
|
70216
70247
|
console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
|
|
70217
70248
|
try {
|
|
70218
70249
|
await this.clipboard?.write([new ClipboardItem({
|
|
70219
|
-
[
|
|
70220
|
-
[
|
|
70250
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
70251
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
70221
70252
|
})]);
|
|
70222
70253
|
} catch (e) {}
|
|
70223
70254
|
}
|
|
70224
|
-
else await this.writeText(clipboardContent[
|
|
70255
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
70225
70256
|
}
|
|
70226
70257
|
async writeText(text) {
|
|
70227
70258
|
try {
|
|
@@ -70250,7 +70281,7 @@ var WebClipboardWrapper = class {
|
|
|
70250
70281
|
}
|
|
70251
70282
|
else return {
|
|
70252
70283
|
status: "ok",
|
|
70253
|
-
content: { [
|
|
70284
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
70254
70285
|
};
|
|
70255
70286
|
}
|
|
70256
70287
|
getClipboardItems(content) {
|
|
@@ -70402,7 +70433,7 @@ var Spreadsheet = class extends _odoo_owl.Component {
|
|
|
70402
70433
|
bindModelEvents() {
|
|
70403
70434
|
this.model.on("update", this, () => this.render(true));
|
|
70404
70435
|
this.model.on("command-rejected", this, ({ result }) => {
|
|
70405
|
-
if (result.isCancelledBecause(
|
|
70436
|
+
if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
|
|
70406
70437
|
type: "info",
|
|
70407
70438
|
text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
|
|
70408
70439
|
sticky: false
|
|
@@ -70487,6 +70518,7 @@ var Spreadsheet = class extends _odoo_owl.Component {
|
|
|
70487
70518
|
//#endregion
|
|
70488
70519
|
//#region src/collaborative/command_squisher.ts
|
|
70489
70520
|
var CommandSquisher = class {
|
|
70521
|
+
getters;
|
|
70490
70522
|
constructor(getters) {
|
|
70491
70523
|
this.getters = getters;
|
|
70492
70524
|
}
|
|
@@ -70593,6 +70625,7 @@ var CommandSquisher = class {
|
|
|
70593
70625
|
//#endregion
|
|
70594
70626
|
//#region src/collaborative/readonly_transport_filter.ts
|
|
70595
70627
|
var ReadonlyTransportFilter = class {
|
|
70628
|
+
transportService;
|
|
70596
70629
|
constructor(transportService) {
|
|
70597
70630
|
this.transportService = transportService;
|
|
70598
70631
|
}
|
|
@@ -70624,6 +70657,8 @@ function inverseCommand(cmd) {
|
|
|
70624
70657
|
* @param operations initial operations
|
|
70625
70658
|
*/
|
|
70626
70659
|
var Branch = class Branch {
|
|
70660
|
+
buildTransformation;
|
|
70661
|
+
operations;
|
|
70627
70662
|
constructor(buildTransformation, operations = []) {
|
|
70628
70663
|
this.buildTransformation = buildTransformation;
|
|
70629
70664
|
this.operations = operations;
|
|
@@ -70740,6 +70775,8 @@ var Branch = class Branch {
|
|
|
70740
70775
|
* to revert it).
|
|
70741
70776
|
*/
|
|
70742
70777
|
var Operation = class {
|
|
70778
|
+
id;
|
|
70779
|
+
data;
|
|
70743
70780
|
constructor(id, data) {
|
|
70744
70781
|
this.id = id;
|
|
70745
70782
|
this.data = data;
|
|
@@ -70749,6 +70786,8 @@ var Operation = class {
|
|
|
70749
70786
|
}
|
|
70750
70787
|
};
|
|
70751
70788
|
var LazyOperation = class LazyOperation {
|
|
70789
|
+
id;
|
|
70790
|
+
lazyData;
|
|
70752
70791
|
constructor(id, lazyData) {
|
|
70753
70792
|
this.id = id;
|
|
70754
70793
|
this.lazyData = lazyData;
|
|
@@ -70774,6 +70813,7 @@ var LazyOperation = class LazyOperation {
|
|
|
70774
70813
|
* ```
|
|
70775
70814
|
*/
|
|
70776
70815
|
var OperationSequence = class OperationSequence {
|
|
70816
|
+
operations;
|
|
70777
70817
|
constructor(operations) {
|
|
70778
70818
|
this.operations = operations;
|
|
70779
70819
|
}
|
|
@@ -70849,6 +70889,7 @@ var OperationSequence = class OperationSequence {
|
|
|
70849
70889
|
*
|
|
70850
70890
|
*/
|
|
70851
70891
|
var Tree = class {
|
|
70892
|
+
buildTransformation;
|
|
70852
70893
|
branches;
|
|
70853
70894
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
70854
70895
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -71358,8 +71399,8 @@ var RangeAdapterPlugin = class {
|
|
|
71358
71399
|
"removeRangesSheetPrefix"
|
|
71359
71400
|
];
|
|
71360
71401
|
allowDispatch(cmd) {
|
|
71361
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
71362
|
-
return
|
|
71402
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
71403
|
+
return "Success";
|
|
71363
71404
|
}
|
|
71364
71405
|
beforeHandle(command) {}
|
|
71365
71406
|
handle(cmd) {
|
|
@@ -71644,6 +71685,7 @@ var EventStream = class {
|
|
|
71644
71685
|
* with the new selected anchor
|
|
71645
71686
|
*/
|
|
71646
71687
|
var SelectionStreamProcessorImpl = class {
|
|
71688
|
+
getters;
|
|
71647
71689
|
stream;
|
|
71648
71690
|
/**
|
|
71649
71691
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -71742,7 +71784,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71742
71784
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
71743
71785
|
*/
|
|
71744
71786
|
moveAnchorCell(direction, step = 1) {
|
|
71745
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71787
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71746
71788
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
71747
71789
|
return this.selectCell(col, row);
|
|
71748
71790
|
}
|
|
@@ -71776,7 +71818,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71776
71818
|
bottom: Math.max(anchorRow, row)
|
|
71777
71819
|
};
|
|
71778
71820
|
const expandedZone = this.getters.expandZone(sheetId, zone);
|
|
71779
|
-
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(
|
|
71821
|
+
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
|
|
71780
71822
|
const anchor = {
|
|
71781
71823
|
zone: expandedZone,
|
|
71782
71824
|
cell: {
|
|
@@ -71838,7 +71880,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71838
71880
|
* of the anchor zone which moves.
|
|
71839
71881
|
*/
|
|
71840
71882
|
resizeAnchorZone(direction, step = 1) {
|
|
71841
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71883
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71842
71884
|
const sheetId = this.getters.getActiveSheetId();
|
|
71843
71885
|
const anchor = this.anchor;
|
|
71844
71886
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -72085,7 +72127,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72085
72127
|
previousAnchor: deepCopy(this.anchor)
|
|
72086
72128
|
};
|
|
72087
72129
|
const commandResult = this.checkEventAnchorZone(event);
|
|
72088
|
-
if (commandResult !==
|
|
72130
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
72089
72131
|
this.anchor = event.anchor;
|
|
72090
72132
|
this.stream.send(event);
|
|
72091
72133
|
return DispatchResult.Success;
|
|
@@ -72095,15 +72137,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72095
72137
|
}
|
|
72096
72138
|
checkAnchorZone(anchor) {
|
|
72097
72139
|
const { cell, zone } = anchor;
|
|
72098
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
72140
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
72099
72141
|
const { left, right, top, bottom } = zone;
|
|
72100
72142
|
const sheetId = this.getters.getActiveSheetId();
|
|
72101
72143
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
72102
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
72103
|
-
return
|
|
72144
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
72145
|
+
return "Success";
|
|
72104
72146
|
}
|
|
72105
72147
|
checkAnchorZoneOrThrow(anchor) {
|
|
72106
|
-
if (this.checkAnchorZone(anchor) ===
|
|
72148
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
|
|
72107
72149
|
}
|
|
72108
72150
|
/**
|
|
72109
72151
|
* ---- PRIVATE ----
|
|
@@ -72260,7 +72302,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72260
72302
|
isCellSkippableInCluster(position) {
|
|
72261
72303
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
72262
72304
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
72263
|
-
return cell.type ===
|
|
72305
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
72264
72306
|
}
|
|
72265
72307
|
};
|
|
72266
72308
|
|
|
@@ -74477,13 +74519,6 @@ function purgeSingleRowTables(data) {
|
|
|
74477
74519
|
|
|
74478
74520
|
//#endregion
|
|
74479
74521
|
//#region src/model.ts
|
|
74480
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
74481
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
74482
|
-
Status[Status["Running"] = 1] = "Running";
|
|
74483
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
74484
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
74485
|
-
return Status;
|
|
74486
|
-
}(Status || {});
|
|
74487
74522
|
/**
|
|
74488
74523
|
* Model
|
|
74489
74524
|
*
|
|
@@ -74529,7 +74564,7 @@ var Model = class Model extends EventBus {
|
|
|
74529
74564
|
/**
|
|
74530
74565
|
* Internal status of the model. Important for command handling coordination
|
|
74531
74566
|
*/
|
|
74532
|
-
status =
|
|
74567
|
+
status = 0;
|
|
74533
74568
|
/**
|
|
74534
74569
|
* The config object contains some configuration flag and callbacks
|
|
74535
74570
|
*/
|
|
@@ -74676,7 +74711,7 @@ var Model = class Model extends EventBus {
|
|
|
74676
74711
|
onRemoteRevisionReceived({ commands }) {
|
|
74677
74712
|
for (const command of commands) {
|
|
74678
74713
|
const previousStatus = this.status;
|
|
74679
|
-
this.status =
|
|
74714
|
+
this.status = 2;
|
|
74680
74715
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
74681
74716
|
this.status = previousStatus;
|
|
74682
74717
|
}
|
|
@@ -74789,7 +74824,7 @@ var Model = class Model extends EventBus {
|
|
|
74789
74824
|
return this.processCommandResults(results);
|
|
74790
74825
|
}
|
|
74791
74826
|
processCommandResults(results) {
|
|
74792
|
-
if (results.some((r) => r !==
|
|
74827
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
74793
74828
|
return DispatchResult.Success;
|
|
74794
74829
|
}
|
|
74795
74830
|
checkDispatchAllowedRemoteCommand(command) {
|
|
@@ -74803,9 +74838,9 @@ var Model = class Model extends EventBus {
|
|
|
74803
74838
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
74804
74839
|
}
|
|
74805
74840
|
finalize() {
|
|
74806
|
-
this.status =
|
|
74841
|
+
this.status = 3;
|
|
74807
74842
|
for (const h of this.handlers) h.finalize();
|
|
74808
|
-
this.status =
|
|
74843
|
+
this.status = 0;
|
|
74809
74844
|
this.trigger("command-finalized");
|
|
74810
74845
|
}
|
|
74811
74846
|
/**
|
|
@@ -74832,10 +74867,10 @@ var Model = class Model extends EventBus {
|
|
|
74832
74867
|
dispatch = (type, payload) => {
|
|
74833
74868
|
const command = createCommand(type, payload);
|
|
74834
74869
|
const status = this.status;
|
|
74835
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
74836
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
74870
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
74871
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
74837
74872
|
switch (status) {
|
|
74838
|
-
case
|
|
74873
|
+
case 0:
|
|
74839
74874
|
const result = this.checkDispatchAllowed(command);
|
|
74840
74875
|
if (!result.isSuccessful) {
|
|
74841
74876
|
this.trigger("update");
|
|
@@ -74845,7 +74880,7 @@ var Model = class Model extends EventBus {
|
|
|
74845
74880
|
});
|
|
74846
74881
|
return result;
|
|
74847
74882
|
}
|
|
74848
|
-
this.status =
|
|
74883
|
+
this.status = 1;
|
|
74849
74884
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
74850
74885
|
const start = performance.now();
|
|
74851
74886
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -74855,10 +74890,10 @@ var Model = class Model extends EventBus {
|
|
|
74855
74890
|
if (time > 5) console.debug(type, time, "ms");
|
|
74856
74891
|
});
|
|
74857
74892
|
this.session.save(command, commands, changes);
|
|
74858
|
-
this.status =
|
|
74893
|
+
this.status = 0;
|
|
74859
74894
|
this.trigger("update");
|
|
74860
74895
|
break;
|
|
74861
|
-
case
|
|
74896
|
+
case 1:
|
|
74862
74897
|
if (isCoreCommand(command)) {
|
|
74863
74898
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
74864
74899
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -74866,8 +74901,8 @@ var Model = class Model extends EventBus {
|
|
|
74866
74901
|
}
|
|
74867
74902
|
this.dispatchToHandlers(this.handlers, command);
|
|
74868
74903
|
break;
|
|
74869
|
-
case
|
|
74870
|
-
case
|
|
74904
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
74905
|
+
case 2:
|
|
74871
74906
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
74872
74907
|
this.dispatchToHandlers(this.handlers, command);
|
|
74873
74908
|
}
|
|
@@ -74880,7 +74915,7 @@ var Model = class Model extends EventBus {
|
|
|
74880
74915
|
dispatchFromCorePlugin = (type, payload) => {
|
|
74881
74916
|
const command = createCommand(type, payload);
|
|
74882
74917
|
const previousStatus = this.status;
|
|
74883
|
-
this.status =
|
|
74918
|
+
this.status = 2;
|
|
74884
74919
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
74885
74920
|
this.dispatchToHandlers(handlers, command);
|
|
74886
74921
|
this.status = previousStatus;
|
|
@@ -74982,9 +75017,9 @@ function createCommand(type, payload = {}) {
|
|
|
74982
75017
|
//#endregion
|
|
74983
75018
|
//#region src/helpers/figures/charts/calendar_chart.ts
|
|
74984
75019
|
function checkDateGranularity(definition) {
|
|
74985
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return
|
|
74986
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return
|
|
74987
|
-
return
|
|
75020
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
|
|
75021
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
|
|
75022
|
+
return "Success";
|
|
74988
75023
|
}
|
|
74989
75024
|
const CalendarChart = {
|
|
74990
75025
|
sequence: 110,
|
|
@@ -75075,7 +75110,7 @@ const ComboChart = {
|
|
|
75075
75110
|
copyInSheetId: (definition) => definition,
|
|
75076
75111
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75077
75112
|
transformDefinition: (definition) => definition,
|
|
75078
|
-
validateDefinition: () =>
|
|
75113
|
+
validateDefinition: () => "Success",
|
|
75079
75114
|
updateRanges: (definition) => definition,
|
|
75080
75115
|
getContextCreation: (definition) => definition,
|
|
75081
75116
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
@@ -75165,7 +75200,7 @@ const FunnelChart = {
|
|
|
75165
75200
|
copyInSheetId: (definition) => definition,
|
|
75166
75201
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75167
75202
|
transformDefinition: (definition) => definition,
|
|
75168
|
-
validateDefinition: () =>
|
|
75203
|
+
validateDefinition: () => "Success",
|
|
75169
75204
|
updateRanges: (definition) => definition,
|
|
75170
75205
|
getContextCreation: (definition) => definition,
|
|
75171
75206
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75231,7 +75266,7 @@ const GeoChart = {
|
|
|
75231
75266
|
copyInSheetId: (definition) => definition,
|
|
75232
75267
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75233
75268
|
transformDefinition: (definition) => definition,
|
|
75234
|
-
validateDefinition: () =>
|
|
75269
|
+
validateDefinition: () => "Success",
|
|
75235
75270
|
updateRanges: (definition) => definition,
|
|
75236
75271
|
getContextCreation: (definition) => definition,
|
|
75237
75272
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75292,7 +75327,7 @@ const PyramidChart = {
|
|
|
75292
75327
|
copyInSheetId: (definition) => definition,
|
|
75293
75328
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75294
75329
|
transformDefinition: (definition) => definition,
|
|
75295
|
-
validateDefinition: () =>
|
|
75330
|
+
validateDefinition: () => "Success",
|
|
75296
75331
|
updateRanges: (definition) => definition,
|
|
75297
75332
|
getContextCreation: (definition) => definition,
|
|
75298
75333
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75378,7 +75413,7 @@ const RadarChart = {
|
|
|
75378
75413
|
copyInSheetId: (definition) => definition,
|
|
75379
75414
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75380
75415
|
transformDefinition: (definition) => definition,
|
|
75381
|
-
validateDefinition: () =>
|
|
75416
|
+
validateDefinition: () => "Success",
|
|
75382
75417
|
updateRanges: (definition) => definition,
|
|
75383
75418
|
getContextCreation: (definition) => definition,
|
|
75384
75419
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75456,7 +75491,7 @@ const ScatterChart = {
|
|
|
75456
75491
|
copyInSheetId: (definition) => definition,
|
|
75457
75492
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75458
75493
|
transformDefinition: (definition) => definition,
|
|
75459
|
-
validateDefinition: () =>
|
|
75494
|
+
validateDefinition: () => "Success",
|
|
75460
75495
|
updateRanges: (definition) => definition,
|
|
75461
75496
|
getContextCreation: (definition) => definition,
|
|
75462
75497
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75535,7 +75570,7 @@ const SunburstChart = {
|
|
|
75535
75570
|
copyInSheetId: (definition) => definition,
|
|
75536
75571
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75537
75572
|
transformDefinition: (definition) => definition,
|
|
75538
|
-
validateDefinition: () =>
|
|
75573
|
+
validateDefinition: () => "Success",
|
|
75539
75574
|
updateRanges: (definition) => definition,
|
|
75540
75575
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75541
75576
|
return {
|
|
@@ -75604,7 +75639,7 @@ const TreeMapChart = {
|
|
|
75604
75639
|
copyInSheetId: (definition) => definition,
|
|
75605
75640
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75606
75641
|
transformDefinition: (definition) => definition,
|
|
75607
|
-
validateDefinition: () =>
|
|
75642
|
+
validateDefinition: () => "Success",
|
|
75608
75643
|
updateRanges: (definition) => definition,
|
|
75609
75644
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75610
75645
|
return {
|
|
@@ -76030,9 +76065,9 @@ var CarouselClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76030
76065
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76031
76066
|
}
|
|
76032
76067
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76033
|
-
if (target.length === 0) return
|
|
76034
|
-
if (option?.pasteOption !== void 0) return
|
|
76035
|
-
return
|
|
76068
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76069
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76070
|
+
return "Success";
|
|
76036
76071
|
}
|
|
76037
76072
|
};
|
|
76038
76073
|
|
|
@@ -76103,9 +76138,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76103
76138
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76104
76139
|
}
|
|
76105
76140
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76106
|
-
if (target.length === 0) return
|
|
76107
|
-
if (option?.pasteOption !== void 0) return
|
|
76108
|
-
return
|
|
76141
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76142
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76143
|
+
return "Success";
|
|
76109
76144
|
}
|
|
76110
76145
|
};
|
|
76111
76146
|
|
|
@@ -76410,9 +76445,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76410
76445
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76411
76446
|
}
|
|
76412
76447
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76413
|
-
if (target.length === 0) return
|
|
76414
|
-
if (option?.pasteOption !== void 0) return
|
|
76415
|
-
return
|
|
76448
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76449
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76450
|
+
return "Success";
|
|
76416
76451
|
}
|
|
76417
76452
|
};
|
|
76418
76453
|
|
|
@@ -76508,10 +76543,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
76508
76543
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
76509
76544
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
76510
76545
|
isPasteAllowed(sheetId, target, content, options) {
|
|
76511
|
-
if (!("cells" in content)) return
|
|
76546
|
+
if (!("cells" in content)) return "Success";
|
|
76512
76547
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
76513
|
-
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return
|
|
76514
|
-
return
|
|
76548
|
+
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
76549
|
+
return "Success";
|
|
76515
76550
|
}
|
|
76516
76551
|
};
|
|
76517
76552
|
|
|
@@ -79352,15 +79387,15 @@ const DATEDIF = {
|
|
|
79352
79387
|
const jsEndDate = numberToJsDate(_endDate);
|
|
79353
79388
|
if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
79354
79389
|
switch (_unit) {
|
|
79355
|
-
case
|
|
79356
|
-
case
|
|
79357
|
-
case
|
|
79358
|
-
case
|
|
79359
|
-
case
|
|
79390
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
79391
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
79392
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79393
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
79394
|
+
case "MD":
|
|
79360
79395
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
79361
79396
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
79362
79397
|
return days;
|
|
79363
|
-
case
|
|
79398
|
+
case "YD": {
|
|
79364
79399
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79365
79400
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
79366
79401
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -80050,11 +80085,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
80050
80085
|
const right = sortColumn[b];
|
|
80051
80086
|
const leftCell = {
|
|
80052
80087
|
value: left,
|
|
80053
|
-
type: left === null ?
|
|
80088
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
80054
80089
|
};
|
|
80055
80090
|
const rightCell = {
|
|
80056
80091
|
value: right,
|
|
80057
|
-
type: right === null ?
|
|
80092
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
80058
80093
|
};
|
|
80059
80094
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
80060
80095
|
if (result !== 0) return result;
|
|
@@ -84652,6 +84687,6 @@ exports.stores = stores;
|
|
|
84652
84687
|
exports.tokenColors = tokenColors;
|
|
84653
84688
|
exports.tokenize = tokenize;
|
|
84654
84689
|
|
|
84655
|
-
__info__.version = "19.3.
|
|
84656
|
-
__info__.date = "2026-05-
|
|
84657
|
-
__info__.hash = "
|
|
84690
|
+
__info__.version = "19.3.4";
|
|
84691
|
+
__info__.date = "2026-05-15T07:07:34.417Z";
|
|
84692
|
+
__info__.hash = "1dc7b42";
|