@odoo/o-spreadsheet 19.3.3 → 19.3.5
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 +944 -865
- package/dist/o_spreadsheet.css +3 -3
- package/dist/o_spreadsheet.esm.js +944 -865
- package/dist/o_spreadsheet.iife.js +946 -867
- 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/dist/types/helpers/pivot/pivot_composer_helpers.d.ts +4 -0
- package/dist/types/plugins/ui_core_views/pivot_ui.d.ts +17 -8
- package/package.json +17 -17
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 19.3.
|
|
6
|
-
* @date 2026-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.3.5
|
|
6
|
+
* @date 2026-05-27T06:08:23.138Z
|
|
7
|
+
* @hash 0cf1540
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function(exports, _odoo_owl) {
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
17
17
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
18
|
var __getProtoOf = Object.getPrototypeOf;
|
|
19
19
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
21
21
|
var __exportAll = (all, no_symbols) => {
|
|
22
22
|
let target = {};
|
|
23
23
|
for (var name in all) {
|
|
@@ -463,13 +463,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
463
463
|
function isMatrix(x) {
|
|
464
464
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
465
465
|
}
|
|
466
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
467
|
-
DIRECTION["UP"] = "up";
|
|
468
|
-
DIRECTION["DOWN"] = "down";
|
|
469
|
-
DIRECTION["LEFT"] = "left";
|
|
470
|
-
DIRECTION["RIGHT"] = "right";
|
|
471
|
-
return DIRECTION;
|
|
472
|
-
}({});
|
|
473
466
|
|
|
474
467
|
//#endregion
|
|
475
468
|
//#region src/helpers/misc.ts
|
|
@@ -926,7 +919,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
926
919
|
}
|
|
927
920
|
shift() {
|
|
928
921
|
const current = this.current;
|
|
929
|
-
|
|
922
|
+
const next = this.text[++this.currentIndex];
|
|
923
|
+
this.current = next;
|
|
930
924
|
return current;
|
|
931
925
|
}
|
|
932
926
|
advanceBy(length) {
|
|
@@ -2114,6 +2108,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2114
2108
|
}
|
|
2115
2109
|
};
|
|
2116
2110
|
var StoreFactory = class {
|
|
2111
|
+
get;
|
|
2117
2112
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
2118
2113
|
constructor(get) {
|
|
2119
2114
|
this.get = get;
|
|
@@ -2158,6 +2153,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2158
2153
|
return MetaStore;
|
|
2159
2154
|
}
|
|
2160
2155
|
var DisposableStore = class {
|
|
2156
|
+
get;
|
|
2161
2157
|
disposeCallbacks = [];
|
|
2162
2158
|
constructor(get) {
|
|
2163
2159
|
this.get = get;
|
|
@@ -2261,6 +2257,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2261
2257
|
//#endregion
|
|
2262
2258
|
//#region src/stores/renderer_store.ts
|
|
2263
2259
|
var RendererStore = class {
|
|
2260
|
+
layers;
|
|
2264
2261
|
mutators = [
|
|
2265
2262
|
"register",
|
|
2266
2263
|
"unRegister",
|
|
@@ -2915,6 +2912,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2915
2912
|
else return ALTERNATING_COLORS_XL;
|
|
2916
2913
|
}
|
|
2917
2914
|
var ColorGenerator = class {
|
|
2915
|
+
preferredColors;
|
|
2918
2916
|
currentColorIndex = 0;
|
|
2919
2917
|
palette;
|
|
2920
2918
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -3311,6 +3309,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
3311
3309
|
return sprintf(_translate(s), ...values);
|
|
3312
3310
|
};
|
|
3313
3311
|
var LazyTranslatedString = class extends String {
|
|
3312
|
+
values;
|
|
3314
3313
|
constructor(str, values) {
|
|
3315
3314
|
super(str);
|
|
3316
3315
|
this.values = values;
|
|
@@ -3340,6 +3339,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
3340
3339
|
};
|
|
3341
3340
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3342
3341
|
var EvaluationError = class {
|
|
3342
|
+
message;
|
|
3343
|
+
value;
|
|
3343
3344
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3344
3345
|
this.message = message;
|
|
3345
3346
|
this.value = value;
|
|
@@ -3372,6 +3373,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
3372
3373
|
}
|
|
3373
3374
|
};
|
|
3374
3375
|
var SplillBlockedError = class extends EvaluationError {
|
|
3376
|
+
errorOriginPosition;
|
|
3375
3377
|
constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
|
|
3376
3378
|
super(message, CellErrorType.SpilledBlocked);
|
|
3377
3379
|
this.errorOriginPosition = errorOriginPosition;
|
|
@@ -5054,46 +5056,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
5054
5056
|
|
|
5055
5057
|
//#endregion
|
|
5056
5058
|
//#region src/formulas/range_tokenizer.ts
|
|
5057
|
-
var State = /* @__PURE__ */ function(State) {
|
|
5058
|
-
/**
|
|
5059
|
-
* Initial state.
|
|
5060
|
-
* Expecting any reference for the left part of a range
|
|
5061
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5062
|
-
*/
|
|
5063
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
5064
|
-
/**
|
|
5065
|
-
* Expecting any reference for the right part of a range
|
|
5066
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5067
|
-
*/
|
|
5068
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
5069
|
-
/**
|
|
5070
|
-
* Expecting the separator without any constraint on the right part
|
|
5071
|
-
*/
|
|
5072
|
-
State[State["Separator"] = 2] = "Separator";
|
|
5073
|
-
/**
|
|
5074
|
-
* Expecting the separator for a full column range
|
|
5075
|
-
*/
|
|
5076
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
5077
|
-
/**
|
|
5078
|
-
* Expecting the separator for a full row range
|
|
5079
|
-
*/
|
|
5080
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
5081
|
-
/**
|
|
5082
|
-
* Expecting the right part of a full column range
|
|
5083
|
-
* e.g. "1", "A1"
|
|
5084
|
-
*/
|
|
5085
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
5086
|
-
/**
|
|
5087
|
-
* Expecting the right part of a full row range
|
|
5088
|
-
* e.g. "A", "A1"
|
|
5089
|
-
*/
|
|
5090
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
5091
|
-
/**
|
|
5092
|
-
* Final state. A range has been matched
|
|
5093
|
-
*/
|
|
5094
|
-
State[State["Found"] = 7] = "Found";
|
|
5095
|
-
return State;
|
|
5096
|
-
}(State || {});
|
|
5097
5059
|
const goTo = (state, guard = () => true) => [{
|
|
5098
5060
|
goTo: state,
|
|
5099
5061
|
guard
|
|
@@ -5103,41 +5065,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
5103
5065
|
guard
|
|
5104
5066
|
});
|
|
5105
5067
|
const machine = {
|
|
5106
|
-
[
|
|
5107
|
-
REFERENCE: goTo(
|
|
5108
|
-
NUMBER: goTo(
|
|
5109
|
-
SYMBOL: [goToMulti(
|
|
5110
|
-
},
|
|
5111
|
-
[
|
|
5112
|
-
SPACE: goTo(
|
|
5113
|
-
OPERATOR: goTo(
|
|
5114
|
-
},
|
|
5115
|
-
[
|
|
5116
|
-
SPACE: goTo(
|
|
5117
|
-
OPERATOR: goTo(
|
|
5118
|
-
},
|
|
5119
|
-
[
|
|
5120
|
-
SPACE: goTo(
|
|
5121
|
-
OPERATOR: goTo(
|
|
5122
|
-
},
|
|
5123
|
-
[
|
|
5124
|
-
SPACE: goTo(
|
|
5125
|
-
NUMBER: goTo(
|
|
5126
|
-
REFERENCE: goTo(
|
|
5127
|
-
SYMBOL: goTo(
|
|
5128
|
-
},
|
|
5129
|
-
[
|
|
5130
|
-
SPACE: goTo(
|
|
5131
|
-
SYMBOL: goTo(
|
|
5132
|
-
REFERENCE: goTo(
|
|
5133
|
-
},
|
|
5134
|
-
[
|
|
5135
|
-
SPACE: goTo(
|
|
5136
|
-
NUMBER: goTo(
|
|
5137
|
-
REFERENCE: goTo(
|
|
5138
|
-
SYMBOL: goTo(
|
|
5139
|
-
},
|
|
5140
|
-
[
|
|
5068
|
+
[0]: {
|
|
5069
|
+
REFERENCE: goTo(2),
|
|
5070
|
+
NUMBER: goTo(4),
|
|
5071
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
5072
|
+
},
|
|
5073
|
+
[3]: {
|
|
5074
|
+
SPACE: goTo(3),
|
|
5075
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
5076
|
+
},
|
|
5077
|
+
[4]: {
|
|
5078
|
+
SPACE: goTo(4),
|
|
5079
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
5080
|
+
},
|
|
5081
|
+
[2]: {
|
|
5082
|
+
SPACE: goTo(2),
|
|
5083
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
5084
|
+
},
|
|
5085
|
+
[1]: {
|
|
5086
|
+
SPACE: goTo(1),
|
|
5087
|
+
NUMBER: goTo(7),
|
|
5088
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5089
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
5090
|
+
},
|
|
5091
|
+
[5]: {
|
|
5092
|
+
SPACE: goTo(5),
|
|
5093
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
5094
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
5095
|
+
},
|
|
5096
|
+
[6]: {
|
|
5097
|
+
SPACE: goTo(6),
|
|
5098
|
+
NUMBER: goTo(7),
|
|
5099
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5100
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
5101
|
+
},
|
|
5102
|
+
[7]: {}
|
|
5141
5103
|
};
|
|
5142
5104
|
/**
|
|
5143
5105
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -5147,7 +5109,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
5147
5109
|
*/
|
|
5148
5110
|
function matchReference(tokens) {
|
|
5149
5111
|
let head = 0;
|
|
5150
|
-
let transitions = machine[
|
|
5112
|
+
let transitions = machine[0];
|
|
5151
5113
|
let matchedTokens = "";
|
|
5152
5114
|
while (transitions !== void 0) {
|
|
5153
5115
|
const token = tokens[head++];
|
|
@@ -5156,7 +5118,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
5156
5118
|
const nextState = transition ? transition.goTo : void 0;
|
|
5157
5119
|
switch (nextState) {
|
|
5158
5120
|
case void 0: return null;
|
|
5159
|
-
case
|
|
5121
|
+
case 7:
|
|
5160
5122
|
matchedTokens += token.value;
|
|
5161
5123
|
tokens.splice(0, head);
|
|
5162
5124
|
return {
|
|
@@ -5855,8 +5817,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
5855
5817
|
changeType: "NONE",
|
|
5856
5818
|
range
|
|
5857
5819
|
};
|
|
5820
|
+
const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
|
|
5821
|
+
if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
|
|
5822
|
+
changeType: "RESIZE",
|
|
5823
|
+
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5824
|
+
};
|
|
5858
5825
|
if (cmd.position === "after") {
|
|
5859
|
-
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
|
|
5826
|
+
if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
|
|
5860
5827
|
changeType: "RESIZE",
|
|
5861
5828
|
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5862
5829
|
};
|
|
@@ -6103,6 +6070,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
6103
6070
|
//#endregion
|
|
6104
6071
|
//#region src/formulas/code_builder.ts
|
|
6105
6072
|
var FunctionCodeBuilder = class {
|
|
6073
|
+
scope;
|
|
6106
6074
|
code = "";
|
|
6107
6075
|
constructor(scope = new Scope()) {
|
|
6108
6076
|
this.scope = scope;
|
|
@@ -6118,6 +6086,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
6118
6086
|
}
|
|
6119
6087
|
};
|
|
6120
6088
|
var FunctionCodeImpl = class {
|
|
6089
|
+
scope;
|
|
6090
|
+
returnExpression;
|
|
6121
6091
|
code;
|
|
6122
6092
|
constructor(scope, code, returnExpression) {
|
|
6123
6093
|
this.scope = scope;
|
|
@@ -6200,6 +6170,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
6200
6170
|
* 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).
|
|
6201
6171
|
* */
|
|
6202
6172
|
var CompiledFormula = class CompiledFormula {
|
|
6173
|
+
sheetId;
|
|
6174
|
+
tokens;
|
|
6175
|
+
literalValues;
|
|
6176
|
+
symbols;
|
|
6177
|
+
isBadExpression;
|
|
6178
|
+
normalizedFormula;
|
|
6179
|
+
execute;
|
|
6203
6180
|
rangeDependencies;
|
|
6204
6181
|
hasDependencies;
|
|
6205
6182
|
constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
|
|
@@ -7805,7 +7782,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
7805
7782
|
constructor(results = []) {
|
|
7806
7783
|
if (!Array.isArray(results)) results = [results];
|
|
7807
7784
|
results = [...new Set(results)];
|
|
7808
|
-
this.reasons = results.filter((result) => result !==
|
|
7785
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
7809
7786
|
}
|
|
7810
7787
|
/**
|
|
7811
7788
|
* Static helper which returns a successful DispatchResult
|
|
@@ -8003,7 +7980,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8003
7980
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
8004
7981
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
8005
7982
|
sheetIdTo: sheetId
|
|
8006
|
-
}).isCancelledBecause(
|
|
7983
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
8007
7984
|
type: "warning",
|
|
8008
7985
|
sticky: false,
|
|
8009
7986
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -8137,22 +8114,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8137
8114
|
return textCell(value, format, formattedValue, position);
|
|
8138
8115
|
}
|
|
8139
8116
|
function isNumberResult(result) {
|
|
8140
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8117
|
+
return !!result && getEvaluatedCellType(result) === "number";
|
|
8141
8118
|
}
|
|
8142
8119
|
function isTextResult(result) {
|
|
8143
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8120
|
+
return !!result && getEvaluatedCellType(result) === "text";
|
|
8144
8121
|
}
|
|
8145
8122
|
function isErrorResult(result) {
|
|
8146
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8123
|
+
return !!result && getEvaluatedCellType(result) === "error";
|
|
8147
8124
|
}
|
|
8148
8125
|
function getEvaluatedCellType({ value, format }) {
|
|
8149
|
-
if (value === null) return
|
|
8150
|
-
else if (isEvaluationError(value)) return
|
|
8151
|
-
else if (isTextFormat(format)) return
|
|
8126
|
+
if (value === null) return "empty";
|
|
8127
|
+
else if (isEvaluationError(value)) return "error";
|
|
8128
|
+
else if (isTextFormat(format)) return "text";
|
|
8152
8129
|
switch (typeof value) {
|
|
8153
|
-
case "number": return
|
|
8154
|
-
case "boolean": return
|
|
8155
|
-
case "string": return
|
|
8130
|
+
case "number": return "number";
|
|
8131
|
+
case "boolean": return "boolean";
|
|
8132
|
+
case "string": return "text";
|
|
8156
8133
|
}
|
|
8157
8134
|
}
|
|
8158
8135
|
function textCell(value, format, formattedValue, position) {
|
|
@@ -8161,7 +8138,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8161
8138
|
format,
|
|
8162
8139
|
formattedValue,
|
|
8163
8140
|
position,
|
|
8164
|
-
type:
|
|
8141
|
+
type: "text",
|
|
8165
8142
|
isAutoSummable: true,
|
|
8166
8143
|
defaultAlign: "left"
|
|
8167
8144
|
};
|
|
@@ -8172,7 +8149,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8172
8149
|
format,
|
|
8173
8150
|
formattedValue,
|
|
8174
8151
|
position,
|
|
8175
|
-
type:
|
|
8152
|
+
type: "number",
|
|
8176
8153
|
isAutoSummable: true,
|
|
8177
8154
|
defaultAlign: "right"
|
|
8178
8155
|
};
|
|
@@ -8182,7 +8159,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8182
8159
|
value: null,
|
|
8183
8160
|
format,
|
|
8184
8161
|
formattedValue: "",
|
|
8185
|
-
type:
|
|
8162
|
+
type: "empty",
|
|
8186
8163
|
isAutoSummable: true,
|
|
8187
8164
|
defaultAlign: "left"
|
|
8188
8165
|
};
|
|
@@ -8193,7 +8170,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8193
8170
|
format,
|
|
8194
8171
|
formattedValue,
|
|
8195
8172
|
position,
|
|
8196
|
-
type:
|
|
8173
|
+
type: "number",
|
|
8197
8174
|
isAutoSummable: false,
|
|
8198
8175
|
defaultAlign: "right"
|
|
8199
8176
|
};
|
|
@@ -8204,7 +8181,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8204
8181
|
format,
|
|
8205
8182
|
formattedValue,
|
|
8206
8183
|
position,
|
|
8207
|
-
type:
|
|
8184
|
+
type: "boolean",
|
|
8208
8185
|
isAutoSummable: false,
|
|
8209
8186
|
defaultAlign: "center"
|
|
8210
8187
|
};
|
|
@@ -8215,7 +8192,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8215
8192
|
formattedValue: value,
|
|
8216
8193
|
message,
|
|
8217
8194
|
position,
|
|
8218
|
-
type:
|
|
8195
|
+
type: "error",
|
|
8219
8196
|
isAutoSummable: false,
|
|
8220
8197
|
defaultAlign: "center",
|
|
8221
8198
|
errorOriginPosition
|
|
@@ -9147,6 +9124,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9147
9124
|
ROUNDDOWN: [{
|
|
9148
9125
|
type: "NUMBER",
|
|
9149
9126
|
value: 0
|
|
9127
|
+
}],
|
|
9128
|
+
IFERROR: [{
|
|
9129
|
+
type: "NUMBER",
|
|
9130
|
+
value: 0
|
|
9150
9131
|
}]
|
|
9151
9132
|
};
|
|
9152
9133
|
/**
|
|
@@ -9458,15 +9439,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9458
9439
|
return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
|
|
9459
9440
|
}
|
|
9460
9441
|
function checkDataset(dataSource) {
|
|
9461
|
-
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
9462
|
-
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
9463
|
-
return
|
|
9442
|
+
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
9443
|
+
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
9444
|
+
return "Success";
|
|
9464
9445
|
}
|
|
9465
9446
|
function checkLabelRange(dataSource) {
|
|
9466
9447
|
if (dataSource.labelRange) {
|
|
9467
|
-
if (!rangeReference.test(dataSource.labelRange || "")) return
|
|
9448
|
+
if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
|
|
9468
9449
|
}
|
|
9469
|
-
return
|
|
9450
|
+
return "Success";
|
|
9470
9451
|
}
|
|
9471
9452
|
function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
|
|
9472
9453
|
return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
|
|
@@ -11131,7 +11112,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
11131
11112
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
11132
11113
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
11133
11114
|
if (!baseline) return "";
|
|
11134
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
11115
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
11135
11116
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
11136
11117
|
return baseline.formattedValue;
|
|
11137
11118
|
}
|
|
@@ -11160,23 +11141,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
11160
11141
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
11161
11142
|
}
|
|
11162
11143
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
11163
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
11144
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
11164
11145
|
const diff = keyValue.value - baseline.value;
|
|
11165
11146
|
if (diff > 0) return colorUp;
|
|
11166
11147
|
else if (diff < 0) return colorDown;
|
|
11167
11148
|
}
|
|
11168
11149
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
11169
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
11150
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
11170
11151
|
const diff = keyValue.value - baseline.value;
|
|
11171
11152
|
if (diff > 0) return "up";
|
|
11172
11153
|
else if (diff < 0) return "down";
|
|
11173
11154
|
return "neutral";
|
|
11174
11155
|
}
|
|
11175
11156
|
function checkKeyValue(definition) {
|
|
11176
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
11157
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
11177
11158
|
}
|
|
11178
11159
|
function checkBaseline(definition) {
|
|
11179
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
11160
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
11180
11161
|
}
|
|
11181
11162
|
const Path2DConstructor = globalThis.Path2D;
|
|
11182
11163
|
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");
|
|
@@ -11435,6 +11416,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
11435
11416
|
}, runtime).computeDesign();
|
|
11436
11417
|
}
|
|
11437
11418
|
var ScorecardChartConfigBuilder = class {
|
|
11419
|
+
runtime;
|
|
11438
11420
|
context;
|
|
11439
11421
|
width;
|
|
11440
11422
|
height;
|
|
@@ -12762,15 +12744,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12762
12744
|
};
|
|
12763
12745
|
}
|
|
12764
12746
|
|
|
12765
|
-
//#endregion
|
|
12766
|
-
//#region src/types/clipboard.ts
|
|
12767
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
12768
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
12769
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
12770
|
-
ClipboardMIMEType["Image"] = "image";
|
|
12771
|
-
return ClipboardMIMEType;
|
|
12772
|
-
}({});
|
|
12773
|
-
|
|
12774
12747
|
//#endregion
|
|
12775
12748
|
//#region src/types/conditional_formatting.ts
|
|
12776
12749
|
const cfOperators = [
|
|
@@ -15078,7 +15051,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15078
15051
|
copyInSheetId: (definition) => definition,
|
|
15079
15052
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15080
15053
|
transformDefinition: (definition) => definition,
|
|
15081
|
-
validateDefinition: () =>
|
|
15054
|
+
validateDefinition: () => "Success",
|
|
15082
15055
|
updateRanges: (definition) => definition,
|
|
15083
15056
|
getContextCreation: (definition) => definition,
|
|
15084
15057
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15143,42 +15116,42 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15143
15116
|
//#endregion
|
|
15144
15117
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
15145
15118
|
function isDataRangeValid(definition) {
|
|
15146
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
15119
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
15147
15120
|
}
|
|
15148
15121
|
function checkRangeLimits(check, batchValidations) {
|
|
15149
15122
|
return batchValidations((definition) => {
|
|
15150
15123
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
15151
|
-
return
|
|
15124
|
+
return "Success";
|
|
15152
15125
|
}, (definition) => {
|
|
15153
15126
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
15154
|
-
return
|
|
15127
|
+
return "Success";
|
|
15155
15128
|
});
|
|
15156
15129
|
}
|
|
15157
15130
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
15158
15131
|
return batchValidations((definition) => {
|
|
15159
15132
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
15160
|
-
return
|
|
15133
|
+
return "Success";
|
|
15161
15134
|
}, (definition) => {
|
|
15162
15135
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
15163
|
-
return
|
|
15136
|
+
return "Success";
|
|
15164
15137
|
});
|
|
15165
15138
|
}
|
|
15166
15139
|
function checkEmpty(value, valueName) {
|
|
15167
15140
|
if (value === "") switch (valueName) {
|
|
15168
|
-
case "rangeMin": return
|
|
15169
|
-
case "rangeMax": return
|
|
15141
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
15142
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
15170
15143
|
}
|
|
15171
|
-
return
|
|
15144
|
+
return "Success";
|
|
15172
15145
|
}
|
|
15173
15146
|
function checkValueIsNumberOrFormula(value, valueName) {
|
|
15174
|
-
if (value.startsWith("=")) return
|
|
15147
|
+
if (value.startsWith("=")) return "Success";
|
|
15175
15148
|
if (isNaN(value)) switch (valueName) {
|
|
15176
|
-
case "rangeMin": return
|
|
15177
|
-
case "rangeMax": return
|
|
15178
|
-
case "lowerInflectionPointValue": return
|
|
15179
|
-
case "upperInflectionPointValue": return
|
|
15149
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
15150
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
15151
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
15152
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
15180
15153
|
}
|
|
15181
|
-
return
|
|
15154
|
+
return "Success";
|
|
15182
15155
|
}
|
|
15183
15156
|
const GaugeChart = {
|
|
15184
15157
|
sequence: 50,
|
|
@@ -15300,7 +15273,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15300
15273
|
col: dataRange.zone.left,
|
|
15301
15274
|
row: dataRange.zone.top
|
|
15302
15275
|
});
|
|
15303
|
-
if (cell.type ===
|
|
15276
|
+
if (cell.type === "number") {
|
|
15304
15277
|
gaugeValue = cell.value;
|
|
15305
15278
|
formattedValue = cell.formattedValue;
|
|
15306
15279
|
format = cell.format;
|
|
@@ -15434,7 +15407,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15434
15407
|
copyInSheetId: (definition) => definition,
|
|
15435
15408
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15436
15409
|
transformDefinition: (definition) => definition,
|
|
15437
|
-
validateDefinition: () =>
|
|
15410
|
+
validateDefinition: () => "Success",
|
|
15438
15411
|
updateRanges: (definition) => definition,
|
|
15439
15412
|
getContextCreation: (definition) => definition,
|
|
15440
15413
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15518,7 +15491,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15518
15491
|
copyInSheetId: (definition) => definition,
|
|
15519
15492
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15520
15493
|
transformDefinition: (definition) => definition,
|
|
15521
|
-
validateDefinition: () =>
|
|
15494
|
+
validateDefinition: () => "Success",
|
|
15522
15495
|
updateRanges: (definition) => definition,
|
|
15523
15496
|
getContextCreation: (definition) => definition,
|
|
15524
15497
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15597,7 +15570,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15597
15570
|
copyInSheetId: (definition) => definition,
|
|
15598
15571
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15599
15572
|
transformDefinition: (definition) => definition,
|
|
15600
|
-
validateDefinition: () =>
|
|
15573
|
+
validateDefinition: () => "Success",
|
|
15601
15574
|
updateRanges: (definition) => definition,
|
|
15602
15575
|
getContextCreation: (definition) => definition,
|
|
15603
15576
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -16909,6 +16882,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
16909
16882
|
* Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
|
|
16910
16883
|
*/
|
|
16911
16884
|
var Animation = class {
|
|
16885
|
+
startValue;
|
|
16886
|
+
endValue;
|
|
16887
|
+
duration;
|
|
16888
|
+
callback;
|
|
16912
16889
|
startTime = void 0;
|
|
16913
16890
|
animationFrameId = null;
|
|
16914
16891
|
constructor(startValue, endValue, duration, callback) {
|
|
@@ -17137,6 +17114,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17137
17114
|
onKeyDown: {
|
|
17138
17115
|
type: Function,
|
|
17139
17116
|
optional: true
|
|
17117
|
+
},
|
|
17118
|
+
disableKeyboardNavigation: {
|
|
17119
|
+
type: Boolean,
|
|
17120
|
+
optional: true
|
|
17140
17121
|
}
|
|
17141
17122
|
};
|
|
17142
17123
|
static components = {};
|
|
@@ -17144,7 +17125,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17144
17125
|
menuRef = (0, _odoo_owl.useRef)("menu");
|
|
17145
17126
|
setup() {
|
|
17146
17127
|
(0, _odoo_owl.useEffect)(() => {
|
|
17147
|
-
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
|
|
17128
|
+
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
|
|
17148
17129
|
const selector = `[data-name='${this.props.hoveredMenuId}']`;
|
|
17149
17130
|
this.menuRef.el.querySelector(selector)?.focus();
|
|
17150
17131
|
}
|
|
@@ -17379,6 +17360,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17379
17360
|
}
|
|
17380
17361
|
};
|
|
17381
17362
|
var PopoverPositionContext = class {
|
|
17363
|
+
anchorRect;
|
|
17364
|
+
containerRect;
|
|
17365
|
+
propsMaxSize;
|
|
17366
|
+
spreadsheetOffset;
|
|
17367
|
+
lastPosition;
|
|
17382
17368
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
|
|
17383
17369
|
this.anchorRect = anchorRect;
|
|
17384
17370
|
this.containerRect = containerRect;
|
|
@@ -17573,7 +17559,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17573
17559
|
onScroll: this.onScroll.bind(this),
|
|
17574
17560
|
onKeyDown: this.onKeydown.bind(this),
|
|
17575
17561
|
hoveredMenuId,
|
|
17576
|
-
isHoveredMenuFocused: !this.subMenu.isOpen
|
|
17562
|
+
isHoveredMenuFocused: !this.subMenu.isOpen,
|
|
17563
|
+
disableKeyboardNavigation: this.props.disableKeyboardNavigation
|
|
17577
17564
|
};
|
|
17578
17565
|
}
|
|
17579
17566
|
get subMenuAnchorRect() {
|
|
@@ -18432,26 +18419,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18432
18419
|
//#region src/components/translations_terms.ts
|
|
18433
18420
|
const CfTerms = {
|
|
18434
18421
|
Errors: {
|
|
18435
|
-
[
|
|
18436
|
-
[
|
|
18437
|
-
[
|
|
18438
|
-
[
|
|
18439
|
-
[
|
|
18440
|
-
[
|
|
18441
|
-
[
|
|
18442
|
-
[
|
|
18443
|
-
[
|
|
18444
|
-
[
|
|
18445
|
-
[
|
|
18446
|
-
[
|
|
18447
|
-
[
|
|
18448
|
-
[
|
|
18449
|
-
[
|
|
18450
|
-
[
|
|
18451
|
-
[
|
|
18452
|
-
[
|
|
18453
|
-
[
|
|
18454
|
-
[
|
|
18422
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18423
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
18424
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
18425
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
18426
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
18427
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
18428
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
18429
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
18430
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
18431
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
18432
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
18433
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
18434
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
18435
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
18436
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
18437
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
18438
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
18439
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
18440
|
+
["EmptyTarget"]: _t("Target must contain at least one zone"),
|
|
18441
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
18455
18442
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
18456
18443
|
},
|
|
18457
18444
|
ColorScale: _t("Color scale"),
|
|
@@ -18470,17 +18457,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18470
18457
|
AggregatedChart: _t("Aggregate"),
|
|
18471
18458
|
Errors: {
|
|
18472
18459
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18473
|
-
[
|
|
18474
|
-
[
|
|
18475
|
-
[
|
|
18476
|
-
[
|
|
18477
|
-
[
|
|
18478
|
-
[
|
|
18479
|
-
[
|
|
18480
|
-
[
|
|
18481
|
-
[
|
|
18482
|
-
[
|
|
18483
|
-
[
|
|
18460
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18461
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18462
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18463
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18464
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18465
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18466
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
18467
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
18468
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
18469
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
18470
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
18484
18471
|
},
|
|
18485
18472
|
ColorScales: {
|
|
18486
18473
|
blues: _t("Blues"),
|
|
@@ -18500,16 +18487,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18500
18487
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
18501
18488
|
const SplitToColumnsTerms = { Errors: {
|
|
18502
18489
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
18503
|
-
[
|
|
18504
|
-
[
|
|
18505
|
-
[
|
|
18490
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
18491
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
18492
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
18506
18493
|
} };
|
|
18507
18494
|
const RemoveDuplicateTerms = { Errors: {
|
|
18508
18495
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
18509
|
-
[
|
|
18510
|
-
[
|
|
18511
|
-
[
|
|
18512
|
-
[
|
|
18496
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
18497
|
+
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
18498
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
18499
|
+
["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
|
|
18513
18500
|
} };
|
|
18514
18501
|
const DVTerms = {
|
|
18515
18502
|
DateIs: {
|
|
@@ -18537,19 +18524,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18537
18524
|
positiveNumber: _t("The value must be a positive number")
|
|
18538
18525
|
},
|
|
18539
18526
|
Errors: {
|
|
18540
|
-
[
|
|
18541
|
-
[
|
|
18542
|
-
[
|
|
18527
|
+
["InvalidRange"]: _t("The range is invalid."),
|
|
18528
|
+
["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
|
|
18529
|
+
["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
|
|
18543
18530
|
Unexpected: _t("The rule is invalid for an unknown reason.")
|
|
18544
18531
|
}
|
|
18545
18532
|
};
|
|
18546
18533
|
const TableTerms = {
|
|
18547
18534
|
Errors: {
|
|
18548
18535
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
18549
|
-
[
|
|
18550
|
-
[
|
|
18551
|
-
[
|
|
18552
|
-
[
|
|
18536
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
18537
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
18538
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18539
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
18553
18540
|
},
|
|
18554
18541
|
Checkboxes: {
|
|
18555
18542
|
hasFilters: _t("Filter button"),
|
|
@@ -18873,6 +18860,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18873
18860
|
* Represent a raw XML string
|
|
18874
18861
|
*/
|
|
18875
18862
|
var XMLString = class {
|
|
18863
|
+
xmlString;
|
|
18876
18864
|
/**
|
|
18877
18865
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
18878
18866
|
*/
|
|
@@ -19223,30 +19211,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19223
19211
|
|
|
19224
19212
|
//#endregion
|
|
19225
19213
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
19226
|
-
/**
|
|
19227
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
19228
|
-
*/
|
|
19229
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
19230
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
19231
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
19232
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
19233
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
19234
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
19235
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
19236
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
19237
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
19238
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
19239
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
19240
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
19241
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
19242
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
19243
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
19244
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
19245
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
19246
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
19247
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
19248
|
-
return WarningTypes;
|
|
19249
|
-
}({});
|
|
19250
19214
|
var XLSXImportWarningManager = class {
|
|
19251
19215
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
19252
19216
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -20006,7 +19970,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20006
19970
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
20007
19971
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
20008
19972
|
} catch (e) {}
|
|
20009
|
-
warningManager.generateNotSupportedWarning(
|
|
19973
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
20010
19974
|
}
|
|
20011
19975
|
function isFormatSupported(format) {
|
|
20012
19976
|
try {
|
|
@@ -20091,20 +20055,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20091
20055
|
return arrayToObject(formats, 1);
|
|
20092
20056
|
}
|
|
20093
20057
|
function addStyleWarnings(font, fill, warningManager) {
|
|
20094
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
20095
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
20058
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
20059
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
20096
20060
|
}
|
|
20097
20061
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
20098
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
20062
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
20099
20063
|
}
|
|
20100
20064
|
function addBorderWarnings(border, warningManager) {
|
|
20101
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
20065
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
20102
20066
|
}
|
|
20103
20067
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
20104
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20068
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
20105
20069
|
}
|
|
20106
20070
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
20107
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20071
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
20108
20072
|
}
|
|
20109
20073
|
|
|
20110
20074
|
//#endregion
|
|
@@ -20273,7 +20237,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20273
20237
|
lower: icons.upper
|
|
20274
20238
|
};
|
|
20275
20239
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
20276
|
-
warningManager.generateNotSupportedWarning(
|
|
20240
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
20277
20241
|
switch (key) {
|
|
20278
20242
|
case "upper":
|
|
20279
20243
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -20309,13 +20273,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20309
20273
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
20310
20274
|
}
|
|
20311
20275
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
20312
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
20313
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
20276
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
20277
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
20314
20278
|
if (cf.cfRules[0].dxfId) {
|
|
20315
20279
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
20316
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
20317
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
20318
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
20280
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
20281
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
20282
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
20319
20283
|
}
|
|
20320
20284
|
}
|
|
20321
20285
|
|
|
@@ -20481,13 +20445,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20481
20445
|
if (!dv) continue;
|
|
20482
20446
|
switch (dv.type) {
|
|
20483
20447
|
case "time":
|
|
20484
|
-
warningManager.generateNotSupportedWarning(
|
|
20448
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
20485
20449
|
break;
|
|
20486
20450
|
case "textLength":
|
|
20487
|
-
warningManager.generateNotSupportedWarning(
|
|
20451
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
20488
20452
|
break;
|
|
20489
20453
|
case "whole":
|
|
20490
|
-
warningManager.generateNotSupportedWarning(
|
|
20454
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
20491
20455
|
break;
|
|
20492
20456
|
case "decimal":
|
|
20493
20457
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -20499,7 +20463,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20499
20463
|
break;
|
|
20500
20464
|
case "date":
|
|
20501
20465
|
if (dv.operator === "notEqual") {
|
|
20502
|
-
warningManager.generateNotSupportedWarning(
|
|
20466
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
20503
20467
|
break;
|
|
20504
20468
|
}
|
|
20505
20469
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -20796,7 +20760,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20796
20760
|
}
|
|
20797
20761
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
20798
20762
|
const label = link.display || cellValue;
|
|
20799
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
20763
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
20800
20764
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
20801
20765
|
}
|
|
20802
20766
|
function getSheetDims(sheet) {
|
|
@@ -24000,7 +23964,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24000
23964
|
//#endregion
|
|
24001
23965
|
//#region src/helpers/ui/paste_interactive.ts
|
|
24002
23966
|
const handleCopyPasteResult = (env, command) => {
|
|
24003
|
-
if (env.model.dispatch(command.type).isCancelledBecause(
|
|
23967
|
+
if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
|
|
24004
23968
|
};
|
|
24005
23969
|
const PasteInteractiveContent = {
|
|
24006
23970
|
wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
|
|
@@ -24010,10 +23974,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24010
23974
|
};
|
|
24011
23975
|
function handlePasteResult(env, result) {
|
|
24012
23976
|
if (!result.isSuccessful) {
|
|
24013
|
-
if (result.reasons.includes(
|
|
24014
|
-
else if (result.reasons.includes(
|
|
24015
|
-
else if (result.reasons.includes(
|
|
24016
|
-
else if (result.reasons.includes(
|
|
23977
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
23978
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
23979
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
23980
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
24017
23981
|
}
|
|
24018
23982
|
}
|
|
24019
23983
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -24201,7 +24165,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24201
24165
|
};
|
|
24202
24166
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
24203
24167
|
const cell = getters.getEvaluatedCell(position);
|
|
24204
|
-
if (cell.type ===
|
|
24168
|
+
if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
|
|
24205
24169
|
isOpen: true,
|
|
24206
24170
|
props: { cellPosition: position },
|
|
24207
24171
|
Component: ErrorToolTip,
|
|
@@ -24250,7 +24214,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24250
24214
|
sortDirection,
|
|
24251
24215
|
sortOptions
|
|
24252
24216
|
});
|
|
24253
|
-
if (result.isCancelledBecause(
|
|
24217
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
24254
24218
|
const { col, row } = anchor;
|
|
24255
24219
|
env.model.selection.selectZone({
|
|
24256
24220
|
cell: {
|
|
@@ -24261,7 +24225,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24261
24225
|
});
|
|
24262
24226
|
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
24263
24227
|
}
|
|
24264
|
-
if (result.isCancelledBecause(
|
|
24228
|
+
if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
|
|
24265
24229
|
const { col, row } = anchor;
|
|
24266
24230
|
env.model.selection.selectZone({
|
|
24267
24231
|
cell: {
|
|
@@ -26912,6 +26876,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26912
26876
|
//#endregion
|
|
26913
26877
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
26914
26878
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
26879
|
+
args;
|
|
26915
26880
|
constructor(get, args) {
|
|
26916
26881
|
super(get);
|
|
26917
26882
|
this.args = args;
|
|
@@ -27815,6 +27780,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27815
27780
|
}
|
|
27816
27781
|
};
|
|
27817
27782
|
var ContainerWrapper = class {
|
|
27783
|
+
el;
|
|
27818
27784
|
constructor(el) {
|
|
27819
27785
|
this.el = el;
|
|
27820
27786
|
}
|
|
@@ -27886,6 +27852,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27886
27852
|
* This plugin handles this internal state.
|
|
27887
27853
|
*/
|
|
27888
27854
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
27855
|
+
initialRanges;
|
|
27856
|
+
inputHasSingleRange;
|
|
27857
|
+
colors;
|
|
27858
|
+
disabledRanges;
|
|
27889
27859
|
mutators = [
|
|
27890
27860
|
"resetWithRanges",
|
|
27891
27861
|
"focusById",
|
|
@@ -29008,8 +28978,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29008
28978
|
row,
|
|
29009
28979
|
col: position.col
|
|
29010
28980
|
});
|
|
29011
|
-
if (cell.type ===
|
|
29012
|
-
else if (cell.type ===
|
|
28981
|
+
if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
|
|
28982
|
+
else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
|
|
29013
28983
|
else cellTypesCount.number++;
|
|
29014
28984
|
}
|
|
29015
28985
|
const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
|
|
@@ -29370,8 +29340,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29370
29340
|
}
|
|
29371
29341
|
function parseOSClipboardContent(content) {
|
|
29372
29342
|
let spreadsheetContent = void 0;
|
|
29373
|
-
if (content[
|
|
29374
|
-
const textContent = content[
|
|
29343
|
+
if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
|
|
29344
|
+
const textContent = content["text/plain"] || "";
|
|
29375
29345
|
let imageBlob = void 0;
|
|
29376
29346
|
if (!textContent.trim()) {
|
|
29377
29347
|
for (const type of AllowedImageMimeTypes) if (content[type]) {
|
|
@@ -29498,10 +29468,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29498
29468
|
let detectedType = "empty";
|
|
29499
29469
|
for (const cell of cells) {
|
|
29500
29470
|
let type = null;
|
|
29501
|
-
if (cell.type ===
|
|
29471
|
+
if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
|
|
29502
29472
|
else if (cell.format?.includes("%")) type = "percentage";
|
|
29503
29473
|
else type = "number";
|
|
29504
|
-
else if (cell.type ===
|
|
29474
|
+
else if (cell.type === "text") type = "text";
|
|
29505
29475
|
if (type) {
|
|
29506
29476
|
const newCount = ++counts[type];
|
|
29507
29477
|
if (newCount > max) {
|
|
@@ -29536,7 +29506,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29536
29506
|
col: column.zone.left,
|
|
29537
29507
|
row: column.zone.top
|
|
29538
29508
|
});
|
|
29539
|
-
return ![
|
|
29509
|
+
return !["number", "empty"].includes(titleCell.type);
|
|
29540
29510
|
}
|
|
29541
29511
|
/**
|
|
29542
29512
|
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
|
|
@@ -29859,8 +29829,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29859
29829
|
config: tableConfig,
|
|
29860
29830
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29861
29831
|
});
|
|
29862
|
-
if (result.isCancelledBecause(
|
|
29863
|
-
else if (result.isCancelledBecause(
|
|
29832
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29833
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29864
29834
|
return result;
|
|
29865
29835
|
}
|
|
29866
29836
|
|
|
@@ -29888,9 +29858,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29888
29858
|
case "ok":
|
|
29889
29859
|
const clipboardId = env.model.getters.getClipboardId();
|
|
29890
29860
|
const target = env.model.getters.getSelectedZones();
|
|
29891
|
-
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
29861
|
+
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
|
|
29892
29862
|
else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
|
|
29893
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29863
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29894
29864
|
break;
|
|
29895
29865
|
case "notImplemented":
|
|
29896
29866
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -32435,13 +32405,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32435
32405
|
if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
|
|
32436
32406
|
}
|
|
32437
32407
|
get errorMessages() {
|
|
32438
|
-
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
32408
|
+
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32439
32409
|
}
|
|
32440
32410
|
get isDatasetInvalid() {
|
|
32441
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32411
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32442
32412
|
}
|
|
32443
32413
|
get isLabelInvalid() {
|
|
32444
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32414
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32445
32415
|
}
|
|
32446
32416
|
get dataSetsHaveTitleLabel() {
|
|
32447
32417
|
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() || "" });
|
|
@@ -32773,6 +32743,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32773
32743
|
//#endregion
|
|
32774
32744
|
//#region src/helpers/figures/chart.ts
|
|
32775
32745
|
var SpreadsheetChart = class SpreadsheetChart {
|
|
32746
|
+
getters;
|
|
32747
|
+
sheetId;
|
|
32748
|
+
definition;
|
|
32749
|
+
chartTypeBuilder;
|
|
32750
|
+
dataSourceBuilder;
|
|
32776
32751
|
dataSource;
|
|
32777
32752
|
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
32778
32753
|
this.getters = getters;
|
|
@@ -32810,9 +32785,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32810
32785
|
dataSource: newDataSource
|
|
32811
32786
|
};
|
|
32812
32787
|
}
|
|
32813
|
-
getSupportedChartTypes() {
|
|
32814
|
-
return new Set(this.dataSourceBuilder.supportedChartTypes);
|
|
32815
|
-
}
|
|
32816
32788
|
getRangeDefinition() {
|
|
32817
32789
|
return {
|
|
32818
32790
|
...this.definition,
|
|
@@ -32912,11 +32884,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32912
32884
|
type: "range",
|
|
32913
32885
|
dataSets: [],
|
|
32914
32886
|
dataSetsHaveTitle: false,
|
|
32887
|
+
labelRange: context.auxiliaryRange,
|
|
32915
32888
|
...context.dataSource
|
|
32916
32889
|
};
|
|
32917
32890
|
},
|
|
32918
32891
|
fromHierarchicalContextCreation(context) {
|
|
32919
|
-
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource
|
|
32892
|
+
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
32920
32893
|
type: "range",
|
|
32921
32894
|
dataSets: [],
|
|
32922
32895
|
dataSetsHaveTitle: false
|
|
@@ -33011,6 +32984,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33011
32984
|
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
33012
32985
|
};
|
|
33013
32986
|
},
|
|
32987
|
+
/**
|
|
32988
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
32989
|
+
* sheetIdTo.
|
|
32990
|
+
*/
|
|
33014
32991
|
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
33015
32992
|
return {
|
|
33016
32993
|
...dataSource,
|
|
@@ -33164,7 +33141,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33164
33141
|
fromExternalDefinition: () => ({ type: "none" }),
|
|
33165
33142
|
fromContextCreation: () => ({ type: "none" }),
|
|
33166
33143
|
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
33167
|
-
validate: () =>
|
|
33144
|
+
validate: () => "Success",
|
|
33168
33145
|
transform: () => ({ type: "none" }),
|
|
33169
33146
|
extractData: () => ({
|
|
33170
33147
|
dataSetsValues: [],
|
|
@@ -33499,10 +33476,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33499
33476
|
state = (0, _odoo_owl.useState)({ dataRangeDispatchResult: void 0 });
|
|
33500
33477
|
dataRange = this.props.definition.dataRange;
|
|
33501
33478
|
get configurationErrorMessages() {
|
|
33502
|
-
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33479
|
+
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33503
33480
|
}
|
|
33504
33481
|
get isDataRangeInvalid() {
|
|
33505
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33482
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33506
33483
|
}
|
|
33507
33484
|
onDataRangeChanged(ranges) {
|
|
33508
33485
|
this.dataRange = ranges[0];
|
|
@@ -33539,19 +33516,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33539
33516
|
});
|
|
33540
33517
|
}
|
|
33541
33518
|
get designErrorMessages() {
|
|
33542
|
-
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !==
|
|
33519
|
+
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33543
33520
|
}
|
|
33544
33521
|
get isRangeMinInvalid() {
|
|
33545
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33522
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
|
|
33546
33523
|
}
|
|
33547
33524
|
get isRangeMaxInvalid() {
|
|
33548
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33525
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
|
|
33549
33526
|
}
|
|
33550
33527
|
get isLowerInflectionPointInvalid() {
|
|
33551
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33528
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
|
|
33552
33529
|
}
|
|
33553
33530
|
get isUpperInflectionPointInvalid() {
|
|
33554
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33531
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
|
|
33555
33532
|
}
|
|
33556
33533
|
updateSectionColor(target, color) {
|
|
33557
33534
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33615,10 +33592,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33615
33592
|
}
|
|
33616
33593
|
checkSectionRuleFormulasAreValid(sectionRule) {
|
|
33617
33594
|
const reasons = /* @__PURE__ */ new Set();
|
|
33618
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(
|
|
33619
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(
|
|
33620
|
-
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(
|
|
33621
|
-
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(
|
|
33595
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
|
|
33596
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
|
|
33597
|
+
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
|
|
33598
|
+
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
|
|
33622
33599
|
return reasons;
|
|
33623
33600
|
}
|
|
33624
33601
|
valueIsValidNumber(value) {
|
|
@@ -33958,13 +33935,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33958
33935
|
keyValue = this.props.definition.keyValue;
|
|
33959
33936
|
baseline = this.props.definition.baseline;
|
|
33960
33937
|
get errorMessages() {
|
|
33961
|
-
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33938
|
+
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33962
33939
|
}
|
|
33963
33940
|
get isKeyValueInvalid() {
|
|
33964
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33941
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33965
33942
|
}
|
|
33966
33943
|
get isBaselineInvalid() {
|
|
33967
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33944
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
33968
33945
|
}
|
|
33969
33946
|
onKeyValueRangeChanged(ranges) {
|
|
33970
33947
|
this.keyValue = ranges[0];
|
|
@@ -34398,13 +34375,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34398
34375
|
});
|
|
34399
34376
|
setup() {
|
|
34400
34377
|
(0, _odoo_owl.useExternalListener)(window, "pointerdown", this.onExternalClick, { capture: true });
|
|
34401
|
-
const
|
|
34378
|
+
const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
|
|
34379
|
+
const supportedTypes = this.getSupportedChartTypes(definition);
|
|
34402
34380
|
for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
|
|
34403
34381
|
if (!supportedTypes.has(subtypeProperties.chartType)) continue;
|
|
34404
34382
|
if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
|
|
34405
34383
|
else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
|
|
34406
34384
|
}
|
|
34407
34385
|
}
|
|
34386
|
+
getSupportedChartTypes(definition) {
|
|
34387
|
+
let supportedTypes;
|
|
34388
|
+
if (definition.dataSource) {
|
|
34389
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
|
|
34390
|
+
supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
|
|
34391
|
+
} else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
|
|
34392
|
+
else throw new Error("Missing chart data source for a chart type that requires it");
|
|
34393
|
+
return supportedTypes;
|
|
34394
|
+
}
|
|
34408
34395
|
onExternalClick(ev) {
|
|
34409
34396
|
if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
|
|
34410
34397
|
this.closePopover();
|
|
@@ -34698,10 +34685,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34698
34685
|
{
|
|
34699
34686
|
name: _t("Unique values"),
|
|
34700
34687
|
types: [
|
|
34701
|
-
|
|
34702
|
-
|
|
34703
|
-
|
|
34704
|
-
|
|
34688
|
+
"number",
|
|
34689
|
+
"text",
|
|
34690
|
+
"boolean",
|
|
34691
|
+
"error"
|
|
34705
34692
|
],
|
|
34706
34693
|
compute: (values, locale) => {
|
|
34707
34694
|
const uniqueValues = /* @__PURE__ */ new Set();
|
|
@@ -34712,27 +34699,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34712
34699
|
},
|
|
34713
34700
|
{
|
|
34714
34701
|
name: _t("Sum"),
|
|
34715
|
-
types: [
|
|
34702
|
+
types: ["number"],
|
|
34716
34703
|
compute: (values, locale) => sum([[values]], locale)
|
|
34717
34704
|
},
|
|
34718
34705
|
{
|
|
34719
34706
|
name: _t("Average"),
|
|
34720
|
-
types: [
|
|
34707
|
+
types: ["number"],
|
|
34721
34708
|
compute: (values, locale) => average([[values]], locale)
|
|
34722
34709
|
},
|
|
34723
34710
|
{
|
|
34724
34711
|
name: _t("Median"),
|
|
34725
|
-
types: [
|
|
34712
|
+
types: ["number"],
|
|
34726
34713
|
compute: (values, locale) => median([[values]], locale) ?? ""
|
|
34727
34714
|
},
|
|
34728
34715
|
{
|
|
34729
34716
|
name: _t("Minimum value"),
|
|
34730
|
-
types: [
|
|
34717
|
+
types: ["number"],
|
|
34731
34718
|
compute: (values, locale) => min([[values]], locale).value
|
|
34732
34719
|
},
|
|
34733
34720
|
{
|
|
34734
34721
|
name: _t("Maximum value"),
|
|
34735
|
-
types: [
|
|
34722
|
+
types: ["number"],
|
|
34736
34723
|
compute: (values, locale) => max([[values]], locale).value
|
|
34737
34724
|
}
|
|
34738
34725
|
];
|
|
@@ -34879,12 +34866,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34879
34866
|
}
|
|
34880
34867
|
const { sheetId, col } = getters.getActivePosition();
|
|
34881
34868
|
this.selectedColumn = col;
|
|
34882
|
-
|
|
34869
|
+
const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
|
|
34883
34870
|
top: 0,
|
|
34884
34871
|
left: col,
|
|
34885
34872
|
bottom: getters.getNumberRows(sheetId) - 1,
|
|
34886
34873
|
right: col
|
|
34887
|
-
}).map((cell) => cell.format)
|
|
34874
|
+
}).map((cell) => cell.format);
|
|
34875
|
+
this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
|
|
34888
34876
|
const numberOfRows = getters.getNumberRows(sheetId);
|
|
34889
34877
|
const cells = [];
|
|
34890
34878
|
const numericValues = [];
|
|
@@ -34902,20 +34890,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34902
34890
|
row
|
|
34903
34891
|
});
|
|
34904
34892
|
cells.push(evaluatedCell);
|
|
34905
|
-
if (evaluatedCell.type !==
|
|
34893
|
+
if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
|
|
34906
34894
|
values.push({
|
|
34907
34895
|
row,
|
|
34908
34896
|
col,
|
|
34909
34897
|
value: evaluatedCell.value
|
|
34910
34898
|
});
|
|
34911
|
-
if (evaluatedCell.type ===
|
|
34899
|
+
if (evaluatedCell.type === "number") numericValues.push({
|
|
34912
34900
|
row,
|
|
34913
34901
|
col,
|
|
34914
34902
|
value: evaluatedCell.value
|
|
34915
34903
|
});
|
|
34916
34904
|
}
|
|
34917
34905
|
}
|
|
34918
|
-
|
|
34906
|
+
const locale = getters.getLocale();
|
|
34907
|
+
this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
|
|
34919
34908
|
this.numericValues = numericValues;
|
|
34920
34909
|
this.values = values;
|
|
34921
34910
|
this.countChartData = this.computeCountChartData();
|
|
@@ -35249,7 +35238,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35249
35238
|
updateConditionalFormat(newCf) {
|
|
35250
35239
|
const ranges = newCf.ranges || this.state.ranges;
|
|
35251
35240
|
if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35252
|
-
if (!newCf.suppressErrors) this.state.errors = [
|
|
35241
|
+
if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
|
|
35253
35242
|
return;
|
|
35254
35243
|
}
|
|
35255
35244
|
const sheetId = this.model.getters.getActiveSheetId();
|
|
@@ -35264,11 +35253,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35264
35253
|
sheetId
|
|
35265
35254
|
});
|
|
35266
35255
|
if (result.isSuccessful) this.state.hasEditedCf = true;
|
|
35267
|
-
const reasons = result.reasons.filter((r) => r !==
|
|
35256
|
+
const reasons = result.reasons.filter((r) => r !== "NoChanges");
|
|
35268
35257
|
if (!newCf.suppressErrors) this.state.errors = reasons;
|
|
35269
35258
|
}
|
|
35270
35259
|
get isRangeValid() {
|
|
35271
|
-
return this.state.errors.includes(
|
|
35260
|
+
return this.state.errors.includes("EmptyRange");
|
|
35272
35261
|
}
|
|
35273
35262
|
get errorMessages() {
|
|
35274
35263
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35522,9 +35511,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35522
35511
|
isValueInvalid() {
|
|
35523
35512
|
const errors = this.props.store.state.errors;
|
|
35524
35513
|
switch (this.props.thresholdType) {
|
|
35525
|
-
case "minimum": return errors.includes(
|
|
35526
|
-
case "midpoint": return errors.includes(
|
|
35527
|
-
case "maximum": return errors.includes(
|
|
35514
|
+
case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
|
|
35515
|
+
case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
|
|
35516
|
+
case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
|
|
35528
35517
|
default: return false;
|
|
35529
35518
|
}
|
|
35530
35519
|
}
|
|
@@ -35632,8 +35621,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35632
35621
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35633
35622
|
const errors = this.props.store.state.errors;
|
|
35634
35623
|
switch (inflectionPoint) {
|
|
35635
|
-
case "lowerInflectionPoint": return errors.includes(
|
|
35636
|
-
case "upperInflectionPoint": return errors.includes(
|
|
35624
|
+
case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35625
|
+
case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35637
35626
|
default: return true;
|
|
35638
35627
|
}
|
|
35639
35628
|
}
|
|
@@ -36050,12 +36039,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
36050
36039
|
//#endregion
|
|
36051
36040
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
36052
36041
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
36053
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
36054
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
36055
|
-
Direction[Direction["current"] = 0] = "current";
|
|
36056
|
-
Direction[Direction["next"] = 1] = "next";
|
|
36057
|
-
return Direction;
|
|
36058
|
-
}(Direction || {});
|
|
36059
36042
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
36060
36043
|
mutators = [
|
|
36061
36044
|
"updateSearchOptions",
|
|
@@ -36117,13 +36100,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
36117
36100
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
36118
36101
|
}
|
|
36119
36102
|
selectPreviousMatch() {
|
|
36120
|
-
this.selectNextCell(
|
|
36103
|
+
this.selectNextCell(-1, {
|
|
36121
36104
|
jumpToMatchSheet: true,
|
|
36122
36105
|
updateSelection: true
|
|
36123
36106
|
});
|
|
36124
36107
|
}
|
|
36125
36108
|
selectNextMatch() {
|
|
36126
|
-
this.selectNextCell(
|
|
36109
|
+
this.selectNextCell(1, {
|
|
36127
36110
|
jumpToMatchSheet: true,
|
|
36128
36111
|
updateSelection: true
|
|
36129
36112
|
});
|
|
@@ -36206,7 +36189,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
36206
36189
|
refreshSearch(options) {
|
|
36207
36190
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
36208
36191
|
this.findMatches();
|
|
36209
|
-
this.selectNextCell(
|
|
36192
|
+
this.selectNextCell(0, options);
|
|
36210
36193
|
}
|
|
36211
36194
|
getSheetsInSearchOrder() {
|
|
36212
36195
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37290,10 +37273,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37290
37273
|
}
|
|
37291
37274
|
function handleResult(env, result) {
|
|
37292
37275
|
if (!result.isSuccessful) {
|
|
37293
|
-
if (result.isCancelledBecause(
|
|
37294
|
-
else if (result.isCancelledBecause(
|
|
37295
|
-
else if (result.isCancelledBecause(
|
|
37296
|
-
else if (result.isCancelledBecause(
|
|
37276
|
+
if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
|
|
37277
|
+
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."));
|
|
37278
|
+
else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
|
|
37279
|
+
else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
|
|
37297
37280
|
}
|
|
37298
37281
|
}
|
|
37299
37282
|
|
|
@@ -37380,6 +37363,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37380
37363
|
//#endregion
|
|
37381
37364
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37382
37365
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37366
|
+
pivotId;
|
|
37367
|
+
initialMeasure;
|
|
37383
37368
|
mutators = [
|
|
37384
37369
|
"cancelMeasureDisplayEdition",
|
|
37385
37370
|
"updateMeasureDisplayType",
|
|
@@ -37571,7 +37556,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37571
37556
|
col,
|
|
37572
37557
|
row
|
|
37573
37558
|
};
|
|
37574
|
-
if (
|
|
37559
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
37575
37560
|
}
|
|
37576
37561
|
return positions;
|
|
37577
37562
|
}
|
|
@@ -38322,7 +38307,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38322
38307
|
});
|
|
38323
38308
|
let text;
|
|
38324
38309
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38325
|
-
else if (result.isCancelledBecause(
|
|
38310
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38326
38311
|
else text = _t("Pivot duplication failed.");
|
|
38327
38312
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38328
38313
|
this.env.notifyUser({
|
|
@@ -38399,13 +38384,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38399
38384
|
break;
|
|
38400
38385
|
}
|
|
38401
38386
|
return {
|
|
38387
|
+
/**
|
|
38388
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38389
|
+
*/
|
|
38402
38390
|
id: measure.id,
|
|
38391
|
+
/**
|
|
38392
|
+
* Display name of the measure
|
|
38393
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38394
|
+
*/
|
|
38403
38395
|
get displayName() {
|
|
38404
38396
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38405
38397
|
},
|
|
38406
38398
|
userDefinedName: measure.userDefinedName,
|
|
38399
|
+
/**
|
|
38400
|
+
* Get the name of the field of the measure
|
|
38401
|
+
*/
|
|
38407
38402
|
fieldName,
|
|
38403
|
+
/**
|
|
38404
|
+
* Get the aggregator of the measure
|
|
38405
|
+
*/
|
|
38408
38406
|
aggregator,
|
|
38407
|
+
/**
|
|
38408
|
+
* Get the type of the measure field
|
|
38409
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38410
|
+
*/
|
|
38409
38411
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38410
38412
|
isValid,
|
|
38411
38413
|
isHidden: measure.isHidden,
|
|
@@ -38419,10 +38421,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38419
38421
|
const type = field?.type ?? "integer";
|
|
38420
38422
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38421
38423
|
return {
|
|
38424
|
+
/**
|
|
38425
|
+
* Get the display name of the dimension
|
|
38426
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38427
|
+
*/
|
|
38422
38428
|
displayName: field?.string ?? dimension.fieldName,
|
|
38429
|
+
/**
|
|
38430
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38431
|
+
* e.g. "stage_id", "create_date:month"
|
|
38432
|
+
*/
|
|
38423
38433
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38434
|
+
/**
|
|
38435
|
+
* Get the name of the field of the dimension
|
|
38436
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38437
|
+
*/
|
|
38424
38438
|
fieldName: dimension.fieldName,
|
|
38439
|
+
/**
|
|
38440
|
+
* Get the aggregate operator of the dimension
|
|
38441
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38442
|
+
*/
|
|
38425
38443
|
granularity,
|
|
38444
|
+
/**
|
|
38445
|
+
* Get the type of the field of the dimension
|
|
38446
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38447
|
+
*/
|
|
38426
38448
|
type: field?.isCustomField ? "custom" : type,
|
|
38427
38449
|
order: dimension.order,
|
|
38428
38450
|
isValid: !!field,
|
|
@@ -39182,15 +39204,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39182
39204
|
|
|
39183
39205
|
//#endregion
|
|
39184
39206
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39185
|
-
|
|
39186
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39187
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39188
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39189
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39190
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39191
|
-
return ReloadType;
|
|
39192
|
-
}(ReloadType || {});
|
|
39193
|
-
/**
|
|
39207
|
+
/**
|
|
39194
39208
|
* This class represents a pivot table that is created from a range of cells.
|
|
39195
39209
|
* It will extract the fields from the first row of the range and the data from
|
|
39196
39210
|
* the rest of the rows.
|
|
@@ -39232,15 +39246,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39232
39246
|
}
|
|
39233
39247
|
init(params = {}) {
|
|
39234
39248
|
if (!this._definition || params.reload) {
|
|
39235
|
-
this.reload(
|
|
39249
|
+
this.reload(4);
|
|
39236
39250
|
this.needsReevaluation = false;
|
|
39237
39251
|
}
|
|
39238
39252
|
}
|
|
39239
39253
|
reload(type) {
|
|
39240
|
-
if (type ===
|
|
39241
|
-
if (type >=
|
|
39242
|
-
if (type >=
|
|
39243
|
-
if (type >=
|
|
39254
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39255
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39256
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39257
|
+
if (type >= 1) {
|
|
39244
39258
|
this.collapsedTable = void 0;
|
|
39245
39259
|
this.expandedTable = void 0;
|
|
39246
39260
|
}
|
|
@@ -39249,13 +39263,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39249
39263
|
const actualDefinition = this.coreDefinition;
|
|
39250
39264
|
this.coreDefinition = nextDefinition;
|
|
39251
39265
|
if (this._definition) {
|
|
39252
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39266
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39253
39267
|
this.reload(reloadType);
|
|
39254
39268
|
}
|
|
39255
39269
|
}
|
|
39256
39270
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39257
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39258
|
-
return
|
|
39271
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39272
|
+
return 4;
|
|
39259
39273
|
}
|
|
39260
39274
|
get isInvalidRange() {
|
|
39261
39275
|
return !!this.invalidRangeError;
|
|
@@ -39328,7 +39342,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39328
39342
|
if (dataEntries.length === 0) return { value: "" };
|
|
39329
39343
|
const measure = this.getMeasure(measureId);
|
|
39330
39344
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39331
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39345
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39332
39346
|
const aggregator = measure.aggregator;
|
|
39333
39347
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39334
39348
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39430,16 +39444,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39430
39444
|
return this.definition.getDimension(nameWithGranularity);
|
|
39431
39445
|
}
|
|
39432
39446
|
getTypeFromZone(sheetId, zone) {
|
|
39433
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39447
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39434
39448
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39435
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39436
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39437
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39449
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39450
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39451
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39438
39452
|
return "char";
|
|
39439
39453
|
}
|
|
39440
39454
|
assertCellIsValidField(col, row, cell) {
|
|
39441
|
-
if (cell.type ===
|
|
39442
|
-
if (cell.type ===
|
|
39455
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39456
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39443
39457
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39444
39458
|
}
|
|
39445
39459
|
/**
|
|
@@ -39498,7 +39512,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39498
39512
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39499
39513
|
if (cell.value === "") entry[field.name] = {
|
|
39500
39514
|
value: null,
|
|
39501
|
-
type:
|
|
39515
|
+
type: "empty",
|
|
39502
39516
|
formattedValue: ""
|
|
39503
39517
|
};
|
|
39504
39518
|
else entry[field.name] = cell;
|
|
@@ -39511,7 +39525,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39511
39525
|
if (!baseValue || !parentField) {
|
|
39512
39526
|
entry[customFieldName] = {
|
|
39513
39527
|
value: null,
|
|
39514
|
-
type:
|
|
39528
|
+
type: "empty",
|
|
39515
39529
|
formattedValue: ""
|
|
39516
39530
|
};
|
|
39517
39531
|
continue;
|
|
@@ -39524,7 +39538,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39524
39538
|
}
|
|
39525
39539
|
entry["__count"] = {
|
|
39526
39540
|
value: 1,
|
|
39527
|
-
type:
|
|
39541
|
+
type: "number",
|
|
39528
39542
|
formattedValue: "1"
|
|
39529
39543
|
};
|
|
39530
39544
|
dataEntries.push(entry);
|
|
@@ -39537,7 +39551,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39537
39551
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39538
39552
|
entry[dimension.nameWithGranularity] = {
|
|
39539
39553
|
value,
|
|
39540
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39554
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39541
39555
|
format: entry[dimension.fieldName]?.format,
|
|
39542
39556
|
formattedValue: formatValue(valueToFormat, {
|
|
39543
39557
|
locale,
|
|
@@ -39616,6 +39630,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39616
39630
|
function getFirstPivotFunction(compiledFormula, getters) {
|
|
39617
39631
|
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
|
|
39618
39632
|
}
|
|
39633
|
+
function getPivotFunctions(compiledFormula, getters) {
|
|
39634
|
+
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
|
|
39635
|
+
}
|
|
39619
39636
|
/**
|
|
39620
39637
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
39621
39638
|
* present in the given formula.
|
|
@@ -39692,6 +39709,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39692
39709
|
//#endregion
|
|
39693
39710
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39694
39711
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39712
|
+
pivotId;
|
|
39713
|
+
updateMode;
|
|
39695
39714
|
mutators = [
|
|
39696
39715
|
"reset",
|
|
39697
39716
|
"deferUpdates",
|
|
@@ -39853,7 +39872,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39853
39872
|
};
|
|
39854
39873
|
}
|
|
39855
39874
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39856
|
-
|
|
39875
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39876
|
+
this.draft = cleanedWithGranularity;
|
|
39857
39877
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39858
39878
|
}
|
|
39859
39879
|
/**
|
|
@@ -41609,7 +41629,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41609
41629
|
separator,
|
|
41610
41630
|
addNewColumns
|
|
41611
41631
|
});
|
|
41612
|
-
if (result.isCancelledBecause(
|
|
41632
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
41613
41633
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
41614
41634
|
separator,
|
|
41615
41635
|
addNewColumns,
|
|
@@ -41691,8 +41711,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41691
41711
|
}).reasons;
|
|
41692
41712
|
const errors = /* @__PURE__ */ new Set();
|
|
41693
41713
|
for (const reason of cancelledReasons) switch (reason) {
|
|
41694
|
-
case
|
|
41695
|
-
case
|
|
41714
|
+
case "SplitWillOverwriteContent":
|
|
41715
|
+
case "EmptySplitSeparator": break;
|
|
41696
41716
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
41697
41717
|
}
|
|
41698
41718
|
return Array.from(errors);
|
|
@@ -41703,7 +41723,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41703
41723
|
separator: this.separatorValue,
|
|
41704
41724
|
addNewColumns: this.state.addNewColumns,
|
|
41705
41725
|
force: false
|
|
41706
|
-
}).reasons.includes(
|
|
41726
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
41707
41727
|
return warnings;
|
|
41708
41728
|
}
|
|
41709
41729
|
get separatorValue() {
|
|
@@ -42334,7 +42354,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42334
42354
|
if (env.model.dispatch(cmd, {
|
|
42335
42355
|
sheetId,
|
|
42336
42356
|
quantity: base
|
|
42337
|
-
}).isCancelledBecause(
|
|
42357
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
42338
42358
|
}
|
|
42339
42359
|
|
|
42340
42360
|
//#endregion
|
|
@@ -42514,11 +42534,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42514
42534
|
}
|
|
42515
42535
|
getLiteralFingerprint(position) {
|
|
42516
42536
|
switch (this.getters.getEvaluatedCell(position).type) {
|
|
42517
|
-
case
|
|
42518
|
-
case
|
|
42519
|
-
case
|
|
42520
|
-
case
|
|
42521
|
-
case
|
|
42537
|
+
case "number":
|
|
42538
|
+
case "boolean": return DATA_FINGERPRINT;
|
|
42539
|
+
case "text":
|
|
42540
|
+
case "empty":
|
|
42541
|
+
case "error": return;
|
|
42522
42542
|
}
|
|
42523
42543
|
}
|
|
42524
42544
|
};
|
|
@@ -42802,7 +42822,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42802
42822
|
function interactiveCut(env) {
|
|
42803
42823
|
const result = env.model.dispatch("CUT");
|
|
42804
42824
|
if (!result.isSuccessful) {
|
|
42805
|
-
if (result.isCancelledBecause(
|
|
42825
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
42806
42826
|
}
|
|
42807
42827
|
}
|
|
42808
42828
|
|
|
@@ -42873,8 +42893,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42873
42893
|
sheetId,
|
|
42874
42894
|
target
|
|
42875
42895
|
});
|
|
42876
|
-
if (result.isCancelledBecause(
|
|
42877
|
-
else if (result.isCancelledBecause(
|
|
42896
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
42897
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
42878
42898
|
env.model.dispatch("ADD_MERGE", {
|
|
42879
42899
|
sheetId,
|
|
42880
42900
|
target,
|
|
@@ -43111,7 +43131,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43111
43131
|
if (!pivotId) return false;
|
|
43112
43132
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
43113
43133
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
43114
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
43134
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
43115
43135
|
},
|
|
43116
43136
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
43117
43137
|
};
|
|
@@ -43752,7 +43772,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43752
43772
|
end: group.end
|
|
43753
43773
|
});
|
|
43754
43774
|
if (!result.isSuccessful) {
|
|
43755
|
-
if (result.isCancelledBecause(
|
|
43775
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
43756
43776
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
43757
43777
|
env.raiseError(errorMessage);
|
|
43758
43778
|
}
|
|
@@ -44707,11 +44727,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44707
44727
|
if (cell?.content.startsWith("'")) return { text: cell.content };
|
|
44708
44728
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
44709
44729
|
switch (type) {
|
|
44710
|
-
case
|
|
44711
|
-
case
|
|
44712
|
-
case
|
|
44713
|
-
case
|
|
44714
|
-
case
|
|
44730
|
+
case "empty": return { text: "" };
|
|
44731
|
+
case "text":
|
|
44732
|
+
case "error": return { text: value };
|
|
44733
|
+
case "boolean": return { text: formattedValue };
|
|
44734
|
+
case "number":
|
|
44715
44735
|
if (format && isDateTimeFormat(format)) {
|
|
44716
44736
|
if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
|
|
44717
44737
|
return { text: formatValue(value, {
|
|
@@ -44768,7 +44788,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44768
44788
|
startEdition(text, selection) {
|
|
44769
44789
|
if (this.getters.isCurrentSheetLocked()) {
|
|
44770
44790
|
this.model.trigger("command-rejected", {
|
|
44771
|
-
result: new DispatchResult(
|
|
44791
|
+
result: new DispatchResult("SheetLocked"),
|
|
44772
44792
|
command: { sheetId: this.getters.getActiveSheetId() }
|
|
44773
44793
|
});
|
|
44774
44794
|
return "NoStateChange";
|
|
@@ -46393,7 +46413,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46393
46413
|
elements,
|
|
46394
46414
|
position: this.state.position
|
|
46395
46415
|
});
|
|
46396
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
46416
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46397
46417
|
}
|
|
46398
46418
|
_selectElement(index, addDistinctHeader) {
|
|
46399
46419
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -46530,8 +46550,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46530
46550
|
position: this.state.position
|
|
46531
46551
|
});
|
|
46532
46552
|
if (!result.isSuccessful) {
|
|
46533
|
-
if (result.reasons.includes(
|
|
46534
|
-
else if (result.reasons.includes(
|
|
46553
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46554
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
46535
46555
|
}
|
|
46536
46556
|
}
|
|
46537
46557
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -46608,6 +46628,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46608
46628
|
//#region src/stores/grid_renderer_store.ts
|
|
46609
46629
|
const CELL_ANIMATION_DURATION = 200;
|
|
46610
46630
|
var GridRenderer = class extends DisposableStore {
|
|
46631
|
+
renderer;
|
|
46611
46632
|
fingerprints;
|
|
46612
46633
|
hoveredTables;
|
|
46613
46634
|
hoveredIcon;
|
|
@@ -47092,7 +47113,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47092
47113
|
const nextCell = this.getters.getEvaluatedCell(position);
|
|
47093
47114
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
47094
47115
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47095
|
-
if (nextCell.type !==
|
|
47116
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
|
|
47096
47117
|
col++;
|
|
47097
47118
|
}
|
|
47098
47119
|
return col;
|
|
@@ -47108,7 +47129,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47108
47129
|
const previousCell = this.getters.getEvaluatedCell(position);
|
|
47109
47130
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
47110
47131
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47111
|
-
if (previousCell.type !==
|
|
47132
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
|
|
47112
47133
|
col--;
|
|
47113
47134
|
}
|
|
47114
47135
|
return col;
|
|
@@ -47118,7 +47139,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47118
47139
|
const { align } = this.getters.getCellStyle(position);
|
|
47119
47140
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
47120
47141
|
if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
|
|
47121
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
47142
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
47122
47143
|
return align || evaluatedCell.defaultAlign;
|
|
47123
47144
|
}
|
|
47124
47145
|
createZoneBox(viewports, sheetId, zone, viewport) {
|
|
@@ -47163,12 +47184,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47163
47184
|
style,
|
|
47164
47185
|
dataBarFill,
|
|
47165
47186
|
overlayColor: this.hoveredTables.overlayColors.get(position),
|
|
47166
|
-
isError: cell.type ===
|
|
47187
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
|
|
47167
47188
|
icons: cellIcons,
|
|
47168
47189
|
disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
|
|
47169
47190
|
};
|
|
47170
47191
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
47171
|
-
if (cell.type ===
|
|
47192
|
+
if (cell.type === "empty" || box.icons.center) return box;
|
|
47172
47193
|
/** Content */
|
|
47173
47194
|
const wrapping = style.wrapping || "overflow";
|
|
47174
47195
|
const wrapText = wrapping === "wrap" && !showFormula;
|
|
@@ -48344,7 +48365,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48344
48365
|
"Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
|
|
48345
48366
|
};
|
|
48346
48367
|
focusComposerFromActiveCell() {
|
|
48347
|
-
this.env.model.getters.getActiveCell().type ===
|
|
48368
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
48348
48369
|
}
|
|
48349
48370
|
editOrMoveInSelection(direction) {
|
|
48350
48371
|
if (this.isSingleCellOrMergeSelection()) {
|
|
@@ -48469,7 +48490,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48469
48490
|
sheetId,
|
|
48470
48491
|
col,
|
|
48471
48492
|
row
|
|
48472
|
-
}).type ===
|
|
48493
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
48473
48494
|
else this.onComposerContentFocused();
|
|
48474
48495
|
}
|
|
48475
48496
|
processArrows(ev) {
|
|
@@ -48550,18 +48571,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48550
48571
|
if (!clipboardData) return;
|
|
48551
48572
|
const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
|
|
48552
48573
|
const osClipboard = { content: {
|
|
48553
|
-
[
|
|
48554
|
-
[
|
|
48574
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
48575
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
48555
48576
|
} };
|
|
48556
48577
|
if (image) osClipboard.content[image.type] = image;
|
|
48557
48578
|
const target = this.env.model.getters.getSelectedZones();
|
|
48558
48579
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
48559
|
-
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
48580
|
+
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
|
|
48560
48581
|
else {
|
|
48561
48582
|
const osClipboardContent = parseOSClipboardContent(osClipboard.content);
|
|
48562
48583
|
await interactivePasteFromOS(this.env, target, osClipboardContent);
|
|
48563
48584
|
}
|
|
48564
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
48585
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
48565
48586
|
}
|
|
48566
48587
|
clearFormatting() {
|
|
48567
48588
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -49048,7 +49069,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49048
49069
|
* There should not be any side effects in this method.
|
|
49049
49070
|
*/
|
|
49050
49071
|
allowDispatch(command) {
|
|
49051
|
-
return
|
|
49072
|
+
return "Success";
|
|
49052
49073
|
}
|
|
49053
49074
|
/**
|
|
49054
49075
|
* This method is useful when a plugin needs to perform some action before a
|
|
@@ -49084,10 +49105,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49084
49105
|
for (const validation of validations) {
|
|
49085
49106
|
let results = validation.call(this, toValidate);
|
|
49086
49107
|
if (!Array.isArray(results)) results = [results];
|
|
49087
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
49108
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
49088
49109
|
if (cancelledReasons.length) return cancelledReasons;
|
|
49089
49110
|
}
|
|
49090
|
-
return
|
|
49111
|
+
return "Success";
|
|
49091
49112
|
};
|
|
49092
49113
|
}
|
|
49093
49114
|
checkValidations(command, ...validations) {
|
|
@@ -49144,7 +49165,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49144
49165
|
allowDispatch(cmd) {
|
|
49145
49166
|
switch (cmd.type) {
|
|
49146
49167
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
49147
|
-
default: return
|
|
49168
|
+
default: return "Success";
|
|
49148
49169
|
}
|
|
49149
49170
|
}
|
|
49150
49171
|
handle(cmd) {
|
|
@@ -49558,8 +49579,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49558
49579
|
checkBordersUnchanged(cmd) {
|
|
49559
49580
|
const currentBorder = this.getCellBorder(cmd);
|
|
49560
49581
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
49561
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
49562
|
-
return
|
|
49582
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
49583
|
+
return "Success";
|
|
49563
49584
|
}
|
|
49564
49585
|
import(data) {
|
|
49565
49586
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
|
|
@@ -49607,13 +49628,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49607
49628
|
allowDispatch(cmd) {
|
|
49608
49629
|
switch (cmd.type) {
|
|
49609
49630
|
case "CREATE_CAROUSEL":
|
|
49610
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
49611
|
-
return
|
|
49631
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
|
|
49632
|
+
return "Success";
|
|
49612
49633
|
case "UPDATE_CAROUSEL":
|
|
49613
|
-
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return
|
|
49614
|
-
return
|
|
49634
|
+
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
49635
|
+
return "Success";
|
|
49615
49636
|
}
|
|
49616
|
-
return
|
|
49637
|
+
return "Success";
|
|
49617
49638
|
}
|
|
49618
49639
|
handle(cmd) {
|
|
49619
49640
|
switch (cmd.type) {
|
|
@@ -50233,9 +50254,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50233
50254
|
switch (cmd.type) {
|
|
50234
50255
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
50235
50256
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
50236
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
50257
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
50237
50258
|
case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
|
|
50238
|
-
default: return
|
|
50259
|
+
default: return "Success";
|
|
50239
50260
|
}
|
|
50240
50261
|
}
|
|
50241
50262
|
handle(cmd) {
|
|
@@ -50591,28 +50612,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50591
50612
|
}
|
|
50592
50613
|
checkCellOutOfSheet(cmd) {
|
|
50593
50614
|
const { sheetId, col, row } = cmd;
|
|
50594
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50595
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
50615
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50616
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
50596
50617
|
}
|
|
50597
50618
|
checkUselessClearCell(cmd) {
|
|
50598
50619
|
const cell = this.getters.getCell(cmd);
|
|
50599
|
-
if (!cell) return
|
|
50600
|
-
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return
|
|
50601
|
-
return
|
|
50620
|
+
if (!cell) return "NoChanges";
|
|
50621
|
+
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
50622
|
+
return "Success";
|
|
50602
50623
|
}
|
|
50603
50624
|
checkUselessUpdateCell(cmd) {
|
|
50604
50625
|
const cell = this.getters.getCell(cmd);
|
|
50605
50626
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
50606
50627
|
const hasStyle = "style" in cmd;
|
|
50607
50628
|
const hasFormat = "format" in cmd;
|
|
50608
|
-
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
|
|
50609
|
-
return
|
|
50629
|
+
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";
|
|
50630
|
+
return "Success";
|
|
50610
50631
|
}
|
|
50611
50632
|
checkUselessSetFormatting(cmd) {
|
|
50612
50633
|
const { sheetId, target } = cmd;
|
|
50613
50634
|
const hasStyle = "style" in cmd;
|
|
50614
50635
|
const hasFormat = "format" in cmd;
|
|
50615
|
-
if (!hasStyle && !hasFormat) return
|
|
50636
|
+
if (!hasStyle && !hasFormat) return "NoChanges";
|
|
50616
50637
|
for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50617
50638
|
const position = {
|
|
50618
50639
|
sheetId,
|
|
@@ -50620,9 +50641,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50620
50641
|
row
|
|
50621
50642
|
};
|
|
50622
50643
|
const cell = this.getters.getCell(position);
|
|
50623
|
-
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return
|
|
50644
|
+
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
|
|
50624
50645
|
}
|
|
50625
|
-
return
|
|
50646
|
+
return "NoChanges";
|
|
50626
50647
|
}
|
|
50627
50648
|
};
|
|
50628
50649
|
|
|
@@ -50653,8 +50674,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50653
50674
|
switch (cmd.type) {
|
|
50654
50675
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
|
|
50655
50676
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
50656
|
-
case "DELETE_CHART": return
|
|
50657
|
-
default: return
|
|
50677
|
+
case "DELETE_CHART": return "SubCommandOnly";
|
|
50678
|
+
default: return "Success";
|
|
50658
50679
|
}
|
|
50659
50680
|
}
|
|
50660
50681
|
handle(cmd) {
|
|
@@ -50813,22 +50834,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50813
50834
|
}
|
|
50814
50835
|
}
|
|
50815
50836
|
checkChartDuplicate(cmd) {
|
|
50816
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50837
|
+
return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
|
|
50817
50838
|
}
|
|
50818
50839
|
checkChartDefinition(cmd) {
|
|
50819
50840
|
return SpreadsheetChart.validate(this, cmd.definition);
|
|
50820
50841
|
}
|
|
50821
50842
|
checkChartExists(cmd) {
|
|
50822
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50843
|
+
return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
|
|
50823
50844
|
}
|
|
50824
50845
|
checkChartChanged(cmd) {
|
|
50825
|
-
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return
|
|
50826
|
-
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ?
|
|
50846
|
+
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
|
|
50847
|
+
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
|
|
50827
50848
|
}
|
|
50828
50849
|
/** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
|
|
50829
50850
|
checkFigureArguments(cmd) {
|
|
50830
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
50831
|
-
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ?
|
|
50851
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
|
|
50852
|
+
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
|
|
50832
50853
|
}
|
|
50833
50854
|
};
|
|
50834
50855
|
|
|
@@ -50895,11 +50916,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50895
50916
|
allowDispatch(cmd) {
|
|
50896
50917
|
switch (cmd.type) {
|
|
50897
50918
|
case "ADD_CONDITIONAL_FORMAT":
|
|
50898
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
50919
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
50899
50920
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
50900
50921
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
50901
50922
|
}
|
|
50902
|
-
return
|
|
50923
|
+
return "Success";
|
|
50903
50924
|
}
|
|
50904
50925
|
handle(cmd) {
|
|
50905
50926
|
switch (cmd.type) {
|
|
@@ -51032,27 +51053,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51032
51053
|
this.history.update("cfRules", sheet, currentCF);
|
|
51033
51054
|
}
|
|
51034
51055
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
51035
|
-
if (!this.cfRules[sheetId]) return
|
|
51056
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
51036
51057
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
51037
|
-
if (ruleIndex === -1) return
|
|
51058
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
51038
51059
|
const cfIndex2 = ruleIndex - delta;
|
|
51039
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
51040
|
-
return
|
|
51060
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
51061
|
+
return "Success";
|
|
51041
51062
|
}
|
|
51042
51063
|
checkEmptyRange(cmd) {
|
|
51043
|
-
return cmd.ranges.length ?
|
|
51064
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51044
51065
|
}
|
|
51045
51066
|
checkCFRule(cmd) {
|
|
51046
51067
|
const rule = cmd.cf.rule;
|
|
51047
51068
|
switch (rule.type) {
|
|
51048
51069
|
case "CellIsRule":
|
|
51049
|
-
if (!availableConditionalFormatOperators.has(rule.operator)) return
|
|
51070
|
+
if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
|
|
51050
51071
|
return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
|
|
51051
51072
|
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)));
|
|
51052
51073
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
51053
|
-
case "DataBarRule": return
|
|
51074
|
+
case "DataBarRule": return "Success";
|
|
51054
51075
|
}
|
|
51055
|
-
return
|
|
51076
|
+
return "InvalidConditionalFormatType";
|
|
51056
51077
|
}
|
|
51057
51078
|
checkCFHasChanged(cmd) {
|
|
51058
51079
|
const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
|
|
@@ -51060,8 +51081,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51060
51081
|
ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
|
|
51061
51082
|
});
|
|
51062
51083
|
const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
|
|
51063
|
-
if (currentCF && deepEquals(newCF, currentCF)) return
|
|
51064
|
-
return
|
|
51084
|
+
if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
|
|
51085
|
+
return "Success";
|
|
51065
51086
|
}
|
|
51066
51087
|
checkOperatorArgsNumber(rule) {
|
|
51067
51088
|
const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
|
|
@@ -51071,9 +51092,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51071
51092
|
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.");
|
|
51072
51093
|
const errors = [];
|
|
51073
51094
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
51074
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
51075
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
51076
|
-
return errors.length ? errors :
|
|
51095
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
51096
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
51097
|
+
return errors.length ? errors : "Success";
|
|
51077
51098
|
}
|
|
51078
51099
|
checkNaN(threshold, thresholdName) {
|
|
51079
51100
|
if ([
|
|
@@ -51081,27 +51102,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51081
51102
|
"percentage",
|
|
51082
51103
|
"percentile"
|
|
51083
51104
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
51084
|
-
case "min": return
|
|
51085
|
-
case "max": return
|
|
51086
|
-
case "mid": return
|
|
51087
|
-
case "upperInflectionPoint": return
|
|
51088
|
-
case "lowerInflectionPoint": return
|
|
51105
|
+
case "min": return "MinNaN";
|
|
51106
|
+
case "max": return "MaxNaN";
|
|
51107
|
+
case "mid": return "MidNaN";
|
|
51108
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
51109
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
51089
51110
|
}
|
|
51090
|
-
return
|
|
51111
|
+
return "Success";
|
|
51091
51112
|
}
|
|
51092
51113
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
51093
|
-
if (threshold.type !== "formula") return
|
|
51114
|
+
if (threshold.type !== "formula") return "Success";
|
|
51094
51115
|
if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
|
|
51095
|
-
case "min": return
|
|
51096
|
-
case "max": return
|
|
51097
|
-
case "mid": return
|
|
51098
|
-
case "upperInflectionPoint": return
|
|
51099
|
-
case "lowerInflectionPoint": return
|
|
51116
|
+
case "min": return "MinInvalidFormula";
|
|
51117
|
+
case "max": return "MaxInvalidFormula";
|
|
51118
|
+
case "mid": return "MidInvalidFormula";
|
|
51119
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
51120
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
51100
51121
|
}
|
|
51101
|
-
return
|
|
51122
|
+
return "Success";
|
|
51102
51123
|
}
|
|
51103
51124
|
checkThresholds(check) {
|
|
51104
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
51125
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
51105
51126
|
}
|
|
51106
51127
|
checkInflectionPoints(check) {
|
|
51107
51128
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -51113,8 +51134,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51113
51134
|
"number",
|
|
51114
51135
|
"percentage",
|
|
51115
51136
|
"percentile"
|
|
51116
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
51117
|
-
return
|
|
51137
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
51138
|
+
return "Success";
|
|
51118
51139
|
}
|
|
51119
51140
|
checkMinBiggerThanMax(rule) {
|
|
51120
51141
|
const minValue = rule.minimum.value;
|
|
@@ -51123,8 +51144,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51123
51144
|
"number",
|
|
51124
51145
|
"percentage",
|
|
51125
51146
|
"percentile"
|
|
51126
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
51127
|
-
return
|
|
51147
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
51148
|
+
return "Success";
|
|
51128
51149
|
}
|
|
51129
51150
|
checkMidBiggerThanMax(rule) {
|
|
51130
51151
|
const midValue = rule.midpoint?.value;
|
|
@@ -51133,8 +51154,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51133
51154
|
"number",
|
|
51134
51155
|
"percentage",
|
|
51135
51156
|
"percentile"
|
|
51136
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
51137
|
-
return
|
|
51157
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
51158
|
+
return "Success";
|
|
51138
51159
|
}
|
|
51139
51160
|
checkMinBiggerThanMid(rule) {
|
|
51140
51161
|
const minValue = rule.minimum.value;
|
|
@@ -51143,15 +51164,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51143
51164
|
"number",
|
|
51144
51165
|
"percentage",
|
|
51145
51166
|
"percentile"
|
|
51146
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
51147
|
-
return
|
|
51167
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
51168
|
+
return "Success";
|
|
51148
51169
|
}
|
|
51149
51170
|
checkCFValues(rule) {
|
|
51150
51171
|
for (const value of rule.values) {
|
|
51151
51172
|
if (!value.startsWith("=")) continue;
|
|
51152
|
-
if (CompiledFormula.IsBadExpression(value)) return
|
|
51173
|
+
if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
|
|
51153
51174
|
}
|
|
51154
|
-
return
|
|
51175
|
+
return "Success";
|
|
51155
51176
|
}
|
|
51156
51177
|
removeConditionalFormatting(id, sheet) {
|
|
51157
51178
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -51226,15 +51247,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51226
51247
|
allowDispatch(cmd) {
|
|
51227
51248
|
switch (cmd.type) {
|
|
51228
51249
|
case "ADD_DATA_VALIDATION_RULE":
|
|
51229
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51230
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
51250
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51251
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
51231
51252
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
51232
51253
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
51233
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51234
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
51254
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51255
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
51235
51256
|
break;
|
|
51236
51257
|
}
|
|
51237
|
-
return
|
|
51258
|
+
return "Success";
|
|
51238
51259
|
}
|
|
51239
51260
|
handle(cmd) {
|
|
51240
51261
|
switch (cmd.type) {
|
|
@@ -51344,7 +51365,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51344
51365
|
}
|
|
51345
51366
|
}
|
|
51346
51367
|
checkEmptyRange(cmd) {
|
|
51347
|
-
return cmd.ranges.length ?
|
|
51368
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51348
51369
|
}
|
|
51349
51370
|
import(data) {
|
|
51350
51371
|
for (const sheet of data.sheets) {
|
|
@@ -51387,13 +51408,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51387
51408
|
}
|
|
51388
51409
|
}
|
|
51389
51410
|
checkCriterionTypeIsValid(cmd) {
|
|
51390
|
-
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
51411
|
+
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
51391
51412
|
}
|
|
51392
51413
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
51393
51414
|
const criterion = cmd.rule.criterion;
|
|
51394
51415
|
const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
51395
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
51396
|
-
return
|
|
51416
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
51417
|
+
return "Success";
|
|
51397
51418
|
}
|
|
51398
51419
|
checkCriterionValuesAreValid(cmd) {
|
|
51399
51420
|
const criterion = cmd.rule.criterion;
|
|
@@ -51403,12 +51424,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51403
51424
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
|
|
51404
51425
|
return !evaluator.isCriterionValueValid(value);
|
|
51405
51426
|
};
|
|
51406
|
-
if (criterion.values.some(isInvalid)) return
|
|
51407
|
-
return
|
|
51427
|
+
if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
|
|
51428
|
+
return "Success";
|
|
51408
51429
|
}
|
|
51409
51430
|
checkValidRange(cmd) {
|
|
51410
|
-
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return
|
|
51411
|
-
return
|
|
51431
|
+
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";
|
|
51432
|
+
return "Success";
|
|
51412
51433
|
}
|
|
51413
51434
|
};
|
|
51414
51435
|
|
|
@@ -51464,7 +51485,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51464
51485
|
case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
|
|
51465
51486
|
case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
|
|
51466
51487
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd);
|
|
51467
|
-
default: return
|
|
51488
|
+
default: return "Success";
|
|
51468
51489
|
}
|
|
51469
51490
|
}
|
|
51470
51491
|
beforeHandle(cmd) {
|
|
@@ -51633,16 +51654,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51633
51654
|
this.history.update("figures", sheetId, id, void 0);
|
|
51634
51655
|
}
|
|
51635
51656
|
checkFigureExists(cmd) {
|
|
51636
|
-
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return
|
|
51637
|
-
return
|
|
51657
|
+
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
|
|
51658
|
+
return "Success";
|
|
51638
51659
|
}
|
|
51639
51660
|
checkFigureDuplicate(cmd) {
|
|
51640
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return
|
|
51641
|
-
return
|
|
51661
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
|
|
51662
|
+
return "Success";
|
|
51642
51663
|
}
|
|
51643
51664
|
checkFigureAnchorOffset(cmd) {
|
|
51644
|
-
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return
|
|
51645
|
-
return
|
|
51665
|
+
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
|
|
51666
|
+
return "Success";
|
|
51646
51667
|
}
|
|
51647
51668
|
getFigures(sheetId) {
|
|
51648
51669
|
const figures = [];
|
|
@@ -51693,28 +51714,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51693
51714
|
switch (cmd.type) {
|
|
51694
51715
|
case "GROUP_HEADERS": {
|
|
51695
51716
|
const { start, end, sheetId } = cmd;
|
|
51696
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51697
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51698
|
-
if (start > end) return
|
|
51699
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
51717
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51718
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51719
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51720
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
51700
51721
|
break;
|
|
51701
51722
|
}
|
|
51702
51723
|
case "UNGROUP_HEADERS": {
|
|
51703
51724
|
const { start, end, sheetId } = cmd;
|
|
51704
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51705
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51706
|
-
if (start > end) return
|
|
51725
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51726
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51727
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51707
51728
|
break;
|
|
51708
51729
|
}
|
|
51709
51730
|
case "UNFOLD_HEADER_GROUP":
|
|
51710
51731
|
case "FOLD_HEADER_GROUP":
|
|
51711
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51732
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51712
51733
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
51713
|
-
if (!group) return
|
|
51714
|
-
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
|
|
51734
|
+
if (!group) return "UnknownHeaderGroup";
|
|
51735
|
+
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";
|
|
51715
51736
|
break;
|
|
51716
51737
|
}
|
|
51717
|
-
return
|
|
51738
|
+
return "Success";
|
|
51718
51739
|
}
|
|
51719
51740
|
handle(cmd) {
|
|
51720
51741
|
switch (cmd.type) {
|
|
@@ -52122,19 +52143,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52122
52143
|
allowDispatch(cmd) {
|
|
52123
52144
|
switch (cmd.type) {
|
|
52124
52145
|
case "HIDE_COLUMNS_ROWS": {
|
|
52125
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52146
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52126
52147
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
52127
52148
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
52128
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
52129
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
52130
|
-
else return
|
|
52149
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
52150
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
52151
|
+
else return "Success";
|
|
52131
52152
|
}
|
|
52132
52153
|
case "REMOVE_COLUMNS_ROWS":
|
|
52133
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52134
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
52135
|
-
return
|
|
52154
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52155
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
52156
|
+
return "Success";
|
|
52136
52157
|
}
|
|
52137
|
-
return
|
|
52158
|
+
return "Success";
|
|
52138
52159
|
}
|
|
52139
52160
|
handle(cmd) {
|
|
52140
52161
|
switch (cmd.type) {
|
|
@@ -52262,9 +52283,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52262
52283
|
allowDispatch(cmd) {
|
|
52263
52284
|
switch (cmd.type) {
|
|
52264
52285
|
case "CREATE_IMAGE":
|
|
52265
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
52266
|
-
return
|
|
52267
|
-
default: return
|
|
52286
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
52287
|
+
return "Success";
|
|
52288
|
+
default: return "Success";
|
|
52268
52289
|
}
|
|
52269
52290
|
}
|
|
52270
52291
|
handle(cmd) {
|
|
@@ -52388,7 +52409,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52388
52409
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
52389
52410
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
52390
52411
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
52391
|
-
default: return
|
|
52412
|
+
default: return "Success";
|
|
52392
52413
|
}
|
|
52393
52414
|
}
|
|
52394
52415
|
handle(cmd) {
|
|
@@ -52549,18 +52570,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52549
52570
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
52550
52571
|
}
|
|
52551
52572
|
checkDestructiveMerge({ sheetId, target }) {
|
|
52552
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52553
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
52573
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52574
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
52554
52575
|
}
|
|
52555
52576
|
checkOverlap({ target }) {
|
|
52556
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
52557
|
-
return
|
|
52577
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
52578
|
+
return "Success";
|
|
52558
52579
|
}
|
|
52559
52580
|
checkFrozenPanes({ sheetId, target }) {
|
|
52560
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52581
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52561
52582
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
52562
|
-
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return
|
|
52563
|
-
return
|
|
52583
|
+
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
52584
|
+
return "Success";
|
|
52564
52585
|
}
|
|
52565
52586
|
/**
|
|
52566
52587
|
* The content of a merged cell should always be empty.
|
|
@@ -52568,10 +52589,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52568
52589
|
*/
|
|
52569
52590
|
checkMergedContentUpdate(cmd) {
|
|
52570
52591
|
const { col, row, content } = cmd;
|
|
52571
|
-
if (content === void 0) return
|
|
52592
|
+
if (content === void 0) return "Success";
|
|
52572
52593
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
52573
|
-
if (mainCol === col && mainRow === row) return
|
|
52574
|
-
return
|
|
52594
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
52595
|
+
return "CellIsMerged";
|
|
52575
52596
|
}
|
|
52576
52597
|
checkMergeExists(cmd) {
|
|
52577
52598
|
const { sheetId, target } = cmd;
|
|
@@ -52582,9 +52603,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52582
52603
|
col: left,
|
|
52583
52604
|
row: top
|
|
52584
52605
|
});
|
|
52585
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
52606
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
52586
52607
|
}
|
|
52587
|
-
return
|
|
52608
|
+
return "Success";
|
|
52588
52609
|
}
|
|
52589
52610
|
/**
|
|
52590
52611
|
* Merge the current selection. Note that:
|
|
@@ -52749,10 +52770,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52749
52770
|
allowDispatch(cmd) {
|
|
52750
52771
|
switch (cmd.type) {
|
|
52751
52772
|
case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
|
|
52752
|
-
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) :
|
|
52773
|
+
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
|
|
52753
52774
|
case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
|
|
52754
52775
|
}
|
|
52755
|
-
return
|
|
52776
|
+
return "Success";
|
|
52756
52777
|
}
|
|
52757
52778
|
handle(cmd) {
|
|
52758
52779
|
switch (cmd.type) {
|
|
@@ -52816,14 +52837,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52816
52837
|
}
|
|
52817
52838
|
}
|
|
52818
52839
|
checkValidNewNamedRangeName(name) {
|
|
52819
|
-
if (this.getNamedRange(name)) return
|
|
52820
|
-
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return
|
|
52821
|
-
if (rangeReference.test(name)) return
|
|
52822
|
-
return
|
|
52840
|
+
if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
|
|
52841
|
+
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
|
|
52842
|
+
if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
|
|
52843
|
+
return "Success";
|
|
52823
52844
|
}
|
|
52824
52845
|
checkNamedRangeExists(name) {
|
|
52825
|
-
if (!this.getNamedRange(name)) return
|
|
52826
|
-
return
|
|
52846
|
+
if (!this.getNamedRange(name)) return "NamedRangeNotFound";
|
|
52847
|
+
return "Success";
|
|
52827
52848
|
}
|
|
52828
52849
|
};
|
|
52829
52850
|
|
|
@@ -52848,25 +52869,25 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52848
52869
|
allowDispatch(cmd) {
|
|
52849
52870
|
switch (cmd.type) {
|
|
52850
52871
|
case "ADD_PIVOT":
|
|
52851
|
-
if (cmd.pivotId in this.pivots) return
|
|
52872
|
+
if (cmd.pivotId in this.pivots) return "PivotIdTaken";
|
|
52852
52873
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52853
52874
|
case "UPDATE_PIVOT":
|
|
52854
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52855
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
52856
|
-
if (cmd.pivot.name === "") return
|
|
52875
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52876
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
52877
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
52857
52878
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52858
52879
|
case "RENAME_PIVOT":
|
|
52859
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52860
|
-
if (cmd.name === "") return
|
|
52880
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52881
|
+
if (cmd.name === "") return "EmptyName";
|
|
52861
52882
|
break;
|
|
52862
52883
|
case "REMOVE_PIVOT":
|
|
52863
52884
|
case "DUPLICATE_PIVOT":
|
|
52864
52885
|
case "INSERT_PIVOT":
|
|
52865
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52886
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52866
52887
|
break;
|
|
52867
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
52888
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52868
52889
|
}
|
|
52869
|
-
return
|
|
52890
|
+
return "Success";
|
|
52870
52891
|
}
|
|
52871
52892
|
handle(cmd) {
|
|
52872
52893
|
switch (cmd.type) {
|
|
@@ -53063,13 +53084,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53063
53084
|
}
|
|
53064
53085
|
checkSortedColumnInMeasures(definition) {
|
|
53065
53086
|
const measures = definition.measures.map((measure) => measure.id);
|
|
53066
|
-
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return
|
|
53067
|
-
return
|
|
53087
|
+
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
|
|
53088
|
+
return "Success";
|
|
53068
53089
|
}
|
|
53069
53090
|
checkDuplicatedMeasureIds(definition) {
|
|
53070
53091
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
53071
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
53072
|
-
return
|
|
53092
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
53093
|
+
return "Success";
|
|
53073
53094
|
}
|
|
53074
53095
|
checkCustomFieldsAreValid(definition) {
|
|
53075
53096
|
for (const customFieldName in definition.customFields) {
|
|
@@ -53078,15 +53099,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53078
53099
|
const groupNames = /* @__PURE__ */ new Set();
|
|
53079
53100
|
let hasOtherGroup = false;
|
|
53080
53101
|
for (const group of customField.groups) {
|
|
53081
|
-
if (!group.name || groupNames.has(group.name)) return
|
|
53082
|
-
if (group.values.some((value) => groupedValues.has(value))) return
|
|
53083
|
-
if (group.isOtherGroup && hasOtherGroup) return
|
|
53102
|
+
if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
|
|
53103
|
+
if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
|
|
53104
|
+
if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
|
|
53084
53105
|
group.values.forEach((value) => groupedValues.add(value));
|
|
53085
53106
|
groupNames.add(group.name);
|
|
53086
53107
|
hasOtherGroup ||= !!group.isOtherGroup;
|
|
53087
53108
|
}
|
|
53088
53109
|
}
|
|
53089
|
-
return
|
|
53110
|
+
return "Success";
|
|
53090
53111
|
}
|
|
53091
53112
|
/**
|
|
53092
53113
|
* Import the pivots
|
|
@@ -53115,9 +53136,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53115
53136
|
locale = DEFAULT_LOCALE;
|
|
53116
53137
|
allowDispatch(cmd) {
|
|
53117
53138
|
switch (cmd.type) {
|
|
53118
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
53139
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
53119
53140
|
}
|
|
53120
|
-
return
|
|
53141
|
+
return "Success";
|
|
53121
53142
|
}
|
|
53122
53143
|
handle(cmd) {
|
|
53123
53144
|
switch (cmd.type) {
|
|
@@ -53198,7 +53219,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53198
53219
|
cellPosition = {};
|
|
53199
53220
|
allowDispatch(cmd) {
|
|
53200
53221
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
53201
|
-
if (genericChecks !==
|
|
53222
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
53202
53223
|
let sheetNameMissing = false;
|
|
53203
53224
|
switch (cmd.type) {
|
|
53204
53225
|
case "CREATE_SHEET":
|
|
@@ -53214,37 +53235,37 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53214
53235
|
if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
|
|
53215
53236
|
switch (cmd.type) {
|
|
53216
53237
|
case "HIDE_SHEET":
|
|
53217
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
53218
|
-
return
|
|
53238
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
53239
|
+
return "Success";
|
|
53219
53240
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
|
|
53220
53241
|
case "DUPLICATE_SHEET":
|
|
53221
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
53222
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
53223
|
-
return
|
|
53242
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
53243
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
53244
|
+
return "Success";
|
|
53224
53245
|
case "MOVE_SHEET": try {
|
|
53225
53246
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
53226
53247
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
53227
|
-
return
|
|
53248
|
+
return "Success";
|
|
53228
53249
|
} catch (e) {
|
|
53229
|
-
return
|
|
53250
|
+
return "WrongSheetMove";
|
|
53230
53251
|
}
|
|
53231
53252
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
53232
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
53233
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
53253
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
53254
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
53234
53255
|
case "ADD_COLUMNS_ROWS":
|
|
53235
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
53236
|
-
else if (cmd.quantity <= 0) return
|
|
53237
|
-
return
|
|
53256
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
53257
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
53258
|
+
return "Success";
|
|
53238
53259
|
case "REMOVE_COLUMNS_ROWS": {
|
|
53239
53260
|
const min = largeMin(cmd.elements);
|
|
53240
53261
|
const max = largeMax(cmd.elements);
|
|
53241
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
53242
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
53243
|
-
else return
|
|
53262
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
53263
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
53264
|
+
else return "Success";
|
|
53244
53265
|
}
|
|
53245
53266
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
53246
53267
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
53247
|
-
default: return
|
|
53268
|
+
default: return "Success";
|
|
53248
53269
|
}
|
|
53249
53270
|
}
|
|
53250
53271
|
handle(cmd) {
|
|
@@ -53519,12 +53540,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53519
53540
|
* not outside the sheet.
|
|
53520
53541
|
*/
|
|
53521
53542
|
checkZonesExistInSheet(sheetId, zones) {
|
|
53522
|
-
if (!zones.every(isZoneValid)) return
|
|
53543
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
53523
53544
|
if (zones.length) {
|
|
53524
53545
|
const sheetZone = this.getSheetZone(sheetId);
|
|
53525
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
53546
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
53526
53547
|
}
|
|
53527
|
-
return
|
|
53548
|
+
return "Success";
|
|
53528
53549
|
}
|
|
53529
53550
|
updateCellPosition(cmd) {
|
|
53530
53551
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -53598,42 +53619,42 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53598
53619
|
throw new Error("There is not enough visible sheets");
|
|
53599
53620
|
}
|
|
53600
53621
|
createSheetHasName(cmd) {
|
|
53601
|
-
if (cmd.name !== void 0 && !cmd.name.trim()) return
|
|
53602
|
-
return
|
|
53622
|
+
if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
|
|
53623
|
+
return "Success";
|
|
53603
53624
|
}
|
|
53604
53625
|
checkSheetName(cmd) {
|
|
53605
53626
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
53606
53627
|
const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
|
|
53607
|
-
if (originalSheetName !== void 0 && sheetName === originalSheetName) return
|
|
53628
|
+
if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
|
|
53608
53629
|
const { orderedSheetIds, sheets } = this;
|
|
53609
53630
|
const name = sheetName && sheetName.trim().toLowerCase();
|
|
53610
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
53611
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
53612
|
-
return
|
|
53631
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
53632
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
53633
|
+
return "Success";
|
|
53613
53634
|
}
|
|
53614
53635
|
checkSheetPosition(cmd) {
|
|
53615
53636
|
const { orderedSheetIds } = this;
|
|
53616
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
53617
|
-
return
|
|
53637
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
53638
|
+
return "Success";
|
|
53618
53639
|
}
|
|
53619
53640
|
checkRowFreezeQuantity(cmd) {
|
|
53620
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
53641
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53621
53642
|
}
|
|
53622
53643
|
checkColFreezeQuantity(cmd) {
|
|
53623
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
53644
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53624
53645
|
}
|
|
53625
53646
|
checkRowFreezeOverlapMerge(cmd) {
|
|
53626
53647
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53627
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
53628
|
-
return
|
|
53648
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
53649
|
+
return "Success";
|
|
53629
53650
|
}
|
|
53630
53651
|
checkColFreezeOverlapMerge(cmd) {
|
|
53631
53652
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53632
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
53633
|
-
return
|
|
53653
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
53654
|
+
return "Success";
|
|
53634
53655
|
}
|
|
53635
53656
|
isRenameAllowed(cmd) {
|
|
53636
|
-
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return
|
|
53657
|
+
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
|
|
53637
53658
|
return this.checkSheetName(cmd);
|
|
53638
53659
|
}
|
|
53639
53660
|
renameSheet(sheet, name) {
|
|
@@ -53856,19 +53877,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53856
53877
|
* sheet.
|
|
53857
53878
|
*/
|
|
53858
53879
|
checkSheetExists(cmd) {
|
|
53859
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
53860
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
53861
|
-
return
|
|
53880
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
53881
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
53882
|
+
return "Success";
|
|
53862
53883
|
}
|
|
53863
53884
|
/**
|
|
53864
53885
|
* Check if zones in the command are well formed and
|
|
53865
53886
|
* not outside the sheet.
|
|
53866
53887
|
*/
|
|
53867
53888
|
checkZonesAreInSheet(cmd) {
|
|
53868
|
-
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return
|
|
53869
|
-
if (!("sheetId" in cmd)) return
|
|
53870
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
53871
|
-
if (isTargetDependent(cmd) && cmd.target.length === 0) return
|
|
53889
|
+
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
|
|
53890
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
53891
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
53892
|
+
if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
|
|
53872
53893
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
53873
53894
|
}
|
|
53874
53895
|
};
|
|
@@ -53883,15 +53904,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53883
53904
|
const definition = cmd.pivot;
|
|
53884
53905
|
return this.checkDataSetValidity(definition);
|
|
53885
53906
|
}
|
|
53886
|
-
return
|
|
53907
|
+
return "Success";
|
|
53887
53908
|
}
|
|
53888
53909
|
checkDataSetValidity(definition) {
|
|
53889
53910
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53890
53911
|
const { zone, sheetId } = definition.dataSet;
|
|
53891
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
53912
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
53892
53913
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53893
53914
|
}
|
|
53894
|
-
return
|
|
53915
|
+
return "Success";
|
|
53895
53916
|
}
|
|
53896
53917
|
};
|
|
53897
53918
|
|
|
@@ -53909,18 +53930,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53909
53930
|
switch (cmd.type) {
|
|
53910
53931
|
case "CREATE_TABLE":
|
|
53911
53932
|
case "UPDATE_TABLE":
|
|
53912
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
53933
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
53913
53934
|
break;
|
|
53914
53935
|
case "CREATE_TABLE_STYLE":
|
|
53915
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
53936
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
53916
53937
|
try {
|
|
53917
53938
|
toHex(cmd.primaryColor);
|
|
53918
53939
|
} catch (e) {
|
|
53919
|
-
return
|
|
53940
|
+
return "InvalidTableStyle";
|
|
53920
53941
|
}
|
|
53921
53942
|
break;
|
|
53922
53943
|
}
|
|
53923
|
-
return
|
|
53944
|
+
return "Success";
|
|
53924
53945
|
}
|
|
53925
53946
|
handle(cmd) {
|
|
53926
53947
|
switch (cmd.type) {
|
|
@@ -53991,21 +54012,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53991
54012
|
allowDispatch(cmd) {
|
|
53992
54013
|
switch (cmd.type) {
|
|
53993
54014
|
case "CREATE_TABLE":
|
|
53994
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
54015
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
53995
54016
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
53996
|
-
if (!areZonesContinuous(zones)) return
|
|
53997
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
54017
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
54018
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53998
54019
|
case "UPDATE_TABLE":
|
|
53999
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
54020
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
54000
54021
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
54001
54022
|
case "ADD_MERGE":
|
|
54002
54023
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
54003
54024
|
const tableZone = table.range.zone;
|
|
54004
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
54025
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
54005
54026
|
}
|
|
54006
54027
|
break;
|
|
54007
54028
|
}
|
|
54008
|
-
return
|
|
54029
|
+
return "Success";
|
|
54009
54030
|
}
|
|
54010
54031
|
handle(cmd) {
|
|
54011
54032
|
switch (cmd.type) {
|
|
@@ -54139,19 +54160,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54139
54160
|
}
|
|
54140
54161
|
}
|
|
54141
54162
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
54142
|
-
if (!cmd.newTableRange) return
|
|
54163
|
+
if (!cmd.newTableRange) return "Success";
|
|
54143
54164
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
54144
54165
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
54145
|
-
if (zoneIsInSheet !==
|
|
54166
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
54146
54167
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
54147
|
-
if (!updatedTable) return
|
|
54148
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
54168
|
+
if (!updatedTable) return "TableNotFound";
|
|
54169
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
54149
54170
|
}
|
|
54150
54171
|
checkTableConfigUpdateIsValid(config) {
|
|
54151
|
-
if (!config) return
|
|
54152
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
54153
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
54154
|
-
return
|
|
54172
|
+
if (!config) return "Success";
|
|
54173
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
54174
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
54175
|
+
return "Success";
|
|
54155
54176
|
}
|
|
54156
54177
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
54157
54178
|
const zone = tableRange.zone;
|
|
@@ -54391,6 +54412,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54391
54412
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
54392
54413
|
}
|
|
54393
54414
|
var CompilationParametersBuilder = class {
|
|
54415
|
+
getters;
|
|
54416
|
+
computeCell;
|
|
54394
54417
|
evalContext;
|
|
54395
54418
|
rangeCache = {};
|
|
54396
54419
|
constructor(context, getters, computeCell) {
|
|
@@ -54482,6 +54505,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54482
54505
|
//#endregion
|
|
54483
54506
|
//#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
|
|
54484
54507
|
var IntervalNode = class {
|
|
54508
|
+
interval;
|
|
54509
|
+
left;
|
|
54510
|
+
right;
|
|
54485
54511
|
/**
|
|
54486
54512
|
* Augmented value: the highest 'bottom' boundary in this subtree.
|
|
54487
54513
|
* Allows O(log n) pruning during overlap searches.
|
|
@@ -55382,6 +55408,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55382
55408
|
const MAX_ITERATION = 30;
|
|
55383
55409
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
55384
55410
|
var Evaluator = class {
|
|
55411
|
+
context;
|
|
55385
55412
|
getters;
|
|
55386
55413
|
compilationParams;
|
|
55387
55414
|
evaluatedCells = new PositionMap();
|
|
@@ -55400,7 +55427,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55400
55427
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
55401
55428
|
if (!spreadZone) return;
|
|
55402
55429
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
55403
|
-
if (evaluatedCell?.type ===
|
|
55430
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
55404
55431
|
return union(positionToZone(position), spreadZone);
|
|
55405
55432
|
}
|
|
55406
55433
|
getEvaluatedPositions() {
|
|
@@ -55410,7 +55437,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55410
55437
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
55411
55438
|
}
|
|
55412
55439
|
getArrayFormulaSpreadingOn(position) {
|
|
55413
|
-
if (this.getEvaluatedCell(position).type ===
|
|
55440
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
55414
55441
|
return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
|
|
55415
55442
|
}
|
|
55416
55443
|
isArrayFormulaSpillBlocked(position) {
|
|
@@ -55607,7 +55634,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55607
55634
|
const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
|
|
55608
55635
|
if (!isMatrix(formulaReturn)) {
|
|
55609
55636
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
|
|
55610
|
-
if (evaluatedCell.type ===
|
|
55637
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
|
|
55611
55638
|
return evaluatedCell;
|
|
55612
55639
|
}
|
|
55613
55640
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
@@ -55668,7 +55695,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55668
55695
|
row: j + row
|
|
55669
55696
|
};
|
|
55670
55697
|
const rawCell = this.getters.getCell(position);
|
|
55671
|
-
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !==
|
|
55698
|
+
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
55672
55699
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
55673
55700
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
|
|
55674
55701
|
}
|
|
@@ -55685,7 +55712,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55685
55712
|
};
|
|
55686
55713
|
const cell = this.getters.getCell(position);
|
|
55687
55714
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
|
|
55688
|
-
if (evaluatedCell.type ===
|
|
55715
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
|
|
55689
55716
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
55690
55717
|
};
|
|
55691
55718
|
return spreadValues;
|
|
@@ -55889,7 +55916,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55889
55916
|
sheetId,
|
|
55890
55917
|
col,
|
|
55891
55918
|
row
|
|
55892
|
-
})).every((cell) => cell.type ===
|
|
55919
|
+
})).every((cell) => cell.type === "empty");
|
|
55893
55920
|
}
|
|
55894
55921
|
/**
|
|
55895
55922
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -56842,7 +56869,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56842
56869
|
}
|
|
56843
56870
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
56844
56871
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
56845
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type ===
|
|
56872
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
56846
56873
|
switch (threshold.type) {
|
|
56847
56874
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
56848
56875
|
case "number": return Number(threshold.value);
|
|
@@ -56873,7 +56900,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56873
56900
|
col,
|
|
56874
56901
|
row
|
|
56875
56902
|
});
|
|
56876
|
-
if (cell.type !==
|
|
56903
|
+
if (cell.type !== "number") continue;
|
|
56877
56904
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
56878
56905
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
56879
56906
|
computedIcons[col][row] = icon;
|
|
@@ -56886,7 +56913,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56886
56913
|
}
|
|
56887
56914
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
56888
56915
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
56889
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
56916
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
56890
56917
|
if (max <= 0) return;
|
|
56891
56918
|
const color = rule.color;
|
|
56892
56919
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -56899,7 +56926,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56899
56926
|
col: targetCol,
|
|
56900
56927
|
row: targetRow
|
|
56901
56928
|
});
|
|
56902
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
56929
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
56903
56930
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
56904
56931
|
computedDataBars[col][row] = {
|
|
56905
56932
|
color: colorNumberToHex(color),
|
|
@@ -56933,7 +56960,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56933
56960
|
col,
|
|
56934
56961
|
row
|
|
56935
56962
|
});
|
|
56936
|
-
if (cell.type ===
|
|
56963
|
+
if (cell.type === "number") {
|
|
56937
56964
|
const value = clip(cell.value, minValue, maxValue);
|
|
56938
56965
|
if (!computedStyle[col]) computedStyle[col] = [];
|
|
56939
56966
|
computedStyle[col][row] = computedStyle[col]?.[row] || {};
|
|
@@ -56943,7 +56970,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56943
56970
|
}
|
|
56944
56971
|
getRuleResultForTarget(target, rule, preComputedCriterion) {
|
|
56945
56972
|
const cell = this.getters.getEvaluatedCell(target);
|
|
56946
|
-
if (cell.type ===
|
|
56973
|
+
if (cell.type === "error") return false;
|
|
56947
56974
|
const { sheetId } = target;
|
|
56948
56975
|
const evaluator = criterionEvaluatorRegistry.get(rule.operator);
|
|
56949
56976
|
const evaluatedCriterionValues = rule.values.map((value) => {
|
|
@@ -57089,7 +57116,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57089
57116
|
if (!validationResults[col]) validationResults[col] = [];
|
|
57090
57117
|
validationResults[col][row] = lazy(() => {
|
|
57091
57118
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
57092
|
-
if (evaluatedCell.type ===
|
|
57119
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
57093
57120
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
57094
57121
|
});
|
|
57095
57122
|
}
|
|
@@ -57820,6 +57847,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57820
57847
|
"getFirstPivotFunction",
|
|
57821
57848
|
"getPivotCellSortDirection",
|
|
57822
57849
|
"getPivotIdFromPosition",
|
|
57850
|
+
"getPivotIdsFromPosition",
|
|
57823
57851
|
"getPivotCellFromPosition",
|
|
57824
57852
|
"generateNewCalculatedMeasureName",
|
|
57825
57853
|
"isPivotUnused",
|
|
@@ -57879,37 +57907,52 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57879
57907
|
}
|
|
57880
57908
|
}
|
|
57881
57909
|
/**
|
|
57882
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
57910
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
57883
57911
|
* is no pivot at this position
|
|
57884
57912
|
*/
|
|
57885
57913
|
getPivotIdFromPosition(position) {
|
|
57914
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
57915
|
+
}
|
|
57916
|
+
/**
|
|
57917
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
57918
|
+
*/
|
|
57919
|
+
getPivotIdsFromPosition(position) {
|
|
57886
57920
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
57887
|
-
if (cell && cell.isFormula)
|
|
57888
|
-
|
|
57889
|
-
|
|
57890
|
-
|
|
57891
|
-
|
|
57892
|
-
|
|
57893
|
-
|
|
57921
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
57922
|
+
return [];
|
|
57923
|
+
}
|
|
57924
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
57925
|
+
return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
|
|
57926
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
57927
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
57928
|
+
}).filter(isDefined);
|
|
57894
57929
|
}
|
|
57895
57930
|
isSpillPivotFormula(position) {
|
|
57896
57931
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
57897
57932
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
|
|
57898
57933
|
return false;
|
|
57899
57934
|
}
|
|
57900
|
-
|
|
57901
|
-
const
|
|
57902
|
-
if (!
|
|
57903
|
-
const
|
|
57904
|
-
|
|
57905
|
-
functionName,
|
|
57906
|
-
|
|
57935
|
+
getPivotFunctions(sheetId, formula) {
|
|
57936
|
+
const pivotFunctions = getPivotFunctions(formula, this.getters);
|
|
57937
|
+
if (!pivotFunctions.length) return [];
|
|
57938
|
+
const evaluatedPivotFunctions = [];
|
|
57939
|
+
for (const pivotFunction of pivotFunctions) {
|
|
57940
|
+
const { functionName, args } = pivotFunction;
|
|
57941
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
57907
57942
|
if (argAst.type === "EMPTY") return;
|
|
57908
57943
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
57909
57944
|
const argsString = astToFormula(argAst);
|
|
57910
57945
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
57911
|
-
})
|
|
57912
|
-
|
|
57946
|
+
});
|
|
57947
|
+
evaluatedPivotFunctions.push({
|
|
57948
|
+
functionName,
|
|
57949
|
+
args: evaluatedArgs
|
|
57950
|
+
});
|
|
57951
|
+
}
|
|
57952
|
+
return evaluatedPivotFunctions;
|
|
57953
|
+
}
|
|
57954
|
+
getFirstPivotFunction(sheetId, formula) {
|
|
57955
|
+
return this.getPivotFunctions(sheetId, formula)[0];
|
|
57913
57956
|
}
|
|
57914
57957
|
/**
|
|
57915
57958
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -58015,8 +58058,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58015
58058
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
58016
58059
|
for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
|
|
58017
58060
|
const position = this.getters.getCellPosition(cell.id);
|
|
58018
|
-
const
|
|
58019
|
-
|
|
58061
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
58062
|
+
for (const pivotId of pivotIds) {
|
|
58020
58063
|
unusedPivots.delete(pivotId);
|
|
58021
58064
|
if (!unusedPivots.size) {
|
|
58022
58065
|
this.unusedPivotsInFormulas = [];
|
|
@@ -58024,6 +58067,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58024
58067
|
}
|
|
58025
58068
|
}
|
|
58026
58069
|
}
|
|
58070
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
58071
|
+
const pivot = this.getters.getPivot(pivotId);
|
|
58072
|
+
for (const measure of pivot.definition.measures) if (measure.computedBy) {
|
|
58073
|
+
const { sheetId } = measure.computedBy;
|
|
58074
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
58075
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
58076
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
58077
|
+
unusedPivots.delete(relatedPivotId);
|
|
58078
|
+
if (!unusedPivots.size) {
|
|
58079
|
+
this.unusedPivotsInFormulas = [];
|
|
58080
|
+
return [];
|
|
58081
|
+
}
|
|
58082
|
+
}
|
|
58083
|
+
}
|
|
58084
|
+
}
|
|
58027
58085
|
this.unusedPivotsInFormulas = [...unusedPivots];
|
|
58028
58086
|
return this.unusedPivotsInFormulas;
|
|
58029
58087
|
}
|
|
@@ -58031,7 +58089,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58031
58089
|
const result = [];
|
|
58032
58090
|
for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
|
|
58033
58091
|
const position = this.getters.getCellPosition(cellId);
|
|
58034
|
-
if (this.getters.getEvaluatedCell(position).type ===
|
|
58092
|
+
if (this.getters.getEvaluatedCell(position).type === "error") continue;
|
|
58035
58093
|
const pivotInfo = this.getPivotStyleAtPosition(position);
|
|
58036
58094
|
if (pivotInfo) result.push({
|
|
58037
58095
|
position,
|
|
@@ -58063,6 +58121,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58063
58121
|
//#endregion
|
|
58064
58122
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
58065
58123
|
var ClipboardHandler = class {
|
|
58124
|
+
getters;
|
|
58125
|
+
dispatch;
|
|
58066
58126
|
constructor(getters, dispatch) {
|
|
58067
58127
|
this.getters = getters;
|
|
58068
58128
|
this.dispatch = dispatch;
|
|
@@ -58070,10 +58130,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58070
58130
|
copy(data, isCutOperation, mode = "copyPaste") {}
|
|
58071
58131
|
paste(target, clippedContent, options) {}
|
|
58072
58132
|
isPasteAllowed(sheetId, target, content, option) {
|
|
58073
|
-
return
|
|
58133
|
+
return "Success";
|
|
58074
58134
|
}
|
|
58075
58135
|
isCutAllowed(data) {
|
|
58076
|
-
return
|
|
58136
|
+
return "Success";
|
|
58077
58137
|
}
|
|
58078
58138
|
getPasteTarget(sheetId, target, content, options) {
|
|
58079
58139
|
return {
|
|
@@ -58099,8 +58159,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58099
58159
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
58100
58160
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
58101
58161
|
isCutAllowed(data) {
|
|
58102
|
-
if (data.zones.length !== 1) return
|
|
58103
|
-
return
|
|
58162
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
58163
|
+
return "Success";
|
|
58104
58164
|
}
|
|
58105
58165
|
copy(data, isCutOperation, mode = "copyPaste") {
|
|
58106
58166
|
const sheetId = data.sheetId;
|
|
@@ -58165,17 +58225,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58165
58225
|
};
|
|
58166
58226
|
}
|
|
58167
58227
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
58168
|
-
if (!content.cells) return
|
|
58169
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
58228
|
+
if (!content.cells) return "Success";
|
|
58229
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
58170
58230
|
if (target.length > 1) {
|
|
58171
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
58231
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
58172
58232
|
}
|
|
58173
58233
|
const clipboardHeight = content.cells.length;
|
|
58174
58234
|
const clipboardWidth = content.cells[0].length;
|
|
58175
58235
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
58176
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
58236
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
58177
58237
|
}
|
|
58178
|
-
return
|
|
58238
|
+
return "Success";
|
|
58179
58239
|
}
|
|
58180
58240
|
/**
|
|
58181
58241
|
* Paste the clipboard content in the given target
|
|
@@ -58324,7 +58384,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58324
58384
|
switch (cmd.type) {
|
|
58325
58385
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
58326
58386
|
}
|
|
58327
|
-
return
|
|
58387
|
+
return "Success";
|
|
58328
58388
|
}
|
|
58329
58389
|
handle(cmd) {
|
|
58330
58390
|
switch (cmd.type) {
|
|
@@ -58407,34 +58467,34 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58407
58467
|
});
|
|
58408
58468
|
}
|
|
58409
58469
|
checkSingleRangeSelected() {
|
|
58410
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
58411
|
-
return
|
|
58470
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
58471
|
+
return "Success";
|
|
58412
58472
|
}
|
|
58413
58473
|
checkNoMergeInZone() {
|
|
58414
58474
|
const sheetId = this.getters.getActiveSheetId();
|
|
58415
58475
|
const zone = this.getters.getSelectedZone();
|
|
58416
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
58417
|
-
return
|
|
58476
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
58477
|
+
return "Success";
|
|
58418
58478
|
}
|
|
58419
58479
|
checkRangeContainsValues(cmd) {
|
|
58420
58480
|
const sheetId = this.getters.getActiveSheetId();
|
|
58421
58481
|
const zone = this.getters.getSelectedZone();
|
|
58422
58482
|
if (cmd.hasHeader) zone.top += 1;
|
|
58423
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
58424
|
-
return
|
|
58483
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
|
|
58484
|
+
return "Success";
|
|
58425
58485
|
}
|
|
58426
58486
|
checkNoColumnProvided(cmd) {
|
|
58427
|
-
if (cmd.columns.length === 0) return
|
|
58428
|
-
return
|
|
58487
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
58488
|
+
return "Success";
|
|
58429
58489
|
}
|
|
58430
58490
|
checkColumnsIncludedInZone(cmd) {
|
|
58431
58491
|
const zone = this.getters.getSelectedZone();
|
|
58432
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
58433
|
-
return
|
|
58492
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
58493
|
+
return "Success";
|
|
58434
58494
|
}
|
|
58435
58495
|
checkColumnsAreUnique(cmd) {
|
|
58436
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
58437
|
-
return
|
|
58496
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
58497
|
+
return "Success";
|
|
58438
58498
|
}
|
|
58439
58499
|
trimWhitespace() {
|
|
58440
58500
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -58552,19 +58612,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58552
58612
|
let x = 0;
|
|
58553
58613
|
let y = 0;
|
|
58554
58614
|
switch (direction) {
|
|
58555
|
-
case
|
|
58615
|
+
case "up":
|
|
58556
58616
|
x = 0;
|
|
58557
58617
|
y = -rule.current;
|
|
58558
58618
|
break;
|
|
58559
|
-
case
|
|
58619
|
+
case "down":
|
|
58560
58620
|
x = 0;
|
|
58561
58621
|
y = rule.current;
|
|
58562
58622
|
break;
|
|
58563
|
-
case
|
|
58623
|
+
case "left":
|
|
58564
58624
|
x = -rule.current;
|
|
58565
58625
|
y = 0;
|
|
58566
58626
|
break;
|
|
58567
|
-
case
|
|
58627
|
+
case "right":
|
|
58568
58628
|
x = rule.current;
|
|
58569
58629
|
y = 0;
|
|
58570
58630
|
break;
|
|
@@ -58691,11 +58751,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58691
58751
|
},
|
|
58692
58752
|
sequence: 10
|
|
58693
58753
|
}).add("increment_alphanumeric_value", {
|
|
58694
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58754
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
58695
58755
|
generateRule: (cell, cells, direction) => {
|
|
58696
58756
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
58697
58757
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
58698
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58758
|
+
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]);
|
|
58699
58759
|
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
58700
58760
|
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
58701
58761
|
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
@@ -58713,7 +58773,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58713
58773
|
},
|
|
58714
58774
|
sequence: 15
|
|
58715
58775
|
}).add("copy_text", {
|
|
58716
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58776
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
58717
58777
|
generateRule: () => {
|
|
58718
58778
|
return { type: "COPY_MODIFIER" };
|
|
58719
58779
|
},
|
|
@@ -58730,10 +58790,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58730
58790
|
sequence: 30
|
|
58731
58791
|
}).add("increment_dates", {
|
|
58732
58792
|
condition: (cell, cells) => {
|
|
58733
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58793
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
58734
58794
|
},
|
|
58735
58795
|
generateRule: (cell, cells) => {
|
|
58736
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58796
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
58737
58797
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
58738
58798
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
58739
58799
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -58742,26 +58802,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58742
58802
|
if (typeof increment === "object") return {
|
|
58743
58803
|
type: "DATE_INCREMENT_MODIFIER",
|
|
58744
58804
|
increment,
|
|
58745
|
-
current: evaluation.type ===
|
|
58805
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58746
58806
|
};
|
|
58747
58807
|
return {
|
|
58748
58808
|
type: "INCREMENT_MODIFIER",
|
|
58749
58809
|
increment,
|
|
58750
|
-
current: evaluation.type ===
|
|
58810
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58751
58811
|
};
|
|
58752
58812
|
},
|
|
58753
58813
|
sequence: 25
|
|
58754
58814
|
}).add("increment_number", {
|
|
58755
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58815
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
58756
58816
|
generateRule: (cell, cells, direction) => {
|
|
58757
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58817
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
58758
58818
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
58759
58819
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
58760
58820
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
58761
58821
|
return {
|
|
58762
58822
|
type: "INCREMENT_MODIFIER",
|
|
58763
58823
|
increment,
|
|
58764
|
-
current: evaluation.type ===
|
|
58824
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58765
58825
|
};
|
|
58766
58826
|
},
|
|
58767
58827
|
sequence: 40
|
|
@@ -58871,10 +58931,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58871
58931
|
const sheetId = this.getters.getActiveSheetId();
|
|
58872
58932
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
58873
58933
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
58874
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
58875
|
-
return
|
|
58934
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
58935
|
+
return "InvalidAutofillSelection";
|
|
58876
58936
|
}
|
|
58877
|
-
return
|
|
58937
|
+
return "Success";
|
|
58878
58938
|
}
|
|
58879
58939
|
handle(cmd) {
|
|
58880
58940
|
switch (cmd.type) {
|
|
@@ -58906,7 +58966,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58906
58966
|
const target = this.autofillZone;
|
|
58907
58967
|
const autofillCellsData = [];
|
|
58908
58968
|
switch (this.direction) {
|
|
58909
|
-
case
|
|
58969
|
+
case "down":
|
|
58910
58970
|
for (let col = source.left; col <= source.right; col++) {
|
|
58911
58971
|
const xcs = [];
|
|
58912
58972
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -58914,7 +58974,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58914
58974
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58915
58975
|
}
|
|
58916
58976
|
break;
|
|
58917
|
-
case
|
|
58977
|
+
case "up":
|
|
58918
58978
|
for (let col = source.left; col <= source.right; col++) {
|
|
58919
58979
|
const xcs = [];
|
|
58920
58980
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -58922,7 +58982,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58922
58982
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58923
58983
|
}
|
|
58924
58984
|
break;
|
|
58925
|
-
case
|
|
58985
|
+
case "left":
|
|
58926
58986
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58927
58987
|
const xcs = [];
|
|
58928
58988
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -58930,7 +58990,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58930
58990
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58931
58991
|
}
|
|
58932
58992
|
break;
|
|
58933
|
-
case
|
|
58993
|
+
case "right":
|
|
58934
58994
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58935
58995
|
const xcs = [];
|
|
58936
58996
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -59056,19 +59116,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59056
59116
|
}
|
|
59057
59117
|
this.direction = this.getDirection(col, row);
|
|
59058
59118
|
switch (this.direction) {
|
|
59059
|
-
case
|
|
59119
|
+
case "up":
|
|
59060
59120
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
59061
59121
|
this.steps = source.top - row;
|
|
59062
59122
|
break;
|
|
59063
|
-
case
|
|
59123
|
+
case "down":
|
|
59064
59124
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
59065
59125
|
this.steps = row - source.bottom;
|
|
59066
59126
|
break;
|
|
59067
|
-
case
|
|
59127
|
+
case "left":
|
|
59068
59128
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
59069
59129
|
this.steps = source.left - col;
|
|
59070
59130
|
break;
|
|
59071
|
-
case
|
|
59131
|
+
case "right":
|
|
59072
59132
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
59073
59133
|
this.steps = col - source.right;
|
|
59074
59134
|
break;
|
|
@@ -59087,7 +59147,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59087
59147
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
59088
59148
|
...activePosition,
|
|
59089
59149
|
row
|
|
59090
|
-
}).type !==
|
|
59150
|
+
}).type !== "empty") {
|
|
59091
59151
|
autofillRow = row - 1;
|
|
59092
59152
|
break;
|
|
59093
59153
|
}
|
|
@@ -59107,7 +59167,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59107
59167
|
col: col - 1,
|
|
59108
59168
|
row
|
|
59109
59169
|
};
|
|
59110
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
59170
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
59111
59171
|
row += 1;
|
|
59112
59172
|
leftPosition = {
|
|
59113
59173
|
sheetId,
|
|
@@ -59124,7 +59184,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59124
59184
|
col: col + 1,
|
|
59125
59185
|
row
|
|
59126
59186
|
};
|
|
59127
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
59187
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
59128
59188
|
row += 1;
|
|
59129
59189
|
rightPosition = {
|
|
59130
59190
|
sheetId,
|
|
@@ -59214,19 +59274,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59214
59274
|
const position = {
|
|
59215
59275
|
up: {
|
|
59216
59276
|
number: source.top - row,
|
|
59217
|
-
value:
|
|
59277
|
+
value: "up"
|
|
59218
59278
|
},
|
|
59219
59279
|
down: {
|
|
59220
59280
|
number: row - source.bottom,
|
|
59221
|
-
value:
|
|
59281
|
+
value: "down"
|
|
59222
59282
|
},
|
|
59223
59283
|
left: {
|
|
59224
59284
|
number: source.left - col,
|
|
59225
|
-
value:
|
|
59285
|
+
value: "left"
|
|
59226
59286
|
},
|
|
59227
59287
|
right: {
|
|
59228
59288
|
number: col - source.right,
|
|
59229
|
-
value:
|
|
59289
|
+
value: "right"
|
|
59230
59290
|
}
|
|
59231
59291
|
};
|
|
59232
59292
|
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;
|
|
@@ -59429,7 +59489,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59429
59489
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
59430
59490
|
}
|
|
59431
59491
|
isNumber(cell) {
|
|
59432
|
-
return cell.type ===
|
|
59492
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
59433
59493
|
}
|
|
59434
59494
|
isZoneValid(zone) {
|
|
59435
59495
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -60492,6 +60552,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60492
60552
|
//#endregion
|
|
60493
60553
|
//#region src/collaborative/revisions.ts
|
|
60494
60554
|
var Revision = class {
|
|
60555
|
+
rootCommand;
|
|
60556
|
+
timestamp;
|
|
60495
60557
|
id;
|
|
60496
60558
|
clientId;
|
|
60497
60559
|
_commands = [];
|
|
@@ -60528,6 +60590,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60528
60590
|
//#region src/collaborative/session.ts
|
|
60529
60591
|
var ClientDisconnectedError = class extends Error {};
|
|
60530
60592
|
var Session = class extends EventBus {
|
|
60593
|
+
revisions;
|
|
60594
|
+
transportService;
|
|
60595
|
+
serverRevisionId;
|
|
60596
|
+
commandSquisher;
|
|
60531
60597
|
/**
|
|
60532
60598
|
* Positions of the others client.
|
|
60533
60599
|
*/
|
|
@@ -60994,7 +61060,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60994
61060
|
...position,
|
|
60995
61061
|
content: "FALSE"
|
|
60996
61062
|
});
|
|
60997
|
-
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type ===
|
|
61063
|
+
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
|
|
60998
61064
|
let value;
|
|
60999
61065
|
if (cell.isFormula) {
|
|
61000
61066
|
const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
|
|
@@ -61004,7 +61070,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61004
61070
|
...position,
|
|
61005
61071
|
content: "FALSE"
|
|
61006
61072
|
});
|
|
61007
|
-
} else if (evaluatedCell.type !==
|
|
61073
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
61008
61074
|
...position,
|
|
61009
61075
|
content: "FALSE"
|
|
61010
61076
|
});
|
|
@@ -61131,7 +61197,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61131
61197
|
getCellNumberFormat(position) {
|
|
61132
61198
|
for (const pos of [position]) {
|
|
61133
61199
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
61134
|
-
if (cell.type ===
|
|
61200
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
61135
61201
|
}
|
|
61136
61202
|
}
|
|
61137
61203
|
};
|
|
@@ -61299,11 +61365,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61299
61365
|
allowDispatch(cmd) {
|
|
61300
61366
|
switch (cmd.type) {
|
|
61301
61367
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
61302
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
61303
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
61368
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
61369
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
61304
61370
|
break;
|
|
61305
61371
|
}
|
|
61306
|
-
return
|
|
61372
|
+
return "Success";
|
|
61307
61373
|
}
|
|
61308
61374
|
handle(cmd) {
|
|
61309
61375
|
switch (cmd.type) {
|
|
@@ -61566,13 +61632,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61566
61632
|
allowDispatch(cmd) {
|
|
61567
61633
|
switch (cmd.type) {
|
|
61568
61634
|
case "REQUEST_UNDO":
|
|
61569
|
-
if (!this.canUndo()) return
|
|
61635
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
61570
61636
|
break;
|
|
61571
61637
|
case "REQUEST_REDO":
|
|
61572
|
-
if (!this.canRedo()) return
|
|
61638
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
61573
61639
|
break;
|
|
61574
61640
|
}
|
|
61575
|
-
return
|
|
61641
|
+
return "Success";
|
|
61576
61642
|
}
|
|
61577
61643
|
handle(cmd) {
|
|
61578
61644
|
switch (cmd.type) {
|
|
@@ -61636,9 +61702,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61636
61702
|
* to other users and can do any operation and can do core modifications that will only affect them
|
|
61637
61703
|
* It is acceptable to bypass the locked sheet restriction in this case
|
|
61638
61704
|
*/
|
|
61639
|
-
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return
|
|
61640
|
-
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return
|
|
61641
|
-
return
|
|
61705
|
+
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
|
|
61706
|
+
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
|
|
61707
|
+
return "Success";
|
|
61642
61708
|
}
|
|
61643
61709
|
isCurrentSheetLocked() {
|
|
61644
61710
|
return this.getters.isSheetLocked(this.getters.getActiveSheetId());
|
|
@@ -61703,18 +61769,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61703
61769
|
//#endregion
|
|
61704
61770
|
//#region src/helpers/sort.ts
|
|
61705
61771
|
const SORT_TYPES = [
|
|
61706
|
-
|
|
61707
|
-
|
|
61708
|
-
|
|
61709
|
-
|
|
61772
|
+
"number",
|
|
61773
|
+
"error",
|
|
61774
|
+
"text",
|
|
61775
|
+
"boolean"
|
|
61710
61776
|
];
|
|
61711
61777
|
function cellsSortingCriterion(sortingOrder) {
|
|
61712
61778
|
const inverse = sortingOrder === "asc" ? 1 : -1;
|
|
61713
61779
|
return (left, right) => {
|
|
61714
|
-
if (left.type ===
|
|
61715
|
-
else if (right.type ===
|
|
61780
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
61781
|
+
else if (right.type === "empty") return -1;
|
|
61716
61782
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
61717
|
-
if (typeOrder === 0) if (left.type ===
|
|
61783
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
61718
61784
|
else typeOrder = left.value - right.value;
|
|
61719
61785
|
return inverse * typeOrder;
|
|
61720
61786
|
};
|
|
@@ -61725,9 +61791,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61725
61791
|
type: cell.type,
|
|
61726
61792
|
value: cell.value
|
|
61727
61793
|
}));
|
|
61728
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
61794
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
61729
61795
|
...cell,
|
|
61730
|
-
type:
|
|
61796
|
+
type: "number",
|
|
61731
61797
|
value: 0
|
|
61732
61798
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
61733
61799
|
}
|
|
@@ -61738,10 +61804,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61738
61804
|
allowDispatch(cmd) {
|
|
61739
61805
|
switch (cmd.type) {
|
|
61740
61806
|
case "SORT_CELLS":
|
|
61741
|
-
if (!isInside(cmd.col, cmd.row, cmd.zone)) return
|
|
61807
|
+
if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
|
|
61742
61808
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
|
|
61743
61809
|
}
|
|
61744
|
-
return
|
|
61810
|
+
return "Success";
|
|
61745
61811
|
}
|
|
61746
61812
|
handle(cmd) {
|
|
61747
61813
|
switch (cmd.type) {
|
|
@@ -61751,24 +61817,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61751
61817
|
}
|
|
61752
61818
|
}
|
|
61753
61819
|
checkMerge({ sheetId, zone }) {
|
|
61754
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61820
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61755
61821
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
61756
61822
|
sheetId,
|
|
61757
61823
|
col,
|
|
61758
61824
|
row
|
|
61759
|
-
}))) return
|
|
61760
|
-
return
|
|
61825
|
+
}))) return "InvalidSortZone";
|
|
61826
|
+
return "Success";
|
|
61761
61827
|
}
|
|
61762
61828
|
checkMergeSizes({ sheetId, zone }) {
|
|
61763
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61829
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61764
61830
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
61765
61831
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
61766
61832
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
61767
61833
|
if (!merges.every((merge) => {
|
|
61768
61834
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
61769
61835
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
61770
|
-
})) return
|
|
61771
|
-
return
|
|
61836
|
+
})) return "InvalidSortZone";
|
|
61837
|
+
return "Success";
|
|
61772
61838
|
}
|
|
61773
61839
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
61774
61840
|
return positions(zone).some(({ col, row }) => {
|
|
@@ -61782,7 +61848,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61782
61848
|
col,
|
|
61783
61849
|
row
|
|
61784
61850
|
});
|
|
61785
|
-
}) ?
|
|
61851
|
+
}) ? "SortZoneWithArrayFormulas" : "Success";
|
|
61786
61852
|
}
|
|
61787
61853
|
/**
|
|
61788
61854
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -61800,9 +61866,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61800
61866
|
col,
|
|
61801
61867
|
row
|
|
61802
61868
|
}).type));
|
|
61803
|
-
if (cells[0][0] ===
|
|
61804
|
-
if (cells.some((item) => item[0] ===
|
|
61805
|
-
else if (cells.some((item) => item[1] !==
|
|
61869
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
61870
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
61871
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
61806
61872
|
else return false;
|
|
61807
61873
|
}
|
|
61808
61874
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -61891,7 +61957,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61891
61957
|
switch (cmd.type) {
|
|
61892
61958
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
61893
61959
|
}
|
|
61894
|
-
return
|
|
61960
|
+
return "Success";
|
|
61895
61961
|
}
|
|
61896
61962
|
handle(cmd) {
|
|
61897
61963
|
switch (cmd.type) {
|
|
@@ -61902,7 +61968,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61902
61968
|
}
|
|
61903
61969
|
getAutomaticSeparator() {
|
|
61904
61970
|
const cells = this.getters.getSelectedCells();
|
|
61905
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
61971
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
61906
61972
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
61907
61973
|
if (separator) return separator;
|
|
61908
61974
|
}
|
|
@@ -62040,24 +62106,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62040
62106
|
});
|
|
62041
62107
|
}
|
|
62042
62108
|
checkSingleColSelected() {
|
|
62043
|
-
if (!this.getters.isSingleColSelected()) return
|
|
62044
|
-
return
|
|
62109
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
62110
|
+
return "Success";
|
|
62045
62111
|
}
|
|
62046
62112
|
checkNonEmptySelector(cmd) {
|
|
62047
|
-
if (cmd.separator === "") return
|
|
62048
|
-
return
|
|
62113
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
62114
|
+
return "Success";
|
|
62049
62115
|
}
|
|
62050
62116
|
checkNotOverwritingContent(cmd) {
|
|
62051
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
62117
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
62052
62118
|
const selection = this.getters.getSelectedZones()[0];
|
|
62053
62119
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
62054
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
62055
|
-
return
|
|
62120
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
62121
|
+
return "Success";
|
|
62056
62122
|
}
|
|
62057
62123
|
checkSeparatorInSelection({ separator }) {
|
|
62058
62124
|
const cells = this.getters.getSelectedCells();
|
|
62059
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
62060
|
-
return
|
|
62125
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
62126
|
+
return "NoSplitSeparatorInSelection";
|
|
62061
62127
|
}
|
|
62062
62128
|
};
|
|
62063
62129
|
|
|
@@ -62102,7 +62168,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62102
62168
|
col,
|
|
62103
62169
|
row: r,
|
|
62104
62170
|
sheetId
|
|
62105
|
-
}).type !==
|
|
62171
|
+
}).type !== "empty") return;
|
|
62106
62172
|
}
|
|
62107
62173
|
const oldSelection = {
|
|
62108
62174
|
zone: this.getters.getSelectedZone(),
|
|
@@ -62131,13 +62197,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62131
62197
|
switch (cmd.type) {
|
|
62132
62198
|
case "RESIZE_TABLE":
|
|
62133
62199
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
62134
|
-
if (!table) return
|
|
62200
|
+
if (!table) return "TableNotFound";
|
|
62135
62201
|
const oldTableZone = table.range.zone;
|
|
62136
62202
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
62137
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
62203
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
62138
62204
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
62139
62205
|
}
|
|
62140
|
-
return
|
|
62206
|
+
return "Success";
|
|
62141
62207
|
}
|
|
62142
62208
|
handle(cmd) {
|
|
62143
62209
|
switch (cmd.type) {
|
|
@@ -62365,7 +62431,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62365
62431
|
*/
|
|
62366
62432
|
isCellEmpty(position) {
|
|
62367
62433
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
62368
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
62434
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
62369
62435
|
}
|
|
62370
62436
|
getColMaxWidth(sheetId, index) {
|
|
62371
62437
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -62379,8 +62445,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62379
62445
|
* sheet.
|
|
62380
62446
|
*/
|
|
62381
62447
|
checkSheetExists(cmd) {
|
|
62382
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return
|
|
62383
|
-
return
|
|
62448
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
|
|
62449
|
+
return "Success";
|
|
62384
62450
|
}
|
|
62385
62451
|
/**
|
|
62386
62452
|
* Check if zones in the command are well formed and
|
|
@@ -62388,11 +62454,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62388
62454
|
*/
|
|
62389
62455
|
checkZonesAreInSheet(cmd) {
|
|
62390
62456
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
62391
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
62457
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
62392
62458
|
const zones = this.getters.getCommandZones(cmd);
|
|
62393
|
-
if (!sheetId && zones.length > 0) return
|
|
62459
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
62394
62460
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
62395
|
-
return
|
|
62461
|
+
return "Success";
|
|
62396
62462
|
}
|
|
62397
62463
|
autoResizeRows(sheetId, rows) {
|
|
62398
62464
|
const rowSizes = [];
|
|
@@ -62439,20 +62505,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62439
62505
|
allowDispatch(cmd) {
|
|
62440
62506
|
switch (cmd.type) {
|
|
62441
62507
|
case "ADD_FIGURE_CHART_TO_CAROUSEL":
|
|
62442
|
-
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return
|
|
62443
|
-
return
|
|
62508
|
+
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
|
|
62509
|
+
return "Success";
|
|
62444
62510
|
case "DUPLICATE_CAROUSEL_CHART":
|
|
62445
|
-
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
|
|
62446
|
-
return
|
|
62511
|
+
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";
|
|
62512
|
+
return "Success";
|
|
62447
62513
|
case "ADD_NEW_CHART_TO_CAROUSEL":
|
|
62448
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62449
|
-
return
|
|
62514
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62515
|
+
return "Success";
|
|
62450
62516
|
case "UPDATE_CAROUSEL_ACTIVE_ITEM":
|
|
62451
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62452
|
-
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return
|
|
62453
|
-
return
|
|
62517
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62518
|
+
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
|
|
62519
|
+
return "Success";
|
|
62454
62520
|
}
|
|
62455
|
-
return
|
|
62521
|
+
return "Success";
|
|
62456
62522
|
}
|
|
62457
62523
|
handle(cmd) {
|
|
62458
62524
|
switch (cmd.type) {
|
|
@@ -62689,7 +62755,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62689
62755
|
});
|
|
62690
62756
|
}
|
|
62691
62757
|
case "PASTE": {
|
|
62692
|
-
if (!this.copiedData) return
|
|
62758
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
62693
62759
|
const pasteOption = cmd.pasteOption;
|
|
62694
62760
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
62695
62761
|
pasteOption,
|
|
@@ -62698,21 +62764,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62698
62764
|
}
|
|
62699
62765
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
62700
62766
|
const zones = this.getters.getSelectedZones();
|
|
62701
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
62767
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
62702
62768
|
const zone = this.getters.getSelectedZone();
|
|
62703
62769
|
const copiedData = this.getCopiedDataAbove(zone);
|
|
62704
62770
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62705
62771
|
}
|
|
62706
62772
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
62707
62773
|
const zones = this.getters.getSelectedZones();
|
|
62708
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
62774
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
62709
62775
|
const zone = this.getters.getSelectedZone();
|
|
62710
62776
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62711
62777
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62712
62778
|
}
|
|
62713
62779
|
case "COPY_PASTE_CELLS_ON_ZONE": {
|
|
62714
62780
|
const zones = this.getters.getSelectedZones();
|
|
62715
|
-
if (zones.length > 1) return
|
|
62781
|
+
if (zones.length > 1) return "InvalidCopyPasteSelection";
|
|
62716
62782
|
const zone = this.getters.getSelectedZone();
|
|
62717
62783
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62718
62784
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
@@ -62728,7 +62794,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62728
62794
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
62729
62795
|
}
|
|
62730
62796
|
}
|
|
62731
|
-
return
|
|
62797
|
+
return "Success";
|
|
62732
62798
|
}
|
|
62733
62799
|
handle(cmd) {
|
|
62734
62800
|
switch (cmd.type) {
|
|
@@ -62931,16 +62997,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62931
62997
|
const clipboardData = this.getClipboardData(zones);
|
|
62932
62998
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
62933
62999
|
const result = handler.isCutAllowed(clipboardData);
|
|
62934
|
-
if (result !==
|
|
63000
|
+
if (result !== "Success") return result;
|
|
62935
63001
|
}
|
|
62936
|
-
return
|
|
63002
|
+
return "Success";
|
|
62937
63003
|
}
|
|
62938
63004
|
isPasteAllowed(target, copiedData, options) {
|
|
62939
63005
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
62940
63006
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
62941
|
-
if (result !==
|
|
63007
|
+
if (result !== "Success") return result;
|
|
62942
63008
|
}
|
|
62943
|
-
return
|
|
63009
|
+
return "Success";
|
|
62944
63010
|
}
|
|
62945
63011
|
isColRowDirtyingClipboard(position, dimension) {
|
|
62946
63012
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -63021,12 +63087,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63021
63087
|
const file = await this.getImageContent();
|
|
63022
63088
|
const mime = file?.type;
|
|
63023
63089
|
const content = {
|
|
63024
|
-
[
|
|
63025
|
-
[
|
|
63090
|
+
["text/plain"]: "",
|
|
63091
|
+
["text/html"]: ""
|
|
63026
63092
|
};
|
|
63027
63093
|
try {
|
|
63028
|
-
content[
|
|
63029
|
-
content[
|
|
63094
|
+
content["text/plain"] = this.getPlainTextContent();
|
|
63095
|
+
content["text/html"] = await this.getHTMLContent();
|
|
63030
63096
|
} catch (error) {
|
|
63031
63097
|
this.ui.notifyUI({
|
|
63032
63098
|
type: "danger",
|
|
@@ -63218,10 +63284,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63218
63284
|
allowDispatch(cmd) {
|
|
63219
63285
|
switch (cmd.type) {
|
|
63220
63286
|
case "UPDATE_FILTER":
|
|
63221
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
63287
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
63222
63288
|
break;
|
|
63223
63289
|
}
|
|
63224
|
-
return
|
|
63290
|
+
return "Success";
|
|
63225
63291
|
}
|
|
63226
63292
|
handle(cmd) {
|
|
63227
63293
|
switch (cmd.type) {
|
|
@@ -63585,14 +63651,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63585
63651
|
allowDispatch(cmd) {
|
|
63586
63652
|
switch (cmd.type) {
|
|
63587
63653
|
case "ACTIVATE_SHEET": try {
|
|
63588
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
63654
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
63589
63655
|
break;
|
|
63590
63656
|
} catch (error) {
|
|
63591
|
-
return
|
|
63657
|
+
return "InvalidSheetId";
|
|
63592
63658
|
}
|
|
63593
63659
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
63594
63660
|
}
|
|
63595
|
-
return
|
|
63661
|
+
return "Success";
|
|
63596
63662
|
}
|
|
63597
63663
|
handleEvent(event) {
|
|
63598
63664
|
let anchor = event.anchor;
|
|
@@ -64113,12 +64179,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64113
64179
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
64114
64180
|
const id = cmd.sheetId;
|
|
64115
64181
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
64116
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
64182
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
64117
64183
|
const headers = [cmd.base, ...cmd.elements];
|
|
64118
64184
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
64119
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
64120
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
64121
|
-
return
|
|
64185
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
64186
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
64187
|
+
return "Success";
|
|
64122
64188
|
}
|
|
64123
64189
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
64124
64190
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -64220,6 +64286,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64220
64286
|
//#endregion
|
|
64221
64287
|
//#region src/helpers/internal_viewport.ts
|
|
64222
64288
|
var InternalViewport = class {
|
|
64289
|
+
getters;
|
|
64290
|
+
sheetId;
|
|
64291
|
+
boundaries;
|
|
64223
64292
|
top;
|
|
64224
64293
|
bottom;
|
|
64225
64294
|
left;
|
|
@@ -64491,6 +64560,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64491
64560
|
* ↓ ↓
|
|
64492
64561
|
*/
|
|
64493
64562
|
var ViewportCollection = class {
|
|
64563
|
+
paneDivision;
|
|
64564
|
+
sheetViewWidth;
|
|
64565
|
+
sheetViewHeight;
|
|
64566
|
+
zoomLevel;
|
|
64494
64567
|
getters;
|
|
64495
64568
|
viewports = {};
|
|
64496
64569
|
gridOffsetX = 0;
|
|
@@ -64807,22 +64880,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64807
64880
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
64808
64881
|
}
|
|
64809
64882
|
checkPositiveDimension(cmd) {
|
|
64810
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
64811
|
-
return
|
|
64883
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
64884
|
+
return "Success";
|
|
64812
64885
|
}
|
|
64813
64886
|
checkValuesAreDifferent(cmd) {
|
|
64814
64887
|
const { height, width } = this.getSheetViewDimension();
|
|
64815
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
64816
|
-
return
|
|
64888
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
64889
|
+
return "Success";
|
|
64817
64890
|
}
|
|
64818
64891
|
checkScrollingDirection(sheetId, { offsetX, offsetY }) {
|
|
64819
64892
|
const pane = this.getMainInternalViewport(sheetId);
|
|
64820
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
64821
|
-
return
|
|
64893
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
64894
|
+
return "Success";
|
|
64822
64895
|
}
|
|
64823
64896
|
checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
|
|
64824
64897
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
|
|
64825
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
64898
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
64826
64899
|
}
|
|
64827
64900
|
getMainViewport(sheetId) {
|
|
64828
64901
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -65139,9 +65212,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65139
65212
|
return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
|
|
65140
65213
|
}
|
|
65141
65214
|
case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
|
|
65142
|
-
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return
|
|
65143
|
-
else return
|
|
65144
|
-
default: return
|
|
65215
|
+
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
|
|
65216
|
+
else return "Success";
|
|
65217
|
+
default: return "Success";
|
|
65145
65218
|
}
|
|
65146
65219
|
}
|
|
65147
65220
|
handleEvent(event) {
|
|
@@ -67215,9 +67288,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67215
67288
|
newName: name,
|
|
67216
67289
|
oldName: env.model.getters.getSheetName(sheetId)
|
|
67217
67290
|
});
|
|
67218
|
-
if (result.reasons.includes(
|
|
67219
|
-
else if (result.reasons.includes(
|
|
67220
|
-
else if (result.reasons.includes(
|
|
67291
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
67292
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
67293
|
+
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);
|
|
67221
67294
|
}
|
|
67222
67295
|
|
|
67223
67296
|
//#endregion
|
|
@@ -67275,7 +67348,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67275
67348
|
(0, _odoo_owl.onMounted)(() => {
|
|
67276
67349
|
const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
|
|
67277
67350
|
this.env.model.on("command-rejected", this, async ({ command, result }) => {
|
|
67278
|
-
if (result.isCancelledBecause(
|
|
67351
|
+
if (result.isCancelledBecause("SheetLocked")) {
|
|
67279
67352
|
if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
|
|
67280
67353
|
this.scrollToSheet();
|
|
67281
67354
|
await animateLockedSheet();
|
|
@@ -67412,41 +67485,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67412
67485
|
const selectionStatisticFunctions = [
|
|
67413
67486
|
{
|
|
67414
67487
|
name: _t("Sum"),
|
|
67415
|
-
types: [
|
|
67488
|
+
types: ["number"],
|
|
67416
67489
|
compute: (values, locale) => sum([[values]], locale)
|
|
67417
67490
|
},
|
|
67418
67491
|
{
|
|
67419
67492
|
name: _t("Avg"),
|
|
67420
|
-
types: [
|
|
67493
|
+
types: ["number"],
|
|
67421
67494
|
compute: (values, locale) => average([[values]], locale)
|
|
67422
67495
|
},
|
|
67423
67496
|
{
|
|
67424
67497
|
name: _t("Min"),
|
|
67425
|
-
types: [
|
|
67498
|
+
types: ["number"],
|
|
67426
67499
|
compute: (values, locale) => min([[values]], locale).value
|
|
67427
67500
|
},
|
|
67428
67501
|
{
|
|
67429
67502
|
name: _t("Max"),
|
|
67430
|
-
types: [
|
|
67503
|
+
types: ["number"],
|
|
67431
67504
|
compute: (values, locale) => max([[values]], locale).value
|
|
67432
67505
|
},
|
|
67433
67506
|
{
|
|
67434
67507
|
name: _t("Count"),
|
|
67435
67508
|
types: [
|
|
67436
|
-
|
|
67437
|
-
|
|
67438
|
-
|
|
67439
|
-
|
|
67509
|
+
"number",
|
|
67510
|
+
"text",
|
|
67511
|
+
"boolean",
|
|
67512
|
+
"error"
|
|
67440
67513
|
],
|
|
67441
67514
|
compute: (values) => countAny([[values]])
|
|
67442
67515
|
},
|
|
67443
67516
|
{
|
|
67444
67517
|
name: _t("Count Numbers"),
|
|
67445
67518
|
types: [
|
|
67446
|
-
|
|
67447
|
-
|
|
67448
|
-
|
|
67449
|
-
|
|
67519
|
+
"number",
|
|
67520
|
+
"text",
|
|
67521
|
+
"boolean",
|
|
67522
|
+
"error"
|
|
67450
67523
|
],
|
|
67451
67524
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
67452
67525
|
}
|
|
@@ -67499,7 +67572,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67499
67572
|
col,
|
|
67500
67573
|
row
|
|
67501
67574
|
});
|
|
67502
|
-
if (evaluatedCell.type !==
|
|
67575
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
67503
67576
|
}
|
|
67504
67577
|
return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
|
|
67505
67578
|
}
|
|
@@ -68447,6 +68520,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68447
68520
|
//#region src/components/standalone_grid_canvas/figure_renderer_store.ts
|
|
68448
68521
|
/** Store that draws the figures directly onto the canvas */
|
|
68449
68522
|
var FigureRendererStore = class extends DisposableStore {
|
|
68523
|
+
renderer;
|
|
68450
68524
|
mutators = ["addLoadedImage"];
|
|
68451
68525
|
getters = this.get(ModelStore).getters;
|
|
68452
68526
|
loadedImages = {};
|
|
@@ -68792,7 +68866,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68792
68866
|
const coreCell = this.getters.getCell(position);
|
|
68793
68867
|
if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
|
|
68794
68868
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
68795
|
-
if (evaluatedCell && evaluatedCell.type !==
|
|
68869
|
+
if (evaluatedCell && evaluatedCell.type !== "empty") return true;
|
|
68796
68870
|
}
|
|
68797
68871
|
return false;
|
|
68798
68872
|
}
|
|
@@ -69133,7 +69207,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
69133
69207
|
}
|
|
69134
69208
|
navigateToRange(range) {
|
|
69135
69209
|
const { sheetId, zone } = range;
|
|
69136
|
-
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !==
|
|
69210
|
+
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
|
|
69137
69211
|
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."));
|
|
69138
69212
|
return;
|
|
69139
69213
|
}
|
|
@@ -70018,6 +70092,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70018
70092
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
70019
70093
|
}
|
|
70020
70094
|
var WebClipboardWrapper = class {
|
|
70095
|
+
clipboard;
|
|
70021
70096
|
constructor(clipboard) {
|
|
70022
70097
|
this.clipboard = clipboard;
|
|
70023
70098
|
}
|
|
@@ -70033,12 +70108,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70033
70108
|
console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
|
|
70034
70109
|
try {
|
|
70035
70110
|
await this.clipboard?.write([new ClipboardItem({
|
|
70036
|
-
[
|
|
70037
|
-
[
|
|
70111
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
70112
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
70038
70113
|
})]);
|
|
70039
70114
|
} catch (e) {}
|
|
70040
70115
|
}
|
|
70041
|
-
else await this.writeText(clipboardContent[
|
|
70116
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
70042
70117
|
}
|
|
70043
70118
|
async writeText(text) {
|
|
70044
70119
|
try {
|
|
@@ -70067,7 +70142,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70067
70142
|
}
|
|
70068
70143
|
else return {
|
|
70069
70144
|
status: "ok",
|
|
70070
|
-
content: { [
|
|
70145
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
70071
70146
|
};
|
|
70072
70147
|
}
|
|
70073
70148
|
getClipboardItems(content) {
|
|
@@ -70219,7 +70294,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70219
70294
|
bindModelEvents() {
|
|
70220
70295
|
this.model.on("update", this, () => this.render(true));
|
|
70221
70296
|
this.model.on("command-rejected", this, ({ result }) => {
|
|
70222
|
-
if (result.isCancelledBecause(
|
|
70297
|
+
if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
|
|
70223
70298
|
type: "info",
|
|
70224
70299
|
text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
|
|
70225
70300
|
sticky: false
|
|
@@ -70304,6 +70379,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70304
70379
|
//#endregion
|
|
70305
70380
|
//#region src/collaborative/command_squisher.ts
|
|
70306
70381
|
var CommandSquisher = class {
|
|
70382
|
+
getters;
|
|
70307
70383
|
constructor(getters) {
|
|
70308
70384
|
this.getters = getters;
|
|
70309
70385
|
}
|
|
@@ -70410,6 +70486,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70410
70486
|
//#endregion
|
|
70411
70487
|
//#region src/collaborative/readonly_transport_filter.ts
|
|
70412
70488
|
var ReadonlyTransportFilter = class {
|
|
70489
|
+
transportService;
|
|
70413
70490
|
constructor(transportService) {
|
|
70414
70491
|
this.transportService = transportService;
|
|
70415
70492
|
}
|
|
@@ -70441,6 +70518,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70441
70518
|
* @param operations initial operations
|
|
70442
70519
|
*/
|
|
70443
70520
|
var Branch = class Branch {
|
|
70521
|
+
buildTransformation;
|
|
70522
|
+
operations;
|
|
70444
70523
|
constructor(buildTransformation, operations = []) {
|
|
70445
70524
|
this.buildTransformation = buildTransformation;
|
|
70446
70525
|
this.operations = operations;
|
|
@@ -70557,6 +70636,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70557
70636
|
* to revert it).
|
|
70558
70637
|
*/
|
|
70559
70638
|
var Operation = class {
|
|
70639
|
+
id;
|
|
70640
|
+
data;
|
|
70560
70641
|
constructor(id, data) {
|
|
70561
70642
|
this.id = id;
|
|
70562
70643
|
this.data = data;
|
|
@@ -70566,6 +70647,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70566
70647
|
}
|
|
70567
70648
|
};
|
|
70568
70649
|
var LazyOperation = class LazyOperation {
|
|
70650
|
+
id;
|
|
70651
|
+
lazyData;
|
|
70569
70652
|
constructor(id, lazyData) {
|
|
70570
70653
|
this.id = id;
|
|
70571
70654
|
this.lazyData = lazyData;
|
|
@@ -70591,6 +70674,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70591
70674
|
* ```
|
|
70592
70675
|
*/
|
|
70593
70676
|
var OperationSequence = class OperationSequence {
|
|
70677
|
+
operations;
|
|
70594
70678
|
constructor(operations) {
|
|
70595
70679
|
this.operations = operations;
|
|
70596
70680
|
}
|
|
@@ -70666,6 +70750,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70666
70750
|
*
|
|
70667
70751
|
*/
|
|
70668
70752
|
var Tree = class {
|
|
70753
|
+
buildTransformation;
|
|
70669
70754
|
branches;
|
|
70670
70755
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
70671
70756
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -71175,8 +71260,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71175
71260
|
"removeRangesSheetPrefix"
|
|
71176
71261
|
];
|
|
71177
71262
|
allowDispatch(cmd) {
|
|
71178
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
71179
|
-
return
|
|
71263
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
71264
|
+
return "Success";
|
|
71180
71265
|
}
|
|
71181
71266
|
beforeHandle(command) {}
|
|
71182
71267
|
handle(cmd) {
|
|
@@ -71461,6 +71546,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71461
71546
|
* with the new selected anchor
|
|
71462
71547
|
*/
|
|
71463
71548
|
var SelectionStreamProcessorImpl = class {
|
|
71549
|
+
getters;
|
|
71464
71550
|
stream;
|
|
71465
71551
|
/**
|
|
71466
71552
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -71559,7 +71645,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71559
71645
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
71560
71646
|
*/
|
|
71561
71647
|
moveAnchorCell(direction, step = 1) {
|
|
71562
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71648
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71563
71649
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
71564
71650
|
return this.selectCell(col, row);
|
|
71565
71651
|
}
|
|
@@ -71593,7 +71679,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71593
71679
|
bottom: Math.max(anchorRow, row)
|
|
71594
71680
|
};
|
|
71595
71681
|
const expandedZone = this.getters.expandZone(sheetId, zone);
|
|
71596
|
-
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(
|
|
71682
|
+
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
|
|
71597
71683
|
const anchor = {
|
|
71598
71684
|
zone: expandedZone,
|
|
71599
71685
|
cell: {
|
|
@@ -71655,7 +71741,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71655
71741
|
* of the anchor zone which moves.
|
|
71656
71742
|
*/
|
|
71657
71743
|
resizeAnchorZone(direction, step = 1) {
|
|
71658
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71744
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71659
71745
|
const sheetId = this.getters.getActiveSheetId();
|
|
71660
71746
|
const anchor = this.anchor;
|
|
71661
71747
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -71902,7 +71988,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71902
71988
|
previousAnchor: deepCopy(this.anchor)
|
|
71903
71989
|
};
|
|
71904
71990
|
const commandResult = this.checkEventAnchorZone(event);
|
|
71905
|
-
if (commandResult !==
|
|
71991
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
71906
71992
|
this.anchor = event.anchor;
|
|
71907
71993
|
this.stream.send(event);
|
|
71908
71994
|
return DispatchResult.Success;
|
|
@@ -71912,15 +71998,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
71912
71998
|
}
|
|
71913
71999
|
checkAnchorZone(anchor) {
|
|
71914
72000
|
const { cell, zone } = anchor;
|
|
71915
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
72001
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
71916
72002
|
const { left, right, top, bottom } = zone;
|
|
71917
72003
|
const sheetId = this.getters.getActiveSheetId();
|
|
71918
72004
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
71919
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
71920
|
-
return
|
|
72005
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
72006
|
+
return "Success";
|
|
71921
72007
|
}
|
|
71922
72008
|
checkAnchorZoneOrThrow(anchor) {
|
|
71923
|
-
if (this.checkAnchorZone(anchor) ===
|
|
72009
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
|
|
71924
72010
|
}
|
|
71925
72011
|
/**
|
|
71926
72012
|
* ---- PRIVATE ----
|
|
@@ -72077,7 +72163,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
72077
72163
|
isCellSkippableInCluster(position) {
|
|
72078
72164
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
72079
72165
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
72080
|
-
return cell.type ===
|
|
72166
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
72081
72167
|
}
|
|
72082
72168
|
};
|
|
72083
72169
|
|
|
@@ -74294,14 +74380,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74294
74380
|
|
|
74295
74381
|
//#endregion
|
|
74296
74382
|
//#region src/model.ts
|
|
74297
|
-
|
|
74298
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
74299
|
-
Status[Status["Running"] = 1] = "Running";
|
|
74300
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
74301
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
74302
|
-
return Status;
|
|
74303
|
-
}(Status || {});
|
|
74304
|
-
/**
|
|
74383
|
+
/**
|
|
74305
74384
|
* Model
|
|
74306
74385
|
*
|
|
74307
74386
|
* The Model class is the owner of the state of the Spreadsheet. However, it
|
|
@@ -74346,7 +74425,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74346
74425
|
/**
|
|
74347
74426
|
* Internal status of the model. Important for command handling coordination
|
|
74348
74427
|
*/
|
|
74349
|
-
status =
|
|
74428
|
+
status = 0;
|
|
74350
74429
|
/**
|
|
74351
74430
|
* The config object contains some configuration flag and callbacks
|
|
74352
74431
|
*/
|
|
@@ -74493,7 +74572,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74493
74572
|
onRemoteRevisionReceived({ commands }) {
|
|
74494
74573
|
for (const command of commands) {
|
|
74495
74574
|
const previousStatus = this.status;
|
|
74496
|
-
this.status =
|
|
74575
|
+
this.status = 2;
|
|
74497
74576
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
74498
74577
|
this.status = previousStatus;
|
|
74499
74578
|
}
|
|
@@ -74606,7 +74685,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74606
74685
|
return this.processCommandResults(results);
|
|
74607
74686
|
}
|
|
74608
74687
|
processCommandResults(results) {
|
|
74609
|
-
if (results.some((r) => r !==
|
|
74688
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
74610
74689
|
return DispatchResult.Success;
|
|
74611
74690
|
}
|
|
74612
74691
|
checkDispatchAllowedRemoteCommand(command) {
|
|
@@ -74620,9 +74699,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74620
74699
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
74621
74700
|
}
|
|
74622
74701
|
finalize() {
|
|
74623
|
-
this.status =
|
|
74702
|
+
this.status = 3;
|
|
74624
74703
|
for (const h of this.handlers) h.finalize();
|
|
74625
|
-
this.status =
|
|
74704
|
+
this.status = 0;
|
|
74626
74705
|
this.trigger("command-finalized");
|
|
74627
74706
|
}
|
|
74628
74707
|
/**
|
|
@@ -74649,10 +74728,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74649
74728
|
dispatch = (type, payload) => {
|
|
74650
74729
|
const command = createCommand(type, payload);
|
|
74651
74730
|
const status = this.status;
|
|
74652
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
74653
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
74731
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
74732
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
74654
74733
|
switch (status) {
|
|
74655
|
-
case
|
|
74734
|
+
case 0:
|
|
74656
74735
|
const result = this.checkDispatchAllowed(command);
|
|
74657
74736
|
if (!result.isSuccessful) {
|
|
74658
74737
|
this.trigger("update");
|
|
@@ -74662,7 +74741,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74662
74741
|
});
|
|
74663
74742
|
return result;
|
|
74664
74743
|
}
|
|
74665
|
-
this.status =
|
|
74744
|
+
this.status = 1;
|
|
74666
74745
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
74667
74746
|
const start = performance.now();
|
|
74668
74747
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -74672,10 +74751,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74672
74751
|
if (time > 5) console.debug(type, time, "ms");
|
|
74673
74752
|
});
|
|
74674
74753
|
this.session.save(command, commands, changes);
|
|
74675
|
-
this.status =
|
|
74754
|
+
this.status = 0;
|
|
74676
74755
|
this.trigger("update");
|
|
74677
74756
|
break;
|
|
74678
|
-
case
|
|
74757
|
+
case 1:
|
|
74679
74758
|
if (isCoreCommand(command)) {
|
|
74680
74759
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
74681
74760
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -74683,8 +74762,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74683
74762
|
}
|
|
74684
74763
|
this.dispatchToHandlers(this.handlers, command);
|
|
74685
74764
|
break;
|
|
74686
|
-
case
|
|
74687
|
-
case
|
|
74765
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
74766
|
+
case 2:
|
|
74688
74767
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
74689
74768
|
this.dispatchToHandlers(this.handlers, command);
|
|
74690
74769
|
}
|
|
@@ -74697,7 +74776,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74697
74776
|
dispatchFromCorePlugin = (type, payload) => {
|
|
74698
74777
|
const command = createCommand(type, payload);
|
|
74699
74778
|
const previousStatus = this.status;
|
|
74700
|
-
this.status =
|
|
74779
|
+
this.status = 2;
|
|
74701
74780
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
74702
74781
|
this.dispatchToHandlers(handlers, command);
|
|
74703
74782
|
this.status = previousStatus;
|
|
@@ -74799,9 +74878,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74799
74878
|
//#endregion
|
|
74800
74879
|
//#region src/helpers/figures/charts/calendar_chart.ts
|
|
74801
74880
|
function checkDateGranularity(definition) {
|
|
74802
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return
|
|
74803
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return
|
|
74804
|
-
return
|
|
74881
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
|
|
74882
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
|
|
74883
|
+
return "Success";
|
|
74805
74884
|
}
|
|
74806
74885
|
const CalendarChart = {
|
|
74807
74886
|
sequence: 110,
|
|
@@ -74892,7 +74971,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74892
74971
|
copyInSheetId: (definition) => definition,
|
|
74893
74972
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74894
74973
|
transformDefinition: (definition) => definition,
|
|
74895
|
-
validateDefinition: () =>
|
|
74974
|
+
validateDefinition: () => "Success",
|
|
74896
74975
|
updateRanges: (definition) => definition,
|
|
74897
74976
|
getContextCreation: (definition) => definition,
|
|
74898
74977
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
@@ -74982,7 +75061,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74982
75061
|
copyInSheetId: (definition) => definition,
|
|
74983
75062
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74984
75063
|
transformDefinition: (definition) => definition,
|
|
74985
|
-
validateDefinition: () =>
|
|
75064
|
+
validateDefinition: () => "Success",
|
|
74986
75065
|
updateRanges: (definition) => definition,
|
|
74987
75066
|
getContextCreation: (definition) => definition,
|
|
74988
75067
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75048,7 +75127,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75048
75127
|
copyInSheetId: (definition) => definition,
|
|
75049
75128
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75050
75129
|
transformDefinition: (definition) => definition,
|
|
75051
|
-
validateDefinition: () =>
|
|
75130
|
+
validateDefinition: () => "Success",
|
|
75052
75131
|
updateRanges: (definition) => definition,
|
|
75053
75132
|
getContextCreation: (definition) => definition,
|
|
75054
75133
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75109,7 +75188,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75109
75188
|
copyInSheetId: (definition) => definition,
|
|
75110
75189
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75111
75190
|
transformDefinition: (definition) => definition,
|
|
75112
|
-
validateDefinition: () =>
|
|
75191
|
+
validateDefinition: () => "Success",
|
|
75113
75192
|
updateRanges: (definition) => definition,
|
|
75114
75193
|
getContextCreation: (definition) => definition,
|
|
75115
75194
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75195,7 +75274,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75195
75274
|
copyInSheetId: (definition) => definition,
|
|
75196
75275
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75197
75276
|
transformDefinition: (definition) => definition,
|
|
75198
|
-
validateDefinition: () =>
|
|
75277
|
+
validateDefinition: () => "Success",
|
|
75199
75278
|
updateRanges: (definition) => definition,
|
|
75200
75279
|
getContextCreation: (definition) => definition,
|
|
75201
75280
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75273,7 +75352,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75273
75352
|
copyInSheetId: (definition) => definition,
|
|
75274
75353
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75275
75354
|
transformDefinition: (definition) => definition,
|
|
75276
|
-
validateDefinition: () =>
|
|
75355
|
+
validateDefinition: () => "Success",
|
|
75277
75356
|
updateRanges: (definition) => definition,
|
|
75278
75357
|
getContextCreation: (definition) => definition,
|
|
75279
75358
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75352,7 +75431,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75352
75431
|
copyInSheetId: (definition) => definition,
|
|
75353
75432
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75354
75433
|
transformDefinition: (definition) => definition,
|
|
75355
|
-
validateDefinition: () =>
|
|
75434
|
+
validateDefinition: () => "Success",
|
|
75356
75435
|
updateRanges: (definition) => definition,
|
|
75357
75436
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75358
75437
|
return {
|
|
@@ -75421,7 +75500,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75421
75500
|
copyInSheetId: (definition) => definition,
|
|
75422
75501
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75423
75502
|
transformDefinition: (definition) => definition,
|
|
75424
|
-
validateDefinition: () =>
|
|
75503
|
+
validateDefinition: () => "Success",
|
|
75425
75504
|
updateRanges: (definition) => definition,
|
|
75426
75505
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75427
75506
|
return {
|
|
@@ -75847,9 +75926,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75847
75926
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75848
75927
|
}
|
|
75849
75928
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75850
|
-
if (target.length === 0) return
|
|
75851
|
-
if (option?.pasteOption !== void 0) return
|
|
75852
|
-
return
|
|
75929
|
+
if (target.length === 0) return "EmptyTarget";
|
|
75930
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
75931
|
+
return "Success";
|
|
75853
75932
|
}
|
|
75854
75933
|
};
|
|
75855
75934
|
|
|
@@ -75920,9 +75999,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75920
75999
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75921
76000
|
}
|
|
75922
76001
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75923
|
-
if (target.length === 0) return
|
|
75924
|
-
if (option?.pasteOption !== void 0) return
|
|
75925
|
-
return
|
|
76002
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76003
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76004
|
+
return "Success";
|
|
75926
76005
|
}
|
|
75927
76006
|
};
|
|
75928
76007
|
|
|
@@ -76227,9 +76306,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76227
76306
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76228
76307
|
}
|
|
76229
76308
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76230
|
-
if (target.length === 0) return
|
|
76231
|
-
if (option?.pasteOption !== void 0) return
|
|
76232
|
-
return
|
|
76309
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76310
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76311
|
+
return "Success";
|
|
76233
76312
|
}
|
|
76234
76313
|
};
|
|
76235
76314
|
|
|
@@ -76325,10 +76404,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76325
76404
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
76326
76405
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
76327
76406
|
isPasteAllowed(sheetId, target, content, options) {
|
|
76328
|
-
if (!("cells" in content)) return
|
|
76407
|
+
if (!("cells" in content)) return "Success";
|
|
76329
76408
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
76330
|
-
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return
|
|
76331
|
-
return
|
|
76409
|
+
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
76410
|
+
return "Success";
|
|
76332
76411
|
}
|
|
76333
76412
|
};
|
|
76334
76413
|
|
|
@@ -79169,15 +79248,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
79169
79248
|
const jsEndDate = numberToJsDate(_endDate);
|
|
79170
79249
|
if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
79171
79250
|
switch (_unit) {
|
|
79172
|
-
case
|
|
79173
|
-
case
|
|
79174
|
-
case
|
|
79175
|
-
case
|
|
79176
|
-
case
|
|
79251
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
79252
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
79253
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79254
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
79255
|
+
case "MD":
|
|
79177
79256
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
79178
79257
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
79179
79258
|
return days;
|
|
79180
|
-
case
|
|
79259
|
+
case "YD": {
|
|
79181
79260
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79182
79261
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
79183
79262
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -79867,11 +79946,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
79867
79946
|
const right = sortColumn[b];
|
|
79868
79947
|
const leftCell = {
|
|
79869
79948
|
value: left,
|
|
79870
|
-
type: left === null ?
|
|
79949
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
79871
79950
|
};
|
|
79872
79951
|
const rightCell = {
|
|
79873
79952
|
value: right,
|
|
79874
|
-
type: right === null ?
|
|
79953
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
79875
79954
|
};
|
|
79876
79955
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
79877
79956
|
if (result !== 0) return result;
|
|
@@ -84469,8 +84548,8 @@ exports.stores = stores;
|
|
|
84469
84548
|
exports.tokenColors = tokenColors;
|
|
84470
84549
|
exports.tokenize = tokenize;
|
|
84471
84550
|
|
|
84472
|
-
__info__.version = "19.3.
|
|
84473
|
-
__info__.date = "2026-05-
|
|
84474
|
-
__info__.hash = "
|
|
84551
|
+
__info__.version = "19.3.5";
|
|
84552
|
+
__info__.date = "2026-05-27T06:08:23.138Z";
|
|
84553
|
+
__info__.hash = "0cf1540";
|
|
84475
84554
|
|
|
84476
84555
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|