@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
package/dist/o_spreadsheet.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 19.3.
|
|
6
|
-
* @date 2026-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.3.5
|
|
6
|
+
* @date 2026-05-27T06:08:23.138Z
|
|
7
|
+
* @hash 0cf1540
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
@@ -15,7 +15,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
15
15
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
16
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17
17
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
19
19
|
var __exportAll = (all, no_symbols) => {
|
|
20
20
|
let target = {};
|
|
21
21
|
for (var name in all) {
|
|
@@ -462,13 +462,6 @@ const borderStyles = [
|
|
|
462
462
|
function isMatrix(x) {
|
|
463
463
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
464
464
|
}
|
|
465
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
466
|
-
DIRECTION["UP"] = "up";
|
|
467
|
-
DIRECTION["DOWN"] = "down";
|
|
468
|
-
DIRECTION["LEFT"] = "left";
|
|
469
|
-
DIRECTION["RIGHT"] = "right";
|
|
470
|
-
return DIRECTION;
|
|
471
|
-
}({});
|
|
472
465
|
|
|
473
466
|
//#endregion
|
|
474
467
|
//#region src/helpers/misc.ts
|
|
@@ -925,7 +918,8 @@ var TokenizingChars = class {
|
|
|
925
918
|
}
|
|
926
919
|
shift() {
|
|
927
920
|
const current = this.current;
|
|
928
|
-
|
|
921
|
+
const next = this.text[++this.currentIndex];
|
|
922
|
+
this.current = next;
|
|
929
923
|
return current;
|
|
930
924
|
}
|
|
931
925
|
advanceBy(length) {
|
|
@@ -2113,6 +2107,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
2113
2107
|
}
|
|
2114
2108
|
};
|
|
2115
2109
|
var StoreFactory = class {
|
|
2110
|
+
get;
|
|
2116
2111
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
2117
2112
|
constructor(get) {
|
|
2118
2113
|
this.get = get;
|
|
@@ -2157,6 +2152,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2157
2152
|
return MetaStore;
|
|
2158
2153
|
}
|
|
2159
2154
|
var DisposableStore = class {
|
|
2155
|
+
get;
|
|
2160
2156
|
disposeCallbacks = [];
|
|
2161
2157
|
constructor(get) {
|
|
2162
2158
|
this.get = get;
|
|
@@ -2260,6 +2256,7 @@ function addRenderingLayer(layer, priority) {
|
|
|
2260
2256
|
//#endregion
|
|
2261
2257
|
//#region src/stores/renderer_store.ts
|
|
2262
2258
|
var RendererStore = class {
|
|
2259
|
+
layers;
|
|
2263
2260
|
mutators = [
|
|
2264
2261
|
"register",
|
|
2265
2262
|
"unRegister",
|
|
@@ -2914,6 +2911,7 @@ function getAlternatingColorsPalette(quantity) {
|
|
|
2914
2911
|
else return ALTERNATING_COLORS_XL;
|
|
2915
2912
|
}
|
|
2916
2913
|
var ColorGenerator = class {
|
|
2914
|
+
preferredColors;
|
|
2917
2915
|
currentColorIndex = 0;
|
|
2918
2916
|
palette;
|
|
2919
2917
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -3310,6 +3308,7 @@ const _t = function(s, ...values) {
|
|
|
3310
3308
|
return sprintf(_translate(s), ...values);
|
|
3311
3309
|
};
|
|
3312
3310
|
var LazyTranslatedString = class extends String {
|
|
3311
|
+
values;
|
|
3313
3312
|
constructor(str, values) {
|
|
3314
3313
|
super(str);
|
|
3315
3314
|
this.values = values;
|
|
@@ -3339,6 +3338,8 @@ const CellErrorType = {
|
|
|
3339
3338
|
};
|
|
3340
3339
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3341
3340
|
var EvaluationError = class {
|
|
3341
|
+
message;
|
|
3342
|
+
value;
|
|
3342
3343
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3343
3344
|
this.message = message;
|
|
3344
3345
|
this.value = value;
|
|
@@ -3371,6 +3372,7 @@ var UnknownFunctionError = class extends EvaluationError {
|
|
|
3371
3372
|
}
|
|
3372
3373
|
};
|
|
3373
3374
|
var SplillBlockedError = class extends EvaluationError {
|
|
3375
|
+
errorOriginPosition;
|
|
3374
3376
|
constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
|
|
3375
3377
|
super(message, CellErrorType.SpilledBlocked);
|
|
3376
3378
|
this.errorOriginPosition = errorOriginPosition;
|
|
@@ -5053,46 +5055,6 @@ function tokenizeInvalidRange(chars) {
|
|
|
5053
5055
|
|
|
5054
5056
|
//#endregion
|
|
5055
5057
|
//#region src/formulas/range_tokenizer.ts
|
|
5056
|
-
var State = /* @__PURE__ */ function(State) {
|
|
5057
|
-
/**
|
|
5058
|
-
* Initial state.
|
|
5059
|
-
* Expecting any reference for the left part of a range
|
|
5060
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5061
|
-
*/
|
|
5062
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
5063
|
-
/**
|
|
5064
|
-
* Expecting any reference for the right part of a range
|
|
5065
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5066
|
-
*/
|
|
5067
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
5068
|
-
/**
|
|
5069
|
-
* Expecting the separator without any constraint on the right part
|
|
5070
|
-
*/
|
|
5071
|
-
State[State["Separator"] = 2] = "Separator";
|
|
5072
|
-
/**
|
|
5073
|
-
* Expecting the separator for a full column range
|
|
5074
|
-
*/
|
|
5075
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
5076
|
-
/**
|
|
5077
|
-
* Expecting the separator for a full row range
|
|
5078
|
-
*/
|
|
5079
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
5080
|
-
/**
|
|
5081
|
-
* Expecting the right part of a full column range
|
|
5082
|
-
* e.g. "1", "A1"
|
|
5083
|
-
*/
|
|
5084
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
5085
|
-
/**
|
|
5086
|
-
* Expecting the right part of a full row range
|
|
5087
|
-
* e.g. "A", "A1"
|
|
5088
|
-
*/
|
|
5089
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
5090
|
-
/**
|
|
5091
|
-
* Final state. A range has been matched
|
|
5092
|
-
*/
|
|
5093
|
-
State[State["Found"] = 7] = "Found";
|
|
5094
|
-
return State;
|
|
5095
|
-
}(State || {});
|
|
5096
5058
|
const goTo = (state, guard = () => true) => [{
|
|
5097
5059
|
goTo: state,
|
|
5098
5060
|
guard
|
|
@@ -5102,41 +5064,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
5102
5064
|
guard
|
|
5103
5065
|
});
|
|
5104
5066
|
const machine = {
|
|
5105
|
-
[
|
|
5106
|
-
REFERENCE: goTo(
|
|
5107
|
-
NUMBER: goTo(
|
|
5108
|
-
SYMBOL: [goToMulti(
|
|
5109
|
-
},
|
|
5110
|
-
[
|
|
5111
|
-
SPACE: goTo(
|
|
5112
|
-
OPERATOR: goTo(
|
|
5113
|
-
},
|
|
5114
|
-
[
|
|
5115
|
-
SPACE: goTo(
|
|
5116
|
-
OPERATOR: goTo(
|
|
5117
|
-
},
|
|
5118
|
-
[
|
|
5119
|
-
SPACE: goTo(
|
|
5120
|
-
OPERATOR: goTo(
|
|
5121
|
-
},
|
|
5122
|
-
[
|
|
5123
|
-
SPACE: goTo(
|
|
5124
|
-
NUMBER: goTo(
|
|
5125
|
-
REFERENCE: goTo(
|
|
5126
|
-
SYMBOL: goTo(
|
|
5127
|
-
},
|
|
5128
|
-
[
|
|
5129
|
-
SPACE: goTo(
|
|
5130
|
-
SYMBOL: goTo(
|
|
5131
|
-
REFERENCE: goTo(
|
|
5132
|
-
},
|
|
5133
|
-
[
|
|
5134
|
-
SPACE: goTo(
|
|
5135
|
-
NUMBER: goTo(
|
|
5136
|
-
REFERENCE: goTo(
|
|
5137
|
-
SYMBOL: goTo(
|
|
5138
|
-
},
|
|
5139
|
-
[
|
|
5067
|
+
[0]: {
|
|
5068
|
+
REFERENCE: goTo(2),
|
|
5069
|
+
NUMBER: goTo(4),
|
|
5070
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
5071
|
+
},
|
|
5072
|
+
[3]: {
|
|
5073
|
+
SPACE: goTo(3),
|
|
5074
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
5075
|
+
},
|
|
5076
|
+
[4]: {
|
|
5077
|
+
SPACE: goTo(4),
|
|
5078
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
5079
|
+
},
|
|
5080
|
+
[2]: {
|
|
5081
|
+
SPACE: goTo(2),
|
|
5082
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
5083
|
+
},
|
|
5084
|
+
[1]: {
|
|
5085
|
+
SPACE: goTo(1),
|
|
5086
|
+
NUMBER: goTo(7),
|
|
5087
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5088
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
5089
|
+
},
|
|
5090
|
+
[5]: {
|
|
5091
|
+
SPACE: goTo(5),
|
|
5092
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
5093
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
5094
|
+
},
|
|
5095
|
+
[6]: {
|
|
5096
|
+
SPACE: goTo(6),
|
|
5097
|
+
NUMBER: goTo(7),
|
|
5098
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5099
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
5100
|
+
},
|
|
5101
|
+
[7]: {}
|
|
5140
5102
|
};
|
|
5141
5103
|
/**
|
|
5142
5104
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -5146,7 +5108,7 @@ const machine = {
|
|
|
5146
5108
|
*/
|
|
5147
5109
|
function matchReference(tokens) {
|
|
5148
5110
|
let head = 0;
|
|
5149
|
-
let transitions = machine[
|
|
5111
|
+
let transitions = machine[0];
|
|
5150
5112
|
let matchedTokens = "";
|
|
5151
5113
|
while (transitions !== void 0) {
|
|
5152
5114
|
const token = tokens[head++];
|
|
@@ -5155,7 +5117,7 @@ function matchReference(tokens) {
|
|
|
5155
5117
|
const nextState = transition ? transition.goTo : void 0;
|
|
5156
5118
|
switch (nextState) {
|
|
5157
5119
|
case void 0: return null;
|
|
5158
|
-
case
|
|
5120
|
+
case 7:
|
|
5159
5121
|
matchedTokens += token.value;
|
|
5160
5122
|
tokens.splice(0, head);
|
|
5161
5123
|
return {
|
|
@@ -5854,8 +5816,13 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
5854
5816
|
changeType: "NONE",
|
|
5855
5817
|
range
|
|
5856
5818
|
};
|
|
5819
|
+
const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
|
|
5820
|
+
if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
|
|
5821
|
+
changeType: "RESIZE",
|
|
5822
|
+
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5823
|
+
};
|
|
5857
5824
|
if (cmd.position === "after") {
|
|
5858
|
-
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
|
|
5825
|
+
if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
|
|
5859
5826
|
changeType: "RESIZE",
|
|
5860
5827
|
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5861
5828
|
};
|
|
@@ -6102,6 +6069,7 @@ function getRange(sheetXC, sheetId) {
|
|
|
6102
6069
|
//#endregion
|
|
6103
6070
|
//#region src/formulas/code_builder.ts
|
|
6104
6071
|
var FunctionCodeBuilder = class {
|
|
6072
|
+
scope;
|
|
6105
6073
|
code = "";
|
|
6106
6074
|
constructor(scope = new Scope()) {
|
|
6107
6075
|
this.scope = scope;
|
|
@@ -6117,6 +6085,8 @@ var FunctionCodeBuilder = class {
|
|
|
6117
6085
|
}
|
|
6118
6086
|
};
|
|
6119
6087
|
var FunctionCodeImpl = class {
|
|
6088
|
+
scope;
|
|
6089
|
+
returnExpression;
|
|
6120
6090
|
code;
|
|
6121
6091
|
constructor(scope, code, returnExpression) {
|
|
6122
6092
|
this.scope = scope;
|
|
@@ -6199,6 +6169,13 @@ const collator = new Intl.Collator("en", { sensitivity: "accent" });
|
|
|
6199
6169
|
* without recompiling it (for example when the formula is copied to another cell, or when we want to replace literal values but keep the same structure).
|
|
6200
6170
|
* */
|
|
6201
6171
|
var CompiledFormula = class CompiledFormula {
|
|
6172
|
+
sheetId;
|
|
6173
|
+
tokens;
|
|
6174
|
+
literalValues;
|
|
6175
|
+
symbols;
|
|
6176
|
+
isBadExpression;
|
|
6177
|
+
normalizedFormula;
|
|
6178
|
+
execute;
|
|
6202
6179
|
rangeDependencies;
|
|
6203
6180
|
hasDependencies;
|
|
6204
6181
|
constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
|
|
@@ -7804,7 +7781,7 @@ var DispatchResult = class {
|
|
|
7804
7781
|
constructor(results = []) {
|
|
7805
7782
|
if (!Array.isArray(results)) results = [results];
|
|
7806
7783
|
results = [...new Set(results)];
|
|
7807
|
-
this.reasons = results.filter((result) => result !==
|
|
7784
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
7808
7785
|
}
|
|
7809
7786
|
/**
|
|
7810
7787
|
* Static helper which returns a successful DispatchResult
|
|
@@ -8002,7 +7979,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
8002
7979
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
8003
7980
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
8004
7981
|
sheetIdTo: sheetId
|
|
8005
|
-
}).isCancelledBecause(
|
|
7982
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
8006
7983
|
type: "warning",
|
|
8007
7984
|
sticky: false,
|
|
8008
7985
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -8136,22 +8113,22 @@ function _createEvaluatedCell(functionResult, locale, position, cell) {
|
|
|
8136
8113
|
return textCell(value, format, formattedValue, position);
|
|
8137
8114
|
}
|
|
8138
8115
|
function isNumberResult(result) {
|
|
8139
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8116
|
+
return !!result && getEvaluatedCellType(result) === "number";
|
|
8140
8117
|
}
|
|
8141
8118
|
function isTextResult(result) {
|
|
8142
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8119
|
+
return !!result && getEvaluatedCellType(result) === "text";
|
|
8143
8120
|
}
|
|
8144
8121
|
function isErrorResult(result) {
|
|
8145
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8122
|
+
return !!result && getEvaluatedCellType(result) === "error";
|
|
8146
8123
|
}
|
|
8147
8124
|
function getEvaluatedCellType({ value, format }) {
|
|
8148
|
-
if (value === null) return
|
|
8149
|
-
else if (isEvaluationError(value)) return
|
|
8150
|
-
else if (isTextFormat(format)) return
|
|
8125
|
+
if (value === null) return "empty";
|
|
8126
|
+
else if (isEvaluationError(value)) return "error";
|
|
8127
|
+
else if (isTextFormat(format)) return "text";
|
|
8151
8128
|
switch (typeof value) {
|
|
8152
|
-
case "number": return
|
|
8153
|
-
case "boolean": return
|
|
8154
|
-
case "string": return
|
|
8129
|
+
case "number": return "number";
|
|
8130
|
+
case "boolean": return "boolean";
|
|
8131
|
+
case "string": return "text";
|
|
8155
8132
|
}
|
|
8156
8133
|
}
|
|
8157
8134
|
function textCell(value, format, formattedValue, position) {
|
|
@@ -8160,7 +8137,7 @@ function textCell(value, format, formattedValue, position) {
|
|
|
8160
8137
|
format,
|
|
8161
8138
|
formattedValue,
|
|
8162
8139
|
position,
|
|
8163
|
-
type:
|
|
8140
|
+
type: "text",
|
|
8164
8141
|
isAutoSummable: true,
|
|
8165
8142
|
defaultAlign: "left"
|
|
8166
8143
|
};
|
|
@@ -8171,7 +8148,7 @@ function numberCell(value, format, formattedValue, position) {
|
|
|
8171
8148
|
format,
|
|
8172
8149
|
formattedValue,
|
|
8173
8150
|
position,
|
|
8174
|
-
type:
|
|
8151
|
+
type: "number",
|
|
8175
8152
|
isAutoSummable: true,
|
|
8176
8153
|
defaultAlign: "right"
|
|
8177
8154
|
};
|
|
@@ -8181,7 +8158,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
8181
8158
|
value: null,
|
|
8182
8159
|
format,
|
|
8183
8160
|
formattedValue: "",
|
|
8184
|
-
type:
|
|
8161
|
+
type: "empty",
|
|
8185
8162
|
isAutoSummable: true,
|
|
8186
8163
|
defaultAlign: "left"
|
|
8187
8164
|
};
|
|
@@ -8192,7 +8169,7 @@ function dateTimeCell(value, format, formattedValue, position) {
|
|
|
8192
8169
|
format,
|
|
8193
8170
|
formattedValue,
|
|
8194
8171
|
position,
|
|
8195
|
-
type:
|
|
8172
|
+
type: "number",
|
|
8196
8173
|
isAutoSummable: false,
|
|
8197
8174
|
defaultAlign: "right"
|
|
8198
8175
|
};
|
|
@@ -8203,7 +8180,7 @@ function booleanCell(value, format, formattedValue, position) {
|
|
|
8203
8180
|
format,
|
|
8204
8181
|
formattedValue,
|
|
8205
8182
|
position,
|
|
8206
|
-
type:
|
|
8183
|
+
type: "boolean",
|
|
8207
8184
|
isAutoSummable: false,
|
|
8208
8185
|
defaultAlign: "center"
|
|
8209
8186
|
};
|
|
@@ -8214,7 +8191,7 @@ function errorCell(value, message, position, errorOriginPosition) {
|
|
|
8214
8191
|
formattedValue: value,
|
|
8215
8192
|
message,
|
|
8216
8193
|
position,
|
|
8217
|
-
type:
|
|
8194
|
+
type: "error",
|
|
8218
8195
|
isAutoSummable: false,
|
|
8219
8196
|
defaultAlign: "center",
|
|
8220
8197
|
errorOriginPosition
|
|
@@ -9146,6 +9123,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
9146
9123
|
ROUNDDOWN: [{
|
|
9147
9124
|
type: "NUMBER",
|
|
9148
9125
|
value: 0
|
|
9126
|
+
}],
|
|
9127
|
+
IFERROR: [{
|
|
9128
|
+
type: "NUMBER",
|
|
9129
|
+
value: 0
|
|
9149
9130
|
}]
|
|
9150
9131
|
};
|
|
9151
9132
|
/**
|
|
@@ -9457,15 +9438,15 @@ function chartMutedFontColor(backgroundColor) {
|
|
|
9457
9438
|
return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
|
|
9458
9439
|
}
|
|
9459
9440
|
function checkDataset(dataSource) {
|
|
9460
|
-
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
9461
|
-
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
9462
|
-
return
|
|
9441
|
+
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
9442
|
+
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
9443
|
+
return "Success";
|
|
9463
9444
|
}
|
|
9464
9445
|
function checkLabelRange(dataSource) {
|
|
9465
9446
|
if (dataSource.labelRange) {
|
|
9466
|
-
if (!rangeReference.test(dataSource.labelRange || "")) return
|
|
9447
|
+
if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
|
|
9467
9448
|
}
|
|
9468
|
-
return
|
|
9449
|
+
return "Success";
|
|
9469
9450
|
}
|
|
9470
9451
|
function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
|
|
9471
9452
|
return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
|
|
@@ -11130,7 +11111,7 @@ var AbstractChart = class {
|
|
|
11130
11111
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
11131
11112
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
11132
11113
|
if (!baseline) return "";
|
|
11133
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
11114
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
11134
11115
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
11135
11116
|
return baseline.formattedValue;
|
|
11136
11117
|
}
|
|
@@ -11159,23 +11140,23 @@ function getKeyValueText(keyValueCell, humanizeNumbers, locale) {
|
|
|
11159
11140
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
11160
11141
|
}
|
|
11161
11142
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
11162
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
11143
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
11163
11144
|
const diff = keyValue.value - baseline.value;
|
|
11164
11145
|
if (diff > 0) return colorUp;
|
|
11165
11146
|
else if (diff < 0) return colorDown;
|
|
11166
11147
|
}
|
|
11167
11148
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
11168
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
11149
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
11169
11150
|
const diff = keyValue.value - baseline.value;
|
|
11170
11151
|
if (diff > 0) return "up";
|
|
11171
11152
|
else if (diff < 0) return "down";
|
|
11172
11153
|
return "neutral";
|
|
11173
11154
|
}
|
|
11174
11155
|
function checkKeyValue(definition) {
|
|
11175
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
11156
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
11176
11157
|
}
|
|
11177
11158
|
function checkBaseline(definition) {
|
|
11178
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
11159
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
11179
11160
|
}
|
|
11180
11161
|
const Path2DConstructor = globalThis.Path2D;
|
|
11181
11162
|
const arrowDownPath = Path2DConstructor && new Path2DConstructor("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
|
|
@@ -11434,6 +11415,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
11434
11415
|
}, runtime).computeDesign();
|
|
11435
11416
|
}
|
|
11436
11417
|
var ScorecardChartConfigBuilder = class {
|
|
11418
|
+
runtime;
|
|
11437
11419
|
context;
|
|
11438
11420
|
width;
|
|
11439
11421
|
height;
|
|
@@ -12761,15 +12743,6 @@ function schemeToColorScale(scheme) {
|
|
|
12761
12743
|
};
|
|
12762
12744
|
}
|
|
12763
12745
|
|
|
12764
|
-
//#endregion
|
|
12765
|
-
//#region src/types/clipboard.ts
|
|
12766
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
12767
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
12768
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
12769
|
-
ClipboardMIMEType["Image"] = "image";
|
|
12770
|
-
return ClipboardMIMEType;
|
|
12771
|
-
}({});
|
|
12772
|
-
|
|
12773
12746
|
//#endregion
|
|
12774
12747
|
//#region src/types/conditional_formatting.ts
|
|
12775
12748
|
const cfOperators = [
|
|
@@ -15077,7 +15050,7 @@ const BarChart = {
|
|
|
15077
15050
|
copyInSheetId: (definition) => definition,
|
|
15078
15051
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15079
15052
|
transformDefinition: (definition) => definition,
|
|
15080
|
-
validateDefinition: () =>
|
|
15053
|
+
validateDefinition: () => "Success",
|
|
15081
15054
|
updateRanges: (definition) => definition,
|
|
15082
15055
|
getContextCreation: (definition) => definition,
|
|
15083
15056
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15142,42 +15115,42 @@ const BarChart = {
|
|
|
15142
15115
|
//#endregion
|
|
15143
15116
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
15144
15117
|
function isDataRangeValid(definition) {
|
|
15145
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
15118
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
15146
15119
|
}
|
|
15147
15120
|
function checkRangeLimits(check, batchValidations) {
|
|
15148
15121
|
return batchValidations((definition) => {
|
|
15149
15122
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
15150
|
-
return
|
|
15123
|
+
return "Success";
|
|
15151
15124
|
}, (definition) => {
|
|
15152
15125
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
15153
|
-
return
|
|
15126
|
+
return "Success";
|
|
15154
15127
|
});
|
|
15155
15128
|
}
|
|
15156
15129
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
15157
15130
|
return batchValidations((definition) => {
|
|
15158
15131
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
15159
|
-
return
|
|
15132
|
+
return "Success";
|
|
15160
15133
|
}, (definition) => {
|
|
15161
15134
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
15162
|
-
return
|
|
15135
|
+
return "Success";
|
|
15163
15136
|
});
|
|
15164
15137
|
}
|
|
15165
15138
|
function checkEmpty(value, valueName) {
|
|
15166
15139
|
if (value === "") switch (valueName) {
|
|
15167
|
-
case "rangeMin": return
|
|
15168
|
-
case "rangeMax": return
|
|
15140
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
15141
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
15169
15142
|
}
|
|
15170
|
-
return
|
|
15143
|
+
return "Success";
|
|
15171
15144
|
}
|
|
15172
15145
|
function checkValueIsNumberOrFormula(value, valueName) {
|
|
15173
|
-
if (value.startsWith("=")) return
|
|
15146
|
+
if (value.startsWith("=")) return "Success";
|
|
15174
15147
|
if (isNaN(value)) switch (valueName) {
|
|
15175
|
-
case "rangeMin": return
|
|
15176
|
-
case "rangeMax": return
|
|
15177
|
-
case "lowerInflectionPointValue": return
|
|
15178
|
-
case "upperInflectionPointValue": return
|
|
15148
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
15149
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
15150
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
15151
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
15179
15152
|
}
|
|
15180
|
-
return
|
|
15153
|
+
return "Success";
|
|
15181
15154
|
}
|
|
15182
15155
|
const GaugeChart = {
|
|
15183
15156
|
sequence: 50,
|
|
@@ -15299,7 +15272,7 @@ const GaugeChart = {
|
|
|
15299
15272
|
col: dataRange.zone.left,
|
|
15300
15273
|
row: dataRange.zone.top
|
|
15301
15274
|
});
|
|
15302
|
-
if (cell.type ===
|
|
15275
|
+
if (cell.type === "number") {
|
|
15303
15276
|
gaugeValue = cell.value;
|
|
15304
15277
|
formattedValue = cell.formattedValue;
|
|
15305
15278
|
format = cell.format;
|
|
@@ -15433,7 +15406,7 @@ const LineChart = {
|
|
|
15433
15406
|
copyInSheetId: (definition) => definition,
|
|
15434
15407
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15435
15408
|
transformDefinition: (definition) => definition,
|
|
15436
|
-
validateDefinition: () =>
|
|
15409
|
+
validateDefinition: () => "Success",
|
|
15437
15410
|
updateRanges: (definition) => definition,
|
|
15438
15411
|
getContextCreation: (definition) => definition,
|
|
15439
15412
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15517,7 +15490,7 @@ const PieChart = {
|
|
|
15517
15490
|
copyInSheetId: (definition) => definition,
|
|
15518
15491
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15519
15492
|
transformDefinition: (definition) => definition,
|
|
15520
|
-
validateDefinition: () =>
|
|
15493
|
+
validateDefinition: () => "Success",
|
|
15521
15494
|
updateRanges: (definition) => definition,
|
|
15522
15495
|
getContextCreation: (definition) => definition,
|
|
15523
15496
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15596,7 +15569,7 @@ const WaterfallChart = {
|
|
|
15596
15569
|
copyInSheetId: (definition) => definition,
|
|
15597
15570
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15598
15571
|
transformDefinition: (definition) => definition,
|
|
15599
|
-
validateDefinition: () =>
|
|
15572
|
+
validateDefinition: () => "Success",
|
|
15600
15573
|
updateRanges: (definition) => definition,
|
|
15601
15574
|
getContextCreation: (definition) => definition,
|
|
15602
15575
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -16908,6 +16881,10 @@ var GaugeChartComponent = class extends _odoo_owl.Component {
|
|
|
16908
16881
|
* Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
|
|
16909
16882
|
*/
|
|
16910
16883
|
var Animation = class {
|
|
16884
|
+
startValue;
|
|
16885
|
+
endValue;
|
|
16886
|
+
duration;
|
|
16887
|
+
callback;
|
|
16911
16888
|
startTime = void 0;
|
|
16912
16889
|
animationFrameId = null;
|
|
16913
16890
|
constructor(startValue, endValue, duration, callback) {
|
|
@@ -17136,6 +17113,10 @@ var Menu = class extends _odoo_owl.Component {
|
|
|
17136
17113
|
onKeyDown: {
|
|
17137
17114
|
type: Function,
|
|
17138
17115
|
optional: true
|
|
17116
|
+
},
|
|
17117
|
+
disableKeyboardNavigation: {
|
|
17118
|
+
type: Boolean,
|
|
17119
|
+
optional: true
|
|
17139
17120
|
}
|
|
17140
17121
|
};
|
|
17141
17122
|
static components = {};
|
|
@@ -17143,7 +17124,7 @@ var Menu = class extends _odoo_owl.Component {
|
|
|
17143
17124
|
menuRef = (0, _odoo_owl.useRef)("menu");
|
|
17144
17125
|
setup() {
|
|
17145
17126
|
(0, _odoo_owl.useEffect)(() => {
|
|
17146
|
-
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
|
|
17127
|
+
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
|
|
17147
17128
|
const selector = `[data-name='${this.props.hoveredMenuId}']`;
|
|
17148
17129
|
this.menuRef.el.querySelector(selector)?.focus();
|
|
17149
17130
|
}
|
|
@@ -17378,6 +17359,11 @@ var Popover = class extends _odoo_owl.Component {
|
|
|
17378
17359
|
}
|
|
17379
17360
|
};
|
|
17380
17361
|
var PopoverPositionContext = class {
|
|
17362
|
+
anchorRect;
|
|
17363
|
+
containerRect;
|
|
17364
|
+
propsMaxSize;
|
|
17365
|
+
spreadsheetOffset;
|
|
17366
|
+
lastPosition;
|
|
17381
17367
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
|
|
17382
17368
|
this.anchorRect = anchorRect;
|
|
17383
17369
|
this.containerRect = containerRect;
|
|
@@ -17572,7 +17558,8 @@ var MenuPopover = class MenuPopover extends _odoo_owl.Component {
|
|
|
17572
17558
|
onScroll: this.onScroll.bind(this),
|
|
17573
17559
|
onKeyDown: this.onKeydown.bind(this),
|
|
17574
17560
|
hoveredMenuId,
|
|
17575
|
-
isHoveredMenuFocused: !this.subMenu.isOpen
|
|
17561
|
+
isHoveredMenuFocused: !this.subMenu.isOpen,
|
|
17562
|
+
disableKeyboardNavigation: this.props.disableKeyboardNavigation
|
|
17576
17563
|
};
|
|
17577
17564
|
}
|
|
17578
17565
|
get subMenuAnchorRect() {
|
|
@@ -18431,26 +18418,26 @@ var DelayedHoveredCellStore = class extends SpreadsheetStore {
|
|
|
18431
18418
|
//#region src/components/translations_terms.ts
|
|
18432
18419
|
const CfTerms = {
|
|
18433
18420
|
Errors: {
|
|
18434
|
-
[
|
|
18435
|
-
[
|
|
18436
|
-
[
|
|
18437
|
-
[
|
|
18438
|
-
[
|
|
18439
|
-
[
|
|
18440
|
-
[
|
|
18441
|
-
[
|
|
18442
|
-
[
|
|
18443
|
-
[
|
|
18444
|
-
[
|
|
18445
|
-
[
|
|
18446
|
-
[
|
|
18447
|
-
[
|
|
18448
|
-
[
|
|
18449
|
-
[
|
|
18450
|
-
[
|
|
18451
|
-
[
|
|
18452
|
-
[
|
|
18453
|
-
[
|
|
18421
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18422
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
18423
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
18424
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
18425
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
18426
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
18427
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
18428
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
18429
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
18430
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
18431
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
18432
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
18433
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
18434
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
18435
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
18436
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
18437
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
18438
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
18439
|
+
["EmptyTarget"]: _t("Target must contain at least one zone"),
|
|
18440
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
18454
18441
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
18455
18442
|
},
|
|
18456
18443
|
ColorScale: _t("Color scale"),
|
|
@@ -18469,17 +18456,17 @@ const ChartTerms = {
|
|
|
18469
18456
|
AggregatedChart: _t("Aggregate"),
|
|
18470
18457
|
Errors: {
|
|
18471
18458
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18472
|
-
[
|
|
18473
|
-
[
|
|
18474
|
-
[
|
|
18475
|
-
[
|
|
18476
|
-
[
|
|
18477
|
-
[
|
|
18478
|
-
[
|
|
18479
|
-
[
|
|
18480
|
-
[
|
|
18481
|
-
[
|
|
18482
|
-
[
|
|
18459
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18460
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18461
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18462
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18463
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18464
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18465
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
18466
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
18467
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
18468
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
18469
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
18483
18470
|
},
|
|
18484
18471
|
ColorScales: {
|
|
18485
18472
|
blues: _t("Blues"),
|
|
@@ -18499,16 +18486,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
18499
18486
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
18500
18487
|
const SplitToColumnsTerms = { Errors: {
|
|
18501
18488
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
18502
|
-
[
|
|
18503
|
-
[
|
|
18504
|
-
[
|
|
18489
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
18490
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
18491
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
18505
18492
|
} };
|
|
18506
18493
|
const RemoveDuplicateTerms = { Errors: {
|
|
18507
18494
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
18508
|
-
[
|
|
18509
|
-
[
|
|
18510
|
-
[
|
|
18511
|
-
[
|
|
18495
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
18496
|
+
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
18497
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
18498
|
+
["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
|
|
18512
18499
|
} };
|
|
18513
18500
|
const DVTerms = {
|
|
18514
18501
|
DateIs: {
|
|
@@ -18536,19 +18523,19 @@ const DVTerms = {
|
|
|
18536
18523
|
positiveNumber: _t("The value must be a positive number")
|
|
18537
18524
|
},
|
|
18538
18525
|
Errors: {
|
|
18539
|
-
[
|
|
18540
|
-
[
|
|
18541
|
-
[
|
|
18526
|
+
["InvalidRange"]: _t("The range is invalid."),
|
|
18527
|
+
["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
|
|
18528
|
+
["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
|
|
18542
18529
|
Unexpected: _t("The rule is invalid for an unknown reason.")
|
|
18543
18530
|
}
|
|
18544
18531
|
};
|
|
18545
18532
|
const TableTerms = {
|
|
18546
18533
|
Errors: {
|
|
18547
18534
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
18548
|
-
[
|
|
18549
|
-
[
|
|
18550
|
-
[
|
|
18551
|
-
[
|
|
18535
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
18536
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
18537
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18538
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
18552
18539
|
},
|
|
18553
18540
|
Checkboxes: {
|
|
18554
18541
|
hasFilters: _t("Filter button"),
|
|
@@ -18872,6 +18859,7 @@ function getDateTimeFormat(locale) {
|
|
|
18872
18859
|
* Represent a raw XML string
|
|
18873
18860
|
*/
|
|
18874
18861
|
var XMLString = class {
|
|
18862
|
+
xmlString;
|
|
18875
18863
|
/**
|
|
18876
18864
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
18877
18865
|
*/
|
|
@@ -19222,30 +19210,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
19222
19210
|
|
|
19223
19211
|
//#endregion
|
|
19224
19212
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
19225
|
-
/**
|
|
19226
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
19227
|
-
*/
|
|
19228
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
19229
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
19230
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
19231
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
19232
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
19233
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
19234
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
19235
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
19236
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
19237
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
19238
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
19239
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
19240
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
19241
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
19242
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
19243
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
19244
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
19245
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
19246
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
19247
|
-
return WarningTypes;
|
|
19248
|
-
}({});
|
|
19249
19213
|
var XLSXImportWarningManager = class {
|
|
19250
19214
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
19251
19215
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -20005,7 +19969,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
20005
19969
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
20006
19970
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
20007
19971
|
} catch (e) {}
|
|
20008
|
-
warningManager.generateNotSupportedWarning(
|
|
19972
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
20009
19973
|
}
|
|
20010
19974
|
function isFormatSupported(format) {
|
|
20011
19975
|
try {
|
|
@@ -20090,20 +20054,20 @@ function convertFormats(data, warningManager) {
|
|
|
20090
20054
|
return arrayToObject(formats, 1);
|
|
20091
20055
|
}
|
|
20092
20056
|
function addStyleWarnings(font, fill, warningManager) {
|
|
20093
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
20094
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
20057
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
20058
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
20095
20059
|
}
|
|
20096
20060
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
20097
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
20061
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
20098
20062
|
}
|
|
20099
20063
|
function addBorderWarnings(border, warningManager) {
|
|
20100
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
20064
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
20101
20065
|
}
|
|
20102
20066
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
20103
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20067
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
20104
20068
|
}
|
|
20105
20069
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
20106
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20070
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
20107
20071
|
}
|
|
20108
20072
|
|
|
20109
20073
|
//#endregion
|
|
@@ -20272,7 +20236,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
20272
20236
|
lower: icons.upper
|
|
20273
20237
|
};
|
|
20274
20238
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
20275
|
-
warningManager.generateNotSupportedWarning(
|
|
20239
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
20276
20240
|
switch (key) {
|
|
20277
20241
|
case "upper":
|
|
20278
20242
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -20308,13 +20272,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
20308
20272
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
20309
20273
|
}
|
|
20310
20274
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
20311
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
20312
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
20275
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
20276
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
20313
20277
|
if (cf.cfRules[0].dxfId) {
|
|
20314
20278
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
20315
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
20316
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
20317
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
20279
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
20280
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
20281
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
20318
20282
|
}
|
|
20319
20283
|
}
|
|
20320
20284
|
|
|
@@ -20480,13 +20444,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20480
20444
|
if (!dv) continue;
|
|
20481
20445
|
switch (dv.type) {
|
|
20482
20446
|
case "time":
|
|
20483
|
-
warningManager.generateNotSupportedWarning(
|
|
20447
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
20484
20448
|
break;
|
|
20485
20449
|
case "textLength":
|
|
20486
|
-
warningManager.generateNotSupportedWarning(
|
|
20450
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
20487
20451
|
break;
|
|
20488
20452
|
case "whole":
|
|
20489
|
-
warningManager.generateNotSupportedWarning(
|
|
20453
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
20490
20454
|
break;
|
|
20491
20455
|
case "decimal":
|
|
20492
20456
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -20498,7 +20462,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20498
20462
|
break;
|
|
20499
20463
|
case "date":
|
|
20500
20464
|
if (dv.operator === "notEqual") {
|
|
20501
|
-
warningManager.generateNotSupportedWarning(
|
|
20465
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
20502
20466
|
break;
|
|
20503
20467
|
}
|
|
20504
20468
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -20795,7 +20759,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
20795
20759
|
}
|
|
20796
20760
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
20797
20761
|
const label = link.display || cellValue;
|
|
20798
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
20762
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
20799
20763
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
20800
20764
|
}
|
|
20801
20765
|
function getSheetDims(sheet) {
|
|
@@ -23999,7 +23963,7 @@ function createEmptyExcelWorkbookData() {
|
|
|
23999
23963
|
//#endregion
|
|
24000
23964
|
//#region src/helpers/ui/paste_interactive.ts
|
|
24001
23965
|
const handleCopyPasteResult = (env, command) => {
|
|
24002
|
-
if (env.model.dispatch(command.type).isCancelledBecause(
|
|
23966
|
+
if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
|
|
24003
23967
|
};
|
|
24004
23968
|
const PasteInteractiveContent = {
|
|
24005
23969
|
wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
|
|
@@ -24009,10 +23973,10 @@ const PasteInteractiveContent = {
|
|
|
24009
23973
|
};
|
|
24010
23974
|
function handlePasteResult(env, result) {
|
|
24011
23975
|
if (!result.isSuccessful) {
|
|
24012
|
-
if (result.reasons.includes(
|
|
24013
|
-
else if (result.reasons.includes(
|
|
24014
|
-
else if (result.reasons.includes(
|
|
24015
|
-
else if (result.reasons.includes(
|
|
23976
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
23977
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
23978
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
23979
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
24016
23980
|
}
|
|
24017
23981
|
}
|
|
24018
23982
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -24200,7 +24164,7 @@ var ErrorToolTip = class extends _odoo_owl.Component {
|
|
|
24200
24164
|
};
|
|
24201
24165
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
24202
24166
|
const cell = getters.getEvaluatedCell(position);
|
|
24203
|
-
if (cell.type ===
|
|
24167
|
+
if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
|
|
24204
24168
|
isOpen: true,
|
|
24205
24169
|
props: { cellPosition: position },
|
|
24206
24170
|
Component: ErrorToolTip,
|
|
@@ -24249,7 +24213,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24249
24213
|
sortDirection,
|
|
24250
24214
|
sortOptions
|
|
24251
24215
|
});
|
|
24252
|
-
if (result.isCancelledBecause(
|
|
24216
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
24253
24217
|
const { col, row } = anchor;
|
|
24254
24218
|
env.model.selection.selectZone({
|
|
24255
24219
|
cell: {
|
|
@@ -24260,7 +24224,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24260
24224
|
});
|
|
24261
24225
|
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
24262
24226
|
}
|
|
24263
|
-
if (result.isCancelledBecause(
|
|
24227
|
+
if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
|
|
24264
24228
|
const { col, row } = anchor;
|
|
24265
24229
|
env.model.selection.selectZone({
|
|
24266
24230
|
cell: {
|
|
@@ -26911,6 +26875,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
26911
26875
|
//#endregion
|
|
26912
26876
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
26913
26877
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
26878
|
+
args;
|
|
26914
26879
|
constructor(get, args) {
|
|
26915
26880
|
super(get);
|
|
26916
26881
|
this.args = args;
|
|
@@ -27814,6 +27779,7 @@ var DOMDndHelper = class {
|
|
|
27814
27779
|
}
|
|
27815
27780
|
};
|
|
27816
27781
|
var ContainerWrapper = class {
|
|
27782
|
+
el;
|
|
27817
27783
|
constructor(el) {
|
|
27818
27784
|
this.el = el;
|
|
27819
27785
|
}
|
|
@@ -27885,6 +27851,10 @@ var FocusStore = class {
|
|
|
27885
27851
|
* This plugin handles this internal state.
|
|
27886
27852
|
*/
|
|
27887
27853
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
27854
|
+
initialRanges;
|
|
27855
|
+
inputHasSingleRange;
|
|
27856
|
+
colors;
|
|
27857
|
+
disabledRanges;
|
|
27888
27858
|
mutators = [
|
|
27889
27859
|
"resetWithRanges",
|
|
27890
27860
|
"focusById",
|
|
@@ -29007,8 +28977,8 @@ var FilterMenu = class extends _odoo_owl.Component {
|
|
|
29007
28977
|
row,
|
|
29008
28978
|
col: position.col
|
|
29009
28979
|
});
|
|
29010
|
-
if (cell.type ===
|
|
29011
|
-
else if (cell.type ===
|
|
28980
|
+
if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
|
|
28981
|
+
else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
|
|
29012
28982
|
else cellTypesCount.number++;
|
|
29013
28983
|
}
|
|
29014
28984
|
const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
|
|
@@ -29369,8 +29339,8 @@ function getPasteZones(target, content) {
|
|
|
29369
29339
|
}
|
|
29370
29340
|
function parseOSClipboardContent(content) {
|
|
29371
29341
|
let spreadsheetContent = void 0;
|
|
29372
|
-
if (content[
|
|
29373
|
-
const textContent = content[
|
|
29342
|
+
if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
|
|
29343
|
+
const textContent = content["text/plain"] || "";
|
|
29374
29344
|
let imageBlob = void 0;
|
|
29375
29345
|
if (!textContent.trim()) {
|
|
29376
29346
|
for (const type of AllowedImageMimeTypes) if (content[type]) {
|
|
@@ -29497,10 +29467,10 @@ function detectColumnType(cells) {
|
|
|
29497
29467
|
let detectedType = "empty";
|
|
29498
29468
|
for (const cell of cells) {
|
|
29499
29469
|
let type = null;
|
|
29500
|
-
if (cell.type ===
|
|
29470
|
+
if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
|
|
29501
29471
|
else if (cell.format?.includes("%")) type = "percentage";
|
|
29502
29472
|
else type = "number";
|
|
29503
|
-
else if (cell.type ===
|
|
29473
|
+
else if (cell.type === "text") type = "text";
|
|
29504
29474
|
if (type) {
|
|
29505
29475
|
const newCount = ++counts[type];
|
|
29506
29476
|
if (newCount > max) {
|
|
@@ -29535,7 +29505,7 @@ function isDatasetTitled(getters, column) {
|
|
|
29535
29505
|
col: column.zone.left,
|
|
29536
29506
|
row: column.zone.top
|
|
29537
29507
|
});
|
|
29538
|
-
return ![
|
|
29508
|
+
return !["number", "empty"].includes(titleCell.type);
|
|
29539
29509
|
}
|
|
29540
29510
|
/**
|
|
29541
29511
|
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
|
|
@@ -29858,8 +29828,8 @@ function interactiveCreateTable(env, sheetId, tableConfig = DEFAULT_TABLE_CONFIG
|
|
|
29858
29828
|
config: tableConfig,
|
|
29859
29829
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29860
29830
|
});
|
|
29861
|
-
if (result.isCancelledBecause(
|
|
29862
|
-
else if (result.isCancelledBecause(
|
|
29831
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29832
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29863
29833
|
return result;
|
|
29864
29834
|
}
|
|
29865
29835
|
|
|
@@ -29887,9 +29857,9 @@ async function paste$1(env, pasteOption) {
|
|
|
29887
29857
|
case "ok":
|
|
29888
29858
|
const clipboardId = env.model.getters.getClipboardId();
|
|
29889
29859
|
const target = env.model.getters.getSelectedZones();
|
|
29890
|
-
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
29860
|
+
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
|
|
29891
29861
|
else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
|
|
29892
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29862
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29893
29863
|
break;
|
|
29894
29864
|
case "notImplemented":
|
|
29895
29865
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -32434,13 +32404,13 @@ var ChartRangeDataSourceComponent = class extends _odoo_owl.Component {
|
|
|
32434
32404
|
if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
|
|
32435
32405
|
}
|
|
32436
32406
|
get errorMessages() {
|
|
32437
|
-
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
32407
|
+
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32438
32408
|
}
|
|
32439
32409
|
get isDatasetInvalid() {
|
|
32440
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32410
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32441
32411
|
}
|
|
32442
32412
|
get isLabelInvalid() {
|
|
32443
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32413
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32444
32414
|
}
|
|
32445
32415
|
get dataSetsHaveTitleLabel() {
|
|
32446
32416
|
return this.datasetOrientation === "rows" ? _t("Use col %(column_name)s as headers", { column_name: numberToLetters(this.calculateHeaderPosition() || 0) }) : _t("Use row %(row_position)s as headers", { row_position: this.calculateHeaderPosition() || "" });
|
|
@@ -32772,6 +32742,11 @@ var ChartRangeDataSourceComponent = class extends _odoo_owl.Component {
|
|
|
32772
32742
|
//#endregion
|
|
32773
32743
|
//#region src/helpers/figures/chart.ts
|
|
32774
32744
|
var SpreadsheetChart = class SpreadsheetChart {
|
|
32745
|
+
getters;
|
|
32746
|
+
sheetId;
|
|
32747
|
+
definition;
|
|
32748
|
+
chartTypeBuilder;
|
|
32749
|
+
dataSourceBuilder;
|
|
32775
32750
|
dataSource;
|
|
32776
32751
|
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
32777
32752
|
this.getters = getters;
|
|
@@ -32809,9 +32784,6 @@ var SpreadsheetChart = class SpreadsheetChart {
|
|
|
32809
32784
|
dataSource: newDataSource
|
|
32810
32785
|
};
|
|
32811
32786
|
}
|
|
32812
|
-
getSupportedChartTypes() {
|
|
32813
|
-
return new Set(this.dataSourceBuilder.supportedChartTypes);
|
|
32814
|
-
}
|
|
32815
32787
|
getRangeDefinition() {
|
|
32816
32788
|
return {
|
|
32817
32789
|
...this.definition,
|
|
@@ -32911,11 +32883,12 @@ const ChartRangeDataSourceHandler = {
|
|
|
32911
32883
|
type: "range",
|
|
32912
32884
|
dataSets: [],
|
|
32913
32885
|
dataSetsHaveTitle: false,
|
|
32886
|
+
labelRange: context.auxiliaryRange,
|
|
32914
32887
|
...context.dataSource
|
|
32915
32888
|
};
|
|
32916
32889
|
},
|
|
32917
32890
|
fromHierarchicalContextCreation(context) {
|
|
32918
|
-
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource
|
|
32891
|
+
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
32919
32892
|
type: "range",
|
|
32920
32893
|
dataSets: [],
|
|
32921
32894
|
dataSetsHaveTitle: false
|
|
@@ -33010,6 +32983,10 @@ const ChartRangeDataSourceHandler = {
|
|
|
33010
32983
|
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
33011
32984
|
};
|
|
33012
32985
|
},
|
|
32986
|
+
/**
|
|
32987
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
32988
|
+
* sheetIdTo.
|
|
32989
|
+
*/
|
|
33013
32990
|
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
33014
32991
|
return {
|
|
33015
32992
|
...dataSource,
|
|
@@ -33163,7 +33140,7 @@ const ChartNeverDataSourceHandler = {
|
|
|
33163
33140
|
fromExternalDefinition: () => ({ type: "none" }),
|
|
33164
33141
|
fromContextCreation: () => ({ type: "none" }),
|
|
33165
33142
|
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
33166
|
-
validate: () =>
|
|
33143
|
+
validate: () => "Success",
|
|
33167
33144
|
transform: () => ({ type: "none" }),
|
|
33168
33145
|
extractData: () => ({
|
|
33169
33146
|
dataSetsValues: [],
|
|
@@ -33498,10 +33475,10 @@ var GaugeChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33498
33475
|
state = (0, _odoo_owl.useState)({ dataRangeDispatchResult: void 0 });
|
|
33499
33476
|
dataRange = this.props.definition.dataRange;
|
|
33500
33477
|
get configurationErrorMessages() {
|
|
33501
|
-
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33478
|
+
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33502
33479
|
}
|
|
33503
33480
|
get isDataRangeInvalid() {
|
|
33504
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33481
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33505
33482
|
}
|
|
33506
33483
|
onDataRangeChanged(ranges) {
|
|
33507
33484
|
this.dataRange = ranges[0];
|
|
@@ -33538,19 +33515,19 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
33538
33515
|
});
|
|
33539
33516
|
}
|
|
33540
33517
|
get designErrorMessages() {
|
|
33541
|
-
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !==
|
|
33518
|
+
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33542
33519
|
}
|
|
33543
33520
|
get isRangeMinInvalid() {
|
|
33544
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33521
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
|
|
33545
33522
|
}
|
|
33546
33523
|
get isRangeMaxInvalid() {
|
|
33547
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33524
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
|
|
33548
33525
|
}
|
|
33549
33526
|
get isLowerInflectionPointInvalid() {
|
|
33550
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33527
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
|
|
33551
33528
|
}
|
|
33552
33529
|
get isUpperInflectionPointInvalid() {
|
|
33553
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33530
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
|
|
33554
33531
|
}
|
|
33555
33532
|
updateSectionColor(target, color) {
|
|
33556
33533
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33614,10 +33591,10 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
33614
33591
|
}
|
|
33615
33592
|
checkSectionRuleFormulasAreValid(sectionRule) {
|
|
33616
33593
|
const reasons = /* @__PURE__ */ new Set();
|
|
33617
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(
|
|
33618
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(
|
|
33619
|
-
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(
|
|
33620
|
-
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(
|
|
33594
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
|
|
33595
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
|
|
33596
|
+
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
|
|
33597
|
+
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
|
|
33621
33598
|
return reasons;
|
|
33622
33599
|
}
|
|
33623
33600
|
valueIsValidNumber(value) {
|
|
@@ -33957,13 +33934,13 @@ var ScorecardChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33957
33934
|
keyValue = this.props.definition.keyValue;
|
|
33958
33935
|
baseline = this.props.definition.baseline;
|
|
33959
33936
|
get errorMessages() {
|
|
33960
|
-
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33937
|
+
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33961
33938
|
}
|
|
33962
33939
|
get isKeyValueInvalid() {
|
|
33963
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33940
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33964
33941
|
}
|
|
33965
33942
|
get isBaselineInvalid() {
|
|
33966
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33943
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
33967
33944
|
}
|
|
33968
33945
|
onKeyValueRangeChanged(ranges) {
|
|
33969
33946
|
this.keyValue = ranges[0];
|
|
@@ -34397,13 +34374,23 @@ var ChartTypePicker = class extends _odoo_owl.Component {
|
|
|
34397
34374
|
});
|
|
34398
34375
|
setup() {
|
|
34399
34376
|
(0, _odoo_owl.useExternalListener)(window, "pointerdown", this.onExternalClick, { capture: true });
|
|
34400
|
-
const
|
|
34377
|
+
const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
|
|
34378
|
+
const supportedTypes = this.getSupportedChartTypes(definition);
|
|
34401
34379
|
for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
|
|
34402
34380
|
if (!supportedTypes.has(subtypeProperties.chartType)) continue;
|
|
34403
34381
|
if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
|
|
34404
34382
|
else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
|
|
34405
34383
|
}
|
|
34406
34384
|
}
|
|
34385
|
+
getSupportedChartTypes(definition) {
|
|
34386
|
+
let supportedTypes;
|
|
34387
|
+
if (definition.dataSource) {
|
|
34388
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
|
|
34389
|
+
supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
|
|
34390
|
+
} else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
|
|
34391
|
+
else throw new Error("Missing chart data source for a chart type that requires it");
|
|
34392
|
+
return supportedTypes;
|
|
34393
|
+
}
|
|
34407
34394
|
onExternalClick(ev) {
|
|
34408
34395
|
if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
|
|
34409
34396
|
this.closePopover();
|
|
@@ -34697,10 +34684,10 @@ const columnStatisticFunctions = [
|
|
|
34697
34684
|
{
|
|
34698
34685
|
name: _t("Unique values"),
|
|
34699
34686
|
types: [
|
|
34700
|
-
|
|
34701
|
-
|
|
34702
|
-
|
|
34703
|
-
|
|
34687
|
+
"number",
|
|
34688
|
+
"text",
|
|
34689
|
+
"boolean",
|
|
34690
|
+
"error"
|
|
34704
34691
|
],
|
|
34705
34692
|
compute: (values, locale) => {
|
|
34706
34693
|
const uniqueValues = /* @__PURE__ */ new Set();
|
|
@@ -34711,27 +34698,27 @@ const columnStatisticFunctions = [
|
|
|
34711
34698
|
},
|
|
34712
34699
|
{
|
|
34713
34700
|
name: _t("Sum"),
|
|
34714
|
-
types: [
|
|
34701
|
+
types: ["number"],
|
|
34715
34702
|
compute: (values, locale) => sum([[values]], locale)
|
|
34716
34703
|
},
|
|
34717
34704
|
{
|
|
34718
34705
|
name: _t("Average"),
|
|
34719
|
-
types: [
|
|
34706
|
+
types: ["number"],
|
|
34720
34707
|
compute: (values, locale) => average([[values]], locale)
|
|
34721
34708
|
},
|
|
34722
34709
|
{
|
|
34723
34710
|
name: _t("Median"),
|
|
34724
|
-
types: [
|
|
34711
|
+
types: ["number"],
|
|
34725
34712
|
compute: (values, locale) => median([[values]], locale) ?? ""
|
|
34726
34713
|
},
|
|
34727
34714
|
{
|
|
34728
34715
|
name: _t("Minimum value"),
|
|
34729
|
-
types: [
|
|
34716
|
+
types: ["number"],
|
|
34730
34717
|
compute: (values, locale) => min([[values]], locale).value
|
|
34731
34718
|
},
|
|
34732
34719
|
{
|
|
34733
34720
|
name: _t("Maximum value"),
|
|
34734
|
-
types: [
|
|
34721
|
+
types: ["number"],
|
|
34735
34722
|
compute: (values, locale) => max([[values]], locale).value
|
|
34736
34723
|
}
|
|
34737
34724
|
];
|
|
@@ -34878,12 +34865,13 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34878
34865
|
}
|
|
34879
34866
|
const { sheetId, col } = getters.getActivePosition();
|
|
34880
34867
|
this.selectedColumn = col;
|
|
34881
|
-
|
|
34868
|
+
const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
|
|
34882
34869
|
top: 0,
|
|
34883
34870
|
left: col,
|
|
34884
34871
|
bottom: getters.getNumberRows(sheetId) - 1,
|
|
34885
34872
|
right: col
|
|
34886
|
-
}).map((cell) => cell.format)
|
|
34873
|
+
}).map((cell) => cell.format);
|
|
34874
|
+
this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
|
|
34887
34875
|
const numberOfRows = getters.getNumberRows(sheetId);
|
|
34888
34876
|
const cells = [];
|
|
34889
34877
|
const numericValues = [];
|
|
@@ -34901,20 +34889,21 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34901
34889
|
row
|
|
34902
34890
|
});
|
|
34903
34891
|
cells.push(evaluatedCell);
|
|
34904
|
-
if (evaluatedCell.type !==
|
|
34892
|
+
if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
|
|
34905
34893
|
values.push({
|
|
34906
34894
|
row,
|
|
34907
34895
|
col,
|
|
34908
34896
|
value: evaluatedCell.value
|
|
34909
34897
|
});
|
|
34910
|
-
if (evaluatedCell.type ===
|
|
34898
|
+
if (evaluatedCell.type === "number") numericValues.push({
|
|
34911
34899
|
row,
|
|
34912
34900
|
col,
|
|
34913
34901
|
value: evaluatedCell.value
|
|
34914
34902
|
});
|
|
34915
34903
|
}
|
|
34916
34904
|
}
|
|
34917
|
-
|
|
34905
|
+
const locale = getters.getLocale();
|
|
34906
|
+
this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
|
|
34918
34907
|
this.numericValues = numericValues;
|
|
34919
34908
|
this.values = values;
|
|
34920
34909
|
this.countChartData = this.computeCountChartData();
|
|
@@ -35248,7 +35237,7 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35248
35237
|
updateConditionalFormat(newCf) {
|
|
35249
35238
|
const ranges = newCf.ranges || this.state.ranges;
|
|
35250
35239
|
if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35251
|
-
if (!newCf.suppressErrors) this.state.errors = [
|
|
35240
|
+
if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
|
|
35252
35241
|
return;
|
|
35253
35242
|
}
|
|
35254
35243
|
const sheetId = this.model.getters.getActiveSheetId();
|
|
@@ -35263,11 +35252,11 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35263
35252
|
sheetId
|
|
35264
35253
|
});
|
|
35265
35254
|
if (result.isSuccessful) this.state.hasEditedCf = true;
|
|
35266
|
-
const reasons = result.reasons.filter((r) => r !==
|
|
35255
|
+
const reasons = result.reasons.filter((r) => r !== "NoChanges");
|
|
35267
35256
|
if (!newCf.suppressErrors) this.state.errors = reasons;
|
|
35268
35257
|
}
|
|
35269
35258
|
get isRangeValid() {
|
|
35270
|
-
return this.state.errors.includes(
|
|
35259
|
+
return this.state.errors.includes("EmptyRange");
|
|
35271
35260
|
}
|
|
35272
35261
|
get errorMessages() {
|
|
35273
35262
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35521,9 +35510,9 @@ var ColorScaleRuleEditorThreshold = class extends _odoo_owl.Component {
|
|
|
35521
35510
|
isValueInvalid() {
|
|
35522
35511
|
const errors = this.props.store.state.errors;
|
|
35523
35512
|
switch (this.props.thresholdType) {
|
|
35524
|
-
case "minimum": return errors.includes(
|
|
35525
|
-
case "midpoint": return errors.includes(
|
|
35526
|
-
case "maximum": return errors.includes(
|
|
35513
|
+
case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
|
|
35514
|
+
case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
|
|
35515
|
+
case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
|
|
35527
35516
|
default: return false;
|
|
35528
35517
|
}
|
|
35529
35518
|
}
|
|
@@ -35631,8 +35620,8 @@ var IconSetRuleEditor = class extends _odoo_owl.Component {
|
|
|
35631
35620
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35632
35621
|
const errors = this.props.store.state.errors;
|
|
35633
35622
|
switch (inflectionPoint) {
|
|
35634
|
-
case "lowerInflectionPoint": return errors.includes(
|
|
35635
|
-
case "upperInflectionPoint": return errors.includes(
|
|
35623
|
+
case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35624
|
+
case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35636
35625
|
default: return true;
|
|
35637
35626
|
}
|
|
35638
35627
|
}
|
|
@@ -36049,12 +36038,6 @@ var DataValidationEditor = class extends _odoo_owl.Component {
|
|
|
36049
36038
|
//#endregion
|
|
36050
36039
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
36051
36040
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
36052
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
36053
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
36054
|
-
Direction[Direction["current"] = 0] = "current";
|
|
36055
|
-
Direction[Direction["next"] = 1] = "next";
|
|
36056
|
-
return Direction;
|
|
36057
|
-
}(Direction || {});
|
|
36058
36041
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
36059
36042
|
mutators = [
|
|
36060
36043
|
"updateSearchOptions",
|
|
@@ -36116,13 +36099,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36116
36099
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
36117
36100
|
}
|
|
36118
36101
|
selectPreviousMatch() {
|
|
36119
|
-
this.selectNextCell(
|
|
36102
|
+
this.selectNextCell(-1, {
|
|
36120
36103
|
jumpToMatchSheet: true,
|
|
36121
36104
|
updateSelection: true
|
|
36122
36105
|
});
|
|
36123
36106
|
}
|
|
36124
36107
|
selectNextMatch() {
|
|
36125
|
-
this.selectNextCell(
|
|
36108
|
+
this.selectNextCell(1, {
|
|
36126
36109
|
jumpToMatchSheet: true,
|
|
36127
36110
|
updateSelection: true
|
|
36128
36111
|
});
|
|
@@ -36205,7 +36188,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36205
36188
|
refreshSearch(options) {
|
|
36206
36189
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
36207
36190
|
this.findMatches();
|
|
36208
|
-
this.selectNextCell(
|
|
36191
|
+
this.selectNextCell(0, options);
|
|
36209
36192
|
}
|
|
36210
36193
|
getSheetsInSearchOrder() {
|
|
36211
36194
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37289,10 +37272,10 @@ function interactiveUpdateNamedRange(env, payload) {
|
|
|
37289
37272
|
}
|
|
37290
37273
|
function handleResult(env, result) {
|
|
37291
37274
|
if (!result.isSuccessful) {
|
|
37292
|
-
if (result.isCancelledBecause(
|
|
37293
|
-
else if (result.isCancelledBecause(
|
|
37294
|
-
else if (result.isCancelledBecause(
|
|
37295
|
-
else if (result.isCancelledBecause(
|
|
37275
|
+
if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
|
|
37276
|
+
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."));
|
|
37277
|
+
else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
|
|
37278
|
+
else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
|
|
37296
37279
|
}
|
|
37297
37280
|
}
|
|
37298
37281
|
|
|
@@ -37379,6 +37362,8 @@ var NamedRangesPanel = class extends _odoo_owl.Component {
|
|
|
37379
37362
|
//#endregion
|
|
37380
37363
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37381
37364
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37365
|
+
pivotId;
|
|
37366
|
+
initialMeasure;
|
|
37382
37367
|
mutators = [
|
|
37383
37368
|
"cancelMeasureDisplayEdition",
|
|
37384
37369
|
"updateMeasureDisplayType",
|
|
@@ -37570,7 +37555,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
|
|
|
37570
37555
|
col,
|
|
37571
37556
|
row
|
|
37572
37557
|
};
|
|
37573
|
-
if (
|
|
37558
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
37574
37559
|
}
|
|
37575
37560
|
return positions;
|
|
37576
37561
|
}
|
|
@@ -38321,7 +38306,7 @@ var PivotTitleSection = class extends _odoo_owl.Component {
|
|
|
38321
38306
|
});
|
|
38322
38307
|
let text;
|
|
38323
38308
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38324
|
-
else if (result.isCancelledBecause(
|
|
38309
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38325
38310
|
else text = _t("Pivot duplication failed.");
|
|
38326
38311
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38327
38312
|
this.env.notifyUser({
|
|
@@ -38398,13 +38383,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38398
38383
|
break;
|
|
38399
38384
|
}
|
|
38400
38385
|
return {
|
|
38386
|
+
/**
|
|
38387
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38388
|
+
*/
|
|
38401
38389
|
id: measure.id,
|
|
38390
|
+
/**
|
|
38391
|
+
* Display name of the measure
|
|
38392
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38393
|
+
*/
|
|
38402
38394
|
get displayName() {
|
|
38403
38395
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38404
38396
|
},
|
|
38405
38397
|
userDefinedName: measure.userDefinedName,
|
|
38398
|
+
/**
|
|
38399
|
+
* Get the name of the field of the measure
|
|
38400
|
+
*/
|
|
38406
38401
|
fieldName,
|
|
38402
|
+
/**
|
|
38403
|
+
* Get the aggregator of the measure
|
|
38404
|
+
*/
|
|
38407
38405
|
aggregator,
|
|
38406
|
+
/**
|
|
38407
|
+
* Get the type of the measure field
|
|
38408
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38409
|
+
*/
|
|
38408
38410
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38409
38411
|
isValid,
|
|
38410
38412
|
isHidden: measure.isHidden,
|
|
@@ -38418,10 +38420,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38418
38420
|
const type = field?.type ?? "integer";
|
|
38419
38421
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38420
38422
|
return {
|
|
38423
|
+
/**
|
|
38424
|
+
* Get the display name of the dimension
|
|
38425
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38426
|
+
*/
|
|
38421
38427
|
displayName: field?.string ?? dimension.fieldName,
|
|
38428
|
+
/**
|
|
38429
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38430
|
+
* e.g. "stage_id", "create_date:month"
|
|
38431
|
+
*/
|
|
38422
38432
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38433
|
+
/**
|
|
38434
|
+
* Get the name of the field of the dimension
|
|
38435
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38436
|
+
*/
|
|
38423
38437
|
fieldName: dimension.fieldName,
|
|
38438
|
+
/**
|
|
38439
|
+
* Get the aggregate operator of the dimension
|
|
38440
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38441
|
+
*/
|
|
38424
38442
|
granularity,
|
|
38443
|
+
/**
|
|
38444
|
+
* Get the type of the field of the dimension
|
|
38445
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38446
|
+
*/
|
|
38425
38447
|
type: field?.isCustomField ? "custom" : type,
|
|
38426
38448
|
order: dimension.order,
|
|
38427
38449
|
isValid: !!field,
|
|
@@ -39181,14 +39203,6 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
39181
39203
|
|
|
39182
39204
|
//#endregion
|
|
39183
39205
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39184
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39185
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39186
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39187
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39188
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39189
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39190
|
-
return ReloadType;
|
|
39191
|
-
}(ReloadType || {});
|
|
39192
39206
|
/**
|
|
39193
39207
|
* This class represents a pivot table that is created from a range of cells.
|
|
39194
39208
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39231,15 +39245,15 @@ var SpreadsheetPivot = class {
|
|
|
39231
39245
|
}
|
|
39232
39246
|
init(params = {}) {
|
|
39233
39247
|
if (!this._definition || params.reload) {
|
|
39234
|
-
this.reload(
|
|
39248
|
+
this.reload(4);
|
|
39235
39249
|
this.needsReevaluation = false;
|
|
39236
39250
|
}
|
|
39237
39251
|
}
|
|
39238
39252
|
reload(type) {
|
|
39239
|
-
if (type ===
|
|
39240
|
-
if (type >=
|
|
39241
|
-
if (type >=
|
|
39242
|
-
if (type >=
|
|
39253
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39254
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39255
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39256
|
+
if (type >= 1) {
|
|
39243
39257
|
this.collapsedTable = void 0;
|
|
39244
39258
|
this.expandedTable = void 0;
|
|
39245
39259
|
}
|
|
@@ -39248,13 +39262,13 @@ var SpreadsheetPivot = class {
|
|
|
39248
39262
|
const actualDefinition = this.coreDefinition;
|
|
39249
39263
|
this.coreDefinition = nextDefinition;
|
|
39250
39264
|
if (this._definition) {
|
|
39251
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39265
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39252
39266
|
this.reload(reloadType);
|
|
39253
39267
|
}
|
|
39254
39268
|
}
|
|
39255
39269
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39256
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39257
|
-
return
|
|
39270
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39271
|
+
return 4;
|
|
39258
39272
|
}
|
|
39259
39273
|
get isInvalidRange() {
|
|
39260
39274
|
return !!this.invalidRangeError;
|
|
@@ -39327,7 +39341,7 @@ var SpreadsheetPivot = class {
|
|
|
39327
39341
|
if (dataEntries.length === 0) return { value: "" };
|
|
39328
39342
|
const measure = this.getMeasure(measureId);
|
|
39329
39343
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39330
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39344
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39331
39345
|
const aggregator = measure.aggregator;
|
|
39332
39346
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39333
39347
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39429,16 +39443,16 @@ var SpreadsheetPivot = class {
|
|
|
39429
39443
|
return this.definition.getDimension(nameWithGranularity);
|
|
39430
39444
|
}
|
|
39431
39445
|
getTypeFromZone(sheetId, zone) {
|
|
39432
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39446
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39433
39447
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39434
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39435
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39436
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39448
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39449
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39450
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39437
39451
|
return "char";
|
|
39438
39452
|
}
|
|
39439
39453
|
assertCellIsValidField(col, row, cell) {
|
|
39440
|
-
if (cell.type ===
|
|
39441
|
-
if (cell.type ===
|
|
39454
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39455
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39442
39456
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39443
39457
|
}
|
|
39444
39458
|
/**
|
|
@@ -39497,7 +39511,7 @@ var SpreadsheetPivot = class {
|
|
|
39497
39511
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39498
39512
|
if (cell.value === "") entry[field.name] = {
|
|
39499
39513
|
value: null,
|
|
39500
|
-
type:
|
|
39514
|
+
type: "empty",
|
|
39501
39515
|
formattedValue: ""
|
|
39502
39516
|
};
|
|
39503
39517
|
else entry[field.name] = cell;
|
|
@@ -39510,7 +39524,7 @@ var SpreadsheetPivot = class {
|
|
|
39510
39524
|
if (!baseValue || !parentField) {
|
|
39511
39525
|
entry[customFieldName] = {
|
|
39512
39526
|
value: null,
|
|
39513
|
-
type:
|
|
39527
|
+
type: "empty",
|
|
39514
39528
|
formattedValue: ""
|
|
39515
39529
|
};
|
|
39516
39530
|
continue;
|
|
@@ -39523,7 +39537,7 @@ var SpreadsheetPivot = class {
|
|
|
39523
39537
|
}
|
|
39524
39538
|
entry["__count"] = {
|
|
39525
39539
|
value: 1,
|
|
39526
|
-
type:
|
|
39540
|
+
type: "number",
|
|
39527
39541
|
formattedValue: "1"
|
|
39528
39542
|
};
|
|
39529
39543
|
dataEntries.push(entry);
|
|
@@ -39536,7 +39550,7 @@ var SpreadsheetPivot = class {
|
|
|
39536
39550
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39537
39551
|
entry[dimension.nameWithGranularity] = {
|
|
39538
39552
|
value,
|
|
39539
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39553
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39540
39554
|
format: entry[dimension.fieldName]?.format,
|
|
39541
39555
|
formattedValue: formatValue(valueToFormat, {
|
|
39542
39556
|
locale,
|
|
@@ -39615,6 +39629,9 @@ const PIVOT_FUNCTIONS = [
|
|
|
39615
39629
|
function getFirstPivotFunction(compiledFormula, getters) {
|
|
39616
39630
|
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
|
|
39617
39631
|
}
|
|
39632
|
+
function getPivotFunctions(compiledFormula, getters) {
|
|
39633
|
+
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
|
|
39634
|
+
}
|
|
39618
39635
|
/**
|
|
39619
39636
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
39620
39637
|
* present in the given formula.
|
|
@@ -39691,6 +39708,8 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
39691
39708
|
//#endregion
|
|
39692
39709
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39693
39710
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39711
|
+
pivotId;
|
|
39712
|
+
updateMode;
|
|
39694
39713
|
mutators = [
|
|
39695
39714
|
"reset",
|
|
39696
39715
|
"deferUpdates",
|
|
@@ -39852,7 +39871,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39852
39871
|
};
|
|
39853
39872
|
}
|
|
39854
39873
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39855
|
-
|
|
39874
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39875
|
+
this.draft = cleanedWithGranularity;
|
|
39856
39876
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39857
39877
|
}
|
|
39858
39878
|
/**
|
|
@@ -41608,7 +41628,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
41608
41628
|
separator,
|
|
41609
41629
|
addNewColumns
|
|
41610
41630
|
});
|
|
41611
|
-
if (result.isCancelledBecause(
|
|
41631
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
41612
41632
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
41613
41633
|
separator,
|
|
41614
41634
|
addNewColumns,
|
|
@@ -41690,8 +41710,8 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
41690
41710
|
}).reasons;
|
|
41691
41711
|
const errors = /* @__PURE__ */ new Set();
|
|
41692
41712
|
for (const reason of cancelledReasons) switch (reason) {
|
|
41693
|
-
case
|
|
41694
|
-
case
|
|
41713
|
+
case "SplitWillOverwriteContent":
|
|
41714
|
+
case "EmptySplitSeparator": break;
|
|
41695
41715
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
41696
41716
|
}
|
|
41697
41717
|
return Array.from(errors);
|
|
@@ -41702,7 +41722,7 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
41702
41722
|
separator: this.separatorValue,
|
|
41703
41723
|
addNewColumns: this.state.addNewColumns,
|
|
41704
41724
|
force: false
|
|
41705
|
-
}).reasons.includes(
|
|
41725
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
41706
41726
|
return warnings;
|
|
41707
41727
|
}
|
|
41708
41728
|
get separatorValue() {
|
|
@@ -42333,7 +42353,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
42333
42353
|
if (env.model.dispatch(cmd, {
|
|
42334
42354
|
sheetId,
|
|
42335
42355
|
quantity: base
|
|
42336
|
-
}).isCancelledBecause(
|
|
42356
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
42337
42357
|
}
|
|
42338
42358
|
|
|
42339
42359
|
//#endregion
|
|
@@ -42513,11 +42533,11 @@ var FormulaFingerprintStore = class extends SpreadsheetStore {
|
|
|
42513
42533
|
}
|
|
42514
42534
|
getLiteralFingerprint(position) {
|
|
42515
42535
|
switch (this.getters.getEvaluatedCell(position).type) {
|
|
42516
|
-
case
|
|
42517
|
-
case
|
|
42518
|
-
case
|
|
42519
|
-
case
|
|
42520
|
-
case
|
|
42536
|
+
case "number":
|
|
42537
|
+
case "boolean": return DATA_FINGERPRINT;
|
|
42538
|
+
case "text":
|
|
42539
|
+
case "empty":
|
|
42540
|
+
case "error": return;
|
|
42521
42541
|
}
|
|
42522
42542
|
}
|
|
42523
42543
|
};
|
|
@@ -42801,7 +42821,7 @@ const togglePinPanel = {
|
|
|
42801
42821
|
function interactiveCut(env) {
|
|
42802
42822
|
const result = env.model.dispatch("CUT");
|
|
42803
42823
|
if (!result.isSuccessful) {
|
|
42804
|
-
if (result.isCancelledBecause(
|
|
42824
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
42805
42825
|
}
|
|
42806
42826
|
}
|
|
42807
42827
|
|
|
@@ -42872,8 +42892,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
42872
42892
|
sheetId,
|
|
42873
42893
|
target
|
|
42874
42894
|
});
|
|
42875
|
-
if (result.isCancelledBecause(
|
|
42876
|
-
else if (result.isCancelledBecause(
|
|
42895
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
42896
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
42877
42897
|
env.model.dispatch("ADD_MERGE", {
|
|
42878
42898
|
sheetId,
|
|
42879
42899
|
target,
|
|
@@ -43110,7 +43130,7 @@ const FIX_FORMULAS = {
|
|
|
43110
43130
|
if (!pivotId) return false;
|
|
43111
43131
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
43112
43132
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
43113
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
43133
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
43114
43134
|
},
|
|
43115
43135
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
43116
43136
|
};
|
|
@@ -43751,7 +43771,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
43751
43771
|
end: group.end
|
|
43752
43772
|
});
|
|
43753
43773
|
if (!result.isSuccessful) {
|
|
43754
|
-
if (result.isCancelledBecause(
|
|
43774
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
43755
43775
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
43756
43776
|
env.raiseError(errorMessage);
|
|
43757
43777
|
}
|
|
@@ -44706,11 +44726,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44706
44726
|
if (cell?.content.startsWith("'")) return { text: cell.content };
|
|
44707
44727
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
44708
44728
|
switch (type) {
|
|
44709
|
-
case
|
|
44710
|
-
case
|
|
44711
|
-
case
|
|
44712
|
-
case
|
|
44713
|
-
case
|
|
44729
|
+
case "empty": return { text: "" };
|
|
44730
|
+
case "text":
|
|
44731
|
+
case "error": return { text: value };
|
|
44732
|
+
case "boolean": return { text: formattedValue };
|
|
44733
|
+
case "number":
|
|
44714
44734
|
if (format && isDateTimeFormat(format)) {
|
|
44715
44735
|
if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
|
|
44716
44736
|
return { text: formatValue(value, {
|
|
@@ -44767,7 +44787,7 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44767
44787
|
startEdition(text, selection) {
|
|
44768
44788
|
if (this.getters.isCurrentSheetLocked()) {
|
|
44769
44789
|
this.model.trigger("command-rejected", {
|
|
44770
|
-
result: new DispatchResult(
|
|
44790
|
+
result: new DispatchResult("SheetLocked"),
|
|
44771
44791
|
command: { sheetId: this.getters.getActiveSheetId() }
|
|
44772
44792
|
});
|
|
44773
44793
|
return "NoStateChange";
|
|
@@ -46392,7 +46412,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
46392
46412
|
elements,
|
|
46393
46413
|
position: this.state.position
|
|
46394
46414
|
});
|
|
46395
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
46415
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46396
46416
|
}
|
|
46397
46417
|
_selectElement(index, addDistinctHeader) {
|
|
46398
46418
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -46529,8 +46549,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
46529
46549
|
position: this.state.position
|
|
46530
46550
|
});
|
|
46531
46551
|
if (!result.isSuccessful) {
|
|
46532
|
-
if (result.reasons.includes(
|
|
46533
|
-
else if (result.reasons.includes(
|
|
46552
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46553
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
46534
46554
|
}
|
|
46535
46555
|
}
|
|
46536
46556
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -46607,6 +46627,7 @@ var HeadersOverlay = class extends _odoo_owl.Component {
|
|
|
46607
46627
|
//#region src/stores/grid_renderer_store.ts
|
|
46608
46628
|
const CELL_ANIMATION_DURATION = 200;
|
|
46609
46629
|
var GridRenderer = class extends DisposableStore {
|
|
46630
|
+
renderer;
|
|
46610
46631
|
fingerprints;
|
|
46611
46632
|
hoveredTables;
|
|
46612
46633
|
hoveredIcon;
|
|
@@ -47091,7 +47112,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47091
47112
|
const nextCell = this.getters.getEvaluatedCell(position);
|
|
47092
47113
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
47093
47114
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47094
|
-
if (nextCell.type !==
|
|
47115
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
|
|
47095
47116
|
col++;
|
|
47096
47117
|
}
|
|
47097
47118
|
return col;
|
|
@@ -47107,7 +47128,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47107
47128
|
const previousCell = this.getters.getEvaluatedCell(position);
|
|
47108
47129
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
47109
47130
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47110
|
-
if (previousCell.type !==
|
|
47131
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
|
|
47111
47132
|
col--;
|
|
47112
47133
|
}
|
|
47113
47134
|
return col;
|
|
@@ -47117,7 +47138,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47117
47138
|
const { align } = this.getters.getCellStyle(position);
|
|
47118
47139
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
47119
47140
|
if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
|
|
47120
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
47141
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
47121
47142
|
return align || evaluatedCell.defaultAlign;
|
|
47122
47143
|
}
|
|
47123
47144
|
createZoneBox(viewports, sheetId, zone, viewport) {
|
|
@@ -47162,12 +47183,12 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47162
47183
|
style,
|
|
47163
47184
|
dataBarFill,
|
|
47164
47185
|
overlayColor: this.hoveredTables.overlayColors.get(position),
|
|
47165
|
-
isError: cell.type ===
|
|
47186
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
|
|
47166
47187
|
icons: cellIcons,
|
|
47167
47188
|
disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
|
|
47168
47189
|
};
|
|
47169
47190
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
47170
|
-
if (cell.type ===
|
|
47191
|
+
if (cell.type === "empty" || box.icons.center) return box;
|
|
47171
47192
|
/** Content */
|
|
47172
47193
|
const wrapping = style.wrapping || "overflow";
|
|
47173
47194
|
const wrapText = wrapping === "wrap" && !showFormula;
|
|
@@ -48343,7 +48364,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48343
48364
|
"Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
|
|
48344
48365
|
};
|
|
48345
48366
|
focusComposerFromActiveCell() {
|
|
48346
|
-
this.env.model.getters.getActiveCell().type ===
|
|
48367
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
48347
48368
|
}
|
|
48348
48369
|
editOrMoveInSelection(direction) {
|
|
48349
48370
|
if (this.isSingleCellOrMergeSelection()) {
|
|
@@ -48468,7 +48489,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48468
48489
|
sheetId,
|
|
48469
48490
|
col,
|
|
48470
48491
|
row
|
|
48471
|
-
}).type ===
|
|
48492
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
48472
48493
|
else this.onComposerContentFocused();
|
|
48473
48494
|
}
|
|
48474
48495
|
processArrows(ev) {
|
|
@@ -48549,18 +48570,18 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
48549
48570
|
if (!clipboardData) return;
|
|
48550
48571
|
const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
|
|
48551
48572
|
const osClipboard = { content: {
|
|
48552
|
-
[
|
|
48553
|
-
[
|
|
48573
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
48574
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
48554
48575
|
} };
|
|
48555
48576
|
if (image) osClipboard.content[image.type] = image;
|
|
48556
48577
|
const target = this.env.model.getters.getSelectedZones();
|
|
48557
48578
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
48558
|
-
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
48579
|
+
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
|
|
48559
48580
|
else {
|
|
48560
48581
|
const osClipboardContent = parseOSClipboardContent(osClipboard.content);
|
|
48561
48582
|
await interactivePasteFromOS(this.env, target, osClipboardContent);
|
|
48562
48583
|
}
|
|
48563
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
48584
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
48564
48585
|
}
|
|
48565
48586
|
clearFormatting() {
|
|
48566
48587
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -49047,7 +49068,7 @@ var BasePlugin = class {
|
|
|
49047
49068
|
* There should not be any side effects in this method.
|
|
49048
49069
|
*/
|
|
49049
49070
|
allowDispatch(command) {
|
|
49050
|
-
return
|
|
49071
|
+
return "Success";
|
|
49051
49072
|
}
|
|
49052
49073
|
/**
|
|
49053
49074
|
* This method is useful when a plugin needs to perform some action before a
|
|
@@ -49083,10 +49104,10 @@ var BasePlugin = class {
|
|
|
49083
49104
|
for (const validation of validations) {
|
|
49084
49105
|
let results = validation.call(this, toValidate);
|
|
49085
49106
|
if (!Array.isArray(results)) results = [results];
|
|
49086
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
49107
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
49087
49108
|
if (cancelledReasons.length) return cancelledReasons;
|
|
49088
49109
|
}
|
|
49089
|
-
return
|
|
49110
|
+
return "Success";
|
|
49090
49111
|
};
|
|
49091
49112
|
}
|
|
49092
49113
|
checkValidations(command, ...validations) {
|
|
@@ -49143,7 +49164,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49143
49164
|
allowDispatch(cmd) {
|
|
49144
49165
|
switch (cmd.type) {
|
|
49145
49166
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
49146
|
-
default: return
|
|
49167
|
+
default: return "Success";
|
|
49147
49168
|
}
|
|
49148
49169
|
}
|
|
49149
49170
|
handle(cmd) {
|
|
@@ -49557,8 +49578,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49557
49578
|
checkBordersUnchanged(cmd) {
|
|
49558
49579
|
const currentBorder = this.getCellBorder(cmd);
|
|
49559
49580
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
49560
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
49561
|
-
return
|
|
49581
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
49582
|
+
return "Success";
|
|
49562
49583
|
}
|
|
49563
49584
|
import(data) {
|
|
49564
49585
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
|
|
@@ -49606,13 +49627,13 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
49606
49627
|
allowDispatch(cmd) {
|
|
49607
49628
|
switch (cmd.type) {
|
|
49608
49629
|
case "CREATE_CAROUSEL":
|
|
49609
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
49610
|
-
return
|
|
49630
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
|
|
49631
|
+
return "Success";
|
|
49611
49632
|
case "UPDATE_CAROUSEL":
|
|
49612
|
-
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return
|
|
49613
|
-
return
|
|
49633
|
+
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
49634
|
+
return "Success";
|
|
49614
49635
|
}
|
|
49615
|
-
return
|
|
49636
|
+
return "Success";
|
|
49616
49637
|
}
|
|
49617
49638
|
handle(cmd) {
|
|
49618
49639
|
switch (cmd.type) {
|
|
@@ -50232,9 +50253,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50232
50253
|
switch (cmd.type) {
|
|
50233
50254
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
50234
50255
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
50235
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
50256
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
50236
50257
|
case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
|
|
50237
|
-
default: return
|
|
50258
|
+
default: return "Success";
|
|
50238
50259
|
}
|
|
50239
50260
|
}
|
|
50240
50261
|
handle(cmd) {
|
|
@@ -50590,28 +50611,28 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50590
50611
|
}
|
|
50591
50612
|
checkCellOutOfSheet(cmd) {
|
|
50592
50613
|
const { sheetId, col, row } = cmd;
|
|
50593
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50594
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
50614
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50615
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
50595
50616
|
}
|
|
50596
50617
|
checkUselessClearCell(cmd) {
|
|
50597
50618
|
const cell = this.getters.getCell(cmd);
|
|
50598
|
-
if (!cell) return
|
|
50599
|
-
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return
|
|
50600
|
-
return
|
|
50619
|
+
if (!cell) return "NoChanges";
|
|
50620
|
+
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
50621
|
+
return "Success";
|
|
50601
50622
|
}
|
|
50602
50623
|
checkUselessUpdateCell(cmd) {
|
|
50603
50624
|
const cell = this.getters.getCell(cmd);
|
|
50604
50625
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
50605
50626
|
const hasStyle = "style" in cmd;
|
|
50606
50627
|
const hasFormat = "format" in cmd;
|
|
50607
|
-
if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
50608
|
-
return
|
|
50628
|
+
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";
|
|
50629
|
+
return "Success";
|
|
50609
50630
|
}
|
|
50610
50631
|
checkUselessSetFormatting(cmd) {
|
|
50611
50632
|
const { sheetId, target } = cmd;
|
|
50612
50633
|
const hasStyle = "style" in cmd;
|
|
50613
50634
|
const hasFormat = "format" in cmd;
|
|
50614
|
-
if (!hasStyle && !hasFormat) return
|
|
50635
|
+
if (!hasStyle && !hasFormat) return "NoChanges";
|
|
50615
50636
|
for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50616
50637
|
const position = {
|
|
50617
50638
|
sheetId,
|
|
@@ -50619,9 +50640,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50619
50640
|
row
|
|
50620
50641
|
};
|
|
50621
50642
|
const cell = this.getters.getCell(position);
|
|
50622
|
-
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return
|
|
50643
|
+
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
|
|
50623
50644
|
}
|
|
50624
|
-
return
|
|
50645
|
+
return "NoChanges";
|
|
50625
50646
|
}
|
|
50626
50647
|
};
|
|
50627
50648
|
|
|
@@ -50652,8 +50673,8 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50652
50673
|
switch (cmd.type) {
|
|
50653
50674
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
|
|
50654
50675
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
50655
|
-
case "DELETE_CHART": return
|
|
50656
|
-
default: return
|
|
50676
|
+
case "DELETE_CHART": return "SubCommandOnly";
|
|
50677
|
+
default: return "Success";
|
|
50657
50678
|
}
|
|
50658
50679
|
}
|
|
50659
50680
|
handle(cmd) {
|
|
@@ -50812,22 +50833,22 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50812
50833
|
}
|
|
50813
50834
|
}
|
|
50814
50835
|
checkChartDuplicate(cmd) {
|
|
50815
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50836
|
+
return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
|
|
50816
50837
|
}
|
|
50817
50838
|
checkChartDefinition(cmd) {
|
|
50818
50839
|
return SpreadsheetChart.validate(this, cmd.definition);
|
|
50819
50840
|
}
|
|
50820
50841
|
checkChartExists(cmd) {
|
|
50821
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50842
|
+
return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
|
|
50822
50843
|
}
|
|
50823
50844
|
checkChartChanged(cmd) {
|
|
50824
|
-
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return
|
|
50825
|
-
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ?
|
|
50845
|
+
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
|
|
50846
|
+
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
|
|
50826
50847
|
}
|
|
50827
50848
|
/** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
|
|
50828
50849
|
checkFigureArguments(cmd) {
|
|
50829
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
50830
|
-
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ?
|
|
50850
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
|
|
50851
|
+
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
|
|
50831
50852
|
}
|
|
50832
50853
|
};
|
|
50833
50854
|
|
|
@@ -50894,11 +50915,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
50894
50915
|
allowDispatch(cmd) {
|
|
50895
50916
|
switch (cmd.type) {
|
|
50896
50917
|
case "ADD_CONDITIONAL_FORMAT":
|
|
50897
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
50918
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
50898
50919
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
50899
50920
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
50900
50921
|
}
|
|
50901
|
-
return
|
|
50922
|
+
return "Success";
|
|
50902
50923
|
}
|
|
50903
50924
|
handle(cmd) {
|
|
50904
50925
|
switch (cmd.type) {
|
|
@@ -51031,27 +51052,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51031
51052
|
this.history.update("cfRules", sheet, currentCF);
|
|
51032
51053
|
}
|
|
51033
51054
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
51034
|
-
if (!this.cfRules[sheetId]) return
|
|
51055
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
51035
51056
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
51036
|
-
if (ruleIndex === -1) return
|
|
51057
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
51037
51058
|
const cfIndex2 = ruleIndex - delta;
|
|
51038
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
51039
|
-
return
|
|
51059
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
51060
|
+
return "Success";
|
|
51040
51061
|
}
|
|
51041
51062
|
checkEmptyRange(cmd) {
|
|
51042
|
-
return cmd.ranges.length ?
|
|
51063
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51043
51064
|
}
|
|
51044
51065
|
checkCFRule(cmd) {
|
|
51045
51066
|
const rule = cmd.cf.rule;
|
|
51046
51067
|
switch (rule.type) {
|
|
51047
51068
|
case "CellIsRule":
|
|
51048
|
-
if (!availableConditionalFormatOperators.has(rule.operator)) return
|
|
51069
|
+
if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
|
|
51049
51070
|
return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
|
|
51050
51071
|
case "ColorScaleRule": return this.checkValidations(rule, this.chainValidations(this.checkThresholds(this.checkFormulaCompilation)), this.chainValidations(this.checkThresholds(this.checkNaN), this.batchValidations(this.checkMinBiggerThanMax, this.checkMinBiggerThanMid, this.checkMidBiggerThanMax)));
|
|
51051
51072
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
51052
|
-
case "DataBarRule": return
|
|
51073
|
+
case "DataBarRule": return "Success";
|
|
51053
51074
|
}
|
|
51054
|
-
return
|
|
51075
|
+
return "InvalidConditionalFormatType";
|
|
51055
51076
|
}
|
|
51056
51077
|
checkCFHasChanged(cmd) {
|
|
51057
51078
|
const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
|
|
@@ -51059,8 +51080,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51059
51080
|
ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
|
|
51060
51081
|
});
|
|
51061
51082
|
const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
|
|
51062
|
-
if (currentCF && deepEquals(newCF, currentCF)) return
|
|
51063
|
-
return
|
|
51083
|
+
if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
|
|
51084
|
+
return "Success";
|
|
51064
51085
|
}
|
|
51065
51086
|
checkOperatorArgsNumber(rule) {
|
|
51066
51087
|
const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
|
|
@@ -51070,9 +51091,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51070
51091
|
if (expectedNumber === void 0 || expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
51071
51092
|
const errors = [];
|
|
51072
51093
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
51073
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
51074
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
51075
|
-
return errors.length ? errors :
|
|
51094
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
51095
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
51096
|
+
return errors.length ? errors : "Success";
|
|
51076
51097
|
}
|
|
51077
51098
|
checkNaN(threshold, thresholdName) {
|
|
51078
51099
|
if ([
|
|
@@ -51080,27 +51101,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51080
51101
|
"percentage",
|
|
51081
51102
|
"percentile"
|
|
51082
51103
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
51083
|
-
case "min": return
|
|
51084
|
-
case "max": return
|
|
51085
|
-
case "mid": return
|
|
51086
|
-
case "upperInflectionPoint": return
|
|
51087
|
-
case "lowerInflectionPoint": return
|
|
51104
|
+
case "min": return "MinNaN";
|
|
51105
|
+
case "max": return "MaxNaN";
|
|
51106
|
+
case "mid": return "MidNaN";
|
|
51107
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
51108
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
51088
51109
|
}
|
|
51089
|
-
return
|
|
51110
|
+
return "Success";
|
|
51090
51111
|
}
|
|
51091
51112
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
51092
|
-
if (threshold.type !== "formula") return
|
|
51113
|
+
if (threshold.type !== "formula") return "Success";
|
|
51093
51114
|
if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
|
|
51094
|
-
case "min": return
|
|
51095
|
-
case "max": return
|
|
51096
|
-
case "mid": return
|
|
51097
|
-
case "upperInflectionPoint": return
|
|
51098
|
-
case "lowerInflectionPoint": return
|
|
51115
|
+
case "min": return "MinInvalidFormula";
|
|
51116
|
+
case "max": return "MaxInvalidFormula";
|
|
51117
|
+
case "mid": return "MidInvalidFormula";
|
|
51118
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
51119
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
51099
51120
|
}
|
|
51100
|
-
return
|
|
51121
|
+
return "Success";
|
|
51101
51122
|
}
|
|
51102
51123
|
checkThresholds(check) {
|
|
51103
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
51124
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
51104
51125
|
}
|
|
51105
51126
|
checkInflectionPoints(check) {
|
|
51106
51127
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -51112,8 +51133,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51112
51133
|
"number",
|
|
51113
51134
|
"percentage",
|
|
51114
51135
|
"percentile"
|
|
51115
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
51116
|
-
return
|
|
51136
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
51137
|
+
return "Success";
|
|
51117
51138
|
}
|
|
51118
51139
|
checkMinBiggerThanMax(rule) {
|
|
51119
51140
|
const minValue = rule.minimum.value;
|
|
@@ -51122,8 +51143,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51122
51143
|
"number",
|
|
51123
51144
|
"percentage",
|
|
51124
51145
|
"percentile"
|
|
51125
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
51126
|
-
return
|
|
51146
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
51147
|
+
return "Success";
|
|
51127
51148
|
}
|
|
51128
51149
|
checkMidBiggerThanMax(rule) {
|
|
51129
51150
|
const midValue = rule.midpoint?.value;
|
|
@@ -51132,8 +51153,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51132
51153
|
"number",
|
|
51133
51154
|
"percentage",
|
|
51134
51155
|
"percentile"
|
|
51135
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
51136
|
-
return
|
|
51156
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
51157
|
+
return "Success";
|
|
51137
51158
|
}
|
|
51138
51159
|
checkMinBiggerThanMid(rule) {
|
|
51139
51160
|
const minValue = rule.minimum.value;
|
|
@@ -51142,15 +51163,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51142
51163
|
"number",
|
|
51143
51164
|
"percentage",
|
|
51144
51165
|
"percentile"
|
|
51145
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
51146
|
-
return
|
|
51166
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
51167
|
+
return "Success";
|
|
51147
51168
|
}
|
|
51148
51169
|
checkCFValues(rule) {
|
|
51149
51170
|
for (const value of rule.values) {
|
|
51150
51171
|
if (!value.startsWith("=")) continue;
|
|
51151
|
-
if (CompiledFormula.IsBadExpression(value)) return
|
|
51172
|
+
if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
|
|
51152
51173
|
}
|
|
51153
|
-
return
|
|
51174
|
+
return "Success";
|
|
51154
51175
|
}
|
|
51155
51176
|
removeConditionalFormatting(id, sheet) {
|
|
51156
51177
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -51225,15 +51246,15 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51225
51246
|
allowDispatch(cmd) {
|
|
51226
51247
|
switch (cmd.type) {
|
|
51227
51248
|
case "ADD_DATA_VALIDATION_RULE":
|
|
51228
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51229
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
51249
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51250
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
51230
51251
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
51231
51252
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
51232
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51233
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
51253
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51254
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
51234
51255
|
break;
|
|
51235
51256
|
}
|
|
51236
|
-
return
|
|
51257
|
+
return "Success";
|
|
51237
51258
|
}
|
|
51238
51259
|
handle(cmd) {
|
|
51239
51260
|
switch (cmd.type) {
|
|
@@ -51343,7 +51364,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51343
51364
|
}
|
|
51344
51365
|
}
|
|
51345
51366
|
checkEmptyRange(cmd) {
|
|
51346
|
-
return cmd.ranges.length ?
|
|
51367
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51347
51368
|
}
|
|
51348
51369
|
import(data) {
|
|
51349
51370
|
for (const sheet of data.sheets) {
|
|
@@ -51386,13 +51407,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51386
51407
|
}
|
|
51387
51408
|
}
|
|
51388
51409
|
checkCriterionTypeIsValid(cmd) {
|
|
51389
|
-
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
51410
|
+
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
51390
51411
|
}
|
|
51391
51412
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
51392
51413
|
const criterion = cmd.rule.criterion;
|
|
51393
51414
|
const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
51394
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
51395
|
-
return
|
|
51415
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
51416
|
+
return "Success";
|
|
51396
51417
|
}
|
|
51397
51418
|
checkCriterionValuesAreValid(cmd) {
|
|
51398
51419
|
const criterion = cmd.rule.criterion;
|
|
@@ -51402,12 +51423,12 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51402
51423
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
|
|
51403
51424
|
return !evaluator.isCriterionValueValid(value);
|
|
51404
51425
|
};
|
|
51405
|
-
if (criterion.values.some(isInvalid)) return
|
|
51406
|
-
return
|
|
51426
|
+
if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
|
|
51427
|
+
return "Success";
|
|
51407
51428
|
}
|
|
51408
51429
|
checkValidRange(cmd) {
|
|
51409
|
-
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return
|
|
51410
|
-
return
|
|
51430
|
+
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";
|
|
51431
|
+
return "Success";
|
|
51411
51432
|
}
|
|
51412
51433
|
};
|
|
51413
51434
|
|
|
@@ -51463,7 +51484,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51463
51484
|
case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
|
|
51464
51485
|
case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
|
|
51465
51486
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd);
|
|
51466
|
-
default: return
|
|
51487
|
+
default: return "Success";
|
|
51467
51488
|
}
|
|
51468
51489
|
}
|
|
51469
51490
|
beforeHandle(cmd) {
|
|
@@ -51632,16 +51653,16 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51632
51653
|
this.history.update("figures", sheetId, id, void 0);
|
|
51633
51654
|
}
|
|
51634
51655
|
checkFigureExists(cmd) {
|
|
51635
|
-
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return
|
|
51636
|
-
return
|
|
51656
|
+
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
|
|
51657
|
+
return "Success";
|
|
51637
51658
|
}
|
|
51638
51659
|
checkFigureDuplicate(cmd) {
|
|
51639
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return
|
|
51640
|
-
return
|
|
51660
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
|
|
51661
|
+
return "Success";
|
|
51641
51662
|
}
|
|
51642
51663
|
checkFigureAnchorOffset(cmd) {
|
|
51643
|
-
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return
|
|
51644
|
-
return
|
|
51664
|
+
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
|
|
51665
|
+
return "Success";
|
|
51645
51666
|
}
|
|
51646
51667
|
getFigures(sheetId) {
|
|
51647
51668
|
const figures = [];
|
|
@@ -51692,28 +51713,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
51692
51713
|
switch (cmd.type) {
|
|
51693
51714
|
case "GROUP_HEADERS": {
|
|
51694
51715
|
const { start, end, sheetId } = cmd;
|
|
51695
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51696
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51697
|
-
if (start > end) return
|
|
51698
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
51716
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51717
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51718
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51719
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
51699
51720
|
break;
|
|
51700
51721
|
}
|
|
51701
51722
|
case "UNGROUP_HEADERS": {
|
|
51702
51723
|
const { start, end, sheetId } = cmd;
|
|
51703
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51704
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51705
|
-
if (start > end) return
|
|
51724
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51725
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51726
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51706
51727
|
break;
|
|
51707
51728
|
}
|
|
51708
51729
|
case "UNFOLD_HEADER_GROUP":
|
|
51709
51730
|
case "FOLD_HEADER_GROUP":
|
|
51710
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51731
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51711
51732
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
51712
|
-
if (!group) return
|
|
51713
|
-
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return
|
|
51733
|
+
if (!group) return "UnknownHeaderGroup";
|
|
51734
|
+
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return "NotEnoughElements";
|
|
51714
51735
|
break;
|
|
51715
51736
|
}
|
|
51716
|
-
return
|
|
51737
|
+
return "Success";
|
|
51717
51738
|
}
|
|
51718
51739
|
handle(cmd) {
|
|
51719
51740
|
switch (cmd.type) {
|
|
@@ -52121,19 +52142,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
52121
52142
|
allowDispatch(cmd) {
|
|
52122
52143
|
switch (cmd.type) {
|
|
52123
52144
|
case "HIDE_COLUMNS_ROWS": {
|
|
52124
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52145
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52125
52146
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
52126
52147
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
52127
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
52128
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
52129
|
-
else return
|
|
52148
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
52149
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
52150
|
+
else return "Success";
|
|
52130
52151
|
}
|
|
52131
52152
|
case "REMOVE_COLUMNS_ROWS":
|
|
52132
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52133
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
52134
|
-
return
|
|
52153
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52154
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
52155
|
+
return "Success";
|
|
52135
52156
|
}
|
|
52136
|
-
return
|
|
52157
|
+
return "Success";
|
|
52137
52158
|
}
|
|
52138
52159
|
handle(cmd) {
|
|
52139
52160
|
switch (cmd.type) {
|
|
@@ -52261,9 +52282,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
52261
52282
|
allowDispatch(cmd) {
|
|
52262
52283
|
switch (cmd.type) {
|
|
52263
52284
|
case "CREATE_IMAGE":
|
|
52264
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
52265
|
-
return
|
|
52266
|
-
default: return
|
|
52285
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
52286
|
+
return "Success";
|
|
52287
|
+
default: return "Success";
|
|
52267
52288
|
}
|
|
52268
52289
|
}
|
|
52269
52290
|
handle(cmd) {
|
|
@@ -52387,7 +52408,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52387
52408
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
52388
52409
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
52389
52410
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
52390
|
-
default: return
|
|
52411
|
+
default: return "Success";
|
|
52391
52412
|
}
|
|
52392
52413
|
}
|
|
52393
52414
|
handle(cmd) {
|
|
@@ -52548,18 +52569,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52548
52569
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
52549
52570
|
}
|
|
52550
52571
|
checkDestructiveMerge({ sheetId, target }) {
|
|
52551
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52552
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
52572
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52573
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
52553
52574
|
}
|
|
52554
52575
|
checkOverlap({ target }) {
|
|
52555
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
52556
|
-
return
|
|
52576
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
52577
|
+
return "Success";
|
|
52557
52578
|
}
|
|
52558
52579
|
checkFrozenPanes({ sheetId, target }) {
|
|
52559
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52580
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52560
52581
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
52561
|
-
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return
|
|
52562
|
-
return
|
|
52582
|
+
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
52583
|
+
return "Success";
|
|
52563
52584
|
}
|
|
52564
52585
|
/**
|
|
52565
52586
|
* The content of a merged cell should always be empty.
|
|
@@ -52567,10 +52588,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52567
52588
|
*/
|
|
52568
52589
|
checkMergedContentUpdate(cmd) {
|
|
52569
52590
|
const { col, row, content } = cmd;
|
|
52570
|
-
if (content === void 0) return
|
|
52591
|
+
if (content === void 0) return "Success";
|
|
52571
52592
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
52572
|
-
if (mainCol === col && mainRow === row) return
|
|
52573
|
-
return
|
|
52593
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
52594
|
+
return "CellIsMerged";
|
|
52574
52595
|
}
|
|
52575
52596
|
checkMergeExists(cmd) {
|
|
52576
52597
|
const { sheetId, target } = cmd;
|
|
@@ -52581,9 +52602,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52581
52602
|
col: left,
|
|
52582
52603
|
row: top
|
|
52583
52604
|
});
|
|
52584
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
52605
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
52585
52606
|
}
|
|
52586
|
-
return
|
|
52607
|
+
return "Success";
|
|
52587
52608
|
}
|
|
52588
52609
|
/**
|
|
52589
52610
|
* Merge the current selection. Note that:
|
|
@@ -52748,10 +52769,10 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52748
52769
|
allowDispatch(cmd) {
|
|
52749
52770
|
switch (cmd.type) {
|
|
52750
52771
|
case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
|
|
52751
|
-
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) :
|
|
52772
|
+
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
|
|
52752
52773
|
case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
|
|
52753
52774
|
}
|
|
52754
|
-
return
|
|
52775
|
+
return "Success";
|
|
52755
52776
|
}
|
|
52756
52777
|
handle(cmd) {
|
|
52757
52778
|
switch (cmd.type) {
|
|
@@ -52815,14 +52836,14 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52815
52836
|
}
|
|
52816
52837
|
}
|
|
52817
52838
|
checkValidNewNamedRangeName(name) {
|
|
52818
|
-
if (this.getNamedRange(name)) return
|
|
52819
|
-
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return
|
|
52820
|
-
if (rangeReference.test(name)) return
|
|
52821
|
-
return
|
|
52839
|
+
if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
|
|
52840
|
+
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
|
|
52841
|
+
if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
|
|
52842
|
+
return "Success";
|
|
52822
52843
|
}
|
|
52823
52844
|
checkNamedRangeExists(name) {
|
|
52824
|
-
if (!this.getNamedRange(name)) return
|
|
52825
|
-
return
|
|
52845
|
+
if (!this.getNamedRange(name)) return "NamedRangeNotFound";
|
|
52846
|
+
return "Success";
|
|
52826
52847
|
}
|
|
52827
52848
|
};
|
|
52828
52849
|
|
|
@@ -52847,25 +52868,25 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
52847
52868
|
allowDispatch(cmd) {
|
|
52848
52869
|
switch (cmd.type) {
|
|
52849
52870
|
case "ADD_PIVOT":
|
|
52850
|
-
if (cmd.pivotId in this.pivots) return
|
|
52871
|
+
if (cmd.pivotId in this.pivots) return "PivotIdTaken";
|
|
52851
52872
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52852
52873
|
case "UPDATE_PIVOT":
|
|
52853
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52854
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
52855
|
-
if (cmd.pivot.name === "") return
|
|
52874
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52875
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
52876
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
52856
52877
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52857
52878
|
case "RENAME_PIVOT":
|
|
52858
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52859
|
-
if (cmd.name === "") return
|
|
52879
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52880
|
+
if (cmd.name === "") return "EmptyName";
|
|
52860
52881
|
break;
|
|
52861
52882
|
case "REMOVE_PIVOT":
|
|
52862
52883
|
case "DUPLICATE_PIVOT":
|
|
52863
52884
|
case "INSERT_PIVOT":
|
|
52864
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52885
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52865
52886
|
break;
|
|
52866
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
52887
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52867
52888
|
}
|
|
52868
|
-
return
|
|
52889
|
+
return "Success";
|
|
52869
52890
|
}
|
|
52870
52891
|
handle(cmd) {
|
|
52871
52892
|
switch (cmd.type) {
|
|
@@ -53062,13 +53083,13 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53062
53083
|
}
|
|
53063
53084
|
checkSortedColumnInMeasures(definition) {
|
|
53064
53085
|
const measures = definition.measures.map((measure) => measure.id);
|
|
53065
|
-
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return
|
|
53066
|
-
return
|
|
53086
|
+
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
|
|
53087
|
+
return "Success";
|
|
53067
53088
|
}
|
|
53068
53089
|
checkDuplicatedMeasureIds(definition) {
|
|
53069
53090
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
53070
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
53071
|
-
return
|
|
53091
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
53092
|
+
return "Success";
|
|
53072
53093
|
}
|
|
53073
53094
|
checkCustomFieldsAreValid(definition) {
|
|
53074
53095
|
for (const customFieldName in definition.customFields) {
|
|
@@ -53077,15 +53098,15 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53077
53098
|
const groupNames = /* @__PURE__ */ new Set();
|
|
53078
53099
|
let hasOtherGroup = false;
|
|
53079
53100
|
for (const group of customField.groups) {
|
|
53080
|
-
if (!group.name || groupNames.has(group.name)) return
|
|
53081
|
-
if (group.values.some((value) => groupedValues.has(value))) return
|
|
53082
|
-
if (group.isOtherGroup && hasOtherGroup) return
|
|
53101
|
+
if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
|
|
53102
|
+
if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
|
|
53103
|
+
if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
|
|
53083
53104
|
group.values.forEach((value) => groupedValues.add(value));
|
|
53084
53105
|
groupNames.add(group.name);
|
|
53085
53106
|
hasOtherGroup ||= !!group.isOtherGroup;
|
|
53086
53107
|
}
|
|
53087
53108
|
}
|
|
53088
|
-
return
|
|
53109
|
+
return "Success";
|
|
53089
53110
|
}
|
|
53090
53111
|
/**
|
|
53091
53112
|
* Import the pivots
|
|
@@ -53114,9 +53135,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
53114
53135
|
locale = DEFAULT_LOCALE;
|
|
53115
53136
|
allowDispatch(cmd) {
|
|
53116
53137
|
switch (cmd.type) {
|
|
53117
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
53138
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
53118
53139
|
}
|
|
53119
|
-
return
|
|
53140
|
+
return "Success";
|
|
53120
53141
|
}
|
|
53121
53142
|
handle(cmd) {
|
|
53122
53143
|
switch (cmd.type) {
|
|
@@ -53197,7 +53218,7 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53197
53218
|
cellPosition = {};
|
|
53198
53219
|
allowDispatch(cmd) {
|
|
53199
53220
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
53200
|
-
if (genericChecks !==
|
|
53221
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
53201
53222
|
let sheetNameMissing = false;
|
|
53202
53223
|
switch (cmd.type) {
|
|
53203
53224
|
case "CREATE_SHEET":
|
|
@@ -53213,37 +53234,37 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53213
53234
|
if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
|
|
53214
53235
|
switch (cmd.type) {
|
|
53215
53236
|
case "HIDE_SHEET":
|
|
53216
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
53217
|
-
return
|
|
53237
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
53238
|
+
return "Success";
|
|
53218
53239
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
|
|
53219
53240
|
case "DUPLICATE_SHEET":
|
|
53220
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
53221
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
53222
|
-
return
|
|
53241
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
53242
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
53243
|
+
return "Success";
|
|
53223
53244
|
case "MOVE_SHEET": try {
|
|
53224
53245
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
53225
53246
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
53226
|
-
return
|
|
53247
|
+
return "Success";
|
|
53227
53248
|
} catch (e) {
|
|
53228
|
-
return
|
|
53249
|
+
return "WrongSheetMove";
|
|
53229
53250
|
}
|
|
53230
53251
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
53231
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
53232
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
53252
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
53253
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
53233
53254
|
case "ADD_COLUMNS_ROWS":
|
|
53234
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
53235
|
-
else if (cmd.quantity <= 0) return
|
|
53236
|
-
return
|
|
53255
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
53256
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
53257
|
+
return "Success";
|
|
53237
53258
|
case "REMOVE_COLUMNS_ROWS": {
|
|
53238
53259
|
const min = largeMin(cmd.elements);
|
|
53239
53260
|
const max = largeMax(cmd.elements);
|
|
53240
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
53241
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
53242
|
-
else return
|
|
53261
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
53262
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
53263
|
+
else return "Success";
|
|
53243
53264
|
}
|
|
53244
53265
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
53245
53266
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
53246
|
-
default: return
|
|
53267
|
+
default: return "Success";
|
|
53247
53268
|
}
|
|
53248
53269
|
}
|
|
53249
53270
|
handle(cmd) {
|
|
@@ -53518,12 +53539,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53518
53539
|
* not outside the sheet.
|
|
53519
53540
|
*/
|
|
53520
53541
|
checkZonesExistInSheet(sheetId, zones) {
|
|
53521
|
-
if (!zones.every(isZoneValid)) return
|
|
53542
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
53522
53543
|
if (zones.length) {
|
|
53523
53544
|
const sheetZone = this.getSheetZone(sheetId);
|
|
53524
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
53545
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
53525
53546
|
}
|
|
53526
|
-
return
|
|
53547
|
+
return "Success";
|
|
53527
53548
|
}
|
|
53528
53549
|
updateCellPosition(cmd) {
|
|
53529
53550
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -53597,42 +53618,42 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53597
53618
|
throw new Error("There is not enough visible sheets");
|
|
53598
53619
|
}
|
|
53599
53620
|
createSheetHasName(cmd) {
|
|
53600
|
-
if (cmd.name !== void 0 && !cmd.name.trim()) return
|
|
53601
|
-
return
|
|
53621
|
+
if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
|
|
53622
|
+
return "Success";
|
|
53602
53623
|
}
|
|
53603
53624
|
checkSheetName(cmd) {
|
|
53604
53625
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
53605
53626
|
const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
|
|
53606
|
-
if (originalSheetName !== void 0 && sheetName === originalSheetName) return
|
|
53627
|
+
if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
|
|
53607
53628
|
const { orderedSheetIds, sheets } = this;
|
|
53608
53629
|
const name = sheetName && sheetName.trim().toLowerCase();
|
|
53609
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
53610
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
53611
|
-
return
|
|
53630
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
53631
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
53632
|
+
return "Success";
|
|
53612
53633
|
}
|
|
53613
53634
|
checkSheetPosition(cmd) {
|
|
53614
53635
|
const { orderedSheetIds } = this;
|
|
53615
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
53616
|
-
return
|
|
53636
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
53637
|
+
return "Success";
|
|
53617
53638
|
}
|
|
53618
53639
|
checkRowFreezeQuantity(cmd) {
|
|
53619
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
53640
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53620
53641
|
}
|
|
53621
53642
|
checkColFreezeQuantity(cmd) {
|
|
53622
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
53643
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53623
53644
|
}
|
|
53624
53645
|
checkRowFreezeOverlapMerge(cmd) {
|
|
53625
53646
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53626
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
53627
|
-
return
|
|
53647
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
53648
|
+
return "Success";
|
|
53628
53649
|
}
|
|
53629
53650
|
checkColFreezeOverlapMerge(cmd) {
|
|
53630
53651
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53631
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
53632
|
-
return
|
|
53652
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
53653
|
+
return "Success";
|
|
53633
53654
|
}
|
|
53634
53655
|
isRenameAllowed(cmd) {
|
|
53635
|
-
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return
|
|
53656
|
+
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
|
|
53636
53657
|
return this.checkSheetName(cmd);
|
|
53637
53658
|
}
|
|
53638
53659
|
renameSheet(sheet, name) {
|
|
@@ -53855,19 +53876,19 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53855
53876
|
* sheet.
|
|
53856
53877
|
*/
|
|
53857
53878
|
checkSheetExists(cmd) {
|
|
53858
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
53859
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
53860
|
-
return
|
|
53879
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
53880
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
53881
|
+
return "Success";
|
|
53861
53882
|
}
|
|
53862
53883
|
/**
|
|
53863
53884
|
* Check if zones in the command are well formed and
|
|
53864
53885
|
* not outside the sheet.
|
|
53865
53886
|
*/
|
|
53866
53887
|
checkZonesAreInSheet(cmd) {
|
|
53867
|
-
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return
|
|
53868
|
-
if (!("sheetId" in cmd)) return
|
|
53869
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
53870
|
-
if (isTargetDependent(cmd) && cmd.target.length === 0) return
|
|
53888
|
+
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
|
|
53889
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
53890
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
53891
|
+
if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
|
|
53871
53892
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
53872
53893
|
}
|
|
53873
53894
|
};
|
|
@@ -53882,15 +53903,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
53882
53903
|
const definition = cmd.pivot;
|
|
53883
53904
|
return this.checkDataSetValidity(definition);
|
|
53884
53905
|
}
|
|
53885
|
-
return
|
|
53906
|
+
return "Success";
|
|
53886
53907
|
}
|
|
53887
53908
|
checkDataSetValidity(definition) {
|
|
53888
53909
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53889
53910
|
const { zone, sheetId } = definition.dataSet;
|
|
53890
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
53911
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
53891
53912
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53892
53913
|
}
|
|
53893
|
-
return
|
|
53914
|
+
return "Success";
|
|
53894
53915
|
}
|
|
53895
53916
|
};
|
|
53896
53917
|
|
|
@@ -53908,18 +53929,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
53908
53929
|
switch (cmd.type) {
|
|
53909
53930
|
case "CREATE_TABLE":
|
|
53910
53931
|
case "UPDATE_TABLE":
|
|
53911
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
53932
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
53912
53933
|
break;
|
|
53913
53934
|
case "CREATE_TABLE_STYLE":
|
|
53914
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
53935
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
53915
53936
|
try {
|
|
53916
53937
|
toHex(cmd.primaryColor);
|
|
53917
53938
|
} catch (e) {
|
|
53918
|
-
return
|
|
53939
|
+
return "InvalidTableStyle";
|
|
53919
53940
|
}
|
|
53920
53941
|
break;
|
|
53921
53942
|
}
|
|
53922
|
-
return
|
|
53943
|
+
return "Success";
|
|
53923
53944
|
}
|
|
53924
53945
|
handle(cmd) {
|
|
53925
53946
|
switch (cmd.type) {
|
|
@@ -53990,21 +54011,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
53990
54011
|
allowDispatch(cmd) {
|
|
53991
54012
|
switch (cmd.type) {
|
|
53992
54013
|
case "CREATE_TABLE":
|
|
53993
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
54014
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
53994
54015
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
53995
|
-
if (!areZonesContinuous(zones)) return
|
|
53996
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
54016
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
54017
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53997
54018
|
case "UPDATE_TABLE":
|
|
53998
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
54019
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
53999
54020
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
54000
54021
|
case "ADD_MERGE":
|
|
54001
54022
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
54002
54023
|
const tableZone = table.range.zone;
|
|
54003
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
54024
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
54004
54025
|
}
|
|
54005
54026
|
break;
|
|
54006
54027
|
}
|
|
54007
|
-
return
|
|
54028
|
+
return "Success";
|
|
54008
54029
|
}
|
|
54009
54030
|
handle(cmd) {
|
|
54010
54031
|
switch (cmd.type) {
|
|
@@ -54138,19 +54159,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
54138
54159
|
}
|
|
54139
54160
|
}
|
|
54140
54161
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
54141
|
-
if (!cmd.newTableRange) return
|
|
54162
|
+
if (!cmd.newTableRange) return "Success";
|
|
54142
54163
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
54143
54164
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
54144
|
-
if (zoneIsInSheet !==
|
|
54165
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
54145
54166
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
54146
|
-
if (!updatedTable) return
|
|
54147
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
54167
|
+
if (!updatedTable) return "TableNotFound";
|
|
54168
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
54148
54169
|
}
|
|
54149
54170
|
checkTableConfigUpdateIsValid(config) {
|
|
54150
|
-
if (!config) return
|
|
54151
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
54152
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
54153
|
-
return
|
|
54171
|
+
if (!config) return "Success";
|
|
54172
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
54173
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
54174
|
+
return "Success";
|
|
54154
54175
|
}
|
|
54155
54176
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
54156
54177
|
const zone = tableRange.zone;
|
|
@@ -54390,6 +54411,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
54390
54411
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
54391
54412
|
}
|
|
54392
54413
|
var CompilationParametersBuilder = class {
|
|
54414
|
+
getters;
|
|
54415
|
+
computeCell;
|
|
54393
54416
|
evalContext;
|
|
54394
54417
|
rangeCache = {};
|
|
54395
54418
|
constructor(context, getters, computeCell) {
|
|
@@ -54481,6 +54504,9 @@ var CompilationParametersBuilder = class {
|
|
|
54481
54504
|
//#endregion
|
|
54482
54505
|
//#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
|
|
54483
54506
|
var IntervalNode = class {
|
|
54507
|
+
interval;
|
|
54508
|
+
left;
|
|
54509
|
+
right;
|
|
54484
54510
|
/**
|
|
54485
54511
|
* Augmented value: the highest 'bottom' boundary in this subtree.
|
|
54486
54512
|
* Allows O(log n) pruning during overlap searches.
|
|
@@ -55565,6 +55591,7 @@ onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
|
55565
55591
|
const MAX_ITERATION = 30;
|
|
55566
55592
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
55567
55593
|
var Evaluator = class {
|
|
55594
|
+
context;
|
|
55568
55595
|
getters;
|
|
55569
55596
|
compilationParams;
|
|
55570
55597
|
evaluatedCells = new PositionMap();
|
|
@@ -55583,7 +55610,7 @@ var Evaluator = class {
|
|
|
55583
55610
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
55584
55611
|
if (!spreadZone) return;
|
|
55585
55612
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
55586
|
-
if (evaluatedCell?.type ===
|
|
55613
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
55587
55614
|
return union(positionToZone(position), spreadZone);
|
|
55588
55615
|
}
|
|
55589
55616
|
getEvaluatedPositions() {
|
|
@@ -55593,7 +55620,7 @@ var Evaluator = class {
|
|
|
55593
55620
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
55594
55621
|
}
|
|
55595
55622
|
getArrayFormulaSpreadingOn(position) {
|
|
55596
|
-
if (this.getEvaluatedCell(position).type ===
|
|
55623
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
55597
55624
|
return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
|
|
55598
55625
|
}
|
|
55599
55626
|
isArrayFormulaSpillBlocked(position) {
|
|
@@ -55790,7 +55817,7 @@ var Evaluator = class {
|
|
|
55790
55817
|
const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
|
|
55791
55818
|
if (!isMatrix(formulaReturn)) {
|
|
55792
55819
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
|
|
55793
|
-
if (evaluatedCell.type ===
|
|
55820
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
|
|
55794
55821
|
return evaluatedCell;
|
|
55795
55822
|
}
|
|
55796
55823
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
@@ -55851,7 +55878,7 @@ var Evaluator = class {
|
|
|
55851
55878
|
row: j + row
|
|
55852
55879
|
};
|
|
55853
55880
|
const rawCell = this.getters.getCell(position);
|
|
55854
|
-
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !==
|
|
55881
|
+
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
55855
55882
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
55856
55883
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
|
|
55857
55884
|
}
|
|
@@ -55868,7 +55895,7 @@ var Evaluator = class {
|
|
|
55868
55895
|
};
|
|
55869
55896
|
const cell = this.getters.getCell(position);
|
|
55870
55897
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
|
|
55871
|
-
if (evaluatedCell.type ===
|
|
55898
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
|
|
55872
55899
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
55873
55900
|
};
|
|
55874
55901
|
return spreadValues;
|
|
@@ -56072,7 +56099,7 @@ var EvaluationPlugin = class extends CoreViewPlugin {
|
|
|
56072
56099
|
sheetId,
|
|
56073
56100
|
col,
|
|
56074
56101
|
row
|
|
56075
|
-
})).every((cell) => cell.type ===
|
|
56102
|
+
})).every((cell) => cell.type === "empty");
|
|
56076
56103
|
}
|
|
56077
56104
|
/**
|
|
56078
56105
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -57025,7 +57052,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57025
57052
|
}
|
|
57026
57053
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
57027
57054
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
57028
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type ===
|
|
57055
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
57029
57056
|
switch (threshold.type) {
|
|
57030
57057
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
57031
57058
|
case "number": return Number(threshold.value);
|
|
@@ -57056,7 +57083,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57056
57083
|
col,
|
|
57057
57084
|
row
|
|
57058
57085
|
});
|
|
57059
|
-
if (cell.type !==
|
|
57086
|
+
if (cell.type !== "number") continue;
|
|
57060
57087
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
57061
57088
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
57062
57089
|
computedIcons[col][row] = icon;
|
|
@@ -57069,7 +57096,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57069
57096
|
}
|
|
57070
57097
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
57071
57098
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
57072
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
57099
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
57073
57100
|
if (max <= 0) return;
|
|
57074
57101
|
const color = rule.color;
|
|
57075
57102
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -57082,7 +57109,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57082
57109
|
col: targetCol,
|
|
57083
57110
|
row: targetRow
|
|
57084
57111
|
});
|
|
57085
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
57112
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
57086
57113
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
57087
57114
|
computedDataBars[col][row] = {
|
|
57088
57115
|
color: colorNumberToHex(color),
|
|
@@ -57116,7 +57143,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57116
57143
|
col,
|
|
57117
57144
|
row
|
|
57118
57145
|
});
|
|
57119
|
-
if (cell.type ===
|
|
57146
|
+
if (cell.type === "number") {
|
|
57120
57147
|
const value = clip(cell.value, minValue, maxValue);
|
|
57121
57148
|
if (!computedStyle[col]) computedStyle[col] = [];
|
|
57122
57149
|
computedStyle[col][row] = computedStyle[col]?.[row] || {};
|
|
@@ -57126,7 +57153,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
57126
57153
|
}
|
|
57127
57154
|
getRuleResultForTarget(target, rule, preComputedCriterion) {
|
|
57128
57155
|
const cell = this.getters.getEvaluatedCell(target);
|
|
57129
|
-
if (cell.type ===
|
|
57156
|
+
if (cell.type === "error") return false;
|
|
57130
57157
|
const { sheetId } = target;
|
|
57131
57158
|
const evaluator = criterionEvaluatorRegistry.get(rule.operator);
|
|
57132
57159
|
const evaluatedCriterionValues = rule.values.map((value) => {
|
|
@@ -57272,7 +57299,7 @@ var EvaluationDataValidationPlugin = class extends CoreViewPlugin {
|
|
|
57272
57299
|
if (!validationResults[col]) validationResults[col] = [];
|
|
57273
57300
|
validationResults[col][row] = lazy(() => {
|
|
57274
57301
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
57275
|
-
if (evaluatedCell.type ===
|
|
57302
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
57276
57303
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
57277
57304
|
});
|
|
57278
57305
|
}
|
|
@@ -58003,6 +58030,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58003
58030
|
"getFirstPivotFunction",
|
|
58004
58031
|
"getPivotCellSortDirection",
|
|
58005
58032
|
"getPivotIdFromPosition",
|
|
58033
|
+
"getPivotIdsFromPosition",
|
|
58006
58034
|
"getPivotCellFromPosition",
|
|
58007
58035
|
"generateNewCalculatedMeasureName",
|
|
58008
58036
|
"isPivotUnused",
|
|
@@ -58062,37 +58090,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58062
58090
|
}
|
|
58063
58091
|
}
|
|
58064
58092
|
/**
|
|
58065
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
58093
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
58066
58094
|
* is no pivot at this position
|
|
58067
58095
|
*/
|
|
58068
58096
|
getPivotIdFromPosition(position) {
|
|
58097
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
58098
|
+
}
|
|
58099
|
+
/**
|
|
58100
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
58101
|
+
*/
|
|
58102
|
+
getPivotIdsFromPosition(position) {
|
|
58069
58103
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
58070
|
-
if (cell && cell.isFormula)
|
|
58071
|
-
|
|
58072
|
-
|
|
58073
|
-
|
|
58074
|
-
|
|
58075
|
-
|
|
58076
|
-
|
|
58104
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
58105
|
+
return [];
|
|
58106
|
+
}
|
|
58107
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
58108
|
+
return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
|
|
58109
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
58110
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
58111
|
+
}).filter(isDefined);
|
|
58077
58112
|
}
|
|
58078
58113
|
isSpillPivotFormula(position) {
|
|
58079
58114
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
58080
58115
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
|
|
58081
58116
|
return false;
|
|
58082
58117
|
}
|
|
58083
|
-
|
|
58084
|
-
const
|
|
58085
|
-
if (!
|
|
58086
|
-
const
|
|
58087
|
-
|
|
58088
|
-
functionName,
|
|
58089
|
-
|
|
58118
|
+
getPivotFunctions(sheetId, formula) {
|
|
58119
|
+
const pivotFunctions = getPivotFunctions(formula, this.getters);
|
|
58120
|
+
if (!pivotFunctions.length) return [];
|
|
58121
|
+
const evaluatedPivotFunctions = [];
|
|
58122
|
+
for (const pivotFunction of pivotFunctions) {
|
|
58123
|
+
const { functionName, args } = pivotFunction;
|
|
58124
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
58090
58125
|
if (argAst.type === "EMPTY") return;
|
|
58091
58126
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
58092
58127
|
const argsString = astToFormula(argAst);
|
|
58093
58128
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
58094
|
-
})
|
|
58095
|
-
|
|
58129
|
+
});
|
|
58130
|
+
evaluatedPivotFunctions.push({
|
|
58131
|
+
functionName,
|
|
58132
|
+
args: evaluatedArgs
|
|
58133
|
+
});
|
|
58134
|
+
}
|
|
58135
|
+
return evaluatedPivotFunctions;
|
|
58136
|
+
}
|
|
58137
|
+
getFirstPivotFunction(sheetId, formula) {
|
|
58138
|
+
return this.getPivotFunctions(sheetId, formula)[0];
|
|
58096
58139
|
}
|
|
58097
58140
|
/**
|
|
58098
58141
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -58198,8 +58241,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58198
58241
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
58199
58242
|
for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
|
|
58200
58243
|
const position = this.getters.getCellPosition(cell.id);
|
|
58201
|
-
const
|
|
58202
|
-
|
|
58244
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
58245
|
+
for (const pivotId of pivotIds) {
|
|
58203
58246
|
unusedPivots.delete(pivotId);
|
|
58204
58247
|
if (!unusedPivots.size) {
|
|
58205
58248
|
this.unusedPivotsInFormulas = [];
|
|
@@ -58207,6 +58250,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58207
58250
|
}
|
|
58208
58251
|
}
|
|
58209
58252
|
}
|
|
58253
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
58254
|
+
const pivot = this.getters.getPivot(pivotId);
|
|
58255
|
+
for (const measure of pivot.definition.measures) if (measure.computedBy) {
|
|
58256
|
+
const { sheetId } = measure.computedBy;
|
|
58257
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
58258
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
58259
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
58260
|
+
unusedPivots.delete(relatedPivotId);
|
|
58261
|
+
if (!unusedPivots.size) {
|
|
58262
|
+
this.unusedPivotsInFormulas = [];
|
|
58263
|
+
return [];
|
|
58264
|
+
}
|
|
58265
|
+
}
|
|
58266
|
+
}
|
|
58267
|
+
}
|
|
58210
58268
|
this.unusedPivotsInFormulas = [...unusedPivots];
|
|
58211
58269
|
return this.unusedPivotsInFormulas;
|
|
58212
58270
|
}
|
|
@@ -58214,7 +58272,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58214
58272
|
const result = [];
|
|
58215
58273
|
for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
|
|
58216
58274
|
const position = this.getters.getCellPosition(cellId);
|
|
58217
|
-
if (this.getters.getEvaluatedCell(position).type ===
|
|
58275
|
+
if (this.getters.getEvaluatedCell(position).type === "error") continue;
|
|
58218
58276
|
const pivotInfo = this.getPivotStyleAtPosition(position);
|
|
58219
58277
|
if (pivotInfo) result.push({
|
|
58220
58278
|
position,
|
|
@@ -58246,6 +58304,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58246
58304
|
//#endregion
|
|
58247
58305
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
58248
58306
|
var ClipboardHandler = class {
|
|
58307
|
+
getters;
|
|
58308
|
+
dispatch;
|
|
58249
58309
|
constructor(getters, dispatch) {
|
|
58250
58310
|
this.getters = getters;
|
|
58251
58311
|
this.dispatch = dispatch;
|
|
@@ -58253,10 +58313,10 @@ var ClipboardHandler = class {
|
|
|
58253
58313
|
copy(data, isCutOperation, mode = "copyPaste") {}
|
|
58254
58314
|
paste(target, clippedContent, options) {}
|
|
58255
58315
|
isPasteAllowed(sheetId, target, content, option) {
|
|
58256
|
-
return
|
|
58316
|
+
return "Success";
|
|
58257
58317
|
}
|
|
58258
58318
|
isCutAllowed(data) {
|
|
58259
|
-
return
|
|
58319
|
+
return "Success";
|
|
58260
58320
|
}
|
|
58261
58321
|
getPasteTarget(sheetId, target, content, options) {
|
|
58262
58322
|
return {
|
|
@@ -58282,8 +58342,8 @@ var AbstractCellClipboardHandler = class extends ClipboardHandler {
|
|
|
58282
58342
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
58283
58343
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
58284
58344
|
isCutAllowed(data) {
|
|
58285
|
-
if (data.zones.length !== 1) return
|
|
58286
|
-
return
|
|
58345
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
58346
|
+
return "Success";
|
|
58287
58347
|
}
|
|
58288
58348
|
copy(data, isCutOperation, mode = "copyPaste") {
|
|
58289
58349
|
const sheetId = data.sheetId;
|
|
@@ -58348,17 +58408,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
58348
58408
|
};
|
|
58349
58409
|
}
|
|
58350
58410
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
58351
|
-
if (!content.cells) return
|
|
58352
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
58411
|
+
if (!content.cells) return "Success";
|
|
58412
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
58353
58413
|
if (target.length > 1) {
|
|
58354
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
58414
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
58355
58415
|
}
|
|
58356
58416
|
const clipboardHeight = content.cells.length;
|
|
58357
58417
|
const clipboardWidth = content.cells[0].length;
|
|
58358
58418
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
58359
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
58419
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
58360
58420
|
}
|
|
58361
|
-
return
|
|
58421
|
+
return "Success";
|
|
58362
58422
|
}
|
|
58363
58423
|
/**
|
|
58364
58424
|
* Paste the clipboard content in the given target
|
|
@@ -58507,7 +58567,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58507
58567
|
switch (cmd.type) {
|
|
58508
58568
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
58509
58569
|
}
|
|
58510
|
-
return
|
|
58570
|
+
return "Success";
|
|
58511
58571
|
}
|
|
58512
58572
|
handle(cmd) {
|
|
58513
58573
|
switch (cmd.type) {
|
|
@@ -58590,34 +58650,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58590
58650
|
});
|
|
58591
58651
|
}
|
|
58592
58652
|
checkSingleRangeSelected() {
|
|
58593
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
58594
|
-
return
|
|
58653
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
58654
|
+
return "Success";
|
|
58595
58655
|
}
|
|
58596
58656
|
checkNoMergeInZone() {
|
|
58597
58657
|
const sheetId = this.getters.getActiveSheetId();
|
|
58598
58658
|
const zone = this.getters.getSelectedZone();
|
|
58599
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
58600
|
-
return
|
|
58659
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
58660
|
+
return "Success";
|
|
58601
58661
|
}
|
|
58602
58662
|
checkRangeContainsValues(cmd) {
|
|
58603
58663
|
const sheetId = this.getters.getActiveSheetId();
|
|
58604
58664
|
const zone = this.getters.getSelectedZone();
|
|
58605
58665
|
if (cmd.hasHeader) zone.top += 1;
|
|
58606
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
58607
|
-
return
|
|
58666
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
|
|
58667
|
+
return "Success";
|
|
58608
58668
|
}
|
|
58609
58669
|
checkNoColumnProvided(cmd) {
|
|
58610
|
-
if (cmd.columns.length === 0) return
|
|
58611
|
-
return
|
|
58670
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
58671
|
+
return "Success";
|
|
58612
58672
|
}
|
|
58613
58673
|
checkColumnsIncludedInZone(cmd) {
|
|
58614
58674
|
const zone = this.getters.getSelectedZone();
|
|
58615
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
58616
|
-
return
|
|
58675
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
58676
|
+
return "Success";
|
|
58617
58677
|
}
|
|
58618
58678
|
checkColumnsAreUnique(cmd) {
|
|
58619
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
58620
|
-
return
|
|
58679
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
58680
|
+
return "Success";
|
|
58621
58681
|
}
|
|
58622
58682
|
trimWhitespace() {
|
|
58623
58683
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -58735,19 +58795,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
58735
58795
|
let x = 0;
|
|
58736
58796
|
let y = 0;
|
|
58737
58797
|
switch (direction) {
|
|
58738
|
-
case
|
|
58798
|
+
case "up":
|
|
58739
58799
|
x = 0;
|
|
58740
58800
|
y = -rule.current;
|
|
58741
58801
|
break;
|
|
58742
|
-
case
|
|
58802
|
+
case "down":
|
|
58743
58803
|
x = 0;
|
|
58744
58804
|
y = rule.current;
|
|
58745
58805
|
break;
|
|
58746
|
-
case
|
|
58806
|
+
case "left":
|
|
58747
58807
|
x = -rule.current;
|
|
58748
58808
|
y = 0;
|
|
58749
58809
|
break;
|
|
58750
|
-
case
|
|
58810
|
+
case "right":
|
|
58751
58811
|
x = rule.current;
|
|
58752
58812
|
y = 0;
|
|
58753
58813
|
break;
|
|
@@ -58874,11 +58934,11 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58874
58934
|
},
|
|
58875
58935
|
sequence: 10
|
|
58876
58936
|
}).add("increment_alphanumeric_value", {
|
|
58877
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58937
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
58878
58938
|
generateRule: (cell, cells, direction) => {
|
|
58879
58939
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
58880
58940
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
58881
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58941
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
|
|
58882
58942
|
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
58883
58943
|
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
58884
58944
|
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
@@ -58896,7 +58956,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58896
58956
|
},
|
|
58897
58957
|
sequence: 15
|
|
58898
58958
|
}).add("copy_text", {
|
|
58899
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58959
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
58900
58960
|
generateRule: () => {
|
|
58901
58961
|
return { type: "COPY_MODIFIER" };
|
|
58902
58962
|
},
|
|
@@ -58913,10 +58973,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58913
58973
|
sequence: 30
|
|
58914
58974
|
}).add("increment_dates", {
|
|
58915
58975
|
condition: (cell, cells) => {
|
|
58916
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58976
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
58917
58977
|
},
|
|
58918
58978
|
generateRule: (cell, cells) => {
|
|
58919
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58979
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
58920
58980
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
58921
58981
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
58922
58982
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -58925,26 +58985,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58925
58985
|
if (typeof increment === "object") return {
|
|
58926
58986
|
type: "DATE_INCREMENT_MODIFIER",
|
|
58927
58987
|
increment,
|
|
58928
|
-
current: evaluation.type ===
|
|
58988
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58929
58989
|
};
|
|
58930
58990
|
return {
|
|
58931
58991
|
type: "INCREMENT_MODIFIER",
|
|
58932
58992
|
increment,
|
|
58933
|
-
current: evaluation.type ===
|
|
58993
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58934
58994
|
};
|
|
58935
58995
|
},
|
|
58936
58996
|
sequence: 25
|
|
58937
58997
|
}).add("increment_number", {
|
|
58938
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58998
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
58939
58999
|
generateRule: (cell, cells, direction) => {
|
|
58940
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
59000
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
58941
59001
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
58942
59002
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
58943
59003
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
58944
59004
|
return {
|
|
58945
59005
|
type: "INCREMENT_MODIFIER",
|
|
58946
59006
|
increment,
|
|
58947
|
-
current: evaluation.type ===
|
|
59007
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58948
59008
|
};
|
|
58949
59009
|
},
|
|
58950
59010
|
sequence: 40
|
|
@@ -59054,10 +59114,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59054
59114
|
const sheetId = this.getters.getActiveSheetId();
|
|
59055
59115
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
59056
59116
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
59057
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
59058
|
-
return
|
|
59117
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
59118
|
+
return "InvalidAutofillSelection";
|
|
59059
59119
|
}
|
|
59060
|
-
return
|
|
59120
|
+
return "Success";
|
|
59061
59121
|
}
|
|
59062
59122
|
handle(cmd) {
|
|
59063
59123
|
switch (cmd.type) {
|
|
@@ -59089,7 +59149,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59089
59149
|
const target = this.autofillZone;
|
|
59090
59150
|
const autofillCellsData = [];
|
|
59091
59151
|
switch (this.direction) {
|
|
59092
|
-
case
|
|
59152
|
+
case "down":
|
|
59093
59153
|
for (let col = source.left; col <= source.right; col++) {
|
|
59094
59154
|
const xcs = [];
|
|
59095
59155
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -59097,7 +59157,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59097
59157
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59098
59158
|
}
|
|
59099
59159
|
break;
|
|
59100
|
-
case
|
|
59160
|
+
case "up":
|
|
59101
59161
|
for (let col = source.left; col <= source.right; col++) {
|
|
59102
59162
|
const xcs = [];
|
|
59103
59163
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -59105,7 +59165,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59105
59165
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59106
59166
|
}
|
|
59107
59167
|
break;
|
|
59108
|
-
case
|
|
59168
|
+
case "left":
|
|
59109
59169
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
59110
59170
|
const xcs = [];
|
|
59111
59171
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -59113,7 +59173,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59113
59173
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
59114
59174
|
}
|
|
59115
59175
|
break;
|
|
59116
|
-
case
|
|
59176
|
+
case "right":
|
|
59117
59177
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
59118
59178
|
const xcs = [];
|
|
59119
59179
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -59239,19 +59299,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59239
59299
|
}
|
|
59240
59300
|
this.direction = this.getDirection(col, row);
|
|
59241
59301
|
switch (this.direction) {
|
|
59242
|
-
case
|
|
59302
|
+
case "up":
|
|
59243
59303
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
59244
59304
|
this.steps = source.top - row;
|
|
59245
59305
|
break;
|
|
59246
|
-
case
|
|
59306
|
+
case "down":
|
|
59247
59307
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
59248
59308
|
this.steps = row - source.bottom;
|
|
59249
59309
|
break;
|
|
59250
|
-
case
|
|
59310
|
+
case "left":
|
|
59251
59311
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
59252
59312
|
this.steps = source.left - col;
|
|
59253
59313
|
break;
|
|
59254
|
-
case
|
|
59314
|
+
case "right":
|
|
59255
59315
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
59256
59316
|
this.steps = col - source.right;
|
|
59257
59317
|
break;
|
|
@@ -59270,7 +59330,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59270
59330
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
59271
59331
|
...activePosition,
|
|
59272
59332
|
row
|
|
59273
|
-
}).type !==
|
|
59333
|
+
}).type !== "empty") {
|
|
59274
59334
|
autofillRow = row - 1;
|
|
59275
59335
|
break;
|
|
59276
59336
|
}
|
|
@@ -59290,7 +59350,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59290
59350
|
col: col - 1,
|
|
59291
59351
|
row
|
|
59292
59352
|
};
|
|
59293
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
59353
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
59294
59354
|
row += 1;
|
|
59295
59355
|
leftPosition = {
|
|
59296
59356
|
sheetId,
|
|
@@ -59307,7 +59367,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59307
59367
|
col: col + 1,
|
|
59308
59368
|
row
|
|
59309
59369
|
};
|
|
59310
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
59370
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
59311
59371
|
row += 1;
|
|
59312
59372
|
rightPosition = {
|
|
59313
59373
|
sheetId,
|
|
@@ -59397,19 +59457,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59397
59457
|
const position = {
|
|
59398
59458
|
up: {
|
|
59399
59459
|
number: source.top - row,
|
|
59400
|
-
value:
|
|
59460
|
+
value: "up"
|
|
59401
59461
|
},
|
|
59402
59462
|
down: {
|
|
59403
59463
|
number: row - source.bottom,
|
|
59404
|
-
value:
|
|
59464
|
+
value: "down"
|
|
59405
59465
|
},
|
|
59406
59466
|
left: {
|
|
59407
59467
|
number: source.left - col,
|
|
59408
|
-
value:
|
|
59468
|
+
value: "left"
|
|
59409
59469
|
},
|
|
59410
59470
|
right: {
|
|
59411
59471
|
number: col - source.right,
|
|
59412
|
-
value:
|
|
59472
|
+
value: "right"
|
|
59413
59473
|
}
|
|
59414
59474
|
};
|
|
59415
59475
|
if (Object.values(position).map((x) => x.number > 0 ? 1 : 0).reduce((acc, value) => acc + value) === 1) return Object.values(position).find((x) => x.number > 0 ? 1 : 0).value;
|
|
@@ -59612,7 +59672,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
59612
59672
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
59613
59673
|
}
|
|
59614
59674
|
isNumber(cell) {
|
|
59615
|
-
return cell.type ===
|
|
59675
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
59616
59676
|
}
|
|
59617
59677
|
isZoneValid(zone) {
|
|
59618
59678
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -60675,6 +60735,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
60675
60735
|
//#endregion
|
|
60676
60736
|
//#region src/collaborative/revisions.ts
|
|
60677
60737
|
var Revision = class {
|
|
60738
|
+
rootCommand;
|
|
60739
|
+
timestamp;
|
|
60678
60740
|
id;
|
|
60679
60741
|
clientId;
|
|
60680
60742
|
_commands = [];
|
|
@@ -60711,6 +60773,10 @@ var Revision = class {
|
|
|
60711
60773
|
//#region src/collaborative/session.ts
|
|
60712
60774
|
var ClientDisconnectedError = class extends Error {};
|
|
60713
60775
|
var Session = class extends EventBus {
|
|
60776
|
+
revisions;
|
|
60777
|
+
transportService;
|
|
60778
|
+
serverRevisionId;
|
|
60779
|
+
commandSquisher;
|
|
60714
60780
|
/**
|
|
60715
60781
|
* Positions of the others client.
|
|
60716
60782
|
*/
|
|
@@ -61177,7 +61243,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61177
61243
|
...position,
|
|
61178
61244
|
content: "FALSE"
|
|
61179
61245
|
});
|
|
61180
|
-
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type ===
|
|
61246
|
+
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
|
|
61181
61247
|
let value;
|
|
61182
61248
|
if (cell.isFormula) {
|
|
61183
61249
|
const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
|
|
@@ -61187,7 +61253,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61187
61253
|
...position,
|
|
61188
61254
|
content: "FALSE"
|
|
61189
61255
|
});
|
|
61190
|
-
} else if (evaluatedCell.type !==
|
|
61256
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
61191
61257
|
...position,
|
|
61192
61258
|
content: "FALSE"
|
|
61193
61259
|
});
|
|
@@ -61314,7 +61380,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
61314
61380
|
getCellNumberFormat(position) {
|
|
61315
61381
|
for (const pos of [position]) {
|
|
61316
61382
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
61317
|
-
if (cell.type ===
|
|
61383
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
61318
61384
|
}
|
|
61319
61385
|
}
|
|
61320
61386
|
};
|
|
@@ -61482,11 +61548,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
61482
61548
|
allowDispatch(cmd) {
|
|
61483
61549
|
switch (cmd.type) {
|
|
61484
61550
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
61485
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
61486
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
61551
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
61552
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
61487
61553
|
break;
|
|
61488
61554
|
}
|
|
61489
|
-
return
|
|
61555
|
+
return "Success";
|
|
61490
61556
|
}
|
|
61491
61557
|
handle(cmd) {
|
|
61492
61558
|
switch (cmd.type) {
|
|
@@ -61749,13 +61815,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
61749
61815
|
allowDispatch(cmd) {
|
|
61750
61816
|
switch (cmd.type) {
|
|
61751
61817
|
case "REQUEST_UNDO":
|
|
61752
|
-
if (!this.canUndo()) return
|
|
61818
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
61753
61819
|
break;
|
|
61754
61820
|
case "REQUEST_REDO":
|
|
61755
|
-
if (!this.canRedo()) return
|
|
61821
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
61756
61822
|
break;
|
|
61757
61823
|
}
|
|
61758
|
-
return
|
|
61824
|
+
return "Success";
|
|
61759
61825
|
}
|
|
61760
61826
|
handle(cmd) {
|
|
61761
61827
|
switch (cmd.type) {
|
|
@@ -61819,9 +61885,9 @@ var LockSheetPlugin = class extends UIPlugin {
|
|
|
61819
61885
|
* to other users and can do any operation and can do core modifications that will only affect them
|
|
61820
61886
|
* It is acceptable to bypass the locked sheet restriction in this case
|
|
61821
61887
|
*/
|
|
61822
|
-
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return
|
|
61823
|
-
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return
|
|
61824
|
-
return
|
|
61888
|
+
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
|
|
61889
|
+
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
|
|
61890
|
+
return "Success";
|
|
61825
61891
|
}
|
|
61826
61892
|
isCurrentSheetLocked() {
|
|
61827
61893
|
return this.getters.isSheetLocked(this.getters.getActiveSheetId());
|
|
@@ -61886,18 +61952,18 @@ var PivotPresencePlugin = class extends UIPlugin {
|
|
|
61886
61952
|
//#endregion
|
|
61887
61953
|
//#region src/helpers/sort.ts
|
|
61888
61954
|
const SORT_TYPES = [
|
|
61889
|
-
|
|
61890
|
-
|
|
61891
|
-
|
|
61892
|
-
|
|
61955
|
+
"number",
|
|
61956
|
+
"error",
|
|
61957
|
+
"text",
|
|
61958
|
+
"boolean"
|
|
61893
61959
|
];
|
|
61894
61960
|
function cellsSortingCriterion(sortingOrder) {
|
|
61895
61961
|
const inverse = sortingOrder === "asc" ? 1 : -1;
|
|
61896
61962
|
return (left, right) => {
|
|
61897
|
-
if (left.type ===
|
|
61898
|
-
else if (right.type ===
|
|
61963
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
61964
|
+
else if (right.type === "empty") return -1;
|
|
61899
61965
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
61900
|
-
if (typeOrder === 0) if (left.type ===
|
|
61966
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
61901
61967
|
else typeOrder = left.value - right.value;
|
|
61902
61968
|
return inverse * typeOrder;
|
|
61903
61969
|
};
|
|
@@ -61908,9 +61974,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
61908
61974
|
type: cell.type,
|
|
61909
61975
|
value: cell.value
|
|
61910
61976
|
}));
|
|
61911
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
61977
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
61912
61978
|
...cell,
|
|
61913
|
-
type:
|
|
61979
|
+
type: "number",
|
|
61914
61980
|
value: 0
|
|
61915
61981
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
61916
61982
|
}
|
|
@@ -61921,10 +61987,10 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61921
61987
|
allowDispatch(cmd) {
|
|
61922
61988
|
switch (cmd.type) {
|
|
61923
61989
|
case "SORT_CELLS":
|
|
61924
|
-
if (!isInside(cmd.col, cmd.row, cmd.zone)) return
|
|
61990
|
+
if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
|
|
61925
61991
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
|
|
61926
61992
|
}
|
|
61927
|
-
return
|
|
61993
|
+
return "Success";
|
|
61928
61994
|
}
|
|
61929
61995
|
handle(cmd) {
|
|
61930
61996
|
switch (cmd.type) {
|
|
@@ -61934,24 +62000,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61934
62000
|
}
|
|
61935
62001
|
}
|
|
61936
62002
|
checkMerge({ sheetId, zone }) {
|
|
61937
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
62003
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61938
62004
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
61939
62005
|
sheetId,
|
|
61940
62006
|
col,
|
|
61941
62007
|
row
|
|
61942
|
-
}))) return
|
|
61943
|
-
return
|
|
62008
|
+
}))) return "InvalidSortZone";
|
|
62009
|
+
return "Success";
|
|
61944
62010
|
}
|
|
61945
62011
|
checkMergeSizes({ sheetId, zone }) {
|
|
61946
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
62012
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61947
62013
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
61948
62014
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
61949
62015
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
61950
62016
|
if (!merges.every((merge) => {
|
|
61951
62017
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
61952
62018
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
61953
|
-
})) return
|
|
61954
|
-
return
|
|
62019
|
+
})) return "InvalidSortZone";
|
|
62020
|
+
return "Success";
|
|
61955
62021
|
}
|
|
61956
62022
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
61957
62023
|
return positions(zone).some(({ col, row }) => {
|
|
@@ -61965,7 +62031,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61965
62031
|
col,
|
|
61966
62032
|
row
|
|
61967
62033
|
});
|
|
61968
|
-
}) ?
|
|
62034
|
+
}) ? "SortZoneWithArrayFormulas" : "Success";
|
|
61969
62035
|
}
|
|
61970
62036
|
/**
|
|
61971
62037
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -61983,9 +62049,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61983
62049
|
col,
|
|
61984
62050
|
row
|
|
61985
62051
|
}).type));
|
|
61986
|
-
if (cells[0][0] ===
|
|
61987
|
-
if (cells.some((item) => item[0] ===
|
|
61988
|
-
else if (cells.some((item) => item[1] !==
|
|
62052
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
62053
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
62054
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
61989
62055
|
else return false;
|
|
61990
62056
|
}
|
|
61991
62057
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -62074,7 +62140,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62074
62140
|
switch (cmd.type) {
|
|
62075
62141
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
62076
62142
|
}
|
|
62077
|
-
return
|
|
62143
|
+
return "Success";
|
|
62078
62144
|
}
|
|
62079
62145
|
handle(cmd) {
|
|
62080
62146
|
switch (cmd.type) {
|
|
@@ -62085,7 +62151,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62085
62151
|
}
|
|
62086
62152
|
getAutomaticSeparator() {
|
|
62087
62153
|
const cells = this.getters.getSelectedCells();
|
|
62088
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
62154
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
62089
62155
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
62090
62156
|
if (separator) return separator;
|
|
62091
62157
|
}
|
|
@@ -62223,24 +62289,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62223
62289
|
});
|
|
62224
62290
|
}
|
|
62225
62291
|
checkSingleColSelected() {
|
|
62226
|
-
if (!this.getters.isSingleColSelected()) return
|
|
62227
|
-
return
|
|
62292
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
62293
|
+
return "Success";
|
|
62228
62294
|
}
|
|
62229
62295
|
checkNonEmptySelector(cmd) {
|
|
62230
|
-
if (cmd.separator === "") return
|
|
62231
|
-
return
|
|
62296
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
62297
|
+
return "Success";
|
|
62232
62298
|
}
|
|
62233
62299
|
checkNotOverwritingContent(cmd) {
|
|
62234
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
62300
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
62235
62301
|
const selection = this.getters.getSelectedZones()[0];
|
|
62236
62302
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
62237
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
62238
|
-
return
|
|
62303
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
62304
|
+
return "Success";
|
|
62239
62305
|
}
|
|
62240
62306
|
checkSeparatorInSelection({ separator }) {
|
|
62241
62307
|
const cells = this.getters.getSelectedCells();
|
|
62242
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
62243
|
-
return
|
|
62308
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
62309
|
+
return "NoSplitSeparatorInSelection";
|
|
62244
62310
|
}
|
|
62245
62311
|
};
|
|
62246
62312
|
|
|
@@ -62285,7 +62351,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
62285
62351
|
col,
|
|
62286
62352
|
row: r,
|
|
62287
62353
|
sheetId
|
|
62288
|
-
}).type !==
|
|
62354
|
+
}).type !== "empty") return;
|
|
62289
62355
|
}
|
|
62290
62356
|
const oldSelection = {
|
|
62291
62357
|
zone: this.getters.getSelectedZone(),
|
|
@@ -62314,13 +62380,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
62314
62380
|
switch (cmd.type) {
|
|
62315
62381
|
case "RESIZE_TABLE":
|
|
62316
62382
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
62317
|
-
if (!table) return
|
|
62383
|
+
if (!table) return "TableNotFound";
|
|
62318
62384
|
const oldTableZone = table.range.zone;
|
|
62319
62385
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
62320
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
62386
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
62321
62387
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
62322
62388
|
}
|
|
62323
|
-
return
|
|
62389
|
+
return "Success";
|
|
62324
62390
|
}
|
|
62325
62391
|
handle(cmd) {
|
|
62326
62392
|
switch (cmd.type) {
|
|
@@ -62548,7 +62614,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62548
62614
|
*/
|
|
62549
62615
|
isCellEmpty(position) {
|
|
62550
62616
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
62551
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
62617
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
62552
62618
|
}
|
|
62553
62619
|
getColMaxWidth(sheetId, index) {
|
|
62554
62620
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -62562,8 +62628,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62562
62628
|
* sheet.
|
|
62563
62629
|
*/
|
|
62564
62630
|
checkSheetExists(cmd) {
|
|
62565
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return
|
|
62566
|
-
return
|
|
62631
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
|
|
62632
|
+
return "Success";
|
|
62567
62633
|
}
|
|
62568
62634
|
/**
|
|
62569
62635
|
* Check if zones in the command are well formed and
|
|
@@ -62571,11 +62637,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62571
62637
|
*/
|
|
62572
62638
|
checkZonesAreInSheet(cmd) {
|
|
62573
62639
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
62574
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
62640
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
62575
62641
|
const zones = this.getters.getCommandZones(cmd);
|
|
62576
|
-
if (!sheetId && zones.length > 0) return
|
|
62642
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
62577
62643
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
62578
|
-
return
|
|
62644
|
+
return "Success";
|
|
62579
62645
|
}
|
|
62580
62646
|
autoResizeRows(sheetId, rows) {
|
|
62581
62647
|
const rowSizes = [];
|
|
@@ -62622,20 +62688,20 @@ var CarouselUIPlugin = class extends UIPlugin {
|
|
|
62622
62688
|
allowDispatch(cmd) {
|
|
62623
62689
|
switch (cmd.type) {
|
|
62624
62690
|
case "ADD_FIGURE_CHART_TO_CAROUSEL":
|
|
62625
|
-
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return
|
|
62626
|
-
return
|
|
62691
|
+
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
|
|
62692
|
+
return "Success";
|
|
62627
62693
|
case "DUPLICATE_CAROUSEL_CHART":
|
|
62628
|
-
if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return
|
|
62629
|
-
return
|
|
62694
|
+
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";
|
|
62695
|
+
return "Success";
|
|
62630
62696
|
case "ADD_NEW_CHART_TO_CAROUSEL":
|
|
62631
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62632
|
-
return
|
|
62697
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62698
|
+
return "Success";
|
|
62633
62699
|
case "UPDATE_CAROUSEL_ACTIVE_ITEM":
|
|
62634
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62635
|
-
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return
|
|
62636
|
-
return
|
|
62700
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62701
|
+
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
|
|
62702
|
+
return "Success";
|
|
62637
62703
|
}
|
|
62638
|
-
return
|
|
62704
|
+
return "Success";
|
|
62639
62705
|
}
|
|
62640
62706
|
handle(cmd) {
|
|
62641
62707
|
switch (cmd.type) {
|
|
@@ -62872,7 +62938,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62872
62938
|
});
|
|
62873
62939
|
}
|
|
62874
62940
|
case "PASTE": {
|
|
62875
|
-
if (!this.copiedData) return
|
|
62941
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
62876
62942
|
const pasteOption = cmd.pasteOption;
|
|
62877
62943
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
62878
62944
|
pasteOption,
|
|
@@ -62881,21 +62947,21 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62881
62947
|
}
|
|
62882
62948
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
62883
62949
|
const zones = this.getters.getSelectedZones();
|
|
62884
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
62950
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
62885
62951
|
const zone = this.getters.getSelectedZone();
|
|
62886
62952
|
const copiedData = this.getCopiedDataAbove(zone);
|
|
62887
62953
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62888
62954
|
}
|
|
62889
62955
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
62890
62956
|
const zones = this.getters.getSelectedZones();
|
|
62891
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
62957
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
62892
62958
|
const zone = this.getters.getSelectedZone();
|
|
62893
62959
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62894
62960
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62895
62961
|
}
|
|
62896
62962
|
case "COPY_PASTE_CELLS_ON_ZONE": {
|
|
62897
62963
|
const zones = this.getters.getSelectedZones();
|
|
62898
|
-
if (zones.length > 1) return
|
|
62964
|
+
if (zones.length > 1) return "InvalidCopyPasteSelection";
|
|
62899
62965
|
const zone = this.getters.getSelectedZone();
|
|
62900
62966
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62901
62967
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
@@ -62911,7 +62977,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62911
62977
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
62912
62978
|
}
|
|
62913
62979
|
}
|
|
62914
|
-
return
|
|
62980
|
+
return "Success";
|
|
62915
62981
|
}
|
|
62916
62982
|
handle(cmd) {
|
|
62917
62983
|
switch (cmd.type) {
|
|
@@ -63114,16 +63180,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63114
63180
|
const clipboardData = this.getClipboardData(zones);
|
|
63115
63181
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
63116
63182
|
const result = handler.isCutAllowed(clipboardData);
|
|
63117
|
-
if (result !==
|
|
63183
|
+
if (result !== "Success") return result;
|
|
63118
63184
|
}
|
|
63119
|
-
return
|
|
63185
|
+
return "Success";
|
|
63120
63186
|
}
|
|
63121
63187
|
isPasteAllowed(target, copiedData, options) {
|
|
63122
63188
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
63123
63189
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
63124
|
-
if (result !==
|
|
63190
|
+
if (result !== "Success") return result;
|
|
63125
63191
|
}
|
|
63126
|
-
return
|
|
63192
|
+
return "Success";
|
|
63127
63193
|
}
|
|
63128
63194
|
isColRowDirtyingClipboard(position, dimension) {
|
|
63129
63195
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -63204,12 +63270,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63204
63270
|
const file = await this.getImageContent();
|
|
63205
63271
|
const mime = file?.type;
|
|
63206
63272
|
const content = {
|
|
63207
|
-
[
|
|
63208
|
-
[
|
|
63273
|
+
["text/plain"]: "",
|
|
63274
|
+
["text/html"]: ""
|
|
63209
63275
|
};
|
|
63210
63276
|
try {
|
|
63211
|
-
content[
|
|
63212
|
-
content[
|
|
63277
|
+
content["text/plain"] = this.getPlainTextContent();
|
|
63278
|
+
content["text/html"] = await this.getHTMLContent();
|
|
63213
63279
|
} catch (error) {
|
|
63214
63280
|
this.ui.notifyUI({
|
|
63215
63281
|
type: "danger",
|
|
@@ -63401,10 +63467,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
63401
63467
|
allowDispatch(cmd) {
|
|
63402
63468
|
switch (cmd.type) {
|
|
63403
63469
|
case "UPDATE_FILTER":
|
|
63404
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
63470
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
63405
63471
|
break;
|
|
63406
63472
|
}
|
|
63407
|
-
return
|
|
63473
|
+
return "Success";
|
|
63408
63474
|
}
|
|
63409
63475
|
handle(cmd) {
|
|
63410
63476
|
switch (cmd.type) {
|
|
@@ -63768,14 +63834,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
63768
63834
|
allowDispatch(cmd) {
|
|
63769
63835
|
switch (cmd.type) {
|
|
63770
63836
|
case "ACTIVATE_SHEET": try {
|
|
63771
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
63837
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
63772
63838
|
break;
|
|
63773
63839
|
} catch (error) {
|
|
63774
|
-
return
|
|
63840
|
+
return "InvalidSheetId";
|
|
63775
63841
|
}
|
|
63776
63842
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
63777
63843
|
}
|
|
63778
|
-
return
|
|
63844
|
+
return "Success";
|
|
63779
63845
|
}
|
|
63780
63846
|
handleEvent(event) {
|
|
63781
63847
|
let anchor = event.anchor;
|
|
@@ -64296,12 +64362,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64296
64362
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
64297
64363
|
const id = cmd.sheetId;
|
|
64298
64364
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
64299
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
64365
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
64300
64366
|
const headers = [cmd.base, ...cmd.elements];
|
|
64301
64367
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
64302
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
64303
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
64304
|
-
return
|
|
64368
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
64369
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
64370
|
+
return "Success";
|
|
64305
64371
|
}
|
|
64306
64372
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
64307
64373
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -64403,6 +64469,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64403
64469
|
//#endregion
|
|
64404
64470
|
//#region src/helpers/internal_viewport.ts
|
|
64405
64471
|
var InternalViewport = class {
|
|
64472
|
+
getters;
|
|
64473
|
+
sheetId;
|
|
64474
|
+
boundaries;
|
|
64406
64475
|
top;
|
|
64407
64476
|
bottom;
|
|
64408
64477
|
left;
|
|
@@ -64674,6 +64743,10 @@ var InternalViewport = class {
|
|
|
64674
64743
|
* ↓ ↓
|
|
64675
64744
|
*/
|
|
64676
64745
|
var ViewportCollection = class {
|
|
64746
|
+
paneDivision;
|
|
64747
|
+
sheetViewWidth;
|
|
64748
|
+
sheetViewHeight;
|
|
64749
|
+
zoomLevel;
|
|
64677
64750
|
getters;
|
|
64678
64751
|
viewports = {};
|
|
64679
64752
|
gridOffsetX = 0;
|
|
@@ -64990,22 +65063,22 @@ var ViewportCollection = class {
|
|
|
64990
65063
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
64991
65064
|
}
|
|
64992
65065
|
checkPositiveDimension(cmd) {
|
|
64993
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
64994
|
-
return
|
|
65066
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
65067
|
+
return "Success";
|
|
64995
65068
|
}
|
|
64996
65069
|
checkValuesAreDifferent(cmd) {
|
|
64997
65070
|
const { height, width } = this.getSheetViewDimension();
|
|
64998
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
64999
|
-
return
|
|
65071
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
65072
|
+
return "Success";
|
|
65000
65073
|
}
|
|
65001
65074
|
checkScrollingDirection(sheetId, { offsetX, offsetY }) {
|
|
65002
65075
|
const pane = this.getMainInternalViewport(sheetId);
|
|
65003
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
65004
|
-
return
|
|
65076
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
65077
|
+
return "Success";
|
|
65005
65078
|
}
|
|
65006
65079
|
checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
|
|
65007
65080
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
|
|
65008
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
65081
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
65009
65082
|
}
|
|
65010
65083
|
getMainViewport(sheetId) {
|
|
65011
65084
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -65322,9 +65395,9 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
65322
65395
|
return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
|
|
65323
65396
|
}
|
|
65324
65397
|
case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
|
|
65325
|
-
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return
|
|
65326
|
-
else return
|
|
65327
|
-
default: return
|
|
65398
|
+
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
|
|
65399
|
+
else return "Success";
|
|
65400
|
+
default: return "Success";
|
|
65328
65401
|
}
|
|
65329
65402
|
}
|
|
65330
65403
|
handleEvent(event) {
|
|
@@ -67398,9 +67471,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
67398
67471
|
newName: name,
|
|
67399
67472
|
oldName: env.model.getters.getSheetName(sheetId)
|
|
67400
67473
|
});
|
|
67401
|
-
if (result.reasons.includes(
|
|
67402
|
-
else if (result.reasons.includes(
|
|
67403
|
-
else if (result.reasons.includes(
|
|
67474
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
67475
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
67476
|
+
else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
|
|
67404
67477
|
}
|
|
67405
67478
|
|
|
67406
67479
|
//#endregion
|
|
@@ -67458,7 +67531,7 @@ var BottomBarSheet = class extends _odoo_owl.Component {
|
|
|
67458
67531
|
(0, _odoo_owl.onMounted)(() => {
|
|
67459
67532
|
const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
|
|
67460
67533
|
this.env.model.on("command-rejected", this, async ({ command, result }) => {
|
|
67461
|
-
if (result.isCancelledBecause(
|
|
67534
|
+
if (result.isCancelledBecause("SheetLocked")) {
|
|
67462
67535
|
if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
|
|
67463
67536
|
this.scrollToSheet();
|
|
67464
67537
|
await animateLockedSheet();
|
|
@@ -67595,41 +67668,41 @@ var BottomBarSheet = class extends _odoo_owl.Component {
|
|
|
67595
67668
|
const selectionStatisticFunctions = [
|
|
67596
67669
|
{
|
|
67597
67670
|
name: _t("Sum"),
|
|
67598
|
-
types: [
|
|
67671
|
+
types: ["number"],
|
|
67599
67672
|
compute: (values, locale) => sum([[values]], locale)
|
|
67600
67673
|
},
|
|
67601
67674
|
{
|
|
67602
67675
|
name: _t("Avg"),
|
|
67603
|
-
types: [
|
|
67676
|
+
types: ["number"],
|
|
67604
67677
|
compute: (values, locale) => average([[values]], locale)
|
|
67605
67678
|
},
|
|
67606
67679
|
{
|
|
67607
67680
|
name: _t("Min"),
|
|
67608
|
-
types: [
|
|
67681
|
+
types: ["number"],
|
|
67609
67682
|
compute: (values, locale) => min([[values]], locale).value
|
|
67610
67683
|
},
|
|
67611
67684
|
{
|
|
67612
67685
|
name: _t("Max"),
|
|
67613
|
-
types: [
|
|
67686
|
+
types: ["number"],
|
|
67614
67687
|
compute: (values, locale) => max([[values]], locale).value
|
|
67615
67688
|
},
|
|
67616
67689
|
{
|
|
67617
67690
|
name: _t("Count"),
|
|
67618
67691
|
types: [
|
|
67619
|
-
|
|
67620
|
-
|
|
67621
|
-
|
|
67622
|
-
|
|
67692
|
+
"number",
|
|
67693
|
+
"text",
|
|
67694
|
+
"boolean",
|
|
67695
|
+
"error"
|
|
67623
67696
|
],
|
|
67624
67697
|
compute: (values) => countAny([[values]])
|
|
67625
67698
|
},
|
|
67626
67699
|
{
|
|
67627
67700
|
name: _t("Count Numbers"),
|
|
67628
67701
|
types: [
|
|
67629
|
-
|
|
67630
|
-
|
|
67631
|
-
|
|
67632
|
-
|
|
67702
|
+
"number",
|
|
67703
|
+
"text",
|
|
67704
|
+
"boolean",
|
|
67705
|
+
"error"
|
|
67633
67706
|
],
|
|
67634
67707
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
67635
67708
|
}
|
|
@@ -67682,7 +67755,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
67682
67755
|
col,
|
|
67683
67756
|
row
|
|
67684
67757
|
});
|
|
67685
|
-
if (evaluatedCell.type !==
|
|
67758
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
67686
67759
|
}
|
|
67687
67760
|
return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
|
|
67688
67761
|
}
|
|
@@ -68630,6 +68703,7 @@ var SmallBottomBar = class extends _odoo_owl.Component {
|
|
|
68630
68703
|
//#region src/components/standalone_grid_canvas/figure_renderer_store.ts
|
|
68631
68704
|
/** Store that draws the figures directly onto the canvas */
|
|
68632
68705
|
var FigureRendererStore = class extends DisposableStore {
|
|
68706
|
+
renderer;
|
|
68633
68707
|
mutators = ["addLoadedImage"];
|
|
68634
68708
|
getters = this.get(ModelStore).getters;
|
|
68635
68709
|
loadedImages = {};
|
|
@@ -68975,7 +69049,7 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
68975
69049
|
const coreCell = this.getters.getCell(position);
|
|
68976
69050
|
if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
|
|
68977
69051
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
68978
|
-
if (evaluatedCell && evaluatedCell.type !==
|
|
69052
|
+
if (evaluatedCell && evaluatedCell.type !== "empty") return true;
|
|
68979
69053
|
}
|
|
68980
69054
|
return false;
|
|
68981
69055
|
}
|
|
@@ -69316,7 +69390,7 @@ var NamedRangeSelector = class extends _odoo_owl.Component {
|
|
|
69316
69390
|
}
|
|
69317
69391
|
navigateToRange(range) {
|
|
69318
69392
|
const { sheetId, zone } = range;
|
|
69319
|
-
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !==
|
|
69393
|
+
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
|
|
69320
69394
|
this.env.raiseError(_t("The range you specified is outside of the sheet.\n\nIf you meant to create a named range, named range cannot have the same name as a cell reference. Please choose another name."));
|
|
69321
69395
|
return;
|
|
69322
69396
|
}
|
|
@@ -70201,6 +70275,7 @@ function instantiateClipboard() {
|
|
|
70201
70275
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
70202
70276
|
}
|
|
70203
70277
|
var WebClipboardWrapper = class {
|
|
70278
|
+
clipboard;
|
|
70204
70279
|
constructor(clipboard) {
|
|
70205
70280
|
this.clipboard = clipboard;
|
|
70206
70281
|
}
|
|
@@ -70216,12 +70291,12 @@ var WebClipboardWrapper = class {
|
|
|
70216
70291
|
console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
|
|
70217
70292
|
try {
|
|
70218
70293
|
await this.clipboard?.write([new ClipboardItem({
|
|
70219
|
-
[
|
|
70220
|
-
[
|
|
70294
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
70295
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
70221
70296
|
})]);
|
|
70222
70297
|
} catch (e) {}
|
|
70223
70298
|
}
|
|
70224
|
-
else await this.writeText(clipboardContent[
|
|
70299
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
70225
70300
|
}
|
|
70226
70301
|
async writeText(text) {
|
|
70227
70302
|
try {
|
|
@@ -70250,7 +70325,7 @@ var WebClipboardWrapper = class {
|
|
|
70250
70325
|
}
|
|
70251
70326
|
else return {
|
|
70252
70327
|
status: "ok",
|
|
70253
|
-
content: { [
|
|
70328
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
70254
70329
|
};
|
|
70255
70330
|
}
|
|
70256
70331
|
getClipboardItems(content) {
|
|
@@ -70402,7 +70477,7 @@ var Spreadsheet = class extends _odoo_owl.Component {
|
|
|
70402
70477
|
bindModelEvents() {
|
|
70403
70478
|
this.model.on("update", this, () => this.render(true));
|
|
70404
70479
|
this.model.on("command-rejected", this, ({ result }) => {
|
|
70405
|
-
if (result.isCancelledBecause(
|
|
70480
|
+
if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
|
|
70406
70481
|
type: "info",
|
|
70407
70482
|
text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
|
|
70408
70483
|
sticky: false
|
|
@@ -70487,6 +70562,7 @@ var Spreadsheet = class extends _odoo_owl.Component {
|
|
|
70487
70562
|
//#endregion
|
|
70488
70563
|
//#region src/collaborative/command_squisher.ts
|
|
70489
70564
|
var CommandSquisher = class {
|
|
70565
|
+
getters;
|
|
70490
70566
|
constructor(getters) {
|
|
70491
70567
|
this.getters = getters;
|
|
70492
70568
|
}
|
|
@@ -70593,6 +70669,7 @@ var CommandSquisher = class {
|
|
|
70593
70669
|
//#endregion
|
|
70594
70670
|
//#region src/collaborative/readonly_transport_filter.ts
|
|
70595
70671
|
var ReadonlyTransportFilter = class {
|
|
70672
|
+
transportService;
|
|
70596
70673
|
constructor(transportService) {
|
|
70597
70674
|
this.transportService = transportService;
|
|
70598
70675
|
}
|
|
@@ -70624,6 +70701,8 @@ function inverseCommand(cmd) {
|
|
|
70624
70701
|
* @param operations initial operations
|
|
70625
70702
|
*/
|
|
70626
70703
|
var Branch = class Branch {
|
|
70704
|
+
buildTransformation;
|
|
70705
|
+
operations;
|
|
70627
70706
|
constructor(buildTransformation, operations = []) {
|
|
70628
70707
|
this.buildTransformation = buildTransformation;
|
|
70629
70708
|
this.operations = operations;
|
|
@@ -70740,6 +70819,8 @@ var Branch = class Branch {
|
|
|
70740
70819
|
* to revert it).
|
|
70741
70820
|
*/
|
|
70742
70821
|
var Operation = class {
|
|
70822
|
+
id;
|
|
70823
|
+
data;
|
|
70743
70824
|
constructor(id, data) {
|
|
70744
70825
|
this.id = id;
|
|
70745
70826
|
this.data = data;
|
|
@@ -70749,6 +70830,8 @@ var Operation = class {
|
|
|
70749
70830
|
}
|
|
70750
70831
|
};
|
|
70751
70832
|
var LazyOperation = class LazyOperation {
|
|
70833
|
+
id;
|
|
70834
|
+
lazyData;
|
|
70752
70835
|
constructor(id, lazyData) {
|
|
70753
70836
|
this.id = id;
|
|
70754
70837
|
this.lazyData = lazyData;
|
|
@@ -70774,6 +70857,7 @@ var LazyOperation = class LazyOperation {
|
|
|
70774
70857
|
* ```
|
|
70775
70858
|
*/
|
|
70776
70859
|
var OperationSequence = class OperationSequence {
|
|
70860
|
+
operations;
|
|
70777
70861
|
constructor(operations) {
|
|
70778
70862
|
this.operations = operations;
|
|
70779
70863
|
}
|
|
@@ -70849,6 +70933,7 @@ var OperationSequence = class OperationSequence {
|
|
|
70849
70933
|
*
|
|
70850
70934
|
*/
|
|
70851
70935
|
var Tree = class {
|
|
70936
|
+
buildTransformation;
|
|
70852
70937
|
branches;
|
|
70853
70938
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
70854
70939
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -71358,8 +71443,8 @@ var RangeAdapterPlugin = class {
|
|
|
71358
71443
|
"removeRangesSheetPrefix"
|
|
71359
71444
|
];
|
|
71360
71445
|
allowDispatch(cmd) {
|
|
71361
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
71362
|
-
return
|
|
71446
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
71447
|
+
return "Success";
|
|
71363
71448
|
}
|
|
71364
71449
|
beforeHandle(command) {}
|
|
71365
71450
|
handle(cmd) {
|
|
@@ -71644,6 +71729,7 @@ var EventStream = class {
|
|
|
71644
71729
|
* with the new selected anchor
|
|
71645
71730
|
*/
|
|
71646
71731
|
var SelectionStreamProcessorImpl = class {
|
|
71732
|
+
getters;
|
|
71647
71733
|
stream;
|
|
71648
71734
|
/**
|
|
71649
71735
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -71742,7 +71828,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71742
71828
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
71743
71829
|
*/
|
|
71744
71830
|
moveAnchorCell(direction, step = 1) {
|
|
71745
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71831
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71746
71832
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
71747
71833
|
return this.selectCell(col, row);
|
|
71748
71834
|
}
|
|
@@ -71776,7 +71862,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71776
71862
|
bottom: Math.max(anchorRow, row)
|
|
71777
71863
|
};
|
|
71778
71864
|
const expandedZone = this.getters.expandZone(sheetId, zone);
|
|
71779
|
-
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(
|
|
71865
|
+
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
|
|
71780
71866
|
const anchor = {
|
|
71781
71867
|
zone: expandedZone,
|
|
71782
71868
|
cell: {
|
|
@@ -71838,7 +71924,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71838
71924
|
* of the anchor zone which moves.
|
|
71839
71925
|
*/
|
|
71840
71926
|
resizeAnchorZone(direction, step = 1) {
|
|
71841
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71927
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71842
71928
|
const sheetId = this.getters.getActiveSheetId();
|
|
71843
71929
|
const anchor = this.anchor;
|
|
71844
71930
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -72085,7 +72171,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72085
72171
|
previousAnchor: deepCopy(this.anchor)
|
|
72086
72172
|
};
|
|
72087
72173
|
const commandResult = this.checkEventAnchorZone(event);
|
|
72088
|
-
if (commandResult !==
|
|
72174
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
72089
72175
|
this.anchor = event.anchor;
|
|
72090
72176
|
this.stream.send(event);
|
|
72091
72177
|
return DispatchResult.Success;
|
|
@@ -72095,15 +72181,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72095
72181
|
}
|
|
72096
72182
|
checkAnchorZone(anchor) {
|
|
72097
72183
|
const { cell, zone } = anchor;
|
|
72098
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
72184
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
72099
72185
|
const { left, right, top, bottom } = zone;
|
|
72100
72186
|
const sheetId = this.getters.getActiveSheetId();
|
|
72101
72187
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
72102
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
72103
|
-
return
|
|
72188
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
72189
|
+
return "Success";
|
|
72104
72190
|
}
|
|
72105
72191
|
checkAnchorZoneOrThrow(anchor) {
|
|
72106
|
-
if (this.checkAnchorZone(anchor) ===
|
|
72192
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
|
|
72107
72193
|
}
|
|
72108
72194
|
/**
|
|
72109
72195
|
* ---- PRIVATE ----
|
|
@@ -72260,7 +72346,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72260
72346
|
isCellSkippableInCluster(position) {
|
|
72261
72347
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
72262
72348
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
72263
|
-
return cell.type ===
|
|
72349
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
72264
72350
|
}
|
|
72265
72351
|
};
|
|
72266
72352
|
|
|
@@ -74477,13 +74563,6 @@ function purgeSingleRowTables(data) {
|
|
|
74477
74563
|
|
|
74478
74564
|
//#endregion
|
|
74479
74565
|
//#region src/model.ts
|
|
74480
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
74481
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
74482
|
-
Status[Status["Running"] = 1] = "Running";
|
|
74483
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
74484
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
74485
|
-
return Status;
|
|
74486
|
-
}(Status || {});
|
|
74487
74566
|
/**
|
|
74488
74567
|
* Model
|
|
74489
74568
|
*
|
|
@@ -74529,7 +74608,7 @@ var Model = class Model extends EventBus {
|
|
|
74529
74608
|
/**
|
|
74530
74609
|
* Internal status of the model. Important for command handling coordination
|
|
74531
74610
|
*/
|
|
74532
|
-
status =
|
|
74611
|
+
status = 0;
|
|
74533
74612
|
/**
|
|
74534
74613
|
* The config object contains some configuration flag and callbacks
|
|
74535
74614
|
*/
|
|
@@ -74676,7 +74755,7 @@ var Model = class Model extends EventBus {
|
|
|
74676
74755
|
onRemoteRevisionReceived({ commands }) {
|
|
74677
74756
|
for (const command of commands) {
|
|
74678
74757
|
const previousStatus = this.status;
|
|
74679
|
-
this.status =
|
|
74758
|
+
this.status = 2;
|
|
74680
74759
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
74681
74760
|
this.status = previousStatus;
|
|
74682
74761
|
}
|
|
@@ -74789,7 +74868,7 @@ var Model = class Model extends EventBus {
|
|
|
74789
74868
|
return this.processCommandResults(results);
|
|
74790
74869
|
}
|
|
74791
74870
|
processCommandResults(results) {
|
|
74792
|
-
if (results.some((r) => r !==
|
|
74871
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
74793
74872
|
return DispatchResult.Success;
|
|
74794
74873
|
}
|
|
74795
74874
|
checkDispatchAllowedRemoteCommand(command) {
|
|
@@ -74803,9 +74882,9 @@ var Model = class Model extends EventBus {
|
|
|
74803
74882
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
74804
74883
|
}
|
|
74805
74884
|
finalize() {
|
|
74806
|
-
this.status =
|
|
74885
|
+
this.status = 3;
|
|
74807
74886
|
for (const h of this.handlers) h.finalize();
|
|
74808
|
-
this.status =
|
|
74887
|
+
this.status = 0;
|
|
74809
74888
|
this.trigger("command-finalized");
|
|
74810
74889
|
}
|
|
74811
74890
|
/**
|
|
@@ -74832,10 +74911,10 @@ var Model = class Model extends EventBus {
|
|
|
74832
74911
|
dispatch = (type, payload) => {
|
|
74833
74912
|
const command = createCommand(type, payload);
|
|
74834
74913
|
const status = this.status;
|
|
74835
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
74836
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
74914
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
74915
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
74837
74916
|
switch (status) {
|
|
74838
|
-
case
|
|
74917
|
+
case 0:
|
|
74839
74918
|
const result = this.checkDispatchAllowed(command);
|
|
74840
74919
|
if (!result.isSuccessful) {
|
|
74841
74920
|
this.trigger("update");
|
|
@@ -74845,7 +74924,7 @@ var Model = class Model extends EventBus {
|
|
|
74845
74924
|
});
|
|
74846
74925
|
return result;
|
|
74847
74926
|
}
|
|
74848
|
-
this.status =
|
|
74927
|
+
this.status = 1;
|
|
74849
74928
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
74850
74929
|
const start = performance.now();
|
|
74851
74930
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -74855,10 +74934,10 @@ var Model = class Model extends EventBus {
|
|
|
74855
74934
|
if (time > 5) console.debug(type, time, "ms");
|
|
74856
74935
|
});
|
|
74857
74936
|
this.session.save(command, commands, changes);
|
|
74858
|
-
this.status =
|
|
74937
|
+
this.status = 0;
|
|
74859
74938
|
this.trigger("update");
|
|
74860
74939
|
break;
|
|
74861
|
-
case
|
|
74940
|
+
case 1:
|
|
74862
74941
|
if (isCoreCommand(command)) {
|
|
74863
74942
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
74864
74943
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -74866,8 +74945,8 @@ var Model = class Model extends EventBus {
|
|
|
74866
74945
|
}
|
|
74867
74946
|
this.dispatchToHandlers(this.handlers, command);
|
|
74868
74947
|
break;
|
|
74869
|
-
case
|
|
74870
|
-
case
|
|
74948
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
74949
|
+
case 2:
|
|
74871
74950
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
74872
74951
|
this.dispatchToHandlers(this.handlers, command);
|
|
74873
74952
|
}
|
|
@@ -74880,7 +74959,7 @@ var Model = class Model extends EventBus {
|
|
|
74880
74959
|
dispatchFromCorePlugin = (type, payload) => {
|
|
74881
74960
|
const command = createCommand(type, payload);
|
|
74882
74961
|
const previousStatus = this.status;
|
|
74883
|
-
this.status =
|
|
74962
|
+
this.status = 2;
|
|
74884
74963
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
74885
74964
|
this.dispatchToHandlers(handlers, command);
|
|
74886
74965
|
this.status = previousStatus;
|
|
@@ -74982,9 +75061,9 @@ function createCommand(type, payload = {}) {
|
|
|
74982
75061
|
//#endregion
|
|
74983
75062
|
//#region src/helpers/figures/charts/calendar_chart.ts
|
|
74984
75063
|
function checkDateGranularity(definition) {
|
|
74985
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return
|
|
74986
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return
|
|
74987
|
-
return
|
|
75064
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
|
|
75065
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
|
|
75066
|
+
return "Success";
|
|
74988
75067
|
}
|
|
74989
75068
|
const CalendarChart = {
|
|
74990
75069
|
sequence: 110,
|
|
@@ -75075,7 +75154,7 @@ const ComboChart = {
|
|
|
75075
75154
|
copyInSheetId: (definition) => definition,
|
|
75076
75155
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75077
75156
|
transformDefinition: (definition) => definition,
|
|
75078
|
-
validateDefinition: () =>
|
|
75157
|
+
validateDefinition: () => "Success",
|
|
75079
75158
|
updateRanges: (definition) => definition,
|
|
75080
75159
|
getContextCreation: (definition) => definition,
|
|
75081
75160
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
@@ -75165,7 +75244,7 @@ const FunnelChart = {
|
|
|
75165
75244
|
copyInSheetId: (definition) => definition,
|
|
75166
75245
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75167
75246
|
transformDefinition: (definition) => definition,
|
|
75168
|
-
validateDefinition: () =>
|
|
75247
|
+
validateDefinition: () => "Success",
|
|
75169
75248
|
updateRanges: (definition) => definition,
|
|
75170
75249
|
getContextCreation: (definition) => definition,
|
|
75171
75250
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75231,7 +75310,7 @@ const GeoChart = {
|
|
|
75231
75310
|
copyInSheetId: (definition) => definition,
|
|
75232
75311
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75233
75312
|
transformDefinition: (definition) => definition,
|
|
75234
|
-
validateDefinition: () =>
|
|
75313
|
+
validateDefinition: () => "Success",
|
|
75235
75314
|
updateRanges: (definition) => definition,
|
|
75236
75315
|
getContextCreation: (definition) => definition,
|
|
75237
75316
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75292,7 +75371,7 @@ const PyramidChart = {
|
|
|
75292
75371
|
copyInSheetId: (definition) => definition,
|
|
75293
75372
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75294
75373
|
transformDefinition: (definition) => definition,
|
|
75295
|
-
validateDefinition: () =>
|
|
75374
|
+
validateDefinition: () => "Success",
|
|
75296
75375
|
updateRanges: (definition) => definition,
|
|
75297
75376
|
getContextCreation: (definition) => definition,
|
|
75298
75377
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75378,7 +75457,7 @@ const RadarChart = {
|
|
|
75378
75457
|
copyInSheetId: (definition) => definition,
|
|
75379
75458
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75380
75459
|
transformDefinition: (definition) => definition,
|
|
75381
|
-
validateDefinition: () =>
|
|
75460
|
+
validateDefinition: () => "Success",
|
|
75382
75461
|
updateRanges: (definition) => definition,
|
|
75383
75462
|
getContextCreation: (definition) => definition,
|
|
75384
75463
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75456,7 +75535,7 @@ const ScatterChart = {
|
|
|
75456
75535
|
copyInSheetId: (definition) => definition,
|
|
75457
75536
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75458
75537
|
transformDefinition: (definition) => definition,
|
|
75459
|
-
validateDefinition: () =>
|
|
75538
|
+
validateDefinition: () => "Success",
|
|
75460
75539
|
updateRanges: (definition) => definition,
|
|
75461
75540
|
getContextCreation: (definition) => definition,
|
|
75462
75541
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75535,7 +75614,7 @@ const SunburstChart = {
|
|
|
75535
75614
|
copyInSheetId: (definition) => definition,
|
|
75536
75615
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75537
75616
|
transformDefinition: (definition) => definition,
|
|
75538
|
-
validateDefinition: () =>
|
|
75617
|
+
validateDefinition: () => "Success",
|
|
75539
75618
|
updateRanges: (definition) => definition,
|
|
75540
75619
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75541
75620
|
return {
|
|
@@ -75604,7 +75683,7 @@ const TreeMapChart = {
|
|
|
75604
75683
|
copyInSheetId: (definition) => definition,
|
|
75605
75684
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75606
75685
|
transformDefinition: (definition) => definition,
|
|
75607
|
-
validateDefinition: () =>
|
|
75686
|
+
validateDefinition: () => "Success",
|
|
75608
75687
|
updateRanges: (definition) => definition,
|
|
75609
75688
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75610
75689
|
return {
|
|
@@ -76030,9 +76109,9 @@ var CarouselClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76030
76109
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76031
76110
|
}
|
|
76032
76111
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76033
|
-
if (target.length === 0) return
|
|
76034
|
-
if (option?.pasteOption !== void 0) return
|
|
76035
|
-
return
|
|
76112
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76113
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76114
|
+
return "Success";
|
|
76036
76115
|
}
|
|
76037
76116
|
};
|
|
76038
76117
|
|
|
@@ -76103,9 +76182,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76103
76182
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76104
76183
|
}
|
|
76105
76184
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76106
|
-
if (target.length === 0) return
|
|
76107
|
-
if (option?.pasteOption !== void 0) return
|
|
76108
|
-
return
|
|
76185
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76186
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76187
|
+
return "Success";
|
|
76109
76188
|
}
|
|
76110
76189
|
};
|
|
76111
76190
|
|
|
@@ -76410,9 +76489,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76410
76489
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76411
76490
|
}
|
|
76412
76491
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76413
|
-
if (target.length === 0) return
|
|
76414
|
-
if (option?.pasteOption !== void 0) return
|
|
76415
|
-
return
|
|
76492
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76493
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76494
|
+
return "Success";
|
|
76416
76495
|
}
|
|
76417
76496
|
};
|
|
76418
76497
|
|
|
@@ -76508,10 +76587,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
76508
76587
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
76509
76588
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
76510
76589
|
isPasteAllowed(sheetId, target, content, options) {
|
|
76511
|
-
if (!("cells" in content)) return
|
|
76590
|
+
if (!("cells" in content)) return "Success";
|
|
76512
76591
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
76513
|
-
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return
|
|
76514
|
-
return
|
|
76592
|
+
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
76593
|
+
return "Success";
|
|
76515
76594
|
}
|
|
76516
76595
|
};
|
|
76517
76596
|
|
|
@@ -79352,15 +79431,15 @@ const DATEDIF = {
|
|
|
79352
79431
|
const jsEndDate = numberToJsDate(_endDate);
|
|
79353
79432
|
if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
79354
79433
|
switch (_unit) {
|
|
79355
|
-
case
|
|
79356
|
-
case
|
|
79357
|
-
case
|
|
79358
|
-
case
|
|
79359
|
-
case
|
|
79434
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
79435
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
79436
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79437
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
79438
|
+
case "MD":
|
|
79360
79439
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
79361
79440
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
79362
79441
|
return days;
|
|
79363
|
-
case
|
|
79442
|
+
case "YD": {
|
|
79364
79443
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79365
79444
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
79366
79445
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -80050,11 +80129,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
80050
80129
|
const right = sortColumn[b];
|
|
80051
80130
|
const leftCell = {
|
|
80052
80131
|
value: left,
|
|
80053
|
-
type: left === null ?
|
|
80132
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
80054
80133
|
};
|
|
80055
80134
|
const rightCell = {
|
|
80056
80135
|
value: right,
|
|
80057
|
-
type: right === null ?
|
|
80136
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
80058
80137
|
};
|
|
80059
80138
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
80060
80139
|
if (result !== 0) return result;
|
|
@@ -84652,6 +84731,6 @@ exports.stores = stores;
|
|
|
84652
84731
|
exports.tokenColors = tokenColors;
|
|
84653
84732
|
exports.tokenize = tokenize;
|
|
84654
84733
|
|
|
84655
|
-
__info__.version = "19.3.
|
|
84656
|
-
__info__.date = "2026-05-
|
|
84657
|
-
__info__.hash = "
|
|
84734
|
+
__info__.version = "19.3.5";
|
|
84735
|
+
__info__.date = "2026-05-27T06:08:23.138Z";
|
|
84736
|
+
__info__.hash = "0cf1540";
|