@odoo/o-spreadsheet 19.3.2 → 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 +20 -20
|
@@ -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
|
import { App, Component, blockDom, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, whenReady, xml } from "@odoo/owl";
|
|
@@ -16,7 +16,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
16
16
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17
17
|
var __getProtoOf = Object.getPrototypeOf;
|
|
18
18
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
20
20
|
var __exportAll = (all, no_symbols) => {
|
|
21
21
|
let target = {};
|
|
22
22
|
for (var name in all) {
|
|
@@ -461,13 +461,6 @@ const borderStyles = [
|
|
|
461
461
|
function isMatrix(x) {
|
|
462
462
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
463
463
|
}
|
|
464
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
465
|
-
DIRECTION["UP"] = "up";
|
|
466
|
-
DIRECTION["DOWN"] = "down";
|
|
467
|
-
DIRECTION["LEFT"] = "left";
|
|
468
|
-
DIRECTION["RIGHT"] = "right";
|
|
469
|
-
return DIRECTION;
|
|
470
|
-
}({});
|
|
471
464
|
|
|
472
465
|
//#endregion
|
|
473
466
|
//#region src/helpers/misc.ts
|
|
@@ -924,7 +917,8 @@ var TokenizingChars = class {
|
|
|
924
917
|
}
|
|
925
918
|
shift() {
|
|
926
919
|
const current = this.current;
|
|
927
|
-
|
|
920
|
+
const next = this.text[++this.currentIndex];
|
|
921
|
+
this.current = next;
|
|
928
922
|
return current;
|
|
929
923
|
}
|
|
930
924
|
advanceBy(length) {
|
|
@@ -2112,6 +2106,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
2112
2106
|
}
|
|
2113
2107
|
};
|
|
2114
2108
|
var StoreFactory = class {
|
|
2109
|
+
get;
|
|
2115
2110
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
2116
2111
|
constructor(get) {
|
|
2117
2112
|
this.get = get;
|
|
@@ -2156,6 +2151,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2156
2151
|
return MetaStore;
|
|
2157
2152
|
}
|
|
2158
2153
|
var DisposableStore = class {
|
|
2154
|
+
get;
|
|
2159
2155
|
disposeCallbacks = [];
|
|
2160
2156
|
constructor(get) {
|
|
2161
2157
|
this.get = get;
|
|
@@ -2259,6 +2255,7 @@ function addRenderingLayer(layer, priority) {
|
|
|
2259
2255
|
//#endregion
|
|
2260
2256
|
//#region src/stores/renderer_store.ts
|
|
2261
2257
|
var RendererStore = class {
|
|
2258
|
+
layers;
|
|
2262
2259
|
mutators = [
|
|
2263
2260
|
"register",
|
|
2264
2261
|
"unRegister",
|
|
@@ -2913,6 +2910,7 @@ function getAlternatingColorsPalette(quantity) {
|
|
|
2913
2910
|
else return ALTERNATING_COLORS_XL;
|
|
2914
2911
|
}
|
|
2915
2912
|
var ColorGenerator = class {
|
|
2913
|
+
preferredColors;
|
|
2916
2914
|
currentColorIndex = 0;
|
|
2917
2915
|
palette;
|
|
2918
2916
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -3309,6 +3307,7 @@ const _t = function(s, ...values) {
|
|
|
3309
3307
|
return sprintf(_translate(s), ...values);
|
|
3310
3308
|
};
|
|
3311
3309
|
var LazyTranslatedString = class extends String {
|
|
3310
|
+
values;
|
|
3312
3311
|
constructor(str, values) {
|
|
3313
3312
|
super(str);
|
|
3314
3313
|
this.values = values;
|
|
@@ -3338,6 +3337,8 @@ const CellErrorType = {
|
|
|
3338
3337
|
};
|
|
3339
3338
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3340
3339
|
var EvaluationError = class {
|
|
3340
|
+
message;
|
|
3341
|
+
value;
|
|
3341
3342
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3342
3343
|
this.message = message;
|
|
3343
3344
|
this.value = value;
|
|
@@ -3370,6 +3371,7 @@ var UnknownFunctionError = class extends EvaluationError {
|
|
|
3370
3371
|
}
|
|
3371
3372
|
};
|
|
3372
3373
|
var SplillBlockedError = class extends EvaluationError {
|
|
3374
|
+
errorOriginPosition;
|
|
3373
3375
|
constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
|
|
3374
3376
|
super(message, CellErrorType.SpilledBlocked);
|
|
3375
3377
|
this.errorOriginPosition = errorOriginPosition;
|
|
@@ -5052,46 +5054,6 @@ function tokenizeInvalidRange(chars) {
|
|
|
5052
5054
|
|
|
5053
5055
|
//#endregion
|
|
5054
5056
|
//#region src/formulas/range_tokenizer.ts
|
|
5055
|
-
var State = /* @__PURE__ */ function(State) {
|
|
5056
|
-
/**
|
|
5057
|
-
* Initial state.
|
|
5058
|
-
* Expecting any reference for the left part of a range
|
|
5059
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5060
|
-
*/
|
|
5061
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
5062
|
-
/**
|
|
5063
|
-
* Expecting any reference for the right part of a range
|
|
5064
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5065
|
-
*/
|
|
5066
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
5067
|
-
/**
|
|
5068
|
-
* Expecting the separator without any constraint on the right part
|
|
5069
|
-
*/
|
|
5070
|
-
State[State["Separator"] = 2] = "Separator";
|
|
5071
|
-
/**
|
|
5072
|
-
* Expecting the separator for a full column range
|
|
5073
|
-
*/
|
|
5074
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
5075
|
-
/**
|
|
5076
|
-
* Expecting the separator for a full row range
|
|
5077
|
-
*/
|
|
5078
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
5079
|
-
/**
|
|
5080
|
-
* Expecting the right part of a full column range
|
|
5081
|
-
* e.g. "1", "A1"
|
|
5082
|
-
*/
|
|
5083
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
5084
|
-
/**
|
|
5085
|
-
* Expecting the right part of a full row range
|
|
5086
|
-
* e.g. "A", "A1"
|
|
5087
|
-
*/
|
|
5088
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
5089
|
-
/**
|
|
5090
|
-
* Final state. A range has been matched
|
|
5091
|
-
*/
|
|
5092
|
-
State[State["Found"] = 7] = "Found";
|
|
5093
|
-
return State;
|
|
5094
|
-
}(State || {});
|
|
5095
5057
|
const goTo = (state, guard = () => true) => [{
|
|
5096
5058
|
goTo: state,
|
|
5097
5059
|
guard
|
|
@@ -5101,41 +5063,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
5101
5063
|
guard
|
|
5102
5064
|
});
|
|
5103
5065
|
const machine = {
|
|
5104
|
-
[
|
|
5105
|
-
REFERENCE: goTo(
|
|
5106
|
-
NUMBER: goTo(
|
|
5107
|
-
SYMBOL: [goToMulti(
|
|
5108
|
-
},
|
|
5109
|
-
[
|
|
5110
|
-
SPACE: goTo(
|
|
5111
|
-
OPERATOR: goTo(
|
|
5112
|
-
},
|
|
5113
|
-
[
|
|
5114
|
-
SPACE: goTo(
|
|
5115
|
-
OPERATOR: goTo(
|
|
5116
|
-
},
|
|
5117
|
-
[
|
|
5118
|
-
SPACE: goTo(
|
|
5119
|
-
OPERATOR: goTo(
|
|
5120
|
-
},
|
|
5121
|
-
[
|
|
5122
|
-
SPACE: goTo(
|
|
5123
|
-
NUMBER: goTo(
|
|
5124
|
-
REFERENCE: goTo(
|
|
5125
|
-
SYMBOL: goTo(
|
|
5126
|
-
},
|
|
5127
|
-
[
|
|
5128
|
-
SPACE: goTo(
|
|
5129
|
-
SYMBOL: goTo(
|
|
5130
|
-
REFERENCE: goTo(
|
|
5131
|
-
},
|
|
5132
|
-
[
|
|
5133
|
-
SPACE: goTo(
|
|
5134
|
-
NUMBER: goTo(
|
|
5135
|
-
REFERENCE: goTo(
|
|
5136
|
-
SYMBOL: goTo(
|
|
5137
|
-
},
|
|
5138
|
-
[
|
|
5066
|
+
[0]: {
|
|
5067
|
+
REFERENCE: goTo(2),
|
|
5068
|
+
NUMBER: goTo(4),
|
|
5069
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
5070
|
+
},
|
|
5071
|
+
[3]: {
|
|
5072
|
+
SPACE: goTo(3),
|
|
5073
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
5074
|
+
},
|
|
5075
|
+
[4]: {
|
|
5076
|
+
SPACE: goTo(4),
|
|
5077
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
5078
|
+
},
|
|
5079
|
+
[2]: {
|
|
5080
|
+
SPACE: goTo(2),
|
|
5081
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
5082
|
+
},
|
|
5083
|
+
[1]: {
|
|
5084
|
+
SPACE: goTo(1),
|
|
5085
|
+
NUMBER: goTo(7),
|
|
5086
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5087
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
5088
|
+
},
|
|
5089
|
+
[5]: {
|
|
5090
|
+
SPACE: goTo(5),
|
|
5091
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
5092
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
5093
|
+
},
|
|
5094
|
+
[6]: {
|
|
5095
|
+
SPACE: goTo(6),
|
|
5096
|
+
NUMBER: goTo(7),
|
|
5097
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5098
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
5099
|
+
},
|
|
5100
|
+
[7]: {}
|
|
5139
5101
|
};
|
|
5140
5102
|
/**
|
|
5141
5103
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -5145,7 +5107,7 @@ const machine = {
|
|
|
5145
5107
|
*/
|
|
5146
5108
|
function matchReference(tokens) {
|
|
5147
5109
|
let head = 0;
|
|
5148
|
-
let transitions = machine[
|
|
5110
|
+
let transitions = machine[0];
|
|
5149
5111
|
let matchedTokens = "";
|
|
5150
5112
|
while (transitions !== void 0) {
|
|
5151
5113
|
const token = tokens[head++];
|
|
@@ -5154,7 +5116,7 @@ function matchReference(tokens) {
|
|
|
5154
5116
|
const nextState = transition ? transition.goTo : void 0;
|
|
5155
5117
|
switch (nextState) {
|
|
5156
5118
|
case void 0: return null;
|
|
5157
|
-
case
|
|
5119
|
+
case 7:
|
|
5158
5120
|
matchedTokens += token.value;
|
|
5159
5121
|
tokens.splice(0, head);
|
|
5160
5122
|
return {
|
|
@@ -6101,6 +6063,7 @@ function getRange(sheetXC, sheetId) {
|
|
|
6101
6063
|
//#endregion
|
|
6102
6064
|
//#region src/formulas/code_builder.ts
|
|
6103
6065
|
var FunctionCodeBuilder = class {
|
|
6066
|
+
scope;
|
|
6104
6067
|
code = "";
|
|
6105
6068
|
constructor(scope = new Scope()) {
|
|
6106
6069
|
this.scope = scope;
|
|
@@ -6116,6 +6079,8 @@ var FunctionCodeBuilder = class {
|
|
|
6116
6079
|
}
|
|
6117
6080
|
};
|
|
6118
6081
|
var FunctionCodeImpl = class {
|
|
6082
|
+
scope;
|
|
6083
|
+
returnExpression;
|
|
6119
6084
|
code;
|
|
6120
6085
|
constructor(scope, code, returnExpression) {
|
|
6121
6086
|
this.scope = scope;
|
|
@@ -6198,6 +6163,13 @@ const collator = new Intl.Collator("en", { sensitivity: "accent" });
|
|
|
6198
6163
|
* 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).
|
|
6199
6164
|
* */
|
|
6200
6165
|
var CompiledFormula = class CompiledFormula {
|
|
6166
|
+
sheetId;
|
|
6167
|
+
tokens;
|
|
6168
|
+
literalValues;
|
|
6169
|
+
symbols;
|
|
6170
|
+
isBadExpression;
|
|
6171
|
+
normalizedFormula;
|
|
6172
|
+
execute;
|
|
6201
6173
|
rangeDependencies;
|
|
6202
6174
|
hasDependencies;
|
|
6203
6175
|
constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
|
|
@@ -7803,7 +7775,7 @@ var DispatchResult = class {
|
|
|
7803
7775
|
constructor(results = []) {
|
|
7804
7776
|
if (!Array.isArray(results)) results = [results];
|
|
7805
7777
|
results = [...new Set(results)];
|
|
7806
|
-
this.reasons = results.filter((result) => result !==
|
|
7778
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
7807
7779
|
}
|
|
7808
7780
|
/**
|
|
7809
7781
|
* Static helper which returns a successful DispatchResult
|
|
@@ -8001,7 +7973,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
8001
7973
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
8002
7974
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
8003
7975
|
sheetIdTo: sheetId
|
|
8004
|
-
}).isCancelledBecause(
|
|
7976
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
8005
7977
|
type: "warning",
|
|
8006
7978
|
sticky: false,
|
|
8007
7979
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -8135,22 +8107,22 @@ function _createEvaluatedCell(functionResult, locale, position, cell) {
|
|
|
8135
8107
|
return textCell(value, format, formattedValue, position);
|
|
8136
8108
|
}
|
|
8137
8109
|
function isNumberResult(result) {
|
|
8138
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8110
|
+
return !!result && getEvaluatedCellType(result) === "number";
|
|
8139
8111
|
}
|
|
8140
8112
|
function isTextResult(result) {
|
|
8141
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8113
|
+
return !!result && getEvaluatedCellType(result) === "text";
|
|
8142
8114
|
}
|
|
8143
8115
|
function isErrorResult(result) {
|
|
8144
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8116
|
+
return !!result && getEvaluatedCellType(result) === "error";
|
|
8145
8117
|
}
|
|
8146
8118
|
function getEvaluatedCellType({ value, format }) {
|
|
8147
|
-
if (value === null) return
|
|
8148
|
-
else if (isEvaluationError(value)) return
|
|
8149
|
-
else if (isTextFormat(format)) return
|
|
8119
|
+
if (value === null) return "empty";
|
|
8120
|
+
else if (isEvaluationError(value)) return "error";
|
|
8121
|
+
else if (isTextFormat(format)) return "text";
|
|
8150
8122
|
switch (typeof value) {
|
|
8151
|
-
case "number": return
|
|
8152
|
-
case "boolean": return
|
|
8153
|
-
case "string": return
|
|
8123
|
+
case "number": return "number";
|
|
8124
|
+
case "boolean": return "boolean";
|
|
8125
|
+
case "string": return "text";
|
|
8154
8126
|
}
|
|
8155
8127
|
}
|
|
8156
8128
|
function textCell(value, format, formattedValue, position) {
|
|
@@ -8159,7 +8131,7 @@ function textCell(value, format, formattedValue, position) {
|
|
|
8159
8131
|
format,
|
|
8160
8132
|
formattedValue,
|
|
8161
8133
|
position,
|
|
8162
|
-
type:
|
|
8134
|
+
type: "text",
|
|
8163
8135
|
isAutoSummable: true,
|
|
8164
8136
|
defaultAlign: "left"
|
|
8165
8137
|
};
|
|
@@ -8170,7 +8142,7 @@ function numberCell(value, format, formattedValue, position) {
|
|
|
8170
8142
|
format,
|
|
8171
8143
|
formattedValue,
|
|
8172
8144
|
position,
|
|
8173
|
-
type:
|
|
8145
|
+
type: "number",
|
|
8174
8146
|
isAutoSummable: true,
|
|
8175
8147
|
defaultAlign: "right"
|
|
8176
8148
|
};
|
|
@@ -8180,7 +8152,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
8180
8152
|
value: null,
|
|
8181
8153
|
format,
|
|
8182
8154
|
formattedValue: "",
|
|
8183
|
-
type:
|
|
8155
|
+
type: "empty",
|
|
8184
8156
|
isAutoSummable: true,
|
|
8185
8157
|
defaultAlign: "left"
|
|
8186
8158
|
};
|
|
@@ -8191,7 +8163,7 @@ function dateTimeCell(value, format, formattedValue, position) {
|
|
|
8191
8163
|
format,
|
|
8192
8164
|
formattedValue,
|
|
8193
8165
|
position,
|
|
8194
|
-
type:
|
|
8166
|
+
type: "number",
|
|
8195
8167
|
isAutoSummable: false,
|
|
8196
8168
|
defaultAlign: "right"
|
|
8197
8169
|
};
|
|
@@ -8202,7 +8174,7 @@ function booleanCell(value, format, formattedValue, position) {
|
|
|
8202
8174
|
format,
|
|
8203
8175
|
formattedValue,
|
|
8204
8176
|
position,
|
|
8205
|
-
type:
|
|
8177
|
+
type: "boolean",
|
|
8206
8178
|
isAutoSummable: false,
|
|
8207
8179
|
defaultAlign: "center"
|
|
8208
8180
|
};
|
|
@@ -8213,7 +8185,7 @@ function errorCell(value, message, position, errorOriginPosition) {
|
|
|
8213
8185
|
formattedValue: value,
|
|
8214
8186
|
message,
|
|
8215
8187
|
position,
|
|
8216
|
-
type:
|
|
8188
|
+
type: "error",
|
|
8217
8189
|
isAutoSummable: false,
|
|
8218
8190
|
defaultAlign: "center",
|
|
8219
8191
|
errorOriginPosition
|
|
@@ -9456,15 +9428,15 @@ function chartMutedFontColor(backgroundColor) {
|
|
|
9456
9428
|
return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
|
|
9457
9429
|
}
|
|
9458
9430
|
function checkDataset(dataSource) {
|
|
9459
|
-
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
9460
|
-
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
9461
|
-
return
|
|
9431
|
+
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
9432
|
+
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
9433
|
+
return "Success";
|
|
9462
9434
|
}
|
|
9463
9435
|
function checkLabelRange(dataSource) {
|
|
9464
9436
|
if (dataSource.labelRange) {
|
|
9465
|
-
if (!rangeReference.test(dataSource.labelRange || "")) return
|
|
9437
|
+
if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
|
|
9466
9438
|
}
|
|
9467
|
-
return
|
|
9439
|
+
return "Success";
|
|
9468
9440
|
}
|
|
9469
9441
|
function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
|
|
9470
9442
|
return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
|
|
@@ -11129,7 +11101,7 @@ var AbstractChart = class {
|
|
|
11129
11101
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
11130
11102
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
11131
11103
|
if (!baseline) return "";
|
|
11132
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
11104
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
11133
11105
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
11134
11106
|
return baseline.formattedValue;
|
|
11135
11107
|
}
|
|
@@ -11158,23 +11130,23 @@ function getKeyValueText(keyValueCell, humanizeNumbers, locale) {
|
|
|
11158
11130
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
11159
11131
|
}
|
|
11160
11132
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
11161
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
11133
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
11162
11134
|
const diff = keyValue.value - baseline.value;
|
|
11163
11135
|
if (diff > 0) return colorUp;
|
|
11164
11136
|
else if (diff < 0) return colorDown;
|
|
11165
11137
|
}
|
|
11166
11138
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
11167
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
11139
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
11168
11140
|
const diff = keyValue.value - baseline.value;
|
|
11169
11141
|
if (diff > 0) return "up";
|
|
11170
11142
|
else if (diff < 0) return "down";
|
|
11171
11143
|
return "neutral";
|
|
11172
11144
|
}
|
|
11173
11145
|
function checkKeyValue(definition) {
|
|
11174
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
11146
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
11175
11147
|
}
|
|
11176
11148
|
function checkBaseline(definition) {
|
|
11177
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
11149
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
11178
11150
|
}
|
|
11179
11151
|
const Path2DConstructor = globalThis.Path2D;
|
|
11180
11152
|
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");
|
|
@@ -11433,6 +11405,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
11433
11405
|
}, runtime).computeDesign();
|
|
11434
11406
|
}
|
|
11435
11407
|
var ScorecardChartConfigBuilder = class {
|
|
11408
|
+
runtime;
|
|
11436
11409
|
context;
|
|
11437
11410
|
width;
|
|
11438
11411
|
height;
|
|
@@ -12760,15 +12733,6 @@ function schemeToColorScale(scheme) {
|
|
|
12760
12733
|
};
|
|
12761
12734
|
}
|
|
12762
12735
|
|
|
12763
|
-
//#endregion
|
|
12764
|
-
//#region src/types/clipboard.ts
|
|
12765
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
12766
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
12767
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
12768
|
-
ClipboardMIMEType["Image"] = "image";
|
|
12769
|
-
return ClipboardMIMEType;
|
|
12770
|
-
}({});
|
|
12771
|
-
|
|
12772
12736
|
//#endregion
|
|
12773
12737
|
//#region src/types/conditional_formatting.ts
|
|
12774
12738
|
const cfOperators = [
|
|
@@ -15076,7 +15040,7 @@ const BarChart = {
|
|
|
15076
15040
|
copyInSheetId: (definition) => definition,
|
|
15077
15041
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15078
15042
|
transformDefinition: (definition) => definition,
|
|
15079
|
-
validateDefinition: () =>
|
|
15043
|
+
validateDefinition: () => "Success",
|
|
15080
15044
|
updateRanges: (definition) => definition,
|
|
15081
15045
|
getContextCreation: (definition) => definition,
|
|
15082
15046
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15141,42 +15105,42 @@ const BarChart = {
|
|
|
15141
15105
|
//#endregion
|
|
15142
15106
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
15143
15107
|
function isDataRangeValid(definition) {
|
|
15144
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
15108
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
15145
15109
|
}
|
|
15146
15110
|
function checkRangeLimits(check, batchValidations) {
|
|
15147
15111
|
return batchValidations((definition) => {
|
|
15148
15112
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
15149
|
-
return
|
|
15113
|
+
return "Success";
|
|
15150
15114
|
}, (definition) => {
|
|
15151
15115
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
15152
|
-
return
|
|
15116
|
+
return "Success";
|
|
15153
15117
|
});
|
|
15154
15118
|
}
|
|
15155
15119
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
15156
15120
|
return batchValidations((definition) => {
|
|
15157
15121
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
15158
|
-
return
|
|
15122
|
+
return "Success";
|
|
15159
15123
|
}, (definition) => {
|
|
15160
15124
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
15161
|
-
return
|
|
15125
|
+
return "Success";
|
|
15162
15126
|
});
|
|
15163
15127
|
}
|
|
15164
15128
|
function checkEmpty(value, valueName) {
|
|
15165
15129
|
if (value === "") switch (valueName) {
|
|
15166
|
-
case "rangeMin": return
|
|
15167
|
-
case "rangeMax": return
|
|
15130
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
15131
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
15168
15132
|
}
|
|
15169
|
-
return
|
|
15133
|
+
return "Success";
|
|
15170
15134
|
}
|
|
15171
15135
|
function checkValueIsNumberOrFormula(value, valueName) {
|
|
15172
|
-
if (value.startsWith("=")) return
|
|
15136
|
+
if (value.startsWith("=")) return "Success";
|
|
15173
15137
|
if (isNaN(value)) switch (valueName) {
|
|
15174
|
-
case "rangeMin": return
|
|
15175
|
-
case "rangeMax": return
|
|
15176
|
-
case "lowerInflectionPointValue": return
|
|
15177
|
-
case "upperInflectionPointValue": return
|
|
15138
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
15139
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
15140
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
15141
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
15178
15142
|
}
|
|
15179
|
-
return
|
|
15143
|
+
return "Success";
|
|
15180
15144
|
}
|
|
15181
15145
|
const GaugeChart = {
|
|
15182
15146
|
sequence: 50,
|
|
@@ -15298,7 +15262,7 @@ const GaugeChart = {
|
|
|
15298
15262
|
col: dataRange.zone.left,
|
|
15299
15263
|
row: dataRange.zone.top
|
|
15300
15264
|
});
|
|
15301
|
-
if (cell.type ===
|
|
15265
|
+
if (cell.type === "number") {
|
|
15302
15266
|
gaugeValue = cell.value;
|
|
15303
15267
|
formattedValue = cell.formattedValue;
|
|
15304
15268
|
format = cell.format;
|
|
@@ -15432,7 +15396,7 @@ const LineChart = {
|
|
|
15432
15396
|
copyInSheetId: (definition) => definition,
|
|
15433
15397
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15434
15398
|
transformDefinition: (definition) => definition,
|
|
15435
|
-
validateDefinition: () =>
|
|
15399
|
+
validateDefinition: () => "Success",
|
|
15436
15400
|
updateRanges: (definition) => definition,
|
|
15437
15401
|
getContextCreation: (definition) => definition,
|
|
15438
15402
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15516,7 +15480,7 @@ const PieChart = {
|
|
|
15516
15480
|
copyInSheetId: (definition) => definition,
|
|
15517
15481
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15518
15482
|
transformDefinition: (definition) => definition,
|
|
15519
|
-
validateDefinition: () =>
|
|
15483
|
+
validateDefinition: () => "Success",
|
|
15520
15484
|
updateRanges: (definition) => definition,
|
|
15521
15485
|
getContextCreation: (definition) => definition,
|
|
15522
15486
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15595,7 +15559,7 @@ const WaterfallChart = {
|
|
|
15595
15559
|
copyInSheetId: (definition) => definition,
|
|
15596
15560
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15597
15561
|
transformDefinition: (definition) => definition,
|
|
15598
|
-
validateDefinition: () =>
|
|
15562
|
+
validateDefinition: () => "Success",
|
|
15599
15563
|
updateRanges: (definition) => definition,
|
|
15600
15564
|
getContextCreation: (definition) => definition,
|
|
15601
15565
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -16907,6 +16871,10 @@ var GaugeChartComponent = class extends Component {
|
|
|
16907
16871
|
* Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
|
|
16908
16872
|
*/
|
|
16909
16873
|
var Animation = class {
|
|
16874
|
+
startValue;
|
|
16875
|
+
endValue;
|
|
16876
|
+
duration;
|
|
16877
|
+
callback;
|
|
16910
16878
|
startTime = void 0;
|
|
16911
16879
|
animationFrameId = null;
|
|
16912
16880
|
constructor(startValue, endValue, duration, callback) {
|
|
@@ -17135,6 +17103,10 @@ var Menu = class extends Component {
|
|
|
17135
17103
|
onKeyDown: {
|
|
17136
17104
|
type: Function,
|
|
17137
17105
|
optional: true
|
|
17106
|
+
},
|
|
17107
|
+
disableKeyboardNavigation: {
|
|
17108
|
+
type: Boolean,
|
|
17109
|
+
optional: true
|
|
17138
17110
|
}
|
|
17139
17111
|
};
|
|
17140
17112
|
static components = {};
|
|
@@ -17142,7 +17114,7 @@ var Menu = class extends Component {
|
|
|
17142
17114
|
menuRef = useRef("menu");
|
|
17143
17115
|
setup() {
|
|
17144
17116
|
useEffect(() => {
|
|
17145
|
-
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
|
|
17117
|
+
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
|
|
17146
17118
|
const selector = `[data-name='${this.props.hoveredMenuId}']`;
|
|
17147
17119
|
this.menuRef.el.querySelector(selector)?.focus();
|
|
17148
17120
|
}
|
|
@@ -17377,6 +17349,11 @@ var Popover = class extends Component {
|
|
|
17377
17349
|
}
|
|
17378
17350
|
};
|
|
17379
17351
|
var PopoverPositionContext = class {
|
|
17352
|
+
anchorRect;
|
|
17353
|
+
containerRect;
|
|
17354
|
+
propsMaxSize;
|
|
17355
|
+
spreadsheetOffset;
|
|
17356
|
+
lastPosition;
|
|
17380
17357
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
|
|
17381
17358
|
this.anchorRect = anchorRect;
|
|
17382
17359
|
this.containerRect = containerRect;
|
|
@@ -17571,7 +17548,8 @@ var MenuPopover = class MenuPopover extends Component {
|
|
|
17571
17548
|
onScroll: this.onScroll.bind(this),
|
|
17572
17549
|
onKeyDown: this.onKeydown.bind(this),
|
|
17573
17550
|
hoveredMenuId,
|
|
17574
|
-
isHoveredMenuFocused: !this.subMenu.isOpen
|
|
17551
|
+
isHoveredMenuFocused: !this.subMenu.isOpen,
|
|
17552
|
+
disableKeyboardNavigation: this.props.disableKeyboardNavigation
|
|
17575
17553
|
};
|
|
17576
17554
|
}
|
|
17577
17555
|
get subMenuAnchorRect() {
|
|
@@ -18430,26 +18408,26 @@ var DelayedHoveredCellStore = class extends SpreadsheetStore {
|
|
|
18430
18408
|
//#region src/components/translations_terms.ts
|
|
18431
18409
|
const CfTerms = {
|
|
18432
18410
|
Errors: {
|
|
18433
|
-
[
|
|
18434
|
-
[
|
|
18435
|
-
[
|
|
18436
|
-
[
|
|
18437
|
-
[
|
|
18438
|
-
[
|
|
18439
|
-
[
|
|
18440
|
-
[
|
|
18441
|
-
[
|
|
18442
|
-
[
|
|
18443
|
-
[
|
|
18444
|
-
[
|
|
18445
|
-
[
|
|
18446
|
-
[
|
|
18447
|
-
[
|
|
18448
|
-
[
|
|
18449
|
-
[
|
|
18450
|
-
[
|
|
18451
|
-
[
|
|
18452
|
-
[
|
|
18411
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18412
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
18413
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
18414
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
18415
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
18416
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
18417
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
18418
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
18419
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
18420
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
18421
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
18422
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
18423
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
18424
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
18425
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
18426
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
18427
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
18428
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
18429
|
+
["EmptyTarget"]: _t("Target must contain at least one zone"),
|
|
18430
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
18453
18431
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
18454
18432
|
},
|
|
18455
18433
|
ColorScale: _t("Color scale"),
|
|
@@ -18468,17 +18446,17 @@ const ChartTerms = {
|
|
|
18468
18446
|
AggregatedChart: _t("Aggregate"),
|
|
18469
18447
|
Errors: {
|
|
18470
18448
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18471
|
-
[
|
|
18472
|
-
[
|
|
18473
|
-
[
|
|
18474
|
-
[
|
|
18475
|
-
[
|
|
18476
|
-
[
|
|
18477
|
-
[
|
|
18478
|
-
[
|
|
18479
|
-
[
|
|
18480
|
-
[
|
|
18481
|
-
[
|
|
18449
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18450
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18451
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18452
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18453
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18454
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18455
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
18456
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
18457
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
18458
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
18459
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
18482
18460
|
},
|
|
18483
18461
|
ColorScales: {
|
|
18484
18462
|
blues: _t("Blues"),
|
|
@@ -18498,16 +18476,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
18498
18476
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
18499
18477
|
const SplitToColumnsTerms = { Errors: {
|
|
18500
18478
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
18501
|
-
[
|
|
18502
|
-
[
|
|
18503
|
-
[
|
|
18479
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
18480
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
18481
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
18504
18482
|
} };
|
|
18505
18483
|
const RemoveDuplicateTerms = { Errors: {
|
|
18506
18484
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
18507
|
-
[
|
|
18508
|
-
[
|
|
18509
|
-
[
|
|
18510
|
-
[
|
|
18485
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
18486
|
+
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
18487
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
18488
|
+
["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
|
|
18511
18489
|
} };
|
|
18512
18490
|
const DVTerms = {
|
|
18513
18491
|
DateIs: {
|
|
@@ -18535,19 +18513,19 @@ const DVTerms = {
|
|
|
18535
18513
|
positiveNumber: _t("The value must be a positive number")
|
|
18536
18514
|
},
|
|
18537
18515
|
Errors: {
|
|
18538
|
-
[
|
|
18539
|
-
[
|
|
18540
|
-
[
|
|
18516
|
+
["InvalidRange"]: _t("The range is invalid."),
|
|
18517
|
+
["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
|
|
18518
|
+
["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
|
|
18541
18519
|
Unexpected: _t("The rule is invalid for an unknown reason.")
|
|
18542
18520
|
}
|
|
18543
18521
|
};
|
|
18544
18522
|
const TableTerms = {
|
|
18545
18523
|
Errors: {
|
|
18546
18524
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
18547
|
-
[
|
|
18548
|
-
[
|
|
18549
|
-
[
|
|
18550
|
-
[
|
|
18525
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
18526
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
18527
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18528
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
18551
18529
|
},
|
|
18552
18530
|
Checkboxes: {
|
|
18553
18531
|
hasFilters: _t("Filter button"),
|
|
@@ -18871,6 +18849,7 @@ function getDateTimeFormat(locale) {
|
|
|
18871
18849
|
* Represent a raw XML string
|
|
18872
18850
|
*/
|
|
18873
18851
|
var XMLString = class {
|
|
18852
|
+
xmlString;
|
|
18874
18853
|
/**
|
|
18875
18854
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
18876
18855
|
*/
|
|
@@ -19221,30 +19200,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
19221
19200
|
|
|
19222
19201
|
//#endregion
|
|
19223
19202
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
19224
|
-
/**
|
|
19225
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
19226
|
-
*/
|
|
19227
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
19228
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
19229
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
19230
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
19231
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
19232
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
19233
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
19234
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
19235
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
19236
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
19237
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
19238
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
19239
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
19240
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
19241
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
19242
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
19243
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
19244
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
19245
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
19246
|
-
return WarningTypes;
|
|
19247
|
-
}({});
|
|
19248
19203
|
var XLSXImportWarningManager = class {
|
|
19249
19204
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
19250
19205
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -20004,7 +19959,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
20004
19959
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
20005
19960
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
20006
19961
|
} catch (e) {}
|
|
20007
|
-
warningManager.generateNotSupportedWarning(
|
|
19962
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
20008
19963
|
}
|
|
20009
19964
|
function isFormatSupported(format) {
|
|
20010
19965
|
try {
|
|
@@ -20089,20 +20044,20 @@ function convertFormats(data, warningManager) {
|
|
|
20089
20044
|
return arrayToObject(formats, 1);
|
|
20090
20045
|
}
|
|
20091
20046
|
function addStyleWarnings(font, fill, warningManager) {
|
|
20092
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
20093
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
20047
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
20048
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
20094
20049
|
}
|
|
20095
20050
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
20096
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
20051
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
20097
20052
|
}
|
|
20098
20053
|
function addBorderWarnings(border, warningManager) {
|
|
20099
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
20054
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
20100
20055
|
}
|
|
20101
20056
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
20102
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20057
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
20103
20058
|
}
|
|
20104
20059
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
20105
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20060
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
20106
20061
|
}
|
|
20107
20062
|
|
|
20108
20063
|
//#endregion
|
|
@@ -20271,7 +20226,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
20271
20226
|
lower: icons.upper
|
|
20272
20227
|
};
|
|
20273
20228
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
20274
|
-
warningManager.generateNotSupportedWarning(
|
|
20229
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
20275
20230
|
switch (key) {
|
|
20276
20231
|
case "upper":
|
|
20277
20232
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -20307,13 +20262,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
20307
20262
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
20308
20263
|
}
|
|
20309
20264
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
20310
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
20311
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
20265
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
20266
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
20312
20267
|
if (cf.cfRules[0].dxfId) {
|
|
20313
20268
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
20314
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
20315
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
20316
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
20269
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
20270
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
20271
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
20317
20272
|
}
|
|
20318
20273
|
}
|
|
20319
20274
|
|
|
@@ -20479,13 +20434,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20479
20434
|
if (!dv) continue;
|
|
20480
20435
|
switch (dv.type) {
|
|
20481
20436
|
case "time":
|
|
20482
|
-
warningManager.generateNotSupportedWarning(
|
|
20437
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
20483
20438
|
break;
|
|
20484
20439
|
case "textLength":
|
|
20485
|
-
warningManager.generateNotSupportedWarning(
|
|
20440
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
20486
20441
|
break;
|
|
20487
20442
|
case "whole":
|
|
20488
|
-
warningManager.generateNotSupportedWarning(
|
|
20443
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
20489
20444
|
break;
|
|
20490
20445
|
case "decimal":
|
|
20491
20446
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -20497,7 +20452,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20497
20452
|
break;
|
|
20498
20453
|
case "date":
|
|
20499
20454
|
if (dv.operator === "notEqual") {
|
|
20500
|
-
warningManager.generateNotSupportedWarning(
|
|
20455
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
20501
20456
|
break;
|
|
20502
20457
|
}
|
|
20503
20458
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -20794,7 +20749,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
20794
20749
|
}
|
|
20795
20750
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
20796
20751
|
const label = link.display || cellValue;
|
|
20797
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
20752
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
20798
20753
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
20799
20754
|
}
|
|
20800
20755
|
function getSheetDims(sheet) {
|
|
@@ -23998,7 +23953,7 @@ function createEmptyExcelWorkbookData() {
|
|
|
23998
23953
|
//#endregion
|
|
23999
23954
|
//#region src/helpers/ui/paste_interactive.ts
|
|
24000
23955
|
const handleCopyPasteResult = (env, command) => {
|
|
24001
|
-
if (env.model.dispatch(command.type).isCancelledBecause(
|
|
23956
|
+
if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
|
|
24002
23957
|
};
|
|
24003
23958
|
const PasteInteractiveContent = {
|
|
24004
23959
|
wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
|
|
@@ -24008,10 +23963,10 @@ const PasteInteractiveContent = {
|
|
|
24008
23963
|
};
|
|
24009
23964
|
function handlePasteResult(env, result) {
|
|
24010
23965
|
if (!result.isSuccessful) {
|
|
24011
|
-
if (result.reasons.includes(
|
|
24012
|
-
else if (result.reasons.includes(
|
|
24013
|
-
else if (result.reasons.includes(
|
|
24014
|
-
else if (result.reasons.includes(
|
|
23966
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
23967
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
23968
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
23969
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
24015
23970
|
}
|
|
24016
23971
|
}
|
|
24017
23972
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -24199,7 +24154,7 @@ var ErrorToolTip = class extends Component {
|
|
|
24199
24154
|
};
|
|
24200
24155
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
24201
24156
|
const cell = getters.getEvaluatedCell(position);
|
|
24202
|
-
if (cell.type ===
|
|
24157
|
+
if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
|
|
24203
24158
|
isOpen: true,
|
|
24204
24159
|
props: { cellPosition: position },
|
|
24205
24160
|
Component: ErrorToolTip,
|
|
@@ -24248,7 +24203,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24248
24203
|
sortDirection,
|
|
24249
24204
|
sortOptions
|
|
24250
24205
|
});
|
|
24251
|
-
if (result.isCancelledBecause(
|
|
24206
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
24252
24207
|
const { col, row } = anchor;
|
|
24253
24208
|
env.model.selection.selectZone({
|
|
24254
24209
|
cell: {
|
|
@@ -24259,7 +24214,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24259
24214
|
});
|
|
24260
24215
|
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
24261
24216
|
}
|
|
24262
|
-
if (result.isCancelledBecause(
|
|
24217
|
+
if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
|
|
24263
24218
|
const { col, row } = anchor;
|
|
24264
24219
|
env.model.selection.selectZone({
|
|
24265
24220
|
cell: {
|
|
@@ -26910,6 +26865,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
26910
26865
|
//#endregion
|
|
26911
26866
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
26912
26867
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
26868
|
+
args;
|
|
26913
26869
|
constructor(get, args) {
|
|
26914
26870
|
super(get);
|
|
26915
26871
|
this.args = args;
|
|
@@ -27813,6 +27769,7 @@ var DOMDndHelper = class {
|
|
|
27813
27769
|
}
|
|
27814
27770
|
};
|
|
27815
27771
|
var ContainerWrapper = class {
|
|
27772
|
+
el;
|
|
27816
27773
|
constructor(el) {
|
|
27817
27774
|
this.el = el;
|
|
27818
27775
|
}
|
|
@@ -27884,6 +27841,10 @@ var FocusStore = class {
|
|
|
27884
27841
|
* This plugin handles this internal state.
|
|
27885
27842
|
*/
|
|
27886
27843
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
27844
|
+
initialRanges;
|
|
27845
|
+
inputHasSingleRange;
|
|
27846
|
+
colors;
|
|
27847
|
+
disabledRanges;
|
|
27887
27848
|
mutators = [
|
|
27888
27849
|
"resetWithRanges",
|
|
27889
27850
|
"focusById",
|
|
@@ -29006,8 +28967,8 @@ var FilterMenu = class extends Component {
|
|
|
29006
28967
|
row,
|
|
29007
28968
|
col: position.col
|
|
29008
28969
|
});
|
|
29009
|
-
if (cell.type ===
|
|
29010
|
-
else if (cell.type ===
|
|
28970
|
+
if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
|
|
28971
|
+
else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
|
|
29011
28972
|
else cellTypesCount.number++;
|
|
29012
28973
|
}
|
|
29013
28974
|
const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
|
|
@@ -29368,8 +29329,8 @@ function getPasteZones(target, content) {
|
|
|
29368
29329
|
}
|
|
29369
29330
|
function parseOSClipboardContent(content) {
|
|
29370
29331
|
let spreadsheetContent = void 0;
|
|
29371
|
-
if (content[
|
|
29372
|
-
const textContent = content[
|
|
29332
|
+
if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
|
|
29333
|
+
const textContent = content["text/plain"] || "";
|
|
29373
29334
|
let imageBlob = void 0;
|
|
29374
29335
|
if (!textContent.trim()) {
|
|
29375
29336
|
for (const type of AllowedImageMimeTypes) if (content[type]) {
|
|
@@ -29496,10 +29457,10 @@ function detectColumnType(cells) {
|
|
|
29496
29457
|
let detectedType = "empty";
|
|
29497
29458
|
for (const cell of cells) {
|
|
29498
29459
|
let type = null;
|
|
29499
|
-
if (cell.type ===
|
|
29460
|
+
if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
|
|
29500
29461
|
else if (cell.format?.includes("%")) type = "percentage";
|
|
29501
29462
|
else type = "number";
|
|
29502
|
-
else if (cell.type ===
|
|
29463
|
+
else if (cell.type === "text") type = "text";
|
|
29503
29464
|
if (type) {
|
|
29504
29465
|
const newCount = ++counts[type];
|
|
29505
29466
|
if (newCount > max) {
|
|
@@ -29534,7 +29495,7 @@ function isDatasetTitled(getters, column) {
|
|
|
29534
29495
|
col: column.zone.left,
|
|
29535
29496
|
row: column.zone.top
|
|
29536
29497
|
});
|
|
29537
|
-
return ![
|
|
29498
|
+
return !["number", "empty"].includes(titleCell.type);
|
|
29538
29499
|
}
|
|
29539
29500
|
/**
|
|
29540
29501
|
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
|
|
@@ -29857,8 +29818,8 @@ function interactiveCreateTable(env, sheetId, tableConfig = DEFAULT_TABLE_CONFIG
|
|
|
29857
29818
|
config: tableConfig,
|
|
29858
29819
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29859
29820
|
});
|
|
29860
|
-
if (result.isCancelledBecause(
|
|
29861
|
-
else if (result.isCancelledBecause(
|
|
29821
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29822
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29862
29823
|
return result;
|
|
29863
29824
|
}
|
|
29864
29825
|
|
|
@@ -29886,9 +29847,9 @@ async function paste$1(env, pasteOption) {
|
|
|
29886
29847
|
case "ok":
|
|
29887
29848
|
const clipboardId = env.model.getters.getClipboardId();
|
|
29888
29849
|
const target = env.model.getters.getSelectedZones();
|
|
29889
|
-
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
29850
|
+
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
|
|
29890
29851
|
else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
|
|
29891
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29852
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29892
29853
|
break;
|
|
29893
29854
|
case "notImplemented":
|
|
29894
29855
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -32433,13 +32394,13 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
32433
32394
|
if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
|
|
32434
32395
|
}
|
|
32435
32396
|
get errorMessages() {
|
|
32436
|
-
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
32397
|
+
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32437
32398
|
}
|
|
32438
32399
|
get isDatasetInvalid() {
|
|
32439
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32400
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32440
32401
|
}
|
|
32441
32402
|
get isLabelInvalid() {
|
|
32442
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32403
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32443
32404
|
}
|
|
32444
32405
|
get dataSetsHaveTitleLabel() {
|
|
32445
32406
|
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() || "" });
|
|
@@ -32771,6 +32732,11 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
32771
32732
|
//#endregion
|
|
32772
32733
|
//#region src/helpers/figures/chart.ts
|
|
32773
32734
|
var SpreadsheetChart = class SpreadsheetChart {
|
|
32735
|
+
getters;
|
|
32736
|
+
sheetId;
|
|
32737
|
+
definition;
|
|
32738
|
+
chartTypeBuilder;
|
|
32739
|
+
dataSourceBuilder;
|
|
32774
32740
|
dataSource;
|
|
32775
32741
|
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
32776
32742
|
this.getters = getters;
|
|
@@ -32808,9 +32774,6 @@ var SpreadsheetChart = class SpreadsheetChart {
|
|
|
32808
32774
|
dataSource: newDataSource
|
|
32809
32775
|
};
|
|
32810
32776
|
}
|
|
32811
|
-
getSupportedChartTypes() {
|
|
32812
|
-
return new Set(this.dataSourceBuilder.supportedChartTypes);
|
|
32813
|
-
}
|
|
32814
32777
|
getRangeDefinition() {
|
|
32815
32778
|
return {
|
|
32816
32779
|
...this.definition,
|
|
@@ -33009,6 +32972,10 @@ const ChartRangeDataSourceHandler = {
|
|
|
33009
32972
|
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
33010
32973
|
};
|
|
33011
32974
|
},
|
|
32975
|
+
/**
|
|
32976
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
32977
|
+
* sheetIdTo.
|
|
32978
|
+
*/
|
|
33012
32979
|
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
33013
32980
|
return {
|
|
33014
32981
|
...dataSource,
|
|
@@ -33162,7 +33129,7 @@ const ChartNeverDataSourceHandler = {
|
|
|
33162
33129
|
fromExternalDefinition: () => ({ type: "none" }),
|
|
33163
33130
|
fromContextCreation: () => ({ type: "none" }),
|
|
33164
33131
|
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
33165
|
-
validate: () =>
|
|
33132
|
+
validate: () => "Success",
|
|
33166
33133
|
transform: () => ({ type: "none" }),
|
|
33167
33134
|
extractData: () => ({
|
|
33168
33135
|
dataSetsValues: [],
|
|
@@ -33497,10 +33464,10 @@ var GaugeChartConfigPanel = class extends Component {
|
|
|
33497
33464
|
state = useState({ dataRangeDispatchResult: void 0 });
|
|
33498
33465
|
dataRange = this.props.definition.dataRange;
|
|
33499
33466
|
get configurationErrorMessages() {
|
|
33500
|
-
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33467
|
+
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33501
33468
|
}
|
|
33502
33469
|
get isDataRangeInvalid() {
|
|
33503
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33470
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33504
33471
|
}
|
|
33505
33472
|
onDataRangeChanged(ranges) {
|
|
33506
33473
|
this.dataRange = ranges[0];
|
|
@@ -33537,19 +33504,19 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
33537
33504
|
});
|
|
33538
33505
|
}
|
|
33539
33506
|
get designErrorMessages() {
|
|
33540
|
-
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !==
|
|
33507
|
+
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33541
33508
|
}
|
|
33542
33509
|
get isRangeMinInvalid() {
|
|
33543
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33510
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
|
|
33544
33511
|
}
|
|
33545
33512
|
get isRangeMaxInvalid() {
|
|
33546
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33513
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
|
|
33547
33514
|
}
|
|
33548
33515
|
get isLowerInflectionPointInvalid() {
|
|
33549
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33516
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
|
|
33550
33517
|
}
|
|
33551
33518
|
get isUpperInflectionPointInvalid() {
|
|
33552
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33519
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
|
|
33553
33520
|
}
|
|
33554
33521
|
updateSectionColor(target, color) {
|
|
33555
33522
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33613,10 +33580,10 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
33613
33580
|
}
|
|
33614
33581
|
checkSectionRuleFormulasAreValid(sectionRule) {
|
|
33615
33582
|
const reasons = /* @__PURE__ */ new Set();
|
|
33616
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(
|
|
33617
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(
|
|
33618
|
-
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(
|
|
33619
|
-
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(
|
|
33583
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
|
|
33584
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
|
|
33585
|
+
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
|
|
33586
|
+
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
|
|
33620
33587
|
return reasons;
|
|
33621
33588
|
}
|
|
33622
33589
|
valueIsValidNumber(value) {
|
|
@@ -33956,13 +33923,13 @@ var ScorecardChartConfigPanel = class extends Component {
|
|
|
33956
33923
|
keyValue = this.props.definition.keyValue;
|
|
33957
33924
|
baseline = this.props.definition.baseline;
|
|
33958
33925
|
get errorMessages() {
|
|
33959
|
-
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33926
|
+
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33960
33927
|
}
|
|
33961
33928
|
get isKeyValueInvalid() {
|
|
33962
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33929
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33963
33930
|
}
|
|
33964
33931
|
get isBaselineInvalid() {
|
|
33965
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33932
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
33966
33933
|
}
|
|
33967
33934
|
onKeyValueRangeChanged(ranges) {
|
|
33968
33935
|
this.keyValue = ranges[0];
|
|
@@ -34396,13 +34363,23 @@ var ChartTypePicker = class extends Component {
|
|
|
34396
34363
|
});
|
|
34397
34364
|
setup() {
|
|
34398
34365
|
useExternalListener(window, "pointerdown", this.onExternalClick, { capture: true });
|
|
34399
|
-
const
|
|
34366
|
+
const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
|
|
34367
|
+
const supportedTypes = this.getSupportedChartTypes(definition);
|
|
34400
34368
|
for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
|
|
34401
34369
|
if (!supportedTypes.has(subtypeProperties.chartType)) continue;
|
|
34402
34370
|
if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
|
|
34403
34371
|
else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
|
|
34404
34372
|
}
|
|
34405
34373
|
}
|
|
34374
|
+
getSupportedChartTypes(definition) {
|
|
34375
|
+
let supportedTypes;
|
|
34376
|
+
if (definition.dataSource) {
|
|
34377
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
|
|
34378
|
+
supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
|
|
34379
|
+
} else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
|
|
34380
|
+
else throw new Error("Missing chart data source for a chart type that requires it");
|
|
34381
|
+
return supportedTypes;
|
|
34382
|
+
}
|
|
34406
34383
|
onExternalClick(ev) {
|
|
34407
34384
|
if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
|
|
34408
34385
|
this.closePopover();
|
|
@@ -34696,10 +34673,10 @@ const columnStatisticFunctions = [
|
|
|
34696
34673
|
{
|
|
34697
34674
|
name: _t("Unique values"),
|
|
34698
34675
|
types: [
|
|
34699
|
-
|
|
34700
|
-
|
|
34701
|
-
|
|
34702
|
-
|
|
34676
|
+
"number",
|
|
34677
|
+
"text",
|
|
34678
|
+
"boolean",
|
|
34679
|
+
"error"
|
|
34703
34680
|
],
|
|
34704
34681
|
compute: (values, locale) => {
|
|
34705
34682
|
const uniqueValues = /* @__PURE__ */ new Set();
|
|
@@ -34710,27 +34687,27 @@ const columnStatisticFunctions = [
|
|
|
34710
34687
|
},
|
|
34711
34688
|
{
|
|
34712
34689
|
name: _t("Sum"),
|
|
34713
|
-
types: [
|
|
34690
|
+
types: ["number"],
|
|
34714
34691
|
compute: (values, locale) => sum([[values]], locale)
|
|
34715
34692
|
},
|
|
34716
34693
|
{
|
|
34717
34694
|
name: _t("Average"),
|
|
34718
|
-
types: [
|
|
34695
|
+
types: ["number"],
|
|
34719
34696
|
compute: (values, locale) => average([[values]], locale)
|
|
34720
34697
|
},
|
|
34721
34698
|
{
|
|
34722
34699
|
name: _t("Median"),
|
|
34723
|
-
types: [
|
|
34700
|
+
types: ["number"],
|
|
34724
34701
|
compute: (values, locale) => median([[values]], locale) ?? ""
|
|
34725
34702
|
},
|
|
34726
34703
|
{
|
|
34727
34704
|
name: _t("Minimum value"),
|
|
34728
|
-
types: [
|
|
34705
|
+
types: ["number"],
|
|
34729
34706
|
compute: (values, locale) => min([[values]], locale).value
|
|
34730
34707
|
},
|
|
34731
34708
|
{
|
|
34732
34709
|
name: _t("Maximum value"),
|
|
34733
|
-
types: [
|
|
34710
|
+
types: ["number"],
|
|
34734
34711
|
compute: (values, locale) => max([[values]], locale).value
|
|
34735
34712
|
}
|
|
34736
34713
|
];
|
|
@@ -34877,12 +34854,13 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34877
34854
|
}
|
|
34878
34855
|
const { sheetId, col } = getters.getActivePosition();
|
|
34879
34856
|
this.selectedColumn = col;
|
|
34880
|
-
|
|
34857
|
+
const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
|
|
34881
34858
|
top: 0,
|
|
34882
34859
|
left: col,
|
|
34883
34860
|
bottom: getters.getNumberRows(sheetId) - 1,
|
|
34884
34861
|
right: col
|
|
34885
|
-
}).map((cell) => cell.format)
|
|
34862
|
+
}).map((cell) => cell.format);
|
|
34863
|
+
this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
|
|
34886
34864
|
const numberOfRows = getters.getNumberRows(sheetId);
|
|
34887
34865
|
const cells = [];
|
|
34888
34866
|
const numericValues = [];
|
|
@@ -34900,20 +34878,21 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34900
34878
|
row
|
|
34901
34879
|
});
|
|
34902
34880
|
cells.push(evaluatedCell);
|
|
34903
|
-
if (evaluatedCell.type !==
|
|
34881
|
+
if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
|
|
34904
34882
|
values.push({
|
|
34905
34883
|
row,
|
|
34906
34884
|
col,
|
|
34907
34885
|
value: evaluatedCell.value
|
|
34908
34886
|
});
|
|
34909
|
-
if (evaluatedCell.type ===
|
|
34887
|
+
if (evaluatedCell.type === "number") numericValues.push({
|
|
34910
34888
|
row,
|
|
34911
34889
|
col,
|
|
34912
34890
|
value: evaluatedCell.value
|
|
34913
34891
|
});
|
|
34914
34892
|
}
|
|
34915
34893
|
}
|
|
34916
|
-
|
|
34894
|
+
const locale = getters.getLocale();
|
|
34895
|
+
this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
|
|
34917
34896
|
this.numericValues = numericValues;
|
|
34918
34897
|
this.values = values;
|
|
34919
34898
|
this.countChartData = this.computeCountChartData();
|
|
@@ -35247,7 +35226,7 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35247
35226
|
updateConditionalFormat(newCf) {
|
|
35248
35227
|
const ranges = newCf.ranges || this.state.ranges;
|
|
35249
35228
|
if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35250
|
-
if (!newCf.suppressErrors) this.state.errors = [
|
|
35229
|
+
if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
|
|
35251
35230
|
return;
|
|
35252
35231
|
}
|
|
35253
35232
|
const sheetId = this.model.getters.getActiveSheetId();
|
|
@@ -35262,11 +35241,11 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35262
35241
|
sheetId
|
|
35263
35242
|
});
|
|
35264
35243
|
if (result.isSuccessful) this.state.hasEditedCf = true;
|
|
35265
|
-
const reasons = result.reasons.filter((r) => r !==
|
|
35244
|
+
const reasons = result.reasons.filter((r) => r !== "NoChanges");
|
|
35266
35245
|
if (!newCf.suppressErrors) this.state.errors = reasons;
|
|
35267
35246
|
}
|
|
35268
35247
|
get isRangeValid() {
|
|
35269
|
-
return this.state.errors.includes(
|
|
35248
|
+
return this.state.errors.includes("EmptyRange");
|
|
35270
35249
|
}
|
|
35271
35250
|
get errorMessages() {
|
|
35272
35251
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35520,9 +35499,9 @@ var ColorScaleRuleEditorThreshold = class extends Component {
|
|
|
35520
35499
|
isValueInvalid() {
|
|
35521
35500
|
const errors = this.props.store.state.errors;
|
|
35522
35501
|
switch (this.props.thresholdType) {
|
|
35523
|
-
case "minimum": return errors.includes(
|
|
35524
|
-
case "midpoint": return errors.includes(
|
|
35525
|
-
case "maximum": return errors.includes(
|
|
35502
|
+
case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
|
|
35503
|
+
case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
|
|
35504
|
+
case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
|
|
35526
35505
|
default: return false;
|
|
35527
35506
|
}
|
|
35528
35507
|
}
|
|
@@ -35630,8 +35609,8 @@ var IconSetRuleEditor = class extends Component {
|
|
|
35630
35609
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35631
35610
|
const errors = this.props.store.state.errors;
|
|
35632
35611
|
switch (inflectionPoint) {
|
|
35633
|
-
case "lowerInflectionPoint": return errors.includes(
|
|
35634
|
-
case "upperInflectionPoint": return errors.includes(
|
|
35612
|
+
case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35613
|
+
case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35635
35614
|
default: return true;
|
|
35636
35615
|
}
|
|
35637
35616
|
}
|
|
@@ -36048,12 +36027,6 @@ var DataValidationEditor = class extends Component {
|
|
|
36048
36027
|
//#endregion
|
|
36049
36028
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
36050
36029
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
36051
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
36052
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
36053
|
-
Direction[Direction["current"] = 0] = "current";
|
|
36054
|
-
Direction[Direction["next"] = 1] = "next";
|
|
36055
|
-
return Direction;
|
|
36056
|
-
}(Direction || {});
|
|
36057
36030
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
36058
36031
|
mutators = [
|
|
36059
36032
|
"updateSearchOptions",
|
|
@@ -36115,13 +36088,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36115
36088
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
36116
36089
|
}
|
|
36117
36090
|
selectPreviousMatch() {
|
|
36118
|
-
this.selectNextCell(
|
|
36091
|
+
this.selectNextCell(-1, {
|
|
36119
36092
|
jumpToMatchSheet: true,
|
|
36120
36093
|
updateSelection: true
|
|
36121
36094
|
});
|
|
36122
36095
|
}
|
|
36123
36096
|
selectNextMatch() {
|
|
36124
|
-
this.selectNextCell(
|
|
36097
|
+
this.selectNextCell(1, {
|
|
36125
36098
|
jumpToMatchSheet: true,
|
|
36126
36099
|
updateSelection: true
|
|
36127
36100
|
});
|
|
@@ -36204,7 +36177,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36204
36177
|
refreshSearch(options) {
|
|
36205
36178
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
36206
36179
|
this.findMatches();
|
|
36207
|
-
this.selectNextCell(
|
|
36180
|
+
this.selectNextCell(0, options);
|
|
36208
36181
|
}
|
|
36209
36182
|
getSheetsInSearchOrder() {
|
|
36210
36183
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37288,10 +37261,10 @@ function interactiveUpdateNamedRange(env, payload) {
|
|
|
37288
37261
|
}
|
|
37289
37262
|
function handleResult(env, result) {
|
|
37290
37263
|
if (!result.isSuccessful) {
|
|
37291
|
-
if (result.isCancelledBecause(
|
|
37292
|
-
else if (result.isCancelledBecause(
|
|
37293
|
-
else if (result.isCancelledBecause(
|
|
37294
|
-
else if (result.isCancelledBecause(
|
|
37264
|
+
if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
|
|
37265
|
+
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."));
|
|
37266
|
+
else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
|
|
37267
|
+
else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
|
|
37295
37268
|
}
|
|
37296
37269
|
}
|
|
37297
37270
|
|
|
@@ -37378,6 +37351,8 @@ var NamedRangesPanel = class extends Component {
|
|
|
37378
37351
|
//#endregion
|
|
37379
37352
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37380
37353
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37354
|
+
pivotId;
|
|
37355
|
+
initialMeasure;
|
|
37381
37356
|
mutators = [
|
|
37382
37357
|
"cancelMeasureDisplayEdition",
|
|
37383
37358
|
"updateMeasureDisplayType",
|
|
@@ -38320,7 +38295,7 @@ var PivotTitleSection = class extends Component {
|
|
|
38320
38295
|
});
|
|
38321
38296
|
let text;
|
|
38322
38297
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38323
|
-
else if (result.isCancelledBecause(
|
|
38298
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38324
38299
|
else text = _t("Pivot duplication failed.");
|
|
38325
38300
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38326
38301
|
this.env.notifyUser({
|
|
@@ -38397,13 +38372,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38397
38372
|
break;
|
|
38398
38373
|
}
|
|
38399
38374
|
return {
|
|
38375
|
+
/**
|
|
38376
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38377
|
+
*/
|
|
38400
38378
|
id: measure.id,
|
|
38379
|
+
/**
|
|
38380
|
+
* Display name of the measure
|
|
38381
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38382
|
+
*/
|
|
38401
38383
|
get displayName() {
|
|
38402
38384
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38403
38385
|
},
|
|
38404
38386
|
userDefinedName: measure.userDefinedName,
|
|
38387
|
+
/**
|
|
38388
|
+
* Get the name of the field of the measure
|
|
38389
|
+
*/
|
|
38405
38390
|
fieldName,
|
|
38391
|
+
/**
|
|
38392
|
+
* Get the aggregator of the measure
|
|
38393
|
+
*/
|
|
38406
38394
|
aggregator,
|
|
38395
|
+
/**
|
|
38396
|
+
* Get the type of the measure field
|
|
38397
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38398
|
+
*/
|
|
38407
38399
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38408
38400
|
isValid,
|
|
38409
38401
|
isHidden: measure.isHidden,
|
|
@@ -38417,10 +38409,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38417
38409
|
const type = field?.type ?? "integer";
|
|
38418
38410
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38419
38411
|
return {
|
|
38412
|
+
/**
|
|
38413
|
+
* Get the display name of the dimension
|
|
38414
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38415
|
+
*/
|
|
38420
38416
|
displayName: field?.string ?? dimension.fieldName,
|
|
38417
|
+
/**
|
|
38418
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38419
|
+
* e.g. "stage_id", "create_date:month"
|
|
38420
|
+
*/
|
|
38421
38421
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38422
|
+
/**
|
|
38423
|
+
* Get the name of the field of the dimension
|
|
38424
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38425
|
+
*/
|
|
38422
38426
|
fieldName: dimension.fieldName,
|
|
38427
|
+
/**
|
|
38428
|
+
* Get the aggregate operator of the dimension
|
|
38429
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38430
|
+
*/
|
|
38423
38431
|
granularity,
|
|
38432
|
+
/**
|
|
38433
|
+
* Get the type of the field of the dimension
|
|
38434
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38435
|
+
*/
|
|
38424
38436
|
type: field?.isCustomField ? "custom" : type,
|
|
38425
38437
|
order: dimension.order,
|
|
38426
38438
|
isValid: !!field,
|
|
@@ -39180,14 +39192,6 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
39180
39192
|
|
|
39181
39193
|
//#endregion
|
|
39182
39194
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39183
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39184
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39185
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39186
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39187
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39188
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39189
|
-
return ReloadType;
|
|
39190
|
-
}(ReloadType || {});
|
|
39191
39195
|
/**
|
|
39192
39196
|
* This class represents a pivot table that is created from a range of cells.
|
|
39193
39197
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39230,15 +39234,15 @@ var SpreadsheetPivot = class {
|
|
|
39230
39234
|
}
|
|
39231
39235
|
init(params = {}) {
|
|
39232
39236
|
if (!this._definition || params.reload) {
|
|
39233
|
-
this.reload(
|
|
39237
|
+
this.reload(4);
|
|
39234
39238
|
this.needsReevaluation = false;
|
|
39235
39239
|
}
|
|
39236
39240
|
}
|
|
39237
39241
|
reload(type) {
|
|
39238
|
-
if (type ===
|
|
39239
|
-
if (type >=
|
|
39240
|
-
if (type >=
|
|
39241
|
-
if (type >=
|
|
39242
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39243
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39244
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39245
|
+
if (type >= 1) {
|
|
39242
39246
|
this.collapsedTable = void 0;
|
|
39243
39247
|
this.expandedTable = void 0;
|
|
39244
39248
|
}
|
|
@@ -39247,13 +39251,13 @@ var SpreadsheetPivot = class {
|
|
|
39247
39251
|
const actualDefinition = this.coreDefinition;
|
|
39248
39252
|
this.coreDefinition = nextDefinition;
|
|
39249
39253
|
if (this._definition) {
|
|
39250
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39254
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39251
39255
|
this.reload(reloadType);
|
|
39252
39256
|
}
|
|
39253
39257
|
}
|
|
39254
39258
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39255
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39256
|
-
return
|
|
39259
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39260
|
+
return 4;
|
|
39257
39261
|
}
|
|
39258
39262
|
get isInvalidRange() {
|
|
39259
39263
|
return !!this.invalidRangeError;
|
|
@@ -39326,7 +39330,7 @@ var SpreadsheetPivot = class {
|
|
|
39326
39330
|
if (dataEntries.length === 0) return { value: "" };
|
|
39327
39331
|
const measure = this.getMeasure(measureId);
|
|
39328
39332
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39329
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39333
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39330
39334
|
const aggregator = measure.aggregator;
|
|
39331
39335
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39332
39336
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39428,16 +39432,16 @@ var SpreadsheetPivot = class {
|
|
|
39428
39432
|
return this.definition.getDimension(nameWithGranularity);
|
|
39429
39433
|
}
|
|
39430
39434
|
getTypeFromZone(sheetId, zone) {
|
|
39431
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39435
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39432
39436
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39433
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39434
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39435
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39437
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39438
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39439
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39436
39440
|
return "char";
|
|
39437
39441
|
}
|
|
39438
39442
|
assertCellIsValidField(col, row, cell) {
|
|
39439
|
-
if (cell.type ===
|
|
39440
|
-
if (cell.type ===
|
|
39443
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39444
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39441
39445
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39442
39446
|
}
|
|
39443
39447
|
/**
|
|
@@ -39496,7 +39500,7 @@ var SpreadsheetPivot = class {
|
|
|
39496
39500
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39497
39501
|
if (cell.value === "") entry[field.name] = {
|
|
39498
39502
|
value: null,
|
|
39499
|
-
type:
|
|
39503
|
+
type: "empty",
|
|
39500
39504
|
formattedValue: ""
|
|
39501
39505
|
};
|
|
39502
39506
|
else entry[field.name] = cell;
|
|
@@ -39509,7 +39513,7 @@ var SpreadsheetPivot = class {
|
|
|
39509
39513
|
if (!baseValue || !parentField) {
|
|
39510
39514
|
entry[customFieldName] = {
|
|
39511
39515
|
value: null,
|
|
39512
|
-
type:
|
|
39516
|
+
type: "empty",
|
|
39513
39517
|
formattedValue: ""
|
|
39514
39518
|
};
|
|
39515
39519
|
continue;
|
|
@@ -39522,7 +39526,7 @@ var SpreadsheetPivot = class {
|
|
|
39522
39526
|
}
|
|
39523
39527
|
entry["__count"] = {
|
|
39524
39528
|
value: 1,
|
|
39525
|
-
type:
|
|
39529
|
+
type: "number",
|
|
39526
39530
|
formattedValue: "1"
|
|
39527
39531
|
};
|
|
39528
39532
|
dataEntries.push(entry);
|
|
@@ -39535,7 +39539,7 @@ var SpreadsheetPivot = class {
|
|
|
39535
39539
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39536
39540
|
entry[dimension.nameWithGranularity] = {
|
|
39537
39541
|
value,
|
|
39538
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39542
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39539
39543
|
format: entry[dimension.fieldName]?.format,
|
|
39540
39544
|
formattedValue: formatValue(valueToFormat, {
|
|
39541
39545
|
locale,
|
|
@@ -39690,6 +39694,8 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
39690
39694
|
//#endregion
|
|
39691
39695
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39692
39696
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39697
|
+
pivotId;
|
|
39698
|
+
updateMode;
|
|
39693
39699
|
mutators = [
|
|
39694
39700
|
"reset",
|
|
39695
39701
|
"deferUpdates",
|
|
@@ -39851,7 +39857,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39851
39857
|
};
|
|
39852
39858
|
}
|
|
39853
39859
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39854
|
-
|
|
39860
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39861
|
+
this.draft = cleanedWithGranularity;
|
|
39855
39862
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39856
39863
|
}
|
|
39857
39864
|
/**
|
|
@@ -41607,7 +41614,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
41607
41614
|
separator,
|
|
41608
41615
|
addNewColumns
|
|
41609
41616
|
});
|
|
41610
|
-
if (result.isCancelledBecause(
|
|
41617
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
41611
41618
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
41612
41619
|
separator,
|
|
41613
41620
|
addNewColumns,
|
|
@@ -41689,8 +41696,8 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
41689
41696
|
}).reasons;
|
|
41690
41697
|
const errors = /* @__PURE__ */ new Set();
|
|
41691
41698
|
for (const reason of cancelledReasons) switch (reason) {
|
|
41692
|
-
case
|
|
41693
|
-
case
|
|
41699
|
+
case "SplitWillOverwriteContent":
|
|
41700
|
+
case "EmptySplitSeparator": break;
|
|
41694
41701
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
41695
41702
|
}
|
|
41696
41703
|
return Array.from(errors);
|
|
@@ -41701,7 +41708,7 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
41701
41708
|
separator: this.separatorValue,
|
|
41702
41709
|
addNewColumns: this.state.addNewColumns,
|
|
41703
41710
|
force: false
|
|
41704
|
-
}).reasons.includes(
|
|
41711
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
41705
41712
|
return warnings;
|
|
41706
41713
|
}
|
|
41707
41714
|
get separatorValue() {
|
|
@@ -42332,7 +42339,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
42332
42339
|
if (env.model.dispatch(cmd, {
|
|
42333
42340
|
sheetId,
|
|
42334
42341
|
quantity: base
|
|
42335
|
-
}).isCancelledBecause(
|
|
42342
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
42336
42343
|
}
|
|
42337
42344
|
|
|
42338
42345
|
//#endregion
|
|
@@ -42512,11 +42519,11 @@ var FormulaFingerprintStore = class extends SpreadsheetStore {
|
|
|
42512
42519
|
}
|
|
42513
42520
|
getLiteralFingerprint(position) {
|
|
42514
42521
|
switch (this.getters.getEvaluatedCell(position).type) {
|
|
42515
|
-
case
|
|
42516
|
-
case
|
|
42517
|
-
case
|
|
42518
|
-
case
|
|
42519
|
-
case
|
|
42522
|
+
case "number":
|
|
42523
|
+
case "boolean": return DATA_FINGERPRINT;
|
|
42524
|
+
case "text":
|
|
42525
|
+
case "empty":
|
|
42526
|
+
case "error": return;
|
|
42520
42527
|
}
|
|
42521
42528
|
}
|
|
42522
42529
|
};
|
|
@@ -42800,7 +42807,7 @@ const togglePinPanel = {
|
|
|
42800
42807
|
function interactiveCut(env) {
|
|
42801
42808
|
const result = env.model.dispatch("CUT");
|
|
42802
42809
|
if (!result.isSuccessful) {
|
|
42803
|
-
if (result.isCancelledBecause(
|
|
42810
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
42804
42811
|
}
|
|
42805
42812
|
}
|
|
42806
42813
|
|
|
@@ -42871,8 +42878,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
42871
42878
|
sheetId,
|
|
42872
42879
|
target
|
|
42873
42880
|
});
|
|
42874
|
-
if (result.isCancelledBecause(
|
|
42875
|
-
else if (result.isCancelledBecause(
|
|
42881
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
42882
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
42876
42883
|
env.model.dispatch("ADD_MERGE", {
|
|
42877
42884
|
sheetId,
|
|
42878
42885
|
target,
|
|
@@ -43109,7 +43116,7 @@ const FIX_FORMULAS = {
|
|
|
43109
43116
|
if (!pivotId) return false;
|
|
43110
43117
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
43111
43118
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
43112
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
43119
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
43113
43120
|
},
|
|
43114
43121
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
43115
43122
|
};
|
|
@@ -43750,7 +43757,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
43750
43757
|
end: group.end
|
|
43751
43758
|
});
|
|
43752
43759
|
if (!result.isSuccessful) {
|
|
43753
|
-
if (result.isCancelledBecause(
|
|
43760
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
43754
43761
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
43755
43762
|
env.raiseError(errorMessage);
|
|
43756
43763
|
}
|
|
@@ -44705,11 +44712,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44705
44712
|
if (cell?.content.startsWith("'")) return { text: cell.content };
|
|
44706
44713
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
44707
44714
|
switch (type) {
|
|
44708
|
-
case
|
|
44709
|
-
case
|
|
44710
|
-
case
|
|
44711
|
-
case
|
|
44712
|
-
case
|
|
44715
|
+
case "empty": return { text: "" };
|
|
44716
|
+
case "text":
|
|
44717
|
+
case "error": return { text: value };
|
|
44718
|
+
case "boolean": return { text: formattedValue };
|
|
44719
|
+
case "number":
|
|
44713
44720
|
if (format && isDateTimeFormat(format)) {
|
|
44714
44721
|
if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
|
|
44715
44722
|
return { text: formatValue(value, {
|
|
@@ -44766,7 +44773,7 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44766
44773
|
startEdition(text, selection) {
|
|
44767
44774
|
if (this.getters.isCurrentSheetLocked()) {
|
|
44768
44775
|
this.model.trigger("command-rejected", {
|
|
44769
|
-
result: new DispatchResult(
|
|
44776
|
+
result: new DispatchResult("SheetLocked"),
|
|
44770
44777
|
command: { sheetId: this.getters.getActiveSheetId() }
|
|
44771
44778
|
});
|
|
44772
44779
|
return "NoStateChange";
|
|
@@ -46391,7 +46398,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
46391
46398
|
elements,
|
|
46392
46399
|
position: this.state.position
|
|
46393
46400
|
});
|
|
46394
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
46401
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46395
46402
|
}
|
|
46396
46403
|
_selectElement(index, addDistinctHeader) {
|
|
46397
46404
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -46528,8 +46535,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
46528
46535
|
position: this.state.position
|
|
46529
46536
|
});
|
|
46530
46537
|
if (!result.isSuccessful) {
|
|
46531
|
-
if (result.reasons.includes(
|
|
46532
|
-
else if (result.reasons.includes(
|
|
46538
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46539
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
46533
46540
|
}
|
|
46534
46541
|
}
|
|
46535
46542
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -46606,6 +46613,7 @@ var HeadersOverlay = class extends Component {
|
|
|
46606
46613
|
//#region src/stores/grid_renderer_store.ts
|
|
46607
46614
|
const CELL_ANIMATION_DURATION = 200;
|
|
46608
46615
|
var GridRenderer = class extends DisposableStore {
|
|
46616
|
+
renderer;
|
|
46609
46617
|
fingerprints;
|
|
46610
46618
|
hoveredTables;
|
|
46611
46619
|
hoveredIcon;
|
|
@@ -47090,7 +47098,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47090
47098
|
const nextCell = this.getters.getEvaluatedCell(position);
|
|
47091
47099
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
47092
47100
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47093
|
-
if (nextCell.type !==
|
|
47101
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
|
|
47094
47102
|
col++;
|
|
47095
47103
|
}
|
|
47096
47104
|
return col;
|
|
@@ -47106,7 +47114,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47106
47114
|
const previousCell = this.getters.getEvaluatedCell(position);
|
|
47107
47115
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
47108
47116
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47109
|
-
if (previousCell.type !==
|
|
47117
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
|
|
47110
47118
|
col--;
|
|
47111
47119
|
}
|
|
47112
47120
|
return col;
|
|
@@ -47116,7 +47124,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47116
47124
|
const { align } = this.getters.getCellStyle(position);
|
|
47117
47125
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
47118
47126
|
if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
|
|
47119
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
47127
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
47120
47128
|
return align || evaluatedCell.defaultAlign;
|
|
47121
47129
|
}
|
|
47122
47130
|
createZoneBox(viewports, sheetId, zone, viewport) {
|
|
@@ -47161,12 +47169,12 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47161
47169
|
style,
|
|
47162
47170
|
dataBarFill,
|
|
47163
47171
|
overlayColor: this.hoveredTables.overlayColors.get(position),
|
|
47164
|
-
isError: cell.type ===
|
|
47172
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
|
|
47165
47173
|
icons: cellIcons,
|
|
47166
47174
|
disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
|
|
47167
47175
|
};
|
|
47168
47176
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
47169
|
-
if (cell.type ===
|
|
47177
|
+
if (cell.type === "empty" || box.icons.center) return box;
|
|
47170
47178
|
/** Content */
|
|
47171
47179
|
const wrapping = style.wrapping || "overflow";
|
|
47172
47180
|
const wrapText = wrapping === "wrap" && !showFormula;
|
|
@@ -48342,7 +48350,7 @@ var Grid = class extends Component {
|
|
|
48342
48350
|
"Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
|
|
48343
48351
|
};
|
|
48344
48352
|
focusComposerFromActiveCell() {
|
|
48345
|
-
this.env.model.getters.getActiveCell().type ===
|
|
48353
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
48346
48354
|
}
|
|
48347
48355
|
editOrMoveInSelection(direction) {
|
|
48348
48356
|
if (this.isSingleCellOrMergeSelection()) {
|
|
@@ -48467,7 +48475,7 @@ var Grid = class extends Component {
|
|
|
48467
48475
|
sheetId,
|
|
48468
48476
|
col,
|
|
48469
48477
|
row
|
|
48470
|
-
}).type ===
|
|
48478
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
48471
48479
|
else this.onComposerContentFocused();
|
|
48472
48480
|
}
|
|
48473
48481
|
processArrows(ev) {
|
|
@@ -48548,18 +48556,18 @@ var Grid = class extends Component {
|
|
|
48548
48556
|
if (!clipboardData) return;
|
|
48549
48557
|
const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
|
|
48550
48558
|
const osClipboard = { content: {
|
|
48551
|
-
[
|
|
48552
|
-
[
|
|
48559
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
48560
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
48553
48561
|
} };
|
|
48554
48562
|
if (image) osClipboard.content[image.type] = image;
|
|
48555
48563
|
const target = this.env.model.getters.getSelectedZones();
|
|
48556
48564
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
48557
|
-
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
48565
|
+
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
|
|
48558
48566
|
else {
|
|
48559
48567
|
const osClipboardContent = parseOSClipboardContent(osClipboard.content);
|
|
48560
48568
|
await interactivePasteFromOS(this.env, target, osClipboardContent);
|
|
48561
48569
|
}
|
|
48562
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
48570
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
48563
48571
|
}
|
|
48564
48572
|
clearFormatting() {
|
|
48565
48573
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -49046,7 +49054,7 @@ var BasePlugin = class {
|
|
|
49046
49054
|
* There should not be any side effects in this method.
|
|
49047
49055
|
*/
|
|
49048
49056
|
allowDispatch(command) {
|
|
49049
|
-
return
|
|
49057
|
+
return "Success";
|
|
49050
49058
|
}
|
|
49051
49059
|
/**
|
|
49052
49060
|
* This method is useful when a plugin needs to perform some action before a
|
|
@@ -49082,10 +49090,10 @@ var BasePlugin = class {
|
|
|
49082
49090
|
for (const validation of validations) {
|
|
49083
49091
|
let results = validation.call(this, toValidate);
|
|
49084
49092
|
if (!Array.isArray(results)) results = [results];
|
|
49085
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
49093
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
49086
49094
|
if (cancelledReasons.length) return cancelledReasons;
|
|
49087
49095
|
}
|
|
49088
|
-
return
|
|
49096
|
+
return "Success";
|
|
49089
49097
|
};
|
|
49090
49098
|
}
|
|
49091
49099
|
checkValidations(command, ...validations) {
|
|
@@ -49142,7 +49150,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49142
49150
|
allowDispatch(cmd) {
|
|
49143
49151
|
switch (cmd.type) {
|
|
49144
49152
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
49145
|
-
default: return
|
|
49153
|
+
default: return "Success";
|
|
49146
49154
|
}
|
|
49147
49155
|
}
|
|
49148
49156
|
handle(cmd) {
|
|
@@ -49556,8 +49564,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49556
49564
|
checkBordersUnchanged(cmd) {
|
|
49557
49565
|
const currentBorder = this.getCellBorder(cmd);
|
|
49558
49566
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
49559
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
49560
|
-
return
|
|
49567
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
49568
|
+
return "Success";
|
|
49561
49569
|
}
|
|
49562
49570
|
import(data) {
|
|
49563
49571
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
|
|
@@ -49605,13 +49613,13 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
49605
49613
|
allowDispatch(cmd) {
|
|
49606
49614
|
switch (cmd.type) {
|
|
49607
49615
|
case "CREATE_CAROUSEL":
|
|
49608
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
49609
|
-
return
|
|
49616
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
|
|
49617
|
+
return "Success";
|
|
49610
49618
|
case "UPDATE_CAROUSEL":
|
|
49611
|
-
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return
|
|
49612
|
-
return
|
|
49619
|
+
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
49620
|
+
return "Success";
|
|
49613
49621
|
}
|
|
49614
|
-
return
|
|
49622
|
+
return "Success";
|
|
49615
49623
|
}
|
|
49616
49624
|
handle(cmd) {
|
|
49617
49625
|
switch (cmd.type) {
|
|
@@ -50231,9 +50239,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50231
50239
|
switch (cmd.type) {
|
|
50232
50240
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
50233
50241
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
50234
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
50242
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
50235
50243
|
case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
|
|
50236
|
-
default: return
|
|
50244
|
+
default: return "Success";
|
|
50237
50245
|
}
|
|
50238
50246
|
}
|
|
50239
50247
|
handle(cmd) {
|
|
@@ -50589,28 +50597,28 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50589
50597
|
}
|
|
50590
50598
|
checkCellOutOfSheet(cmd) {
|
|
50591
50599
|
const { sheetId, col, row } = cmd;
|
|
50592
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50593
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
50600
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50601
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
50594
50602
|
}
|
|
50595
50603
|
checkUselessClearCell(cmd) {
|
|
50596
50604
|
const cell = this.getters.getCell(cmd);
|
|
50597
|
-
if (!cell) return
|
|
50598
|
-
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return
|
|
50599
|
-
return
|
|
50605
|
+
if (!cell) return "NoChanges";
|
|
50606
|
+
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
50607
|
+
return "Success";
|
|
50600
50608
|
}
|
|
50601
50609
|
checkUselessUpdateCell(cmd) {
|
|
50602
50610
|
const cell = this.getters.getCell(cmd);
|
|
50603
50611
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
50604
50612
|
const hasStyle = "style" in cmd;
|
|
50605
50613
|
const hasFormat = "format" in cmd;
|
|
50606
|
-
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
|
|
50607
|
-
return
|
|
50614
|
+
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";
|
|
50615
|
+
return "Success";
|
|
50608
50616
|
}
|
|
50609
50617
|
checkUselessSetFormatting(cmd) {
|
|
50610
50618
|
const { sheetId, target } = cmd;
|
|
50611
50619
|
const hasStyle = "style" in cmd;
|
|
50612
50620
|
const hasFormat = "format" in cmd;
|
|
50613
|
-
if (!hasStyle && !hasFormat) return
|
|
50621
|
+
if (!hasStyle && !hasFormat) return "NoChanges";
|
|
50614
50622
|
for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50615
50623
|
const position = {
|
|
50616
50624
|
sheetId,
|
|
@@ -50618,9 +50626,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50618
50626
|
row
|
|
50619
50627
|
};
|
|
50620
50628
|
const cell = this.getters.getCell(position);
|
|
50621
|
-
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return
|
|
50629
|
+
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
|
|
50622
50630
|
}
|
|
50623
|
-
return
|
|
50631
|
+
return "NoChanges";
|
|
50624
50632
|
}
|
|
50625
50633
|
};
|
|
50626
50634
|
|
|
@@ -50651,8 +50659,8 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50651
50659
|
switch (cmd.type) {
|
|
50652
50660
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
|
|
50653
50661
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
50654
|
-
case "DELETE_CHART": return
|
|
50655
|
-
default: return
|
|
50662
|
+
case "DELETE_CHART": return "SubCommandOnly";
|
|
50663
|
+
default: return "Success";
|
|
50656
50664
|
}
|
|
50657
50665
|
}
|
|
50658
50666
|
handle(cmd) {
|
|
@@ -50811,22 +50819,22 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50811
50819
|
}
|
|
50812
50820
|
}
|
|
50813
50821
|
checkChartDuplicate(cmd) {
|
|
50814
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50822
|
+
return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
|
|
50815
50823
|
}
|
|
50816
50824
|
checkChartDefinition(cmd) {
|
|
50817
50825
|
return SpreadsheetChart.validate(this, cmd.definition);
|
|
50818
50826
|
}
|
|
50819
50827
|
checkChartExists(cmd) {
|
|
50820
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50828
|
+
return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
|
|
50821
50829
|
}
|
|
50822
50830
|
checkChartChanged(cmd) {
|
|
50823
|
-
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return
|
|
50824
|
-
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ?
|
|
50831
|
+
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
|
|
50832
|
+
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
|
|
50825
50833
|
}
|
|
50826
50834
|
/** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
|
|
50827
50835
|
checkFigureArguments(cmd) {
|
|
50828
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
50829
|
-
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ?
|
|
50836
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
|
|
50837
|
+
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
|
|
50830
50838
|
}
|
|
50831
50839
|
};
|
|
50832
50840
|
|
|
@@ -50893,11 +50901,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
50893
50901
|
allowDispatch(cmd) {
|
|
50894
50902
|
switch (cmd.type) {
|
|
50895
50903
|
case "ADD_CONDITIONAL_FORMAT":
|
|
50896
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
50904
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
50897
50905
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
50898
50906
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
50899
50907
|
}
|
|
50900
|
-
return
|
|
50908
|
+
return "Success";
|
|
50901
50909
|
}
|
|
50902
50910
|
handle(cmd) {
|
|
50903
50911
|
switch (cmd.type) {
|
|
@@ -51030,27 +51038,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51030
51038
|
this.history.update("cfRules", sheet, currentCF);
|
|
51031
51039
|
}
|
|
51032
51040
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
51033
|
-
if (!this.cfRules[sheetId]) return
|
|
51041
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
51034
51042
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
51035
|
-
if (ruleIndex === -1) return
|
|
51043
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
51036
51044
|
const cfIndex2 = ruleIndex - delta;
|
|
51037
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
51038
|
-
return
|
|
51045
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
51046
|
+
return "Success";
|
|
51039
51047
|
}
|
|
51040
51048
|
checkEmptyRange(cmd) {
|
|
51041
|
-
return cmd.ranges.length ?
|
|
51049
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51042
51050
|
}
|
|
51043
51051
|
checkCFRule(cmd) {
|
|
51044
51052
|
const rule = cmd.cf.rule;
|
|
51045
51053
|
switch (rule.type) {
|
|
51046
51054
|
case "CellIsRule":
|
|
51047
|
-
if (!availableConditionalFormatOperators.has(rule.operator)) return
|
|
51055
|
+
if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
|
|
51048
51056
|
return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
|
|
51049
51057
|
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)));
|
|
51050
51058
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
51051
|
-
case "DataBarRule": return
|
|
51059
|
+
case "DataBarRule": return "Success";
|
|
51052
51060
|
}
|
|
51053
|
-
return
|
|
51061
|
+
return "InvalidConditionalFormatType";
|
|
51054
51062
|
}
|
|
51055
51063
|
checkCFHasChanged(cmd) {
|
|
51056
51064
|
const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
|
|
@@ -51058,8 +51066,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51058
51066
|
ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
|
|
51059
51067
|
});
|
|
51060
51068
|
const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
|
|
51061
|
-
if (currentCF && deepEquals(newCF, currentCF)) return
|
|
51062
|
-
return
|
|
51069
|
+
if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
|
|
51070
|
+
return "Success";
|
|
51063
51071
|
}
|
|
51064
51072
|
checkOperatorArgsNumber(rule) {
|
|
51065
51073
|
const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
|
|
@@ -51069,9 +51077,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51069
51077
|
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.");
|
|
51070
51078
|
const errors = [];
|
|
51071
51079
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
51072
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
51073
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
51074
|
-
return errors.length ? errors :
|
|
51080
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
51081
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
51082
|
+
return errors.length ? errors : "Success";
|
|
51075
51083
|
}
|
|
51076
51084
|
checkNaN(threshold, thresholdName) {
|
|
51077
51085
|
if ([
|
|
@@ -51079,27 +51087,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51079
51087
|
"percentage",
|
|
51080
51088
|
"percentile"
|
|
51081
51089
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
51082
|
-
case "min": return
|
|
51083
|
-
case "max": return
|
|
51084
|
-
case "mid": return
|
|
51085
|
-
case "upperInflectionPoint": return
|
|
51086
|
-
case "lowerInflectionPoint": return
|
|
51090
|
+
case "min": return "MinNaN";
|
|
51091
|
+
case "max": return "MaxNaN";
|
|
51092
|
+
case "mid": return "MidNaN";
|
|
51093
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
51094
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
51087
51095
|
}
|
|
51088
|
-
return
|
|
51096
|
+
return "Success";
|
|
51089
51097
|
}
|
|
51090
51098
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
51091
|
-
if (threshold.type !== "formula") return
|
|
51099
|
+
if (threshold.type !== "formula") return "Success";
|
|
51092
51100
|
if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
|
|
51093
|
-
case "min": return
|
|
51094
|
-
case "max": return
|
|
51095
|
-
case "mid": return
|
|
51096
|
-
case "upperInflectionPoint": return
|
|
51097
|
-
case "lowerInflectionPoint": return
|
|
51101
|
+
case "min": return "MinInvalidFormula";
|
|
51102
|
+
case "max": return "MaxInvalidFormula";
|
|
51103
|
+
case "mid": return "MidInvalidFormula";
|
|
51104
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
51105
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
51098
51106
|
}
|
|
51099
|
-
return
|
|
51107
|
+
return "Success";
|
|
51100
51108
|
}
|
|
51101
51109
|
checkThresholds(check) {
|
|
51102
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
51110
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
51103
51111
|
}
|
|
51104
51112
|
checkInflectionPoints(check) {
|
|
51105
51113
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -51111,8 +51119,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51111
51119
|
"number",
|
|
51112
51120
|
"percentage",
|
|
51113
51121
|
"percentile"
|
|
51114
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
51115
|
-
return
|
|
51122
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
51123
|
+
return "Success";
|
|
51116
51124
|
}
|
|
51117
51125
|
checkMinBiggerThanMax(rule) {
|
|
51118
51126
|
const minValue = rule.minimum.value;
|
|
@@ -51121,8 +51129,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51121
51129
|
"number",
|
|
51122
51130
|
"percentage",
|
|
51123
51131
|
"percentile"
|
|
51124
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
51125
|
-
return
|
|
51132
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
51133
|
+
return "Success";
|
|
51126
51134
|
}
|
|
51127
51135
|
checkMidBiggerThanMax(rule) {
|
|
51128
51136
|
const midValue = rule.midpoint?.value;
|
|
@@ -51131,8 +51139,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51131
51139
|
"number",
|
|
51132
51140
|
"percentage",
|
|
51133
51141
|
"percentile"
|
|
51134
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
51135
|
-
return
|
|
51142
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
51143
|
+
return "Success";
|
|
51136
51144
|
}
|
|
51137
51145
|
checkMinBiggerThanMid(rule) {
|
|
51138
51146
|
const minValue = rule.minimum.value;
|
|
@@ -51141,15 +51149,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51141
51149
|
"number",
|
|
51142
51150
|
"percentage",
|
|
51143
51151
|
"percentile"
|
|
51144
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
51145
|
-
return
|
|
51152
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
51153
|
+
return "Success";
|
|
51146
51154
|
}
|
|
51147
51155
|
checkCFValues(rule) {
|
|
51148
51156
|
for (const value of rule.values) {
|
|
51149
51157
|
if (!value.startsWith("=")) continue;
|
|
51150
|
-
if (CompiledFormula.IsBadExpression(value)) return
|
|
51158
|
+
if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
|
|
51151
51159
|
}
|
|
51152
|
-
return
|
|
51160
|
+
return "Success";
|
|
51153
51161
|
}
|
|
51154
51162
|
removeConditionalFormatting(id, sheet) {
|
|
51155
51163
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -51224,15 +51232,15 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51224
51232
|
allowDispatch(cmd) {
|
|
51225
51233
|
switch (cmd.type) {
|
|
51226
51234
|
case "ADD_DATA_VALIDATION_RULE":
|
|
51227
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51228
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
51235
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51236
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
51229
51237
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
51230
51238
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
51231
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51232
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
51239
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51240
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
51233
51241
|
break;
|
|
51234
51242
|
}
|
|
51235
|
-
return
|
|
51243
|
+
return "Success";
|
|
51236
51244
|
}
|
|
51237
51245
|
handle(cmd) {
|
|
51238
51246
|
switch (cmd.type) {
|
|
@@ -51342,7 +51350,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51342
51350
|
}
|
|
51343
51351
|
}
|
|
51344
51352
|
checkEmptyRange(cmd) {
|
|
51345
|
-
return cmd.ranges.length ?
|
|
51353
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51346
51354
|
}
|
|
51347
51355
|
import(data) {
|
|
51348
51356
|
for (const sheet of data.sheets) {
|
|
@@ -51385,13 +51393,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51385
51393
|
}
|
|
51386
51394
|
}
|
|
51387
51395
|
checkCriterionTypeIsValid(cmd) {
|
|
51388
|
-
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
51396
|
+
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
51389
51397
|
}
|
|
51390
51398
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
51391
51399
|
const criterion = cmd.rule.criterion;
|
|
51392
51400
|
const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
51393
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
51394
|
-
return
|
|
51401
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
51402
|
+
return "Success";
|
|
51395
51403
|
}
|
|
51396
51404
|
checkCriterionValuesAreValid(cmd) {
|
|
51397
51405
|
const criterion = cmd.rule.criterion;
|
|
@@ -51401,12 +51409,12 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51401
51409
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
|
|
51402
51410
|
return !evaluator.isCriterionValueValid(value);
|
|
51403
51411
|
};
|
|
51404
|
-
if (criterion.values.some(isInvalid)) return
|
|
51405
|
-
return
|
|
51412
|
+
if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
|
|
51413
|
+
return "Success";
|
|
51406
51414
|
}
|
|
51407
51415
|
checkValidRange(cmd) {
|
|
51408
|
-
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return
|
|
51409
|
-
return
|
|
51416
|
+
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";
|
|
51417
|
+
return "Success";
|
|
51410
51418
|
}
|
|
51411
51419
|
};
|
|
51412
51420
|
|
|
@@ -51462,7 +51470,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51462
51470
|
case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
|
|
51463
51471
|
case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
|
|
51464
51472
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd);
|
|
51465
|
-
default: return
|
|
51473
|
+
default: return "Success";
|
|
51466
51474
|
}
|
|
51467
51475
|
}
|
|
51468
51476
|
beforeHandle(cmd) {
|
|
@@ -51631,16 +51639,16 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51631
51639
|
this.history.update("figures", sheetId, id, void 0);
|
|
51632
51640
|
}
|
|
51633
51641
|
checkFigureExists(cmd) {
|
|
51634
|
-
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return
|
|
51635
|
-
return
|
|
51642
|
+
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
|
|
51643
|
+
return "Success";
|
|
51636
51644
|
}
|
|
51637
51645
|
checkFigureDuplicate(cmd) {
|
|
51638
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return
|
|
51639
|
-
return
|
|
51646
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
|
|
51647
|
+
return "Success";
|
|
51640
51648
|
}
|
|
51641
51649
|
checkFigureAnchorOffset(cmd) {
|
|
51642
|
-
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return
|
|
51643
|
-
return
|
|
51650
|
+
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
|
|
51651
|
+
return "Success";
|
|
51644
51652
|
}
|
|
51645
51653
|
getFigures(sheetId) {
|
|
51646
51654
|
const figures = [];
|
|
@@ -51691,28 +51699,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
51691
51699
|
switch (cmd.type) {
|
|
51692
51700
|
case "GROUP_HEADERS": {
|
|
51693
51701
|
const { start, end, sheetId } = cmd;
|
|
51694
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51695
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51696
|
-
if (start > end) return
|
|
51697
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
51702
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51703
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51704
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51705
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
51698
51706
|
break;
|
|
51699
51707
|
}
|
|
51700
51708
|
case "UNGROUP_HEADERS": {
|
|
51701
51709
|
const { start, end, sheetId } = cmd;
|
|
51702
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51703
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51704
|
-
if (start > end) return
|
|
51710
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51711
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51712
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51705
51713
|
break;
|
|
51706
51714
|
}
|
|
51707
51715
|
case "UNFOLD_HEADER_GROUP":
|
|
51708
51716
|
case "FOLD_HEADER_GROUP":
|
|
51709
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51717
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51710
51718
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
51711
|
-
if (!group) return
|
|
51712
|
-
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
|
|
51719
|
+
if (!group) return "UnknownHeaderGroup";
|
|
51720
|
+
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";
|
|
51713
51721
|
break;
|
|
51714
51722
|
}
|
|
51715
|
-
return
|
|
51723
|
+
return "Success";
|
|
51716
51724
|
}
|
|
51717
51725
|
handle(cmd) {
|
|
51718
51726
|
switch (cmd.type) {
|
|
@@ -52120,19 +52128,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
52120
52128
|
allowDispatch(cmd) {
|
|
52121
52129
|
switch (cmd.type) {
|
|
52122
52130
|
case "HIDE_COLUMNS_ROWS": {
|
|
52123
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52131
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52124
52132
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
52125
52133
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
52126
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
52127
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
52128
|
-
else return
|
|
52134
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
52135
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
52136
|
+
else return "Success";
|
|
52129
52137
|
}
|
|
52130
52138
|
case "REMOVE_COLUMNS_ROWS":
|
|
52131
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52132
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
52133
|
-
return
|
|
52139
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52140
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
52141
|
+
return "Success";
|
|
52134
52142
|
}
|
|
52135
|
-
return
|
|
52143
|
+
return "Success";
|
|
52136
52144
|
}
|
|
52137
52145
|
handle(cmd) {
|
|
52138
52146
|
switch (cmd.type) {
|
|
@@ -52260,9 +52268,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
52260
52268
|
allowDispatch(cmd) {
|
|
52261
52269
|
switch (cmd.type) {
|
|
52262
52270
|
case "CREATE_IMAGE":
|
|
52263
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
52264
|
-
return
|
|
52265
|
-
default: return
|
|
52271
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
52272
|
+
return "Success";
|
|
52273
|
+
default: return "Success";
|
|
52266
52274
|
}
|
|
52267
52275
|
}
|
|
52268
52276
|
handle(cmd) {
|
|
@@ -52386,7 +52394,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52386
52394
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
52387
52395
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
52388
52396
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
52389
|
-
default: return
|
|
52397
|
+
default: return "Success";
|
|
52390
52398
|
}
|
|
52391
52399
|
}
|
|
52392
52400
|
handle(cmd) {
|
|
@@ -52547,18 +52555,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52547
52555
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
52548
52556
|
}
|
|
52549
52557
|
checkDestructiveMerge({ sheetId, target }) {
|
|
52550
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52551
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
52558
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52559
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
52552
52560
|
}
|
|
52553
52561
|
checkOverlap({ target }) {
|
|
52554
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
52555
|
-
return
|
|
52562
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
52563
|
+
return "Success";
|
|
52556
52564
|
}
|
|
52557
52565
|
checkFrozenPanes({ sheetId, target }) {
|
|
52558
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52566
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52559
52567
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
52560
|
-
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return
|
|
52561
|
-
return
|
|
52568
|
+
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
52569
|
+
return "Success";
|
|
52562
52570
|
}
|
|
52563
52571
|
/**
|
|
52564
52572
|
* The content of a merged cell should always be empty.
|
|
@@ -52566,10 +52574,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52566
52574
|
*/
|
|
52567
52575
|
checkMergedContentUpdate(cmd) {
|
|
52568
52576
|
const { col, row, content } = cmd;
|
|
52569
|
-
if (content === void 0) return
|
|
52577
|
+
if (content === void 0) return "Success";
|
|
52570
52578
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
52571
|
-
if (mainCol === col && mainRow === row) return
|
|
52572
|
-
return
|
|
52579
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
52580
|
+
return "CellIsMerged";
|
|
52573
52581
|
}
|
|
52574
52582
|
checkMergeExists(cmd) {
|
|
52575
52583
|
const { sheetId, target } = cmd;
|
|
@@ -52580,9 +52588,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52580
52588
|
col: left,
|
|
52581
52589
|
row: top
|
|
52582
52590
|
});
|
|
52583
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
52591
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
52584
52592
|
}
|
|
52585
|
-
return
|
|
52593
|
+
return "Success";
|
|
52586
52594
|
}
|
|
52587
52595
|
/**
|
|
52588
52596
|
* Merge the current selection. Note that:
|
|
@@ -52747,10 +52755,10 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52747
52755
|
allowDispatch(cmd) {
|
|
52748
52756
|
switch (cmd.type) {
|
|
52749
52757
|
case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
|
|
52750
|
-
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) :
|
|
52758
|
+
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
|
|
52751
52759
|
case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
|
|
52752
52760
|
}
|
|
52753
|
-
return
|
|
52761
|
+
return "Success";
|
|
52754
52762
|
}
|
|
52755
52763
|
handle(cmd) {
|
|
52756
52764
|
switch (cmd.type) {
|
|
@@ -52814,14 +52822,14 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52814
52822
|
}
|
|
52815
52823
|
}
|
|
52816
52824
|
checkValidNewNamedRangeName(name) {
|
|
52817
|
-
if (this.getNamedRange(name)) return
|
|
52818
|
-
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return
|
|
52819
|
-
if (rangeReference.test(name)) return
|
|
52820
|
-
return
|
|
52825
|
+
if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
|
|
52826
|
+
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
|
|
52827
|
+
if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
|
|
52828
|
+
return "Success";
|
|
52821
52829
|
}
|
|
52822
52830
|
checkNamedRangeExists(name) {
|
|
52823
|
-
if (!this.getNamedRange(name)) return
|
|
52824
|
-
return
|
|
52831
|
+
if (!this.getNamedRange(name)) return "NamedRangeNotFound";
|
|
52832
|
+
return "Success";
|
|
52825
52833
|
}
|
|
52826
52834
|
};
|
|
52827
52835
|
|
|
@@ -52846,25 +52854,25 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
52846
52854
|
allowDispatch(cmd) {
|
|
52847
52855
|
switch (cmd.type) {
|
|
52848
52856
|
case "ADD_PIVOT":
|
|
52849
|
-
if (cmd.pivotId in this.pivots) return
|
|
52857
|
+
if (cmd.pivotId in this.pivots) return "PivotIdTaken";
|
|
52850
52858
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52851
52859
|
case "UPDATE_PIVOT":
|
|
52852
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52853
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
52854
|
-
if (cmd.pivot.name === "") return
|
|
52860
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52861
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
52862
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
52855
52863
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52856
52864
|
case "RENAME_PIVOT":
|
|
52857
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52858
|
-
if (cmd.name === "") return
|
|
52865
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52866
|
+
if (cmd.name === "") return "EmptyName";
|
|
52859
52867
|
break;
|
|
52860
52868
|
case "REMOVE_PIVOT":
|
|
52861
52869
|
case "DUPLICATE_PIVOT":
|
|
52862
52870
|
case "INSERT_PIVOT":
|
|
52863
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52871
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52864
52872
|
break;
|
|
52865
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
52873
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52866
52874
|
}
|
|
52867
|
-
return
|
|
52875
|
+
return "Success";
|
|
52868
52876
|
}
|
|
52869
52877
|
handle(cmd) {
|
|
52870
52878
|
switch (cmd.type) {
|
|
@@ -53061,13 +53069,13 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53061
53069
|
}
|
|
53062
53070
|
checkSortedColumnInMeasures(definition) {
|
|
53063
53071
|
const measures = definition.measures.map((measure) => measure.id);
|
|
53064
|
-
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return
|
|
53065
|
-
return
|
|
53072
|
+
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
|
|
53073
|
+
return "Success";
|
|
53066
53074
|
}
|
|
53067
53075
|
checkDuplicatedMeasureIds(definition) {
|
|
53068
53076
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
53069
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
53070
|
-
return
|
|
53077
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
53078
|
+
return "Success";
|
|
53071
53079
|
}
|
|
53072
53080
|
checkCustomFieldsAreValid(definition) {
|
|
53073
53081
|
for (const customFieldName in definition.customFields) {
|
|
@@ -53076,15 +53084,15 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53076
53084
|
const groupNames = /* @__PURE__ */ new Set();
|
|
53077
53085
|
let hasOtherGroup = false;
|
|
53078
53086
|
for (const group of customField.groups) {
|
|
53079
|
-
if (!group.name || groupNames.has(group.name)) return
|
|
53080
|
-
if (group.values.some((value) => groupedValues.has(value))) return
|
|
53081
|
-
if (group.isOtherGroup && hasOtherGroup) return
|
|
53087
|
+
if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
|
|
53088
|
+
if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
|
|
53089
|
+
if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
|
|
53082
53090
|
group.values.forEach((value) => groupedValues.add(value));
|
|
53083
53091
|
groupNames.add(group.name);
|
|
53084
53092
|
hasOtherGroup ||= !!group.isOtherGroup;
|
|
53085
53093
|
}
|
|
53086
53094
|
}
|
|
53087
|
-
return
|
|
53095
|
+
return "Success";
|
|
53088
53096
|
}
|
|
53089
53097
|
/**
|
|
53090
53098
|
* Import the pivots
|
|
@@ -53113,9 +53121,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
53113
53121
|
locale = DEFAULT_LOCALE;
|
|
53114
53122
|
allowDispatch(cmd) {
|
|
53115
53123
|
switch (cmd.type) {
|
|
53116
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
53124
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
53117
53125
|
}
|
|
53118
|
-
return
|
|
53126
|
+
return "Success";
|
|
53119
53127
|
}
|
|
53120
53128
|
handle(cmd) {
|
|
53121
53129
|
switch (cmd.type) {
|
|
@@ -53196,7 +53204,7 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53196
53204
|
cellPosition = {};
|
|
53197
53205
|
allowDispatch(cmd) {
|
|
53198
53206
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
53199
|
-
if (genericChecks !==
|
|
53207
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
53200
53208
|
let sheetNameMissing = false;
|
|
53201
53209
|
switch (cmd.type) {
|
|
53202
53210
|
case "CREATE_SHEET":
|
|
@@ -53212,37 +53220,37 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53212
53220
|
if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
|
|
53213
53221
|
switch (cmd.type) {
|
|
53214
53222
|
case "HIDE_SHEET":
|
|
53215
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
53216
|
-
return
|
|
53223
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
53224
|
+
return "Success";
|
|
53217
53225
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
|
|
53218
53226
|
case "DUPLICATE_SHEET":
|
|
53219
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
53220
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
53221
|
-
return
|
|
53227
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
53228
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
53229
|
+
return "Success";
|
|
53222
53230
|
case "MOVE_SHEET": try {
|
|
53223
53231
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
53224
53232
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
53225
|
-
return
|
|
53233
|
+
return "Success";
|
|
53226
53234
|
} catch (e) {
|
|
53227
|
-
return
|
|
53235
|
+
return "WrongSheetMove";
|
|
53228
53236
|
}
|
|
53229
53237
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
53230
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
53231
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
53238
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
53239
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
53232
53240
|
case "ADD_COLUMNS_ROWS":
|
|
53233
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
53234
|
-
else if (cmd.quantity <= 0) return
|
|
53235
|
-
return
|
|
53241
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
53242
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
53243
|
+
return "Success";
|
|
53236
53244
|
case "REMOVE_COLUMNS_ROWS": {
|
|
53237
53245
|
const min = largeMin(cmd.elements);
|
|
53238
53246
|
const max = largeMax(cmd.elements);
|
|
53239
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
53240
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
53241
|
-
else return
|
|
53247
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
53248
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
53249
|
+
else return "Success";
|
|
53242
53250
|
}
|
|
53243
53251
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
53244
53252
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
53245
|
-
default: return
|
|
53253
|
+
default: return "Success";
|
|
53246
53254
|
}
|
|
53247
53255
|
}
|
|
53248
53256
|
handle(cmd) {
|
|
@@ -53517,12 +53525,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53517
53525
|
* not outside the sheet.
|
|
53518
53526
|
*/
|
|
53519
53527
|
checkZonesExistInSheet(sheetId, zones) {
|
|
53520
|
-
if (!zones.every(isZoneValid)) return
|
|
53528
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
53521
53529
|
if (zones.length) {
|
|
53522
53530
|
const sheetZone = this.getSheetZone(sheetId);
|
|
53523
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
53531
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
53524
53532
|
}
|
|
53525
|
-
return
|
|
53533
|
+
return "Success";
|
|
53526
53534
|
}
|
|
53527
53535
|
updateCellPosition(cmd) {
|
|
53528
53536
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -53596,42 +53604,42 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53596
53604
|
throw new Error("There is not enough visible sheets");
|
|
53597
53605
|
}
|
|
53598
53606
|
createSheetHasName(cmd) {
|
|
53599
|
-
if (cmd.name !== void 0 && !cmd.name.trim()) return
|
|
53600
|
-
return
|
|
53607
|
+
if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
|
|
53608
|
+
return "Success";
|
|
53601
53609
|
}
|
|
53602
53610
|
checkSheetName(cmd) {
|
|
53603
53611
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
53604
53612
|
const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
|
|
53605
|
-
if (originalSheetName !== void 0 && sheetName === originalSheetName) return
|
|
53613
|
+
if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
|
|
53606
53614
|
const { orderedSheetIds, sheets } = this;
|
|
53607
53615
|
const name = sheetName && sheetName.trim().toLowerCase();
|
|
53608
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
53609
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
53610
|
-
return
|
|
53616
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
53617
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
53618
|
+
return "Success";
|
|
53611
53619
|
}
|
|
53612
53620
|
checkSheetPosition(cmd) {
|
|
53613
53621
|
const { orderedSheetIds } = this;
|
|
53614
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
53615
|
-
return
|
|
53622
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
53623
|
+
return "Success";
|
|
53616
53624
|
}
|
|
53617
53625
|
checkRowFreezeQuantity(cmd) {
|
|
53618
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
53626
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53619
53627
|
}
|
|
53620
53628
|
checkColFreezeQuantity(cmd) {
|
|
53621
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
53629
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53622
53630
|
}
|
|
53623
53631
|
checkRowFreezeOverlapMerge(cmd) {
|
|
53624
53632
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53625
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
53626
|
-
return
|
|
53633
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
53634
|
+
return "Success";
|
|
53627
53635
|
}
|
|
53628
53636
|
checkColFreezeOverlapMerge(cmd) {
|
|
53629
53637
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53630
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
53631
|
-
return
|
|
53638
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
53639
|
+
return "Success";
|
|
53632
53640
|
}
|
|
53633
53641
|
isRenameAllowed(cmd) {
|
|
53634
|
-
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return
|
|
53642
|
+
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
|
|
53635
53643
|
return this.checkSheetName(cmd);
|
|
53636
53644
|
}
|
|
53637
53645
|
renameSheet(sheet, name) {
|
|
@@ -53854,19 +53862,19 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53854
53862
|
* sheet.
|
|
53855
53863
|
*/
|
|
53856
53864
|
checkSheetExists(cmd) {
|
|
53857
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
53858
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
53859
|
-
return
|
|
53865
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
53866
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
53867
|
+
return "Success";
|
|
53860
53868
|
}
|
|
53861
53869
|
/**
|
|
53862
53870
|
* Check if zones in the command are well formed and
|
|
53863
53871
|
* not outside the sheet.
|
|
53864
53872
|
*/
|
|
53865
53873
|
checkZonesAreInSheet(cmd) {
|
|
53866
|
-
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return
|
|
53867
|
-
if (!("sheetId" in cmd)) return
|
|
53868
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
53869
|
-
if (isTargetDependent(cmd) && cmd.target.length === 0) return
|
|
53874
|
+
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
|
|
53875
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
53876
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
53877
|
+
if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
|
|
53870
53878
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
53871
53879
|
}
|
|
53872
53880
|
};
|
|
@@ -53881,15 +53889,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
53881
53889
|
const definition = cmd.pivot;
|
|
53882
53890
|
return this.checkDataSetValidity(definition);
|
|
53883
53891
|
}
|
|
53884
|
-
return
|
|
53892
|
+
return "Success";
|
|
53885
53893
|
}
|
|
53886
53894
|
checkDataSetValidity(definition) {
|
|
53887
53895
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53888
53896
|
const { zone, sheetId } = definition.dataSet;
|
|
53889
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
53897
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
53890
53898
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53891
53899
|
}
|
|
53892
|
-
return
|
|
53900
|
+
return "Success";
|
|
53893
53901
|
}
|
|
53894
53902
|
};
|
|
53895
53903
|
|
|
@@ -53907,18 +53915,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
53907
53915
|
switch (cmd.type) {
|
|
53908
53916
|
case "CREATE_TABLE":
|
|
53909
53917
|
case "UPDATE_TABLE":
|
|
53910
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
53918
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
53911
53919
|
break;
|
|
53912
53920
|
case "CREATE_TABLE_STYLE":
|
|
53913
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
53921
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
53914
53922
|
try {
|
|
53915
53923
|
toHex(cmd.primaryColor);
|
|
53916
53924
|
} catch (e) {
|
|
53917
|
-
return
|
|
53925
|
+
return "InvalidTableStyle";
|
|
53918
53926
|
}
|
|
53919
53927
|
break;
|
|
53920
53928
|
}
|
|
53921
|
-
return
|
|
53929
|
+
return "Success";
|
|
53922
53930
|
}
|
|
53923
53931
|
handle(cmd) {
|
|
53924
53932
|
switch (cmd.type) {
|
|
@@ -53989,21 +53997,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
53989
53997
|
allowDispatch(cmd) {
|
|
53990
53998
|
switch (cmd.type) {
|
|
53991
53999
|
case "CREATE_TABLE":
|
|
53992
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
54000
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
53993
54001
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
53994
|
-
if (!areZonesContinuous(zones)) return
|
|
53995
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
54002
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
54003
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53996
54004
|
case "UPDATE_TABLE":
|
|
53997
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
54005
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
53998
54006
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53999
54007
|
case "ADD_MERGE":
|
|
54000
54008
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
54001
54009
|
const tableZone = table.range.zone;
|
|
54002
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
54010
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
54003
54011
|
}
|
|
54004
54012
|
break;
|
|
54005
54013
|
}
|
|
54006
|
-
return
|
|
54014
|
+
return "Success";
|
|
54007
54015
|
}
|
|
54008
54016
|
handle(cmd) {
|
|
54009
54017
|
switch (cmd.type) {
|
|
@@ -54137,19 +54145,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
54137
54145
|
}
|
|
54138
54146
|
}
|
|
54139
54147
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
54140
|
-
if (!cmd.newTableRange) return
|
|
54148
|
+
if (!cmd.newTableRange) return "Success";
|
|
54141
54149
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
54142
54150
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
54143
|
-
if (zoneIsInSheet !==
|
|
54151
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
54144
54152
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
54145
|
-
if (!updatedTable) return
|
|
54146
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
54153
|
+
if (!updatedTable) return "TableNotFound";
|
|
54154
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
54147
54155
|
}
|
|
54148
54156
|
checkTableConfigUpdateIsValid(config) {
|
|
54149
|
-
if (!config) return
|
|
54150
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
54151
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
54152
|
-
return
|
|
54157
|
+
if (!config) return "Success";
|
|
54158
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
54159
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
54160
|
+
return "Success";
|
|
54153
54161
|
}
|
|
54154
54162
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
54155
54163
|
const zone = tableRange.zone;
|
|
@@ -54389,6 +54397,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
54389
54397
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
54390
54398
|
}
|
|
54391
54399
|
var CompilationParametersBuilder = class {
|
|
54400
|
+
getters;
|
|
54401
|
+
computeCell;
|
|
54392
54402
|
evalContext;
|
|
54393
54403
|
rangeCache = {};
|
|
54394
54404
|
constructor(context, getters, computeCell) {
|
|
@@ -54480,6 +54490,9 @@ var CompilationParametersBuilder = class {
|
|
|
54480
54490
|
//#endregion
|
|
54481
54491
|
//#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
|
|
54482
54492
|
var IntervalNode = class {
|
|
54493
|
+
interval;
|
|
54494
|
+
left;
|
|
54495
|
+
right;
|
|
54483
54496
|
/**
|
|
54484
54497
|
* Augmented value: the highest 'bottom' boundary in this subtree.
|
|
54485
54498
|
* Allows O(log n) pruning during overlap searches.
|
|
@@ -55380,6 +55393,7 @@ onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
|
55380
55393
|
const MAX_ITERATION = 30;
|
|
55381
55394
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
55382
55395
|
var Evaluator = class {
|
|
55396
|
+
context;
|
|
55383
55397
|
getters;
|
|
55384
55398
|
compilationParams;
|
|
55385
55399
|
evaluatedCells = new PositionMap();
|
|
@@ -55398,7 +55412,7 @@ var Evaluator = class {
|
|
|
55398
55412
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
55399
55413
|
if (!spreadZone) return;
|
|
55400
55414
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
55401
|
-
if (evaluatedCell?.type ===
|
|
55415
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
55402
55416
|
return union(positionToZone(position), spreadZone);
|
|
55403
55417
|
}
|
|
55404
55418
|
getEvaluatedPositions() {
|
|
@@ -55408,7 +55422,7 @@ var Evaluator = class {
|
|
|
55408
55422
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
55409
55423
|
}
|
|
55410
55424
|
getArrayFormulaSpreadingOn(position) {
|
|
55411
|
-
if (this.getEvaluatedCell(position).type ===
|
|
55425
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
55412
55426
|
return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
|
|
55413
55427
|
}
|
|
55414
55428
|
isArrayFormulaSpillBlocked(position) {
|
|
@@ -55605,7 +55619,7 @@ var Evaluator = class {
|
|
|
55605
55619
|
const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
|
|
55606
55620
|
if (!isMatrix(formulaReturn)) {
|
|
55607
55621
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
|
|
55608
|
-
if (evaluatedCell.type ===
|
|
55622
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
|
|
55609
55623
|
return evaluatedCell;
|
|
55610
55624
|
}
|
|
55611
55625
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
@@ -55666,7 +55680,7 @@ var Evaluator = class {
|
|
|
55666
55680
|
row: j + row
|
|
55667
55681
|
};
|
|
55668
55682
|
const rawCell = this.getters.getCell(position);
|
|
55669
|
-
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !==
|
|
55683
|
+
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
55670
55684
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
55671
55685
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
|
|
55672
55686
|
}
|
|
@@ -55683,7 +55697,7 @@ var Evaluator = class {
|
|
|
55683
55697
|
};
|
|
55684
55698
|
const cell = this.getters.getCell(position);
|
|
55685
55699
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
|
|
55686
|
-
if (evaluatedCell.type ===
|
|
55700
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
|
|
55687
55701
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
55688
55702
|
};
|
|
55689
55703
|
return spreadValues;
|
|
@@ -55887,7 +55901,7 @@ var EvaluationPlugin = class extends CoreViewPlugin {
|
|
|
55887
55901
|
sheetId,
|
|
55888
55902
|
col,
|
|
55889
55903
|
row
|
|
55890
|
-
})).every((cell) => cell.type ===
|
|
55904
|
+
})).every((cell) => cell.type === "empty");
|
|
55891
55905
|
}
|
|
55892
55906
|
/**
|
|
55893
55907
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -56840,7 +56854,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56840
56854
|
}
|
|
56841
56855
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
56842
56856
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
56843
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type ===
|
|
56857
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
56844
56858
|
switch (threshold.type) {
|
|
56845
56859
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
56846
56860
|
case "number": return Number(threshold.value);
|
|
@@ -56871,7 +56885,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56871
56885
|
col,
|
|
56872
56886
|
row
|
|
56873
56887
|
});
|
|
56874
|
-
if (cell.type !==
|
|
56888
|
+
if (cell.type !== "number") continue;
|
|
56875
56889
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
56876
56890
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
56877
56891
|
computedIcons[col][row] = icon;
|
|
@@ -56884,7 +56898,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56884
56898
|
}
|
|
56885
56899
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
56886
56900
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
56887
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
56901
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
56888
56902
|
if (max <= 0) return;
|
|
56889
56903
|
const color = rule.color;
|
|
56890
56904
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -56897,7 +56911,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56897
56911
|
col: targetCol,
|
|
56898
56912
|
row: targetRow
|
|
56899
56913
|
});
|
|
56900
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
56914
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
56901
56915
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
56902
56916
|
computedDataBars[col][row] = {
|
|
56903
56917
|
color: colorNumberToHex(color),
|
|
@@ -56931,7 +56945,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56931
56945
|
col,
|
|
56932
56946
|
row
|
|
56933
56947
|
});
|
|
56934
|
-
if (cell.type ===
|
|
56948
|
+
if (cell.type === "number") {
|
|
56935
56949
|
const value = clip(cell.value, minValue, maxValue);
|
|
56936
56950
|
if (!computedStyle[col]) computedStyle[col] = [];
|
|
56937
56951
|
computedStyle[col][row] = computedStyle[col]?.[row] || {};
|
|
@@ -56941,7 +56955,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56941
56955
|
}
|
|
56942
56956
|
getRuleResultForTarget(target, rule, preComputedCriterion) {
|
|
56943
56957
|
const cell = this.getters.getEvaluatedCell(target);
|
|
56944
|
-
if (cell.type ===
|
|
56958
|
+
if (cell.type === "error") return false;
|
|
56945
56959
|
const { sheetId } = target;
|
|
56946
56960
|
const evaluator = criterionEvaluatorRegistry.get(rule.operator);
|
|
56947
56961
|
const evaluatedCriterionValues = rule.values.map((value) => {
|
|
@@ -57087,7 +57101,7 @@ var EvaluationDataValidationPlugin = class extends CoreViewPlugin {
|
|
|
57087
57101
|
if (!validationResults[col]) validationResults[col] = [];
|
|
57088
57102
|
validationResults[col][row] = lazy(() => {
|
|
57089
57103
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
57090
|
-
if (evaluatedCell.type ===
|
|
57104
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
57091
57105
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
57092
57106
|
});
|
|
57093
57107
|
}
|
|
@@ -58029,7 +58043,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58029
58043
|
const result = [];
|
|
58030
58044
|
for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
|
|
58031
58045
|
const position = this.getters.getCellPosition(cellId);
|
|
58032
|
-
if (this.getters.getEvaluatedCell(position).type ===
|
|
58046
|
+
if (this.getters.getEvaluatedCell(position).type === "error") continue;
|
|
58033
58047
|
const pivotInfo = this.getPivotStyleAtPosition(position);
|
|
58034
58048
|
if (pivotInfo) result.push({
|
|
58035
58049
|
position,
|
|
@@ -58061,6 +58075,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58061
58075
|
//#endregion
|
|
58062
58076
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
58063
58077
|
var ClipboardHandler = class {
|
|
58078
|
+
getters;
|
|
58079
|
+
dispatch;
|
|
58064
58080
|
constructor(getters, dispatch) {
|
|
58065
58081
|
this.getters = getters;
|
|
58066
58082
|
this.dispatch = dispatch;
|
|
@@ -58068,10 +58084,10 @@ var ClipboardHandler = class {
|
|
|
58068
58084
|
copy(data, isCutOperation, mode = "copyPaste") {}
|
|
58069
58085
|
paste(target, clippedContent, options) {}
|
|
58070
58086
|
isPasteAllowed(sheetId, target, content, option) {
|
|
58071
|
-
return
|
|
58087
|
+
return "Success";
|
|
58072
58088
|
}
|
|
58073
58089
|
isCutAllowed(data) {
|
|
58074
|
-
return
|
|
58090
|
+
return "Success";
|
|
58075
58091
|
}
|
|
58076
58092
|
getPasteTarget(sheetId, target, content, options) {
|
|
58077
58093
|
return {
|
|
@@ -58097,8 +58113,8 @@ var AbstractCellClipboardHandler = class extends ClipboardHandler {
|
|
|
58097
58113
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
58098
58114
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
58099
58115
|
isCutAllowed(data) {
|
|
58100
|
-
if (data.zones.length !== 1) return
|
|
58101
|
-
return
|
|
58116
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
58117
|
+
return "Success";
|
|
58102
58118
|
}
|
|
58103
58119
|
copy(data, isCutOperation, mode = "copyPaste") {
|
|
58104
58120
|
const sheetId = data.sheetId;
|
|
@@ -58163,17 +58179,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
58163
58179
|
};
|
|
58164
58180
|
}
|
|
58165
58181
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
58166
|
-
if (!content.cells) return
|
|
58167
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
58182
|
+
if (!content.cells) return "Success";
|
|
58183
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
58168
58184
|
if (target.length > 1) {
|
|
58169
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
58185
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
58170
58186
|
}
|
|
58171
58187
|
const clipboardHeight = content.cells.length;
|
|
58172
58188
|
const clipboardWidth = content.cells[0].length;
|
|
58173
58189
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
58174
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
58190
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
58175
58191
|
}
|
|
58176
|
-
return
|
|
58192
|
+
return "Success";
|
|
58177
58193
|
}
|
|
58178
58194
|
/**
|
|
58179
58195
|
* Paste the clipboard content in the given target
|
|
@@ -58322,7 +58338,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58322
58338
|
switch (cmd.type) {
|
|
58323
58339
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
58324
58340
|
}
|
|
58325
|
-
return
|
|
58341
|
+
return "Success";
|
|
58326
58342
|
}
|
|
58327
58343
|
handle(cmd) {
|
|
58328
58344
|
switch (cmd.type) {
|
|
@@ -58405,34 +58421,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58405
58421
|
});
|
|
58406
58422
|
}
|
|
58407
58423
|
checkSingleRangeSelected() {
|
|
58408
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
58409
|
-
return
|
|
58424
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
58425
|
+
return "Success";
|
|
58410
58426
|
}
|
|
58411
58427
|
checkNoMergeInZone() {
|
|
58412
58428
|
const sheetId = this.getters.getActiveSheetId();
|
|
58413
58429
|
const zone = this.getters.getSelectedZone();
|
|
58414
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
58415
|
-
return
|
|
58430
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
58431
|
+
return "Success";
|
|
58416
58432
|
}
|
|
58417
58433
|
checkRangeContainsValues(cmd) {
|
|
58418
58434
|
const sheetId = this.getters.getActiveSheetId();
|
|
58419
58435
|
const zone = this.getters.getSelectedZone();
|
|
58420
58436
|
if (cmd.hasHeader) zone.top += 1;
|
|
58421
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
58422
|
-
return
|
|
58437
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
|
|
58438
|
+
return "Success";
|
|
58423
58439
|
}
|
|
58424
58440
|
checkNoColumnProvided(cmd) {
|
|
58425
|
-
if (cmd.columns.length === 0) return
|
|
58426
|
-
return
|
|
58441
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
58442
|
+
return "Success";
|
|
58427
58443
|
}
|
|
58428
58444
|
checkColumnsIncludedInZone(cmd) {
|
|
58429
58445
|
const zone = this.getters.getSelectedZone();
|
|
58430
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
58431
|
-
return
|
|
58446
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
58447
|
+
return "Success";
|
|
58432
58448
|
}
|
|
58433
58449
|
checkColumnsAreUnique(cmd) {
|
|
58434
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
58435
|
-
return
|
|
58450
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
58451
|
+
return "Success";
|
|
58436
58452
|
}
|
|
58437
58453
|
trimWhitespace() {
|
|
58438
58454
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -58550,19 +58566,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
58550
58566
|
let x = 0;
|
|
58551
58567
|
let y = 0;
|
|
58552
58568
|
switch (direction) {
|
|
58553
|
-
case
|
|
58569
|
+
case "up":
|
|
58554
58570
|
x = 0;
|
|
58555
58571
|
y = -rule.current;
|
|
58556
58572
|
break;
|
|
58557
|
-
case
|
|
58573
|
+
case "down":
|
|
58558
58574
|
x = 0;
|
|
58559
58575
|
y = rule.current;
|
|
58560
58576
|
break;
|
|
58561
|
-
case
|
|
58577
|
+
case "left":
|
|
58562
58578
|
x = -rule.current;
|
|
58563
58579
|
y = 0;
|
|
58564
58580
|
break;
|
|
58565
|
-
case
|
|
58581
|
+
case "right":
|
|
58566
58582
|
x = rule.current;
|
|
58567
58583
|
y = 0;
|
|
58568
58584
|
break;
|
|
@@ -58689,11 +58705,11 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58689
58705
|
},
|
|
58690
58706
|
sequence: 10
|
|
58691
58707
|
}).add("increment_alphanumeric_value", {
|
|
58692
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58708
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
58693
58709
|
generateRule: (cell, cells, direction) => {
|
|
58694
58710
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
58695
58711
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
58696
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58712
|
+
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]);
|
|
58697
58713
|
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
58698
58714
|
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
58699
58715
|
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
@@ -58711,7 +58727,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58711
58727
|
},
|
|
58712
58728
|
sequence: 15
|
|
58713
58729
|
}).add("copy_text", {
|
|
58714
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58730
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
58715
58731
|
generateRule: () => {
|
|
58716
58732
|
return { type: "COPY_MODIFIER" };
|
|
58717
58733
|
},
|
|
@@ -58728,10 +58744,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58728
58744
|
sequence: 30
|
|
58729
58745
|
}).add("increment_dates", {
|
|
58730
58746
|
condition: (cell, cells) => {
|
|
58731
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58747
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
58732
58748
|
},
|
|
58733
58749
|
generateRule: (cell, cells) => {
|
|
58734
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58750
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
58735
58751
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
58736
58752
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
58737
58753
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -58740,26 +58756,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58740
58756
|
if (typeof increment === "object") return {
|
|
58741
58757
|
type: "DATE_INCREMENT_MODIFIER",
|
|
58742
58758
|
increment,
|
|
58743
|
-
current: evaluation.type ===
|
|
58759
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58744
58760
|
};
|
|
58745
58761
|
return {
|
|
58746
58762
|
type: "INCREMENT_MODIFIER",
|
|
58747
58763
|
increment,
|
|
58748
|
-
current: evaluation.type ===
|
|
58764
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58749
58765
|
};
|
|
58750
58766
|
},
|
|
58751
58767
|
sequence: 25
|
|
58752
58768
|
}).add("increment_number", {
|
|
58753
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58769
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
58754
58770
|
generateRule: (cell, cells, direction) => {
|
|
58755
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58771
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
58756
58772
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
58757
58773
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
58758
58774
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
58759
58775
|
return {
|
|
58760
58776
|
type: "INCREMENT_MODIFIER",
|
|
58761
58777
|
increment,
|
|
58762
|
-
current: evaluation.type ===
|
|
58778
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58763
58779
|
};
|
|
58764
58780
|
},
|
|
58765
58781
|
sequence: 40
|
|
@@ -58869,10 +58885,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58869
58885
|
const sheetId = this.getters.getActiveSheetId();
|
|
58870
58886
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
58871
58887
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
58872
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
58873
|
-
return
|
|
58888
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
58889
|
+
return "InvalidAutofillSelection";
|
|
58874
58890
|
}
|
|
58875
|
-
return
|
|
58891
|
+
return "Success";
|
|
58876
58892
|
}
|
|
58877
58893
|
handle(cmd) {
|
|
58878
58894
|
switch (cmd.type) {
|
|
@@ -58904,7 +58920,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58904
58920
|
const target = this.autofillZone;
|
|
58905
58921
|
const autofillCellsData = [];
|
|
58906
58922
|
switch (this.direction) {
|
|
58907
|
-
case
|
|
58923
|
+
case "down":
|
|
58908
58924
|
for (let col = source.left; col <= source.right; col++) {
|
|
58909
58925
|
const xcs = [];
|
|
58910
58926
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -58912,7 +58928,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58912
58928
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58913
58929
|
}
|
|
58914
58930
|
break;
|
|
58915
|
-
case
|
|
58931
|
+
case "up":
|
|
58916
58932
|
for (let col = source.left; col <= source.right; col++) {
|
|
58917
58933
|
const xcs = [];
|
|
58918
58934
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -58920,7 +58936,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58920
58936
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58921
58937
|
}
|
|
58922
58938
|
break;
|
|
58923
|
-
case
|
|
58939
|
+
case "left":
|
|
58924
58940
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58925
58941
|
const xcs = [];
|
|
58926
58942
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -58928,7 +58944,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58928
58944
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58929
58945
|
}
|
|
58930
58946
|
break;
|
|
58931
|
-
case
|
|
58947
|
+
case "right":
|
|
58932
58948
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58933
58949
|
const xcs = [];
|
|
58934
58950
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -59054,19 +59070,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59054
59070
|
}
|
|
59055
59071
|
this.direction = this.getDirection(col, row);
|
|
59056
59072
|
switch (this.direction) {
|
|
59057
|
-
case
|
|
59073
|
+
case "up":
|
|
59058
59074
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
59059
59075
|
this.steps = source.top - row;
|
|
59060
59076
|
break;
|
|
59061
|
-
case
|
|
59077
|
+
case "down":
|
|
59062
59078
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
59063
59079
|
this.steps = row - source.bottom;
|
|
59064
59080
|
break;
|
|
59065
|
-
case
|
|
59081
|
+
case "left":
|
|
59066
59082
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
59067
59083
|
this.steps = source.left - col;
|
|
59068
59084
|
break;
|
|
59069
|
-
case
|
|
59085
|
+
case "right":
|
|
59070
59086
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
59071
59087
|
this.steps = col - source.right;
|
|
59072
59088
|
break;
|
|
@@ -59085,7 +59101,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59085
59101
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
59086
59102
|
...activePosition,
|
|
59087
59103
|
row
|
|
59088
|
-
}).type !==
|
|
59104
|
+
}).type !== "empty") {
|
|
59089
59105
|
autofillRow = row - 1;
|
|
59090
59106
|
break;
|
|
59091
59107
|
}
|
|
@@ -59105,7 +59121,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59105
59121
|
col: col - 1,
|
|
59106
59122
|
row
|
|
59107
59123
|
};
|
|
59108
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
59124
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
59109
59125
|
row += 1;
|
|
59110
59126
|
leftPosition = {
|
|
59111
59127
|
sheetId,
|
|
@@ -59122,7 +59138,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59122
59138
|
col: col + 1,
|
|
59123
59139
|
row
|
|
59124
59140
|
};
|
|
59125
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
59141
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
59126
59142
|
row += 1;
|
|
59127
59143
|
rightPosition = {
|
|
59128
59144
|
sheetId,
|
|
@@ -59212,19 +59228,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59212
59228
|
const position = {
|
|
59213
59229
|
up: {
|
|
59214
59230
|
number: source.top - row,
|
|
59215
|
-
value:
|
|
59231
|
+
value: "up"
|
|
59216
59232
|
},
|
|
59217
59233
|
down: {
|
|
59218
59234
|
number: row - source.bottom,
|
|
59219
|
-
value:
|
|
59235
|
+
value: "down"
|
|
59220
59236
|
},
|
|
59221
59237
|
left: {
|
|
59222
59238
|
number: source.left - col,
|
|
59223
|
-
value:
|
|
59239
|
+
value: "left"
|
|
59224
59240
|
},
|
|
59225
59241
|
right: {
|
|
59226
59242
|
number: col - source.right,
|
|
59227
|
-
value:
|
|
59243
|
+
value: "right"
|
|
59228
59244
|
}
|
|
59229
59245
|
};
|
|
59230
59246
|
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;
|
|
@@ -59427,7 +59443,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
59427
59443
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
59428
59444
|
}
|
|
59429
59445
|
isNumber(cell) {
|
|
59430
|
-
return cell.type ===
|
|
59446
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
59431
59447
|
}
|
|
59432
59448
|
isZoneValid(zone) {
|
|
59433
59449
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -60490,6 +60506,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
60490
60506
|
//#endregion
|
|
60491
60507
|
//#region src/collaborative/revisions.ts
|
|
60492
60508
|
var Revision = class {
|
|
60509
|
+
rootCommand;
|
|
60510
|
+
timestamp;
|
|
60493
60511
|
id;
|
|
60494
60512
|
clientId;
|
|
60495
60513
|
_commands = [];
|
|
@@ -60526,6 +60544,10 @@ var Revision = class {
|
|
|
60526
60544
|
//#region src/collaborative/session.ts
|
|
60527
60545
|
var ClientDisconnectedError = class extends Error {};
|
|
60528
60546
|
var Session = class extends EventBus {
|
|
60547
|
+
revisions;
|
|
60548
|
+
transportService;
|
|
60549
|
+
serverRevisionId;
|
|
60550
|
+
commandSquisher;
|
|
60529
60551
|
/**
|
|
60530
60552
|
* Positions of the others client.
|
|
60531
60553
|
*/
|
|
@@ -60992,7 +61014,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
60992
61014
|
...position,
|
|
60993
61015
|
content: "FALSE"
|
|
60994
61016
|
});
|
|
60995
|
-
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type ===
|
|
61017
|
+
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
|
|
60996
61018
|
let value;
|
|
60997
61019
|
if (cell.isFormula) {
|
|
60998
61020
|
const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
|
|
@@ -61002,7 +61024,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61002
61024
|
...position,
|
|
61003
61025
|
content: "FALSE"
|
|
61004
61026
|
});
|
|
61005
|
-
} else if (evaluatedCell.type !==
|
|
61027
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
61006
61028
|
...position,
|
|
61007
61029
|
content: "FALSE"
|
|
61008
61030
|
});
|
|
@@ -61129,7 +61151,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
61129
61151
|
getCellNumberFormat(position) {
|
|
61130
61152
|
for (const pos of [position]) {
|
|
61131
61153
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
61132
|
-
if (cell.type ===
|
|
61154
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
61133
61155
|
}
|
|
61134
61156
|
}
|
|
61135
61157
|
};
|
|
@@ -61297,11 +61319,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
61297
61319
|
allowDispatch(cmd) {
|
|
61298
61320
|
switch (cmd.type) {
|
|
61299
61321
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
61300
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
61301
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
61322
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
61323
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
61302
61324
|
break;
|
|
61303
61325
|
}
|
|
61304
|
-
return
|
|
61326
|
+
return "Success";
|
|
61305
61327
|
}
|
|
61306
61328
|
handle(cmd) {
|
|
61307
61329
|
switch (cmd.type) {
|
|
@@ -61564,13 +61586,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
61564
61586
|
allowDispatch(cmd) {
|
|
61565
61587
|
switch (cmd.type) {
|
|
61566
61588
|
case "REQUEST_UNDO":
|
|
61567
|
-
if (!this.canUndo()) return
|
|
61589
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
61568
61590
|
break;
|
|
61569
61591
|
case "REQUEST_REDO":
|
|
61570
|
-
if (!this.canRedo()) return
|
|
61592
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
61571
61593
|
break;
|
|
61572
61594
|
}
|
|
61573
|
-
return
|
|
61595
|
+
return "Success";
|
|
61574
61596
|
}
|
|
61575
61597
|
handle(cmd) {
|
|
61576
61598
|
switch (cmd.type) {
|
|
@@ -61634,9 +61656,9 @@ var LockSheetPlugin = class extends UIPlugin {
|
|
|
61634
61656
|
* to other users and can do any operation and can do core modifications that will only affect them
|
|
61635
61657
|
* It is acceptable to bypass the locked sheet restriction in this case
|
|
61636
61658
|
*/
|
|
61637
|
-
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return
|
|
61638
|
-
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return
|
|
61639
|
-
return
|
|
61659
|
+
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
|
|
61660
|
+
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
|
|
61661
|
+
return "Success";
|
|
61640
61662
|
}
|
|
61641
61663
|
isCurrentSheetLocked() {
|
|
61642
61664
|
return this.getters.isSheetLocked(this.getters.getActiveSheetId());
|
|
@@ -61701,18 +61723,18 @@ var PivotPresencePlugin = class extends UIPlugin {
|
|
|
61701
61723
|
//#endregion
|
|
61702
61724
|
//#region src/helpers/sort.ts
|
|
61703
61725
|
const SORT_TYPES = [
|
|
61704
|
-
|
|
61705
|
-
|
|
61706
|
-
|
|
61707
|
-
|
|
61726
|
+
"number",
|
|
61727
|
+
"error",
|
|
61728
|
+
"text",
|
|
61729
|
+
"boolean"
|
|
61708
61730
|
];
|
|
61709
61731
|
function cellsSortingCriterion(sortingOrder) {
|
|
61710
61732
|
const inverse = sortingOrder === "asc" ? 1 : -1;
|
|
61711
61733
|
return (left, right) => {
|
|
61712
|
-
if (left.type ===
|
|
61713
|
-
else if (right.type ===
|
|
61734
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
61735
|
+
else if (right.type === "empty") return -1;
|
|
61714
61736
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
61715
|
-
if (typeOrder === 0) if (left.type ===
|
|
61737
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
61716
61738
|
else typeOrder = left.value - right.value;
|
|
61717
61739
|
return inverse * typeOrder;
|
|
61718
61740
|
};
|
|
@@ -61723,9 +61745,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
61723
61745
|
type: cell.type,
|
|
61724
61746
|
value: cell.value
|
|
61725
61747
|
}));
|
|
61726
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
61748
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
61727
61749
|
...cell,
|
|
61728
|
-
type:
|
|
61750
|
+
type: "number",
|
|
61729
61751
|
value: 0
|
|
61730
61752
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
61731
61753
|
}
|
|
@@ -61736,10 +61758,10 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61736
61758
|
allowDispatch(cmd) {
|
|
61737
61759
|
switch (cmd.type) {
|
|
61738
61760
|
case "SORT_CELLS":
|
|
61739
|
-
if (!isInside(cmd.col, cmd.row, cmd.zone)) return
|
|
61761
|
+
if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
|
|
61740
61762
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
|
|
61741
61763
|
}
|
|
61742
|
-
return
|
|
61764
|
+
return "Success";
|
|
61743
61765
|
}
|
|
61744
61766
|
handle(cmd) {
|
|
61745
61767
|
switch (cmd.type) {
|
|
@@ -61749,24 +61771,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61749
61771
|
}
|
|
61750
61772
|
}
|
|
61751
61773
|
checkMerge({ sheetId, zone }) {
|
|
61752
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61774
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61753
61775
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
61754
61776
|
sheetId,
|
|
61755
61777
|
col,
|
|
61756
61778
|
row
|
|
61757
|
-
}))) return
|
|
61758
|
-
return
|
|
61779
|
+
}))) return "InvalidSortZone";
|
|
61780
|
+
return "Success";
|
|
61759
61781
|
}
|
|
61760
61782
|
checkMergeSizes({ sheetId, zone }) {
|
|
61761
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61783
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61762
61784
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
61763
61785
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
61764
61786
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
61765
61787
|
if (!merges.every((merge) => {
|
|
61766
61788
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
61767
61789
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
61768
|
-
})) return
|
|
61769
|
-
return
|
|
61790
|
+
})) return "InvalidSortZone";
|
|
61791
|
+
return "Success";
|
|
61770
61792
|
}
|
|
61771
61793
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
61772
61794
|
return positions(zone).some(({ col, row }) => {
|
|
@@ -61780,7 +61802,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61780
61802
|
col,
|
|
61781
61803
|
row
|
|
61782
61804
|
});
|
|
61783
|
-
}) ?
|
|
61805
|
+
}) ? "SortZoneWithArrayFormulas" : "Success";
|
|
61784
61806
|
}
|
|
61785
61807
|
/**
|
|
61786
61808
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -61798,9 +61820,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61798
61820
|
col,
|
|
61799
61821
|
row
|
|
61800
61822
|
}).type));
|
|
61801
|
-
if (cells[0][0] ===
|
|
61802
|
-
if (cells.some((item) => item[0] ===
|
|
61803
|
-
else if (cells.some((item) => item[1] !==
|
|
61823
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
61824
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
61825
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
61804
61826
|
else return false;
|
|
61805
61827
|
}
|
|
61806
61828
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -61889,7 +61911,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
61889
61911
|
switch (cmd.type) {
|
|
61890
61912
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
61891
61913
|
}
|
|
61892
|
-
return
|
|
61914
|
+
return "Success";
|
|
61893
61915
|
}
|
|
61894
61916
|
handle(cmd) {
|
|
61895
61917
|
switch (cmd.type) {
|
|
@@ -61900,7 +61922,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
61900
61922
|
}
|
|
61901
61923
|
getAutomaticSeparator() {
|
|
61902
61924
|
const cells = this.getters.getSelectedCells();
|
|
61903
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
61925
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
61904
61926
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
61905
61927
|
if (separator) return separator;
|
|
61906
61928
|
}
|
|
@@ -62038,24 +62060,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62038
62060
|
});
|
|
62039
62061
|
}
|
|
62040
62062
|
checkSingleColSelected() {
|
|
62041
|
-
if (!this.getters.isSingleColSelected()) return
|
|
62042
|
-
return
|
|
62063
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
62064
|
+
return "Success";
|
|
62043
62065
|
}
|
|
62044
62066
|
checkNonEmptySelector(cmd) {
|
|
62045
|
-
if (cmd.separator === "") return
|
|
62046
|
-
return
|
|
62067
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
62068
|
+
return "Success";
|
|
62047
62069
|
}
|
|
62048
62070
|
checkNotOverwritingContent(cmd) {
|
|
62049
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
62071
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
62050
62072
|
const selection = this.getters.getSelectedZones()[0];
|
|
62051
62073
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
62052
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
62053
|
-
return
|
|
62074
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
62075
|
+
return "Success";
|
|
62054
62076
|
}
|
|
62055
62077
|
checkSeparatorInSelection({ separator }) {
|
|
62056
62078
|
const cells = this.getters.getSelectedCells();
|
|
62057
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
62058
|
-
return
|
|
62079
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
62080
|
+
return "NoSplitSeparatorInSelection";
|
|
62059
62081
|
}
|
|
62060
62082
|
};
|
|
62061
62083
|
|
|
@@ -62100,7 +62122,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
62100
62122
|
col,
|
|
62101
62123
|
row: r,
|
|
62102
62124
|
sheetId
|
|
62103
|
-
}).type !==
|
|
62125
|
+
}).type !== "empty") return;
|
|
62104
62126
|
}
|
|
62105
62127
|
const oldSelection = {
|
|
62106
62128
|
zone: this.getters.getSelectedZone(),
|
|
@@ -62129,13 +62151,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
62129
62151
|
switch (cmd.type) {
|
|
62130
62152
|
case "RESIZE_TABLE":
|
|
62131
62153
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
62132
|
-
if (!table) return
|
|
62154
|
+
if (!table) return "TableNotFound";
|
|
62133
62155
|
const oldTableZone = table.range.zone;
|
|
62134
62156
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
62135
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
62157
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
62136
62158
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
62137
62159
|
}
|
|
62138
|
-
return
|
|
62160
|
+
return "Success";
|
|
62139
62161
|
}
|
|
62140
62162
|
handle(cmd) {
|
|
62141
62163
|
switch (cmd.type) {
|
|
@@ -62363,7 +62385,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62363
62385
|
*/
|
|
62364
62386
|
isCellEmpty(position) {
|
|
62365
62387
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
62366
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
62388
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
62367
62389
|
}
|
|
62368
62390
|
getColMaxWidth(sheetId, index) {
|
|
62369
62391
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -62377,8 +62399,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62377
62399
|
* sheet.
|
|
62378
62400
|
*/
|
|
62379
62401
|
checkSheetExists(cmd) {
|
|
62380
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return
|
|
62381
|
-
return
|
|
62402
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
|
|
62403
|
+
return "Success";
|
|
62382
62404
|
}
|
|
62383
62405
|
/**
|
|
62384
62406
|
* Check if zones in the command are well formed and
|
|
@@ -62386,11 +62408,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62386
62408
|
*/
|
|
62387
62409
|
checkZonesAreInSheet(cmd) {
|
|
62388
62410
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
62389
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
62411
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
62390
62412
|
const zones = this.getters.getCommandZones(cmd);
|
|
62391
|
-
if (!sheetId && zones.length > 0) return
|
|
62413
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
62392
62414
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
62393
|
-
return
|
|
62415
|
+
return "Success";
|
|
62394
62416
|
}
|
|
62395
62417
|
autoResizeRows(sheetId, rows) {
|
|
62396
62418
|
const rowSizes = [];
|
|
@@ -62437,20 +62459,20 @@ var CarouselUIPlugin = class extends UIPlugin {
|
|
|
62437
62459
|
allowDispatch(cmd) {
|
|
62438
62460
|
switch (cmd.type) {
|
|
62439
62461
|
case "ADD_FIGURE_CHART_TO_CAROUSEL":
|
|
62440
|
-
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return
|
|
62441
|
-
return
|
|
62462
|
+
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
|
|
62463
|
+
return "Success";
|
|
62442
62464
|
case "DUPLICATE_CAROUSEL_CHART":
|
|
62443
|
-
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
|
|
62444
|
-
return
|
|
62465
|
+
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";
|
|
62466
|
+
return "Success";
|
|
62445
62467
|
case "ADD_NEW_CHART_TO_CAROUSEL":
|
|
62446
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62447
|
-
return
|
|
62468
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62469
|
+
return "Success";
|
|
62448
62470
|
case "UPDATE_CAROUSEL_ACTIVE_ITEM":
|
|
62449
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62450
|
-
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return
|
|
62451
|
-
return
|
|
62471
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62472
|
+
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
|
|
62473
|
+
return "Success";
|
|
62452
62474
|
}
|
|
62453
|
-
return
|
|
62475
|
+
return "Success";
|
|
62454
62476
|
}
|
|
62455
62477
|
handle(cmd) {
|
|
62456
62478
|
switch (cmd.type) {
|
|
@@ -62687,7 +62709,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62687
62709
|
});
|
|
62688
62710
|
}
|
|
62689
62711
|
case "PASTE": {
|
|
62690
|
-
if (!this.copiedData) return
|
|
62712
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
62691
62713
|
const pasteOption = cmd.pasteOption;
|
|
62692
62714
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
62693
62715
|
pasteOption,
|
|
@@ -62696,21 +62718,21 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62696
62718
|
}
|
|
62697
62719
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
62698
62720
|
const zones = this.getters.getSelectedZones();
|
|
62699
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
62721
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
62700
62722
|
const zone = this.getters.getSelectedZone();
|
|
62701
62723
|
const copiedData = this.getCopiedDataAbove(zone);
|
|
62702
62724
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62703
62725
|
}
|
|
62704
62726
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
62705
62727
|
const zones = this.getters.getSelectedZones();
|
|
62706
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
62728
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
62707
62729
|
const zone = this.getters.getSelectedZone();
|
|
62708
62730
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62709
62731
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62710
62732
|
}
|
|
62711
62733
|
case "COPY_PASTE_CELLS_ON_ZONE": {
|
|
62712
62734
|
const zones = this.getters.getSelectedZones();
|
|
62713
|
-
if (zones.length > 1) return
|
|
62735
|
+
if (zones.length > 1) return "InvalidCopyPasteSelection";
|
|
62714
62736
|
const zone = this.getters.getSelectedZone();
|
|
62715
62737
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62716
62738
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
@@ -62726,7 +62748,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62726
62748
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
62727
62749
|
}
|
|
62728
62750
|
}
|
|
62729
|
-
return
|
|
62751
|
+
return "Success";
|
|
62730
62752
|
}
|
|
62731
62753
|
handle(cmd) {
|
|
62732
62754
|
switch (cmd.type) {
|
|
@@ -62929,16 +62951,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62929
62951
|
const clipboardData = this.getClipboardData(zones);
|
|
62930
62952
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
62931
62953
|
const result = handler.isCutAllowed(clipboardData);
|
|
62932
|
-
if (result !==
|
|
62954
|
+
if (result !== "Success") return result;
|
|
62933
62955
|
}
|
|
62934
|
-
return
|
|
62956
|
+
return "Success";
|
|
62935
62957
|
}
|
|
62936
62958
|
isPasteAllowed(target, copiedData, options) {
|
|
62937
62959
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
62938
62960
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
62939
|
-
if (result !==
|
|
62961
|
+
if (result !== "Success") return result;
|
|
62940
62962
|
}
|
|
62941
|
-
return
|
|
62963
|
+
return "Success";
|
|
62942
62964
|
}
|
|
62943
62965
|
isColRowDirtyingClipboard(position, dimension) {
|
|
62944
62966
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -63019,12 +63041,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63019
63041
|
const file = await this.getImageContent();
|
|
63020
63042
|
const mime = file?.type;
|
|
63021
63043
|
const content = {
|
|
63022
|
-
[
|
|
63023
|
-
[
|
|
63044
|
+
["text/plain"]: "",
|
|
63045
|
+
["text/html"]: ""
|
|
63024
63046
|
};
|
|
63025
63047
|
try {
|
|
63026
|
-
content[
|
|
63027
|
-
content[
|
|
63048
|
+
content["text/plain"] = this.getPlainTextContent();
|
|
63049
|
+
content["text/html"] = await this.getHTMLContent();
|
|
63028
63050
|
} catch (error) {
|
|
63029
63051
|
this.ui.notifyUI({
|
|
63030
63052
|
type: "danger",
|
|
@@ -63216,10 +63238,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
63216
63238
|
allowDispatch(cmd) {
|
|
63217
63239
|
switch (cmd.type) {
|
|
63218
63240
|
case "UPDATE_FILTER":
|
|
63219
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
63241
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
63220
63242
|
break;
|
|
63221
63243
|
}
|
|
63222
|
-
return
|
|
63244
|
+
return "Success";
|
|
63223
63245
|
}
|
|
63224
63246
|
handle(cmd) {
|
|
63225
63247
|
switch (cmd.type) {
|
|
@@ -63583,14 +63605,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
63583
63605
|
allowDispatch(cmd) {
|
|
63584
63606
|
switch (cmd.type) {
|
|
63585
63607
|
case "ACTIVATE_SHEET": try {
|
|
63586
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
63608
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
63587
63609
|
break;
|
|
63588
63610
|
} catch (error) {
|
|
63589
|
-
return
|
|
63611
|
+
return "InvalidSheetId";
|
|
63590
63612
|
}
|
|
63591
63613
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
63592
63614
|
}
|
|
63593
|
-
return
|
|
63615
|
+
return "Success";
|
|
63594
63616
|
}
|
|
63595
63617
|
handleEvent(event) {
|
|
63596
63618
|
let anchor = event.anchor;
|
|
@@ -64111,12 +64133,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64111
64133
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
64112
64134
|
const id = cmd.sheetId;
|
|
64113
64135
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
64114
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
64136
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
64115
64137
|
const headers = [cmd.base, ...cmd.elements];
|
|
64116
64138
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
64117
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
64118
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
64119
|
-
return
|
|
64139
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
64140
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
64141
|
+
return "Success";
|
|
64120
64142
|
}
|
|
64121
64143
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
64122
64144
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -64218,6 +64240,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64218
64240
|
//#endregion
|
|
64219
64241
|
//#region src/helpers/internal_viewport.ts
|
|
64220
64242
|
var InternalViewport = class {
|
|
64243
|
+
getters;
|
|
64244
|
+
sheetId;
|
|
64245
|
+
boundaries;
|
|
64221
64246
|
top;
|
|
64222
64247
|
bottom;
|
|
64223
64248
|
left;
|
|
@@ -64489,6 +64514,10 @@ var InternalViewport = class {
|
|
|
64489
64514
|
* ↓ ↓
|
|
64490
64515
|
*/
|
|
64491
64516
|
var ViewportCollection = class {
|
|
64517
|
+
paneDivision;
|
|
64518
|
+
sheetViewWidth;
|
|
64519
|
+
sheetViewHeight;
|
|
64520
|
+
zoomLevel;
|
|
64492
64521
|
getters;
|
|
64493
64522
|
viewports = {};
|
|
64494
64523
|
gridOffsetX = 0;
|
|
@@ -64805,22 +64834,22 @@ var ViewportCollection = class {
|
|
|
64805
64834
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
64806
64835
|
}
|
|
64807
64836
|
checkPositiveDimension(cmd) {
|
|
64808
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
64809
|
-
return
|
|
64837
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
64838
|
+
return "Success";
|
|
64810
64839
|
}
|
|
64811
64840
|
checkValuesAreDifferent(cmd) {
|
|
64812
64841
|
const { height, width } = this.getSheetViewDimension();
|
|
64813
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
64814
|
-
return
|
|
64842
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
64843
|
+
return "Success";
|
|
64815
64844
|
}
|
|
64816
64845
|
checkScrollingDirection(sheetId, { offsetX, offsetY }) {
|
|
64817
64846
|
const pane = this.getMainInternalViewport(sheetId);
|
|
64818
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
64819
|
-
return
|
|
64847
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
64848
|
+
return "Success";
|
|
64820
64849
|
}
|
|
64821
64850
|
checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
|
|
64822
64851
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
|
|
64823
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
64852
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
64824
64853
|
}
|
|
64825
64854
|
getMainViewport(sheetId) {
|
|
64826
64855
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -65137,9 +65166,9 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
65137
65166
|
return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
|
|
65138
65167
|
}
|
|
65139
65168
|
case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
|
|
65140
|
-
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return
|
|
65141
|
-
else return
|
|
65142
|
-
default: return
|
|
65169
|
+
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
|
|
65170
|
+
else return "Success";
|
|
65171
|
+
default: return "Success";
|
|
65143
65172
|
}
|
|
65144
65173
|
}
|
|
65145
65174
|
handleEvent(event) {
|
|
@@ -67213,9 +67242,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
67213
67242
|
newName: name,
|
|
67214
67243
|
oldName: env.model.getters.getSheetName(sheetId)
|
|
67215
67244
|
});
|
|
67216
|
-
if (result.reasons.includes(
|
|
67217
|
-
else if (result.reasons.includes(
|
|
67218
|
-
else if (result.reasons.includes(
|
|
67245
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
67246
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
67247
|
+
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);
|
|
67219
67248
|
}
|
|
67220
67249
|
|
|
67221
67250
|
//#endregion
|
|
@@ -67273,7 +67302,7 @@ var BottomBarSheet = class extends Component {
|
|
|
67273
67302
|
onMounted(() => {
|
|
67274
67303
|
const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
|
|
67275
67304
|
this.env.model.on("command-rejected", this, async ({ command, result }) => {
|
|
67276
|
-
if (result.isCancelledBecause(
|
|
67305
|
+
if (result.isCancelledBecause("SheetLocked")) {
|
|
67277
67306
|
if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
|
|
67278
67307
|
this.scrollToSheet();
|
|
67279
67308
|
await animateLockedSheet();
|
|
@@ -67410,41 +67439,41 @@ var BottomBarSheet = class extends Component {
|
|
|
67410
67439
|
const selectionStatisticFunctions = [
|
|
67411
67440
|
{
|
|
67412
67441
|
name: _t("Sum"),
|
|
67413
|
-
types: [
|
|
67442
|
+
types: ["number"],
|
|
67414
67443
|
compute: (values, locale) => sum([[values]], locale)
|
|
67415
67444
|
},
|
|
67416
67445
|
{
|
|
67417
67446
|
name: _t("Avg"),
|
|
67418
|
-
types: [
|
|
67447
|
+
types: ["number"],
|
|
67419
67448
|
compute: (values, locale) => average([[values]], locale)
|
|
67420
67449
|
},
|
|
67421
67450
|
{
|
|
67422
67451
|
name: _t("Min"),
|
|
67423
|
-
types: [
|
|
67452
|
+
types: ["number"],
|
|
67424
67453
|
compute: (values, locale) => min([[values]], locale).value
|
|
67425
67454
|
},
|
|
67426
67455
|
{
|
|
67427
67456
|
name: _t("Max"),
|
|
67428
|
-
types: [
|
|
67457
|
+
types: ["number"],
|
|
67429
67458
|
compute: (values, locale) => max([[values]], locale).value
|
|
67430
67459
|
},
|
|
67431
67460
|
{
|
|
67432
67461
|
name: _t("Count"),
|
|
67433
67462
|
types: [
|
|
67434
|
-
|
|
67435
|
-
|
|
67436
|
-
|
|
67437
|
-
|
|
67463
|
+
"number",
|
|
67464
|
+
"text",
|
|
67465
|
+
"boolean",
|
|
67466
|
+
"error"
|
|
67438
67467
|
],
|
|
67439
67468
|
compute: (values) => countAny([[values]])
|
|
67440
67469
|
},
|
|
67441
67470
|
{
|
|
67442
67471
|
name: _t("Count Numbers"),
|
|
67443
67472
|
types: [
|
|
67444
|
-
|
|
67445
|
-
|
|
67446
|
-
|
|
67447
|
-
|
|
67473
|
+
"number",
|
|
67474
|
+
"text",
|
|
67475
|
+
"boolean",
|
|
67476
|
+
"error"
|
|
67448
67477
|
],
|
|
67449
67478
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
67450
67479
|
}
|
|
@@ -67497,7 +67526,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
67497
67526
|
col,
|
|
67498
67527
|
row
|
|
67499
67528
|
});
|
|
67500
|
-
if (evaluatedCell.type !==
|
|
67529
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
67501
67530
|
}
|
|
67502
67531
|
return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
|
|
67503
67532
|
}
|
|
@@ -68445,6 +68474,7 @@ var SmallBottomBar = class extends Component {
|
|
|
68445
68474
|
//#region src/components/standalone_grid_canvas/figure_renderer_store.ts
|
|
68446
68475
|
/** Store that draws the figures directly onto the canvas */
|
|
68447
68476
|
var FigureRendererStore = class extends DisposableStore {
|
|
68477
|
+
renderer;
|
|
68448
68478
|
mutators = ["addLoadedImage"];
|
|
68449
68479
|
getters = this.get(ModelStore).getters;
|
|
68450
68480
|
loadedImages = {};
|
|
@@ -68790,7 +68820,7 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
68790
68820
|
const coreCell = this.getters.getCell(position);
|
|
68791
68821
|
if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
|
|
68792
68822
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
68793
|
-
if (evaluatedCell && evaluatedCell.type !==
|
|
68823
|
+
if (evaluatedCell && evaluatedCell.type !== "empty") return true;
|
|
68794
68824
|
}
|
|
68795
68825
|
return false;
|
|
68796
68826
|
}
|
|
@@ -69131,7 +69161,7 @@ var NamedRangeSelector = class extends Component {
|
|
|
69131
69161
|
}
|
|
69132
69162
|
navigateToRange(range) {
|
|
69133
69163
|
const { sheetId, zone } = range;
|
|
69134
|
-
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !==
|
|
69164
|
+
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
|
|
69135
69165
|
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."));
|
|
69136
69166
|
return;
|
|
69137
69167
|
}
|
|
@@ -70016,6 +70046,7 @@ function instantiateClipboard() {
|
|
|
70016
70046
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
70017
70047
|
}
|
|
70018
70048
|
var WebClipboardWrapper = class {
|
|
70049
|
+
clipboard;
|
|
70019
70050
|
constructor(clipboard) {
|
|
70020
70051
|
this.clipboard = clipboard;
|
|
70021
70052
|
}
|
|
@@ -70031,12 +70062,12 @@ var WebClipboardWrapper = class {
|
|
|
70031
70062
|
console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
|
|
70032
70063
|
try {
|
|
70033
70064
|
await this.clipboard?.write([new ClipboardItem({
|
|
70034
|
-
[
|
|
70035
|
-
[
|
|
70065
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
70066
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
70036
70067
|
})]);
|
|
70037
70068
|
} catch (e) {}
|
|
70038
70069
|
}
|
|
70039
|
-
else await this.writeText(clipboardContent[
|
|
70070
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
70040
70071
|
}
|
|
70041
70072
|
async writeText(text) {
|
|
70042
70073
|
try {
|
|
@@ -70065,7 +70096,7 @@ var WebClipboardWrapper = class {
|
|
|
70065
70096
|
}
|
|
70066
70097
|
else return {
|
|
70067
70098
|
status: "ok",
|
|
70068
|
-
content: { [
|
|
70099
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
70069
70100
|
};
|
|
70070
70101
|
}
|
|
70071
70102
|
getClipboardItems(content) {
|
|
@@ -70217,7 +70248,7 @@ var Spreadsheet = class extends Component {
|
|
|
70217
70248
|
bindModelEvents() {
|
|
70218
70249
|
this.model.on("update", this, () => this.render(true));
|
|
70219
70250
|
this.model.on("command-rejected", this, ({ result }) => {
|
|
70220
|
-
if (result.isCancelledBecause(
|
|
70251
|
+
if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
|
|
70221
70252
|
type: "info",
|
|
70222
70253
|
text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
|
|
70223
70254
|
sticky: false
|
|
@@ -70302,6 +70333,7 @@ var Spreadsheet = class extends Component {
|
|
|
70302
70333
|
//#endregion
|
|
70303
70334
|
//#region src/collaborative/command_squisher.ts
|
|
70304
70335
|
var CommandSquisher = class {
|
|
70336
|
+
getters;
|
|
70305
70337
|
constructor(getters) {
|
|
70306
70338
|
this.getters = getters;
|
|
70307
70339
|
}
|
|
@@ -70408,6 +70440,7 @@ var CommandSquisher = class {
|
|
|
70408
70440
|
//#endregion
|
|
70409
70441
|
//#region src/collaborative/readonly_transport_filter.ts
|
|
70410
70442
|
var ReadonlyTransportFilter = class {
|
|
70443
|
+
transportService;
|
|
70411
70444
|
constructor(transportService) {
|
|
70412
70445
|
this.transportService = transportService;
|
|
70413
70446
|
}
|
|
@@ -70439,6 +70472,8 @@ function inverseCommand(cmd) {
|
|
|
70439
70472
|
* @param operations initial operations
|
|
70440
70473
|
*/
|
|
70441
70474
|
var Branch = class Branch {
|
|
70475
|
+
buildTransformation;
|
|
70476
|
+
operations;
|
|
70442
70477
|
constructor(buildTransformation, operations = []) {
|
|
70443
70478
|
this.buildTransformation = buildTransformation;
|
|
70444
70479
|
this.operations = operations;
|
|
@@ -70555,6 +70590,8 @@ var Branch = class Branch {
|
|
|
70555
70590
|
* to revert it).
|
|
70556
70591
|
*/
|
|
70557
70592
|
var Operation = class {
|
|
70593
|
+
id;
|
|
70594
|
+
data;
|
|
70558
70595
|
constructor(id, data) {
|
|
70559
70596
|
this.id = id;
|
|
70560
70597
|
this.data = data;
|
|
@@ -70564,6 +70601,8 @@ var Operation = class {
|
|
|
70564
70601
|
}
|
|
70565
70602
|
};
|
|
70566
70603
|
var LazyOperation = class LazyOperation {
|
|
70604
|
+
id;
|
|
70605
|
+
lazyData;
|
|
70567
70606
|
constructor(id, lazyData) {
|
|
70568
70607
|
this.id = id;
|
|
70569
70608
|
this.lazyData = lazyData;
|
|
@@ -70589,6 +70628,7 @@ var LazyOperation = class LazyOperation {
|
|
|
70589
70628
|
* ```
|
|
70590
70629
|
*/
|
|
70591
70630
|
var OperationSequence = class OperationSequence {
|
|
70631
|
+
operations;
|
|
70592
70632
|
constructor(operations) {
|
|
70593
70633
|
this.operations = operations;
|
|
70594
70634
|
}
|
|
@@ -70664,6 +70704,7 @@ var OperationSequence = class OperationSequence {
|
|
|
70664
70704
|
*
|
|
70665
70705
|
*/
|
|
70666
70706
|
var Tree = class {
|
|
70707
|
+
buildTransformation;
|
|
70667
70708
|
branches;
|
|
70668
70709
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
70669
70710
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -71173,8 +71214,8 @@ var RangeAdapterPlugin = class {
|
|
|
71173
71214
|
"removeRangesSheetPrefix"
|
|
71174
71215
|
];
|
|
71175
71216
|
allowDispatch(cmd) {
|
|
71176
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
71177
|
-
return
|
|
71217
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
71218
|
+
return "Success";
|
|
71178
71219
|
}
|
|
71179
71220
|
beforeHandle(command) {}
|
|
71180
71221
|
handle(cmd) {
|
|
@@ -71459,6 +71500,7 @@ var EventStream = class {
|
|
|
71459
71500
|
* with the new selected anchor
|
|
71460
71501
|
*/
|
|
71461
71502
|
var SelectionStreamProcessorImpl = class {
|
|
71503
|
+
getters;
|
|
71462
71504
|
stream;
|
|
71463
71505
|
/**
|
|
71464
71506
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -71557,7 +71599,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71557
71599
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
71558
71600
|
*/
|
|
71559
71601
|
moveAnchorCell(direction, step = 1) {
|
|
71560
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71602
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71561
71603
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
71562
71604
|
return this.selectCell(col, row);
|
|
71563
71605
|
}
|
|
@@ -71591,7 +71633,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71591
71633
|
bottom: Math.max(anchorRow, row)
|
|
71592
71634
|
};
|
|
71593
71635
|
const expandedZone = this.getters.expandZone(sheetId, zone);
|
|
71594
|
-
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(
|
|
71636
|
+
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
|
|
71595
71637
|
const anchor = {
|
|
71596
71638
|
zone: expandedZone,
|
|
71597
71639
|
cell: {
|
|
@@ -71653,7 +71695,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71653
71695
|
* of the anchor zone which moves.
|
|
71654
71696
|
*/
|
|
71655
71697
|
resizeAnchorZone(direction, step = 1) {
|
|
71656
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71698
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71657
71699
|
const sheetId = this.getters.getActiveSheetId();
|
|
71658
71700
|
const anchor = this.anchor;
|
|
71659
71701
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -71900,7 +71942,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71900
71942
|
previousAnchor: deepCopy(this.anchor)
|
|
71901
71943
|
};
|
|
71902
71944
|
const commandResult = this.checkEventAnchorZone(event);
|
|
71903
|
-
if (commandResult !==
|
|
71945
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
71904
71946
|
this.anchor = event.anchor;
|
|
71905
71947
|
this.stream.send(event);
|
|
71906
71948
|
return DispatchResult.Success;
|
|
@@ -71910,15 +71952,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71910
71952
|
}
|
|
71911
71953
|
checkAnchorZone(anchor) {
|
|
71912
71954
|
const { cell, zone } = anchor;
|
|
71913
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
71955
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
71914
71956
|
const { left, right, top, bottom } = zone;
|
|
71915
71957
|
const sheetId = this.getters.getActiveSheetId();
|
|
71916
71958
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
71917
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
71918
|
-
return
|
|
71959
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
71960
|
+
return "Success";
|
|
71919
71961
|
}
|
|
71920
71962
|
checkAnchorZoneOrThrow(anchor) {
|
|
71921
|
-
if (this.checkAnchorZone(anchor) ===
|
|
71963
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
|
|
71922
71964
|
}
|
|
71923
71965
|
/**
|
|
71924
71966
|
* ---- PRIVATE ----
|
|
@@ -72075,7 +72117,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72075
72117
|
isCellSkippableInCluster(position) {
|
|
72076
72118
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
72077
72119
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
72078
|
-
return cell.type ===
|
|
72120
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
72079
72121
|
}
|
|
72080
72122
|
};
|
|
72081
72123
|
|
|
@@ -74292,13 +74334,6 @@ function purgeSingleRowTables(data) {
|
|
|
74292
74334
|
|
|
74293
74335
|
//#endregion
|
|
74294
74336
|
//#region src/model.ts
|
|
74295
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
74296
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
74297
|
-
Status[Status["Running"] = 1] = "Running";
|
|
74298
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
74299
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
74300
|
-
return Status;
|
|
74301
|
-
}(Status || {});
|
|
74302
74337
|
/**
|
|
74303
74338
|
* Model
|
|
74304
74339
|
*
|
|
@@ -74344,7 +74379,7 @@ var Model = class Model extends EventBus {
|
|
|
74344
74379
|
/**
|
|
74345
74380
|
* Internal status of the model. Important for command handling coordination
|
|
74346
74381
|
*/
|
|
74347
|
-
status =
|
|
74382
|
+
status = 0;
|
|
74348
74383
|
/**
|
|
74349
74384
|
* The config object contains some configuration flag and callbacks
|
|
74350
74385
|
*/
|
|
@@ -74491,7 +74526,7 @@ var Model = class Model extends EventBus {
|
|
|
74491
74526
|
onRemoteRevisionReceived({ commands }) {
|
|
74492
74527
|
for (const command of commands) {
|
|
74493
74528
|
const previousStatus = this.status;
|
|
74494
|
-
this.status =
|
|
74529
|
+
this.status = 2;
|
|
74495
74530
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
74496
74531
|
this.status = previousStatus;
|
|
74497
74532
|
}
|
|
@@ -74604,7 +74639,7 @@ var Model = class Model extends EventBus {
|
|
|
74604
74639
|
return this.processCommandResults(results);
|
|
74605
74640
|
}
|
|
74606
74641
|
processCommandResults(results) {
|
|
74607
|
-
if (results.some((r) => r !==
|
|
74642
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
74608
74643
|
return DispatchResult.Success;
|
|
74609
74644
|
}
|
|
74610
74645
|
checkDispatchAllowedRemoteCommand(command) {
|
|
@@ -74618,9 +74653,9 @@ var Model = class Model extends EventBus {
|
|
|
74618
74653
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
74619
74654
|
}
|
|
74620
74655
|
finalize() {
|
|
74621
|
-
this.status =
|
|
74656
|
+
this.status = 3;
|
|
74622
74657
|
for (const h of this.handlers) h.finalize();
|
|
74623
|
-
this.status =
|
|
74658
|
+
this.status = 0;
|
|
74624
74659
|
this.trigger("command-finalized");
|
|
74625
74660
|
}
|
|
74626
74661
|
/**
|
|
@@ -74647,10 +74682,10 @@ var Model = class Model extends EventBus {
|
|
|
74647
74682
|
dispatch = (type, payload) => {
|
|
74648
74683
|
const command = createCommand(type, payload);
|
|
74649
74684
|
const status = this.status;
|
|
74650
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
74651
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
74685
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
74686
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
74652
74687
|
switch (status) {
|
|
74653
|
-
case
|
|
74688
|
+
case 0:
|
|
74654
74689
|
const result = this.checkDispatchAllowed(command);
|
|
74655
74690
|
if (!result.isSuccessful) {
|
|
74656
74691
|
this.trigger("update");
|
|
@@ -74660,7 +74695,7 @@ var Model = class Model extends EventBus {
|
|
|
74660
74695
|
});
|
|
74661
74696
|
return result;
|
|
74662
74697
|
}
|
|
74663
|
-
this.status =
|
|
74698
|
+
this.status = 1;
|
|
74664
74699
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
74665
74700
|
const start = performance.now();
|
|
74666
74701
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -74670,10 +74705,10 @@ var Model = class Model extends EventBus {
|
|
|
74670
74705
|
if (time > 5) console.debug(type, time, "ms");
|
|
74671
74706
|
});
|
|
74672
74707
|
this.session.save(command, commands, changes);
|
|
74673
|
-
this.status =
|
|
74708
|
+
this.status = 0;
|
|
74674
74709
|
this.trigger("update");
|
|
74675
74710
|
break;
|
|
74676
|
-
case
|
|
74711
|
+
case 1:
|
|
74677
74712
|
if (isCoreCommand(command)) {
|
|
74678
74713
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
74679
74714
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -74681,8 +74716,8 @@ var Model = class Model extends EventBus {
|
|
|
74681
74716
|
}
|
|
74682
74717
|
this.dispatchToHandlers(this.handlers, command);
|
|
74683
74718
|
break;
|
|
74684
|
-
case
|
|
74685
|
-
case
|
|
74719
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
74720
|
+
case 2:
|
|
74686
74721
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
74687
74722
|
this.dispatchToHandlers(this.handlers, command);
|
|
74688
74723
|
}
|
|
@@ -74695,7 +74730,7 @@ var Model = class Model extends EventBus {
|
|
|
74695
74730
|
dispatchFromCorePlugin = (type, payload) => {
|
|
74696
74731
|
const command = createCommand(type, payload);
|
|
74697
74732
|
const previousStatus = this.status;
|
|
74698
|
-
this.status =
|
|
74733
|
+
this.status = 2;
|
|
74699
74734
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
74700
74735
|
this.dispatchToHandlers(handlers, command);
|
|
74701
74736
|
this.status = previousStatus;
|
|
@@ -74797,9 +74832,9 @@ function createCommand(type, payload = {}) {
|
|
|
74797
74832
|
//#endregion
|
|
74798
74833
|
//#region src/helpers/figures/charts/calendar_chart.ts
|
|
74799
74834
|
function checkDateGranularity(definition) {
|
|
74800
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return
|
|
74801
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return
|
|
74802
|
-
return
|
|
74835
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
|
|
74836
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
|
|
74837
|
+
return "Success";
|
|
74803
74838
|
}
|
|
74804
74839
|
const CalendarChart = {
|
|
74805
74840
|
sequence: 110,
|
|
@@ -74890,7 +74925,7 @@ const ComboChart = {
|
|
|
74890
74925
|
copyInSheetId: (definition) => definition,
|
|
74891
74926
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74892
74927
|
transformDefinition: (definition) => definition,
|
|
74893
|
-
validateDefinition: () =>
|
|
74928
|
+
validateDefinition: () => "Success",
|
|
74894
74929
|
updateRanges: (definition) => definition,
|
|
74895
74930
|
getContextCreation: (definition) => definition,
|
|
74896
74931
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
@@ -74980,7 +75015,7 @@ const FunnelChart = {
|
|
|
74980
75015
|
copyInSheetId: (definition) => definition,
|
|
74981
75016
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74982
75017
|
transformDefinition: (definition) => definition,
|
|
74983
|
-
validateDefinition: () =>
|
|
75018
|
+
validateDefinition: () => "Success",
|
|
74984
75019
|
updateRanges: (definition) => definition,
|
|
74985
75020
|
getContextCreation: (definition) => definition,
|
|
74986
75021
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75046,7 +75081,7 @@ const GeoChart = {
|
|
|
75046
75081
|
copyInSheetId: (definition) => definition,
|
|
75047
75082
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75048
75083
|
transformDefinition: (definition) => definition,
|
|
75049
|
-
validateDefinition: () =>
|
|
75084
|
+
validateDefinition: () => "Success",
|
|
75050
75085
|
updateRanges: (definition) => definition,
|
|
75051
75086
|
getContextCreation: (definition) => definition,
|
|
75052
75087
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75107,7 +75142,7 @@ const PyramidChart = {
|
|
|
75107
75142
|
copyInSheetId: (definition) => definition,
|
|
75108
75143
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75109
75144
|
transformDefinition: (definition) => definition,
|
|
75110
|
-
validateDefinition: () =>
|
|
75145
|
+
validateDefinition: () => "Success",
|
|
75111
75146
|
updateRanges: (definition) => definition,
|
|
75112
75147
|
getContextCreation: (definition) => definition,
|
|
75113
75148
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75193,7 +75228,7 @@ const RadarChart = {
|
|
|
75193
75228
|
copyInSheetId: (definition) => definition,
|
|
75194
75229
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75195
75230
|
transformDefinition: (definition) => definition,
|
|
75196
|
-
validateDefinition: () =>
|
|
75231
|
+
validateDefinition: () => "Success",
|
|
75197
75232
|
updateRanges: (definition) => definition,
|
|
75198
75233
|
getContextCreation: (definition) => definition,
|
|
75199
75234
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75271,7 +75306,7 @@ const ScatterChart = {
|
|
|
75271
75306
|
copyInSheetId: (definition) => definition,
|
|
75272
75307
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75273
75308
|
transformDefinition: (definition) => definition,
|
|
75274
|
-
validateDefinition: () =>
|
|
75309
|
+
validateDefinition: () => "Success",
|
|
75275
75310
|
updateRanges: (definition) => definition,
|
|
75276
75311
|
getContextCreation: (definition) => definition,
|
|
75277
75312
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75350,7 +75385,7 @@ const SunburstChart = {
|
|
|
75350
75385
|
copyInSheetId: (definition) => definition,
|
|
75351
75386
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75352
75387
|
transformDefinition: (definition) => definition,
|
|
75353
|
-
validateDefinition: () =>
|
|
75388
|
+
validateDefinition: () => "Success",
|
|
75354
75389
|
updateRanges: (definition) => definition,
|
|
75355
75390
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75356
75391
|
return {
|
|
@@ -75419,7 +75454,7 @@ const TreeMapChart = {
|
|
|
75419
75454
|
copyInSheetId: (definition) => definition,
|
|
75420
75455
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75421
75456
|
transformDefinition: (definition) => definition,
|
|
75422
|
-
validateDefinition: () =>
|
|
75457
|
+
validateDefinition: () => "Success",
|
|
75423
75458
|
updateRanges: (definition) => definition,
|
|
75424
75459
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75425
75460
|
return {
|
|
@@ -75845,9 +75880,9 @@ var CarouselClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
75845
75880
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75846
75881
|
}
|
|
75847
75882
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75848
|
-
if (target.length === 0) return
|
|
75849
|
-
if (option?.pasteOption !== void 0) return
|
|
75850
|
-
return
|
|
75883
|
+
if (target.length === 0) return "EmptyTarget";
|
|
75884
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
75885
|
+
return "Success";
|
|
75851
75886
|
}
|
|
75852
75887
|
};
|
|
75853
75888
|
|
|
@@ -75918,9 +75953,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
75918
75953
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75919
75954
|
}
|
|
75920
75955
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75921
|
-
if (target.length === 0) return
|
|
75922
|
-
if (option?.pasteOption !== void 0) return
|
|
75923
|
-
return
|
|
75956
|
+
if (target.length === 0) return "EmptyTarget";
|
|
75957
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
75958
|
+
return "Success";
|
|
75924
75959
|
}
|
|
75925
75960
|
};
|
|
75926
75961
|
|
|
@@ -76225,9 +76260,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76225
76260
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76226
76261
|
}
|
|
76227
76262
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76228
|
-
if (target.length === 0) return
|
|
76229
|
-
if (option?.pasteOption !== void 0) return
|
|
76230
|
-
return
|
|
76263
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76264
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76265
|
+
return "Success";
|
|
76231
76266
|
}
|
|
76232
76267
|
};
|
|
76233
76268
|
|
|
@@ -76323,10 +76358,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
76323
76358
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
76324
76359
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
76325
76360
|
isPasteAllowed(sheetId, target, content, options) {
|
|
76326
|
-
if (!("cells" in content)) return
|
|
76361
|
+
if (!("cells" in content)) return "Success";
|
|
76327
76362
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
76328
|
-
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return
|
|
76329
|
-
return
|
|
76363
|
+
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
76364
|
+
return "Success";
|
|
76330
76365
|
}
|
|
76331
76366
|
};
|
|
76332
76367
|
|
|
@@ -79167,15 +79202,15 @@ const DATEDIF = {
|
|
|
79167
79202
|
const jsEndDate = numberToJsDate(_endDate);
|
|
79168
79203
|
if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
79169
79204
|
switch (_unit) {
|
|
79170
|
-
case
|
|
79171
|
-
case
|
|
79172
|
-
case
|
|
79173
|
-
case
|
|
79174
|
-
case
|
|
79205
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
79206
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
79207
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79208
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
79209
|
+
case "MD":
|
|
79175
79210
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
79176
79211
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
79177
79212
|
return days;
|
|
79178
|
-
case
|
|
79213
|
+
case "YD": {
|
|
79179
79214
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79180
79215
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
79181
79216
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -79865,11 +79900,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
79865
79900
|
const right = sortColumn[b];
|
|
79866
79901
|
const leftCell = {
|
|
79867
79902
|
value: left,
|
|
79868
|
-
type: left === null ?
|
|
79903
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
79869
79904
|
};
|
|
79870
79905
|
const rightCell = {
|
|
79871
79906
|
value: right,
|
|
79872
|
-
type: right === null ?
|
|
79907
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
79873
79908
|
};
|
|
79874
79909
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
79875
79910
|
if (result !== 0) return result;
|
|
@@ -84409,6 +84444,6 @@ const chartHelpers = {
|
|
|
84409
84444
|
//#endregion
|
|
84410
84445
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, canExecuteInReadonly, categories, chartHelpers, components, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isSheetDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
84411
84446
|
|
|
84412
|
-
__info__.version = "19.3.
|
|
84413
|
-
__info__.date = "2026-05-
|
|
84414
|
-
__info__.hash = "
|
|
84447
|
+
__info__.version = "19.3.4";
|
|
84448
|
+
__info__.date = "2026-05-15T07:07:34.417Z";
|
|
84449
|
+
__info__.hash = "1dc7b42";
|